Conversation
622a366 to
74e6b0a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74e6b0a4b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff44f0d256
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@sbillig Codex is happy, are you, too? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9e56427b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee2afab133
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Thank you @codex, I love you, too. |
|
To use Codex here, create an environment for this repo. |
Since `Result::unwrap()` already ABI-encodes errors on revert via `panic_with_value`, `unwrap_or_revert()` was a leftover that duplicated this behavior.
Introduce a new `#[error]` struct attribute that mirrors the existing `#[event]` pattern. The compiler auto-generates `ErrorVariant<Sol>`, `AbiSize`, and `Encode<Sol>` implementations with a compile-time computed 4-byte selector matching Solidity's custom error ABI. New stdlib additions: - `ErrorVariant<A>` trait in `core::error` (analogous to `MsgVariant`) - `revert_error<T>()` in `std::evm::effects` for selector-prefixed reverts - `Panic` struct in `std::evm::panic` with Solidity-compatible panic codes
Add two new optional arguments to the test attribute: - `#[test(should_revert, panic = 0x11)]` — match Panic(uint256) with specific code (verifies selector 0x4e487b71 + ABI-encoded code) - `#[test(should_revert, selector = 0x4e487b71)]` — match only the 4-byte error selector This enables end-to-end verification that `revert_error()` produces the correct Solidity-compatible revert payloads.
`assert(false)` now calls `revert_error(Panic { code: 0x01 })`
producing a Solidity-compatible Panic(uint256) revert payload,
making assertion failures identifiable by off-chain tooling.
The monomorphizer now checks whether the error type of `panic_with_value<T>()` implements `ErrorVariant<Sol>`. If so, the call is rewritten to `revert_error<T>()` (selector-prefixed) instead of `revert<T>()` (raw ABI-encoded). This means `Result<MyError, T>::unwrap()` automatically produces Solidity-compatible error payloads when `MyError` is an `#[error]` type, without requiring the user to call `revert_error()` explicitly.
The Sonatina codegen now writes Panic(uint256) revert payloads with the correct Solidity panic code instead of empty revert data: - 0x11 for arithmetic overflow/underflow (add, sub, mul, neg) - 0x12 for division/modulo by zero (div, rem) - 0x32 for array index out of bounds
Summary
EvmResultExttrait andunwrap_or_revert()method.#[error]for Solidity-compatible custom error types, including generated ABI encoding support,revert_error(), and a predefinedPanic(uint256)error type.#[test(should_revert)]withpanicandselectorarguments for verifying revert payloads.assert(false)revert with Solidity-compatiblePanic(uint256)data instead of empty revert data.Result::unwrap()emit selector-prefixed revert data for#[error]types.Panic(uint256)data.