Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
303 stars 191 forks source link

fix(orchestration): errors should have error messages #9593

Closed erights closed 3 days ago

erights commented 4 days ago

closes: #XXXX refs: https://github.com/Agoric/agoric-sdk/pull/9519

Description

While trying to debug https://github.com/Agoric/agoric-sdk/pull/9519 , I'm seeing errors like

Error#20: {"type":1,"data":"CmgKIy9jb3Ntb3Muc3Rha2luZy52MWJldGExLk1zZ0RlbGVnYXRlEkEKGFVOUEFSU0FCTEVfQ0hBSU5fQUREUkVTUxISYWdvcmljMXZhbG9wZXJmdWZ1GhEKBXVmbGl4EggxMDAwMDAwMA==","memo":""}
  at parseTxPacket (file:///Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/orchestration/src/utils/packet.js:87:14)

which only has the data without any message text saying what's wrong with the data. While fixing, also switched to a Fail to give us control over redaction. I made the conservative assumption that to not unredact the actual packet data, because I don't know why it should be public on the error even in non-debugging scenarios. If it should be unredacted, I can easily change to ${q(response)}. Reviewers, please advise.

Note that either way, the unredacted info will still show up in error logs, as above, and will still even show up on the error object in standard debugging configurations.

Security Considerations

Possibly repaired an unintended disclosure of info that should have been redacted, though the main motivation was adding an informative error message.

Scaling Considerations

none

Documentation Considerations

none

Testing Considerations

none

Upgrade Considerations

none

cloudflare-pages[bot] commented 4 days ago

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7d51692
Status: ✅  Deploy successful!
Preview URL: https://85df1d4d.agoric-sdk.pages.dev
Branch Preview URL: https://markm-better-error-message.agoric-sdk.pages.dev

View logs

0xpatrickdev commented 4 days ago

Thanks, this is much clearer. Also confirming your choice on the redaction - if we are able to see the response in debug logs that's sufficient.