feat!(wallet): future-compatibility with External Contract Calls#320
feat!(wallet): future-compatibility with External Contract Calls#320mitinarseny wants to merge 9 commits into
Conversation
📝 WalkthroughWalkthrough
ChangesWallet request handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
contracts/wallet/src/message.rs (1)
220-222: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winTest serialization of the enabled flag.
The fixture only verifies that an omitted field defaults to
false. Add a serde round-trip assertion thatpay_for_gas: trueis emitted and preserved for the future external-call wire path.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/wallet/src/message.rs` around lines 220 - 222, Extend the serialization test around the external-call fixture to cover the enabled flag: construct or update the relevant message with pay_for_gas set to true, serialize it through serde, and deserialize it again, asserting the emitted field is present and the value remains true. Keep the existing omitted-field/default-false fixture coverage unchanged.contracts/wallet/src/contract.rs (1)
182-189: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winLock down the rejection path with a contract-level test.
Add or confirm a test that
pay_for_gas: trueaborts before nonce commit, event emission, or request execution, and explicitly records whether the public failure should be the raw panic or aContractError.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contracts/wallet/src/contract.rs` around lines 182 - 189, Update the contract-level test covering the request path to submit a message with pay_for_gas: true and verify that it aborts before nonce commit, event emission, or request execution; assert the intended public failure representation explicitly, distinguishing the raw panic from a ContractError, while keeping the existing unsupported-feature rejection in the pay_for_gas handling unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contracts/wallet/signatures/ed25519/src/lib.rs`:
- Around line 50-53: Keep the existing verification keys unchanged in the
Ed25519 fixture at contracts/wallet/signatures/ed25519/src/lib.rs:50-53 and the
P-256 fixture at contracts/wallet/signatures/webauthn/src/p256.rs:31-34; update
only the message-schema data. Regenerate the corresponding proofs at
contracts/wallet/signatures/ed25519/src/lib.rs:78 and
contracts/wallet/signatures/webauthn/src/p256.rs:49 for the updated messages and
retained keys, or explicitly document intentional key rotation at each site.
---
Nitpick comments:
In `@contracts/wallet/src/contract.rs`:
- Around line 182-189: Update the contract-level test covering the request path
to submit a message with pay_for_gas: true and verify that it aborts before
nonce commit, event emission, or request execution; assert the intended public
failure representation explicitly, distinguishing the raw panic from a
ContractError, while keeping the existing unsupported-feature rejection in the
pay_for_gas handling unchanged.
In `@contracts/wallet/src/message.rs`:
- Around line 220-222: Extend the serialization test around the external-call
fixture to cover the enabled flag: construct or update the relevant message with
pay_for_gas set to true, serialize it through serde, and deserialize it again,
asserting the emitted field is present and the value remains true. Keep the
existing omitted-field/default-false fixture coverage unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 35410de4-7afd-424f-8fc3-07ba9b74c4c1
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
contracts/wallet/signatures/ed25519/Cargo.tomlcontracts/wallet/signatures/ed25519/src/lib.rscontracts/wallet/signatures/ed25519/src/signer.rscontracts/wallet/signatures/webauthn/src/ed25519.rscontracts/wallet/signatures/webauthn/src/p256.rscontracts/wallet/src/contract.rscontracts/wallet/src/error.rscontracts/wallet/src/message.rscrates/wallet/sdk/src/lib.rs
| #[case( | ||
| hex!("8565df94b8caab08f28cdd2ee014b800915741d4694fa840e50cca02ae5c6466"), | ||
| hex!("42be545513aacf13e895cae91e4ecd04498d7e9556795855c8787dbdccf55e9c"), | ||
| RequestMessage { | ||
| pay_for_gas: false, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep verification keys stable across message-schema fixture updates.
The pay_for_gas field changes the signed payload and proof, but not the verification key. Preserve the existing keys and regenerate only proofs, or document intentional key rotation at each site.
contracts/wallet/signatures/ed25519/src/lib.rs#L50-L53: retain the existing Ed25519 public key while updating the message.contracts/wallet/signatures/ed25519/src/lib.rs#L78-L78: regenerate the proof for the updated message and retained key.contracts/wallet/signatures/webauthn/src/p256.rs#L31-L34: retain the existing P-256 public key while updating the message.contracts/wallet/signatures/webauthn/src/p256.rs#L49-L49: regenerate the WebAuthn proof for the updated message and retained key.
📍 Affects 2 files
contracts/wallet/signatures/ed25519/src/lib.rs#L50-L53(this comment)contracts/wallet/signatures/ed25519/src/lib.rs#L78-L78contracts/wallet/signatures/webauthn/src/p256.rs#L31-L34contracts/wallet/signatures/webauthn/src/p256.rs#L49-L49
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@contracts/wallet/signatures/ed25519/src/lib.rs` around lines 50 - 53, Keep
the existing verification keys unchanged in the Ed25519 fixture at
contracts/wallet/signatures/ed25519/src/lib.rs:50-53 and the P-256 fixture at
contracts/wallet/signatures/webauthn/src/p256.rs:31-34; update only the
message-schema data. Regenerate the corresponding proofs at
contracts/wallet/signatures/ed25519/src/lib.rs:78 and
contracts/wallet/signatures/webauthn/src/p256.rs:49 for the updated messages and
retained keys, or explicitly document intentional key rotation at each site.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation