stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
61 stars 42 forks source link

events: not outputting contract ids #1457

Open leighmcculloch opened 1 month ago

leighmcculloch commented 1 month ago

What version are you using?

v21.3.0

What did you do?

$ stellar events

What did you expect to see?

A contract ID included for each event.

What did you see instead?

An empty string for the contract ID for all events.

$ stellar events --start-ledger 1000515 --count 1
Event 0004297179204177920-0000000000 [DIAGNOSTIC]:
  Ledger:   1000515 (closed at 2024-08-11T18:20:19Z)
  Contract: 
  Topics:
            Symbol(ScSymbol(StringM(fn_call)))
            Bytes(ScBytes(BytesM(5592a35e78c59a27a7c61550f436137149341d5d57c8e9338d64e0f2e47ff1be)))
            Symbol(ScSymbol(StringM(set_price)))
  Value: Vec(Some(ScVec(VecM([Vec(Some(ScVec(VecM([I128(Int128Parts { hi: 0, lo: 6030498141684976144 }), I128(Int128Parts { hi: 0, lo: 264300176334177058 }), I128(Int128Parts { hi: 0, lo: 100042306801017 }), I128(Int128Parts { hi: 0, lo: 57089003741740 }), I128(Int128Parts { hi: 0, lo: 14891168315329625 }), I128(Int128Parts { hi: 0, lo: 99998281452494 }), I128(Int128Parts { hi: 0, lo: 34145543629896 }), I128(Int128Parts { hi: 0, lo: 2124833337818254 }), I128(Int128Parts { hi: 0, lo: 462765034860489 }), I128(Int128Parts { hi: 0, lo: 41896389205476 }), I128(Int128Parts { hi: 0, lo: 1044839762379844 }), I128(Int128Parts { hi: 0, lo: 99994385720802 }), I128(Int128Parts { hi: 0, lo: 503678952187986 }), I128(Int128Parts { hi: 0, lo: 10019120674185 }), I128(Int128Parts { hi: 0, lo: 613458381756352 }), I128(Int128Parts { hi: 0, lo: 109893731453483 })])))), U64(1723400400000)]))))
$ stellar events --start-ledger 1000515 --count 1 --output json
{
  "type": "diagnostic",
  "ledger": 1000515,
  "ledgerClosedAt": "2024-08-11T18:20:19Z",
  "id": "0004297179204177920-0000000000",
  "pagingToken": "0004297179204177920-0000000000",
  "contractId": "",
  "topic": [
    "AAAADwAAAAdmbl9jYWxsAA==",
    "AAAADQAAACBVkqNeeMWaJ6fGFVD0NhNxSTQdXVfI6TONZODy5H/xvg==",
    "AAAADwAAAAlzZXRfcHJpY2UAAAA="
  ],
  "value": "AAAAEAAAAAEAAAACAAAAEAAAAAEAAAAQAAAACgAAAAAAAAAAU7CiG+HJShAAAAAKAAAAAAAAAAADqvucLHjDIgAAAAoAAAAAAAAAAAAAWvzqKM15AAAACgAAAAAAAAAAAAAz7BHJ4iwAAAAKAAAAAAAAAAAANOdwTbnMWQAAAAoAAAAAAAAAAAAAWvKqC0vOAAAACgAAAAAAAAAAAAAfDiD/rEgAAAAKAAAAAAAAAAAAB4yGUE68jgAAAAoAAAAAAAAAAAABpOHhhG/JAAAACgAAAAAAAAAAAAAmGsNlXeQAAAAKAAAAAAAAAAAAA7ZGtuJERAAAAAoAAAAAAAAAAAAAWvHB1yXiAAAACgAAAAAAAAAAAAHKF+UGqFIAAAAKAAAAAAAAAAAAAAkcwiD1iQAAAAoAAAAAAAAAAAACLe/o7dfAAAAACgAAAAAAAAAAAABj8qDTiisAAAAFAAABkUKrLIA="
}
leighmcculloch commented 1 month ago

Actually, these events are diagnostic events, so maybe can't reliable connect some of these events to contracts. That connecting is done in the RPC in any case and isn't a CLI issue.

🤔 But there's still a usability problem here, it's difficult as a user to lookup diagnostic events that relate to specific contract invocations.

janewang commented 1 month ago

"contractId": "", is this an optional field.

janewang commented 1 month ago

Discussed with Platform team and they have confirmed that the RPC is returning an empty string for system events. Transferred to Platform for fix per consensus cc @mollykarcher

leighmcculloch commented 1 month ago

I transferred the issue to the rs-soroban-env repo because I think this is an issue with the environment. RPC is simply serving a view into what the environment is providing and the environment isn't attaching contract addresses to diagnostic events.