soroban-cli: outputting long noisy host events without verbose mode enabled

Open
#918 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
cli

Research direction

Reproduce the issue with the shown soroban contract invoke command and inspect the soroban-cli::log::host_event entry point mentioned in the output. The change is done when the command prints only 3 without verbose mode, while the diagnostic host events remain available when verbose output is enabled.

Written by the indexing model from the issue text.

Description

bug cli
What version are you using?
  • stellar/soroban-tools@b1519a4d90502ce3155960541b2a98c88f3dd043 (rpc and cli)
  • stellar/stellar-core@22b9bb38416e5ce058eb9c1fadfdd414a4661833
  • stellar/rs-soroban-env@eb5a9ba053a7b64a8eff605db625525378f7bea0
What did you do?
❯ soroban contract invoke --wasm ../rs-soroban-sdk/target/wasm32-unknown-unknown/release/test_add_u64.wasm --id 1 -- add --a 1 --b 2
What did you expect to see?
3
What did you see instead?
2023-09-01T19:54:56.041234Z  INFO soroban_cli::log::host_event: 0: HostEvent {
    event: ContractEvent {
        ext: V0,
        contract_id: None,
        type_: Diagnostic,
        body: V0(
            ContractEventV0 {
                topics: VecM(
                    [
                        Symbol(
                            ScSymbol(
                                StringM(fn_call),
                            ),
                        ),
                        Bytes(
                            ScBytes(
                                BytesM(0000000000000000000000000000000000000000000000000000000000000001),
                            ),
                        ),
                        Symbol(
                            ScSymbol(
                                StringM(add),
                            ),
                        ),
                    ],
                ),
                data: Vec(
                    Some(
                        ScVec(
                            VecM(
                                [
                                    U64(
                                        1,
                                    ),
                                    U64(
                                        2,
                                    ),
                                ],
                            ),
                        ),
                    ),
                ),
            },
        ),
    },
    failed_call: false,
}
2023-09-01T19:54:56.041429Z  INFO soroban_cli::log::host_event: 1: HostEvent {
    event: ContractEvent {
        ext: V0,
        contract_id: Some(
            Hash(0000000000000000000000000000000000000000000000000000000000000001),
        ),
        type_: Diagnostic,
        body: V0(
            ContractEventV0 {
                topics: VecM(
                    [
                        Symbol(
                            ScSymbol(
                                StringM(fn_return),
                            ),
                        ),
                        Symbol(
                            ScSymbol(
                                StringM(add),
                            ),
                        ),
                    ],
                ),
                data: U64(
                    3,
                ),
            },
        ),
    },
    failed_call: false,
}
3
Discussion

This seems like possibly a bug, such as we're logging something at the wrong level, or not distinguishing between contract events vs host events when deciding to log at the info level.

However, this might also not be a bug and it might be working as intended. I'm not sure.

Dominant language
Rust
Stars
123
Forks
141
Avg merge
2d 21h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stellar/stellar-cli

All issues in stellar/stellar-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.