-
Notifications
You must be signed in to change notification settings - Fork 2
7702 execution session keys #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced the `engine-eip7702-core` package with its dependencies in `Cargo.lock` and `Cargo.toml`. - Updated the `executors` module to include `engine-eip7702-core` as a dependency. - Refactored execution options in `eip7702.rs` to support new execution models for EIP-7702. - Enhanced transaction handling in the `eip7702_executor` to accommodate new sender details and improve compatibility with existing job structures. - Updated webhook and job data structures to reflect changes in sender details and execution options. - Improved error handling and retry logic in job processing to enhance robustness.
WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Executor
participant DelegatedAccount
participant Bundler
Client->>Executor: Submit EIP-7702 job (with execution_options)
Executor->>DelegatedAccount: Construct DelegatedAccount (from options)
Executor->>DelegatedAccount: Check is_minimal_account()
DelegatedAccount-->>Executor: Returns delegation status
Executor->>DelegatedAccount: Build MinimalAccountTransaction (owner/session key)
Executor->>DelegatedAccount: (If needed) Sign authorization
DelegatedAccount-->>Executor: Returns signed authorization
Executor->>MinimalAccountTransaction: Build wrapped calls, sign transaction
MinimalAccountTransaction-->>Executor: Returns payload and signature
Executor->>Bundler: Submit transaction for execution
Bundler-->>Executor: Returns transaction result
Executor-->>Client: Returns job result (with sender details)
Estimated code review effort4 (~90 minutes) ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (5)
thirdweb-core/src/iaw/mod.rs (1)
70-76
: Unify#[derive]
blocks to avoid duplicationYou currently have two consecutive
#[derive]
attributes:#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Default)]It’s legal, but redundant and easy to overlook when adding further traits. Consider merging:
-#[derive(Debug, Clone, Serialize, Deserialize)] -#[derive(Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)]Pure style, feel free to ignore if preferred.
eip7702-core/src/constants.rs (1)
3-11
: Add a quick unit-test to guard hard-coded delegation constantsHard-coding the delegation prefix, address and computed length is fine, but a tiny test will prevent accidental edits:
#[test] fn test_eip7702_constants() { use super::*; assert_eq!(EIP_7702_DELEGATION_PREFIX.len() + 20, EIP_7702_DELEGATION_CODE_LENGTH); }Helps catch mismatches during refactors.
executors/src/eip7702_executor/confirm.rs (1)
34-38
: Add tracking information to the migration TODOs.The backward compatibility approach is good, but the TODOs should include more specific tracking information (e.g., a ticket number, target date, or version) to ensure timely cleanup.
- /// ! Deprecated todo: remove this field after all jobs are processed + /// ! Deprecated: Remove this field after migration is complete (track via issue #XXX) pub eoa_address: Option<Address>, - // TODO: make non-optional after all jobs are processed + // TODO: Make non-optional after migration is complete (track via issue #XXX) pub sender_details: Option<Eip7702Sender>,executors/src/eip7702_executor/send.rs (2)
42-50
: Track the backward compatibility TODO in an issueThe TODO comment indicates a temporary backward compatibility solution. This should be tracked in an issue to ensure it's addressed in the next release.
Would you like me to create an issue to track the removal of
eoa_address
field and makingexecution_options
required in the next release?
259-269
: Consider renamingis_build_error_retryable
for clarityThe function
is_build_error_retryable
is used for authorization signing errors, but its name suggests it's specifically for build errors. Consider renaming tois_error_retryable
or creating a more specific function for authorization errors.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (16)
Cargo.toml
(1 hunks)core/src/execution_options/eip7702.rs
(1 hunks)core/src/execution_options/mod.rs
(1 hunks)core/src/signer.rs
(1 hunks)eip7702-core/Cargo.toml
(1 hunks)eip7702-core/src/constants.rs
(1 hunks)eip7702-core/src/delegated_account.rs
(1 hunks)eip7702-core/src/lib.rs
(1 hunks)eip7702-core/src/transaction.rs
(1 hunks)executors/Cargo.toml
(1 hunks)executors/src/eip7702_executor/confirm.rs
(6 hunks)executors/src/eip7702_executor/send.rs
(6 hunks)executors/src/eoa/error_classifier.rs
(1 hunks)server/src/execution_router/mod.rs
(1 hunks)thirdweb-core/src/iaw/mod.rs
(1 hunks)twmq/src/job.rs
(3 hunks)
🧬 Code Graph Analysis (1)
twmq/src/job.rs (1)
twmq/src/multilane.rs (1)
delay
(1342-1348)
🧰 Additional context used
🧬 Code Graph Analysis (1)
twmq/src/job.rs (1)
twmq/src/multilane.rs (1)
delay
(1342-1348)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: coverage
- GitHub Check: test
🔇 Additional comments (24)
executors/Cargo.toml (1)
19-19
: LGTM! Clean dependency addition for EIP-7702 support.The addition of the
engine-eip7702-core
dependency with local path reference is correctly structured and supports the new EIP-7702 functionality.Cargo.toml (1)
6-6
: LGTM! Proper workspace integration.The addition of
"eip7702-core"
to the workspace members is correctly placed and necessary for the new crate integration.executors/src/eoa/error_classifier.rs (1)
245-245
: LGTM! Clean import optimization.Removing the unused
ToJobResult
import while keepingToJobError
is a good cleanup that aligns with the actual usage in theto_send_job_result
method.server/src/execution_router/mod.rs (1)
353-354
: Compatibility with new execution/job structure confirmedThe Eip7702 executor’s
Eip7702SendJobData
still definespub eoa_address: Option<Address>, // legacy support until next release pub execution_options: Option<…>, // new structured optionsand in
executors/src/eip7702_executor/send.rs
it selects the sender via:
- If
eoa_address: Some(addr)
, it maps toEip7702Sender::Owner { eoa_address: addr }
- Otherwise (i.e.
eoa_address: None
), it reads fromexecution_options
, handling both Owner and SessionKey variantsThis preserves backward compatibility for queued jobs created before this change while fully supporting the new model. No further action is required.
core/src/signer.rs (1)
341-341
: IAW client signature confirmed – passingtransaction
(a&TypedTransaction
) matches the expected&EthereumTypedTransaction<…>
parameter.No unnecessary moves or clones introduced, and this aligns with the vault client’s use of
transaction.clone()
(since it requires ownership).All good to go.
core/src/execution_options/mod.rs (1)
29-47
: Confirm removal ofJsonSchema
derive doesn’t break OpenAPI consumers
SpecificExecutionOptions
no longer derivesschemars::JsonSchema
, while other structs in this module still do.
If any downstream tooling combinesutoipa::ToSchema
withschemars::JsonSchema
(e.g.utoipa-swagger-ui
when generating component references), the missing derive could cause schema gaps or runtime panics during OpenAPI generation.Please double-check the docs/CI that produce OpenAPI specs and, if necessary, keep
JsonSchema
or add#[cfg_attr(feature = "schema", derive(JsonSchema))]
to gate the dependency.eip7702-core/src/lib.rs (1)
1-3
: Module pub re-exports look goodPublicly re-exporting the three sub-modules makes the crate’s API clear and ergonomic.
core/src/execution_options/eip7702.rs (1)
9-36
: LGTM! Well-structured enum design for execution options.The refactoring from a single struct to an enum with Owner and SessionKey variants provides good extensibility. The untagged serialization works well here since the variants have distinct field names, preventing deserialization ambiguity.
twmq/src/job.rs (1)
58-101
: LGTM! Useful retry-aware error handling methods.The new
map_err_with_max_retries
andnack_with_max_retries
methods provide a clean way to conditionally fail jobs after exceeding retry limits. The implementation correctly checkscurrent_attempts >= max_retries
to determine whether to fail or requeue.executors/src/eip7702_executor/confirm.rs (2)
97-97
: Good optimization: Boxing large error variant.Boxing the
TransactionReceipt
reduces the size of the error enum, which is beneficial for performance when errors are propagated through the call stack.
265-277
: LGTM! Well-implemented backward compatibility.The migration logic correctly handles both the new
sender_details
field and the deprecatedeoa_address
field, with appropriate error handling when neither is present.eip7702-core/src/delegated_account.rs (4)
33-80
: LGTM! Correct EIP-7702 delegation verification.The delegation checking logic correctly:
- Validates the delegation prefix (0xef0100)
- Extracts the target address from the correct byte range [3..23]
- Includes helpful debug logging for troubleshooting
87-94
: LGTM! Clean nonce retrieval implementation.Simple and correct delegation to the chain provider with proper error handling.
101-123
: LGTM! Well-structured authorization signing.The method provides a clean abstraction for EIP-7702 authorization signing, correctly fetching the nonce and setting up the signing context.
125-132
: LGTM! Secure random UID generation.The implementation correctly uses the rand crate's cryptographically secure RNG to generate a 32-byte UID.
eip7702-core/src/transaction.rs (5)
46-95
: LGTM! Well-documented session key transaction flow.The double-wrapping logic correctly implements the session key execution pattern. The detailed comments effectively explain the transaction flow from executor → session key → target account.
97-121
: LGTM! Clean owner transaction implementation.The owner transaction flow is appropriately simpler than the session key flow, directly wrapping the calls without intermediate steps.
129-141
: LGTM! Correct conditional authorization logic.The method correctly adds authorization only when needed (i.e., when the account doesn't already have EIP-7702 delegation set up).
162-181
: LGTM! Clean transaction execution flow.The execute method properly orchestrates building the transaction data and submitting it to the bundler with appropriate error handling.
220-231
: LGTM! Proper EIP-712 typed data implementation.The typed data creation correctly uses the minimal account domain parameters and properly sets the verifying contract to the account address.
executors/src/eip7702_executor/send.rs (4)
86-96
: Well-designed sender enum structureThe
Eip7702Sender
enum provides a clean abstraction for distinguishing between owner and session key transactions, with appropriate serde attributes for flexible serialization.
211-221
: Owner address resolution handles backward compatibility correctlyThe logic properly resolves the owner address from either the legacy
eoa_address
field or the newexecution_options
, with appropriate error handling when both are None.
473-484
: Comprehensive revert detection logicThe
contains_revert_data
function provides thorough detection of contract reverts using both common selectors and revert-related keywords.
459-461
: Fix pattern matching for HTTP 500 errorsThe pattern match on line 460 is incorrect. It should properly destructure the status code.
- RpcErrorKind::TransportHttpError { status: 500, body } => !contains_revert_data(body), + RpcErrorKind::TransportHttpError { status, body } if *status == 500 => !contains_revert_data(body),Likely an incorrect or invalid review comment.
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)] | ||
#[schema(title = "EIP-7702 Execution Options")] | ||
#[serde(rename_all = "camelCase", untagged)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the removal of JsonSchema
derive is intentional.
The JsonSchema
derive was removed from the enum while being retained on the struct variants. This might affect API documentation generation if schemas are used for OpenAPI specs.
🏁 Script executed:
#!/bin/bash
# Description: Check if JsonSchema removal is consistent across execution options
# Check if other execution option enums also removed JsonSchema
rg -A 3 "enum.*ExecutionOptions" --type rust
# Check for any schema-related issues or TODOs
rg -i "schema|openapi" -C 3 "ExecutionOptions" --type rust
Length of output: 890
🏁 Script executed:
#!/bin/bash
set -e
# List all files in the execution_options directory
find core/src/execution_options -maxdepth 1 -type f
# Check for any remaining JsonSchema derives in this directory
rg "#\[derive.*JsonSchema" -n core/src/execution_options
# List all derive macros to see which traits are used
rg "#\[derive" -n core/src/execution_options
# Show the first 20 lines of mod.rs to inspect its derive attributes
sed -n '1,20p' core/src/execution_options/mod.rs
Length of output: 3451
Add missing JsonSchema
derive to EIP-7702 execution options
The Eip7702ExecutionOptions
enum and its two variant structs currently derive Debug
, Clone
, Serialize
, Deserialize
, and utoipa::ToSchema
, but omit JsonSchema
. All other ExecutionOptions
types in this module include the JsonSchema
derive to feed Schemars into your OpenAPI docs. To keep schema generation consistent, please update the derives as follows:
• In core/src/execution_options/eip7702.rs:
- #[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
+ #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)]
• Apply the same change to the two structs at lines 17 and 26 so they also include JsonSchema
.
This will restore Schemars support for the EIP-7702 options and align with the rest of the execution-options API.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)] | |
#[schema(title = "EIP-7702 Execution Options")] | |
#[serde(rename_all = "camelCase", untagged)] | |
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, utoipa::ToSchema)] | |
#[schema(title = "EIP-7702 Execution Options")] | |
#[serde(rename_all = "camelCase", untagged)] |
🤖 Prompt for AI Agents
In core/src/execution_options/eip7702.rs around lines 6 to 8, the
Eip7702ExecutionOptions enum is missing the JsonSchema derive attribute. Add
JsonSchema to the derive list alongside Debug, Clone, Serialize, Deserialize,
and utoipa::ToSchema. Also, locate the two variant structs at lines 17 and 26
and add the JsonSchema derive to them as well to ensure consistent schema
generation across all execution option types.
[package] | ||
name = "engine-eip7702-core" | ||
version = "0.1.0" | ||
edition = "2024" | ||
|
||
[dependencies] | ||
alloy = { workspace = true, features = ["serde"] } | ||
tokio = "1.44.2" | ||
engine-core = { path = "../core" } | ||
serde = { version = "1.0.219", features = ["derive"] } | ||
serde_json = "1.0" | ||
tracing = "0.1.41" | ||
rand = "0.9" | ||
thiserror = "2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edition = "2024"
and tokio = "1.44.2"
are not yet available
edition = "2024"
is unstable on the current stable toolchain; compilation will fail for all users not on nightly with the 2024-edition preview enabled.- The latest published
tokio
crate is 1.38.x (as of July 2025). Version1.44.2
does not exist and will causecargo
resolution errors.
-edition = "2024"
+edition = "2021"
-tokio = "1.44.2"
+# keep in sync with workspace root
+tokio = "1.38"
Please bump once the official 2024 edition and the referenced Tokio release ship.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
[package] | |
name = "engine-eip7702-core" | |
version = "0.1.0" | |
edition = "2024" | |
[dependencies] | |
alloy = { workspace = true, features = ["serde"] } | |
tokio = "1.44.2" | |
engine-core = { path = "../core" } | |
serde = { version = "1.0.219", features = ["derive"] } | |
serde_json = "1.0" | |
tracing = "0.1.41" | |
rand = "0.9" | |
thiserror = "2.0" | |
[package] | |
name = "engine-eip7702-core" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
alloy = { workspace = true, features = ["serde"] } | |
# keep in sync with workspace root | |
tokio = "1.38" | |
engine-core = { path = "../core" } | |
serde = { version = "1.0.219", features = ["derive"] } | |
serde_json = "1.0" | |
tracing = "0.1.41" | |
rand = "0.9" | |
thiserror = "2.0" |
🤖 Prompt for AI Agents
In eip7702-core/Cargo.toml lines 1 to 14, the edition is set to "2024" which is
not stable and the tokio version "1.44.2" does not exist. Change the edition to
the latest stable one, such as "2021", and set the tokio dependency to the
latest published version, for example "1.38". Update these once the official
2024 edition and the correct Tokio version are released.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores