better surface errors#153
Open
FelixFan1992 wants to merge 1 commit into
Open
Conversation
Soroban Contract Test Coverage92.77% line coverage — 18248 / 19671 lines hit
Per-Contract Breakdown
Full file-level coverage report |
|
Code coverage report:
|
Integration Test Coverage (excl. Token Pool) |
Integration Test Coverage (Token Pool) |
There was a problem hiding this comment.
Pull request overview
This PR improves error surfacing for downstream contract invocations by distinguishing between callee-returned contract errors and host traps/panics, and propagates the new error codes through interfaces and Go bindings.
Changes:
- Update Timelock and MCMS downstream invoke handling to map
InvokeError::Abort→CallAbortedandInvokeError::Contract(_)→CallReverted. - Add
CallAbortederror variants/codes across contract error enums, common interfaces, and Go bindings. - Extend MCMS tests (and snapshot) to cover the contract-error vs abort distinction.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/timelock/src/lib.rs | Distinguish abort vs contract-error failures when invoking downstream contracts. |
| contracts/timelock/src/error.rs | Add CallAborted error code and docs. |
| contracts/mcms/src/lib.rs | Distinguish abort vs contract-error failures when invoking downstream contracts. |
| contracts/mcms/src/error.rs | Add CallAborted error code and docs. |
| contracts/mcms/src/test.rs | Add mocks + test to assert CallReverted for callee contract error; update abort-path expectation. |
| contracts/mcms/test_snapshots/test/test_execute_contract_error_surfaces_call_reverted.1.json | New snapshot for the added MCMS test. |
| contracts/common/interfaces/src/timelock.rs | Add CallAborted to exported Timelock error interface. |
| contracts/common/interfaces/src/mcms.rs | Add CallAborted to exported MCMS error interface. |
| bindings/contracts/timelock/types.go | Add Timelock CallAborted constant + message. |
| bindings/contracts/mcms/types.go | Add MCMS CallAborted constant + message. |
Files not reviewed (2)
- bindings/contracts/mcms/types.go: Generated file
- bindings/contracts/timelock/types.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+365
to
+369
| // Surface the failure mode instead of collapsing both into CallReverted: a | ||
| // callee-returned contract error vs. a host trap/panic. The callee's specific u32 | ||
| // code can't be carried through Soroban's fixed-enum error model, so only the mode | ||
| // is surfaced (CallReverted vs CallAborted). | ||
| Err(e) => { |
Comment on lines
+624
to
+632
| // Surface the failure mode: callee-returned contract error vs. host trap/panic. | ||
| Err(e) => { | ||
| let ie = match e { | ||
| Ok(ie) | Err(ie) => ie, | ||
| }; | ||
| Err(match ie { | ||
| InvokeError::Abort => TimelockError::CallAborted, | ||
| InvokeError::Contract(_) => TimelockError::CallReverted, | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.