-
Notifications
You must be signed in to change notification settings - Fork 2
EOA diagnostics and improvements #29
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
Caution Review failedThe pull request is closed. WalkthroughThis set of changes primarily modernizes string formatting throughout the codebase, adopting Rust's inline named argument syntax ( Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant AuthExtractor
participant EoaExecutorStore
participant Redis
Client->>Server: GET /admin/executors/eoa/{eoa_chain}
Server->>AuthExtractor: Validate diagnostic password
AuthExtractor-->>Server: Ok / Error
Server->>EoaExecutorStore: Fetch EOA state (cached/optimistic nonce, counts, recycled nonces)
EoaExecutorStore->>Redis: Get state, counts, nonces
Redis-->>EoaExecutorStore: Data
EoaExecutorStore-->>Server: EOA state
Server-->>Client: EOA state JSON response
sequenceDiagram
participant Server
participant EoaExecutorStore
participant Redis
Server->>EoaExecutorStore: get_pending_transactions_count()
EoaExecutorStore->>Redis: ZCARD pending set
Redis-->>EoaExecutorStore: count
EoaExecutorStore-->>Server: count
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: 4
🔭 Outside diff range comments (1)
eip7702-core/tests/integration_tests.rs (1)
379-386
: Avoid hard-coding external RPC URLs in integration tests
The helperfetch_and_set_bytecode
ineip7702-core/tests/integration_tests.rs
(lines 379–386) calls the live endpoint"https://84532.rpc.thirdweb.com".parse()? .get_code_at(MINIMAL_ACCOUNT_IMPLEMENTATION_ADDRESS) .await?;Relying on an external RPC makes CI fragile (network blips, rate limits). Instead, serialize the fetched bytecode into a fixture—e.g. add a
tests/fixtures/minimal_account_bytecode.bin
and load it viainclude_bytes!
or similar—and gate any live-RPC fetch behind an opt-in Cargo feature (e.g.--features=live-rpc
) so tests remain hermetic by default.• File: eip7702-core/tests/integration_tests.rs lines 379–386
🧹 Nitpick comments (4)
server/src/http/routes/admin/mod.rs (1)
1-2
: Publicly exposing the diagnostics module deserves an explicit visibility audit
pub mod eoa_diagnostics;
makes all sub-items reachable from other crates.
Double-check that sensitive structs/responses don’t leak secrets and every route is wrapped byDiagnosticAuthExtractor
.twmq/src/lib.rs (1)
125-128
: Consider using accessor methods instead of exposing fields directly.Making these internal fields public breaks encapsulation and could make future API changes more difficult. Consider providing controlled access through methods instead:
- pub handler: Arc<H>, - pub options: QueueOptions, + handler: Arc<H>, + options: QueueOptions, // concurrency: usize, - pub name: String, + name: String,Then add accessor methods:
impl<H: DurableExecution> Queue<H> { pub fn handler(&self) -> &Arc<H> { &self.handler } pub fn options(&self) -> &QueueOptions { &self.options } // name() method already exists at line 174 }server/src/http/routes/admin/eoa_diagnostics.rs (2)
104-110
: Simplify namespace extractionThe namespace extraction can be simplified by storing a reference to the handler.
- // Get namespace from the config - let namespace = state - .queue_manager - .eoa_executor_queue - .handler - .namespace - .clone(); + // Get namespace from the handler + let handler = &state.queue_manager.eoa_executor_queue.handler; + let namespace = handler.namespace.clone();
400-429
: Simplify route handler referencesSince this router function is defined in the same module as the handlers, you can reference them directly without the full module path.
pub fn eoa_diagnostics_router() -> Router<EngineServerState> { // Add hidden admin diagnostic routes (not included in OpenAPI) Router::new() .route( "/admin/executors/eoa/{eoa_chain}/state", - axum::routing::get(crate::http::routes::admin::eoa_diagnostics::get_eoa_state), + axum::routing::get(get_eoa_state), ) .route( "/admin/executors/eoa/{eoa_chain}/transaction/{transaction_id}", - axum::routing::get(crate::http::routes::admin::eoa_diagnostics::get_transaction_detail), + axum::routing::get(get_transaction_detail), ) .route( "/admin/executors/eoa/{eoa_chain}/pending", - axum::routing::get( - crate::http::routes::admin::eoa_diagnostics::get_pending_transactions, - ), + axum::routing::get(get_pending_transactions), ) .route( "/admin/executors/eoa/{eoa_chain}/submitted", - axum::routing::get( - crate::http::routes::admin::eoa_diagnostics::get_submitted_transactions, - ), + axum::routing::get(get_submitted_transactions), ) .route( "/admin/executors/eoa/{eoa_chain}/borrowed", - axum::routing::get( - crate::http::routes::admin::eoa_diagnostics::get_borrowed_transactions, - ), + axum::routing::get(get_borrowed_transactions), ) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (53)
aa-core/src/signer.rs
(1 hunks)core/src/chain.rs
(4 hunks)core/src/error.rs
(4 hunks)core/src/execution_options/aa.rs
(1 hunks)core/src/execution_options/mod.rs
(1 hunks)core/src/signer.rs
(5 hunks)core/src/userop.rs
(3 hunks)eip7702-core/src/transaction.rs
(1 hunks)eip7702-core/tests/integration_tests.rs
(8 hunks)executors/src/eip7702_executor/confirm.rs
(5 hunks)executors/src/eip7702_executor/send.rs
(3 hunks)executors/src/eoa/error_classifier.rs
(2 hunks)executors/src/eoa/store/atomic.rs
(2 hunks)executors/src/eoa/store/borrowed.rs
(2 hunks)executors/src/eoa/store/hydrate.rs
(3 hunks)executors/src/eoa/store/mod.rs
(2 hunks)executors/src/eoa/store/pending.rs
(4 hunks)executors/src/eoa/worker/confirm.rs
(5 hunks)executors/src/eoa/worker/error.rs
(2 hunks)executors/src/eoa/worker/mod.rs
(6 hunks)executors/src/eoa/worker/send.rs
(2 hunks)executors/src/eoa/worker/transaction.rs
(5 hunks)executors/src/external_bundler/confirm.rs
(2 hunks)executors/src/external_bundler/deployment.rs
(5 hunks)executors/src/external_bundler/send.rs
(7 hunks)executors/src/transaction_registry.rs
(1 hunks)executors/src/webhook/mod.rs
(5 hunks)server/src/config.rs
(4 hunks)server/src/execution_router/mod.rs
(10 hunks)server/src/http/dyn_contract.rs
(5 hunks)server/src/http/extractors.rs
(5 hunks)server/src/http/routes/admin/eoa_diagnostics.rs
(1 hunks)server/src/http/routes/admin/mod.rs
(1 hunks)server/src/http/routes/admin/queue.rs
(3 hunks)server/src/http/routes/contract_read.rs
(4 hunks)server/src/http/routes/contract_write.rs
(1 hunks)server/src/http/routes/sign_typed_data.rs
(1 hunks)server/src/http/routes/transaction.rs
(1 hunks)server/src/http/server.rs
(4 hunks)server/src/main.rs
(1 hunks)server/src/queue/manager.rs
(1 hunks)thirdweb-core/src/iaw/mod.rs
(7 hunks)twmq/benches/throughput.rs
(4 hunks)twmq/src/lib.rs
(3 hunks)twmq/src/multilane.rs
(2 hunks)twmq/src/shutdown.rs
(2 hunks)twmq/tests/basic.rs
(5 hunks)twmq/tests/basic_hook.rs
(4 hunks)twmq/tests/delay.rs
(6 hunks)twmq/tests/idempotency_modes.rs
(3 hunks)twmq/tests/lease_expiry.rs
(2 hunks)twmq/tests/multilane_batch_pop.rs
(10 hunks)twmq/tests/nack.rs
(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: the eoa executor store uses comprehensive watch-based coordination where every redis state mutation ...
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: The EOA executor store uses comprehensive WATCH-based coordination where every Redis state mutation watches the lock key and validates ownership before proceeding. If the lock is lost during any operation, the transaction fails with LockLost error. This makes aggressive lock acquisition safe because only the actual lock holder can successfully perform state mutations, regardless of who claims the lock.
Applied to files:
executors/src/eoa/store/borrowed.rs
executors/src/eoa/worker/confirm.rs
executors/src/eoa/store/atomic.rs
executors/src/eoa/store/mod.rs
server/src/execution_router/mod.rs
📚 Learning: in the eoa executor system, aggressive lock acquisition is safe because every redis state mutation u...
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: In the EOA executor system, aggressive lock acquisition is safe because every Redis state mutation uses WATCH operations on the lock key. If the lock is lost during a transaction, the WATCH causes the transaction to fail and the worker exits gracefully. This provides coordination between workers even when using forceful lock takeover.
Applied to files:
executors/src/eoa/worker/confirm.rs
executors/src/eoa/store/atomic.rs
server/src/execution_router/mod.rs
🧬 Code Graph Analysis (4)
server/src/http/server.rs (1)
server/src/http/routes/admin/eoa_diagnostics.rs (1)
eoa_diagnostics_router
(400-429)
executors/src/eoa/store/pending.rs (2)
executors/src/eoa/store/submitted.rs (1)
nonce
(66-71)executors/src/eoa/store/mod.rs (1)
nonce
(368-373)
twmq/tests/idempotency_modes.rs (1)
twmq/src/queue.rs (3)
default
(20-22)default
(45-55)default
(85-87)
server/src/execution_router/mod.rs (6)
executors/src/eip7702_executor/send.rs (1)
webhook_options
(50-52)executors/src/eip7702_executor/confirm.rs (1)
webhook_options
(43-45)executors/src/external_bundler/confirm.rs (1)
webhook_options
(341-343)executors/src/webhook/mod.rs (1)
webhook_options
(441-460)executors/src/external_bundler/send.rs (1)
webhook_options
(63-65)executors/src/webhook/envelope.rs (1)
webhook_options
(113-113)
⏰ 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: test
- GitHub Check: coverage
🔇 Additional comments (119)
executors/src/eoa/error_classifier.rs (2)
4-4
: LGTM - Good cleanup of unused import.Removing the unused
RpcErrorKind
import improves code cleanliness.
131-131
: LGTM - Modernized string formatting.The update to use Rust's inline named argument formatting (
{code}
and{message}
) improves readability and aligns with modern Rust practices.executors/src/transaction_registry.rs (1)
32-32
: LGTM - Modernized string formatting.The update to use Rust's inline named argument formatting (
{ns}
) improves readability and maintains consistency with the broader codebase modernization.eip7702-core/src/transaction.rs (1)
217-217
: LGTM - Modernized error message formatting.The update to use Rust's inline named argument formatting (
{e}
) improves readability and aligns with the broader codebase modernization effort.server/src/queue/manager.rs (1)
33-33
: LGTM - Modernized string formatting.The update to use Rust's inline named argument formatting (
{namespace}_{name}
) improves readability and maintains consistency with the codebase-wide formatting modernization.twmq/src/shutdown.rs (2)
66-66
: LGTM - Modernized error message formatting.The update to use Rust's inline named argument formatting (
{e}
) improves readability and aligns with the codebase modernization effort.
120-120
: LGTM - Modernized error message formatting.The update to use Rust's inline named argument formatting (
{i}
and{e}
) improves readability and maintains consistency with the broader formatting improvements.executors/src/external_bundler/deployment.rs (2)
45-45
: LGTM - String formatting modernizationThe updates to use inline variable formatting (
{var}
) improve readability and align with modern Rust conventions.Also applies to: 74-75, 78-78
153-153
: LGTM - Error message formatting modernizationThe conversion to inline variable formatting in error messages improves consistency and readability while maintaining identical functionality.
Also applies to: 162-162, 168-168, 175-175, 199-199
executors/src/webhook/mod.rs (4)
144-144
: LGTM - Header validation error formatting modernizationThe inline variable formatting improves readability while maintaining identical error handling behavior.
Also applies to: 150-150
170-170
: LGTM - System time and HMAC error formatting modernizationThe updated formatting syntax improves consistency across error messages without affecting functionality.
Also applies to: 184-184
195-195
: LGTM - Header value error formatting modernizationThe inline variable formatting enhances readability while preserving error handling functionality.
Also applies to: 203-203
252-252
: LGTM - Response body error formatting modernizationThe updated formatting syntax maintains consistency with other error messages while preserving functionality.
twmq/src/multilane.rs (2)
437-437
: LGTM - Cancel job error formatting modernizationThe inline variable formatting improves readability while maintaining identical error handling behavior.
525-525
: LGTM - Shutdown error formatting modernizationThe updated formatting syntax enhances consistency across error messages without affecting functionality.
thirdweb-core/src/iaw/mod.rs (3)
129-129
: LGTM - Field parsing error formatting modernizationThe inline variable formatting improves error message readability while maintaining identical parsing and error handling behavior.
Also applies to: 136-136, 140-140, 144-144
228-228
: LGTM - Authorization header formatting modernizationThe updated formatting syntax improves consistency across all IAWClient methods while preserving identical header construction functionality.
Also applies to: 307-307, 374-374, 444-444, 527-527
491-491
: LGTM - API response parsing error formatting modernizationThe inline variable formatting enhances readability while maintaining identical error handling functionality.
eip7702-core/tests/integration_tests.rs (2)
373-374
:anvil_setBalance
uses a stringified U256 ‑ confirm the hex prefix is accepted
format!("0x{balance:x}")
builds a hex string without leading zeros.
While Anvil accepts it, other Ethereum clients sometimes expect 0-padded 32-byte values. If cross-client compatibility matters, pad to even length.
184-186
: Minor: repetitiveformat!
calls allocate each timeInside tight loops this can matter, but here it’s only in error branches. Nothing actionable—just noting the trade-off.
Also applies to: 207-209, 228-230, 257-259
executors/src/eoa/worker/send.rs (2)
296-299
: Nice guard-rail for zero-budget batchesEarly-return with a warning prevents useless log noise and avoids spawning empty futures. LGTM.
37-38
: Improved inline formatting – tiny winInline
{engine_error}
reads better than positional placeholders. No further action.server/src/http/routes/sign_typed_data.rs (1)
185-186
: Inline formatting change looks goodAllocations are unchanged; the message is clearer. No concerns.
core/src/execution_options/aa.rs (1)
94-94
: LGTM: String formatting modernizationThe update to use Rust's inline formatting syntax (
{e}
) instead of positional placeholders ({}
) improves code readability and aligns with modern Rust conventions.Also applies to: 99-99
server/src/http/routes/transaction.rs (1)
130-130
: LGTM: Consistent formatting modernizationThe inline variable formatting (
{other_queue}
) maintains consistency with the broader codebase modernization effort while preserving the same error handling logic.server/src/http/routes/contract_write.rs (1)
157-157
: LGTM: Improved error message formattingThe inline formatting syntax (
{index}: {error}
) enhances readability while maintaining the same error aggregation logic for contract call preparation failures.aa-core/src/signer.rs (1)
88-88
: LGTM: Error formatting modernizationThe inline formatting syntax (
{e}
) improves code clarity while preserving the same error handling behavior in the smart account determination process.twmq/tests/basic.rs (1)
21-21
: LGTM: Test output formatting modernizationThe consistent use of inline variable formatting in debug print statements improves code readability while maintaining identical test functionality.
Also applies to: 35-35, 54-54, 77-77, 96-96
core/src/chain.rs (1)
134-134
: LGTM! String formatting modernization.The changes consistently update error message formatting from the older
format!("message {}", var)
style to Rust 1.58+ inline variable interpolationformat!("message {var}")
. This improves code readability and aligns with modern Rust conventions.Also applies to: 152-152, 161-161, 170-170
twmq/benches/throughput.rs (1)
171-171
: LGTM! Consistent string formatting modernization.The changes consistently update all
format!
andprintln!
macro calls to use Rust's inline variable interpolation syntax. This improves code readability and maintains consistency with the broader codebase modernization effort.Also applies to: 204-204, 244-244, 292-292, 294-294, 295-295, 297-297, 298-298, 300-300, 305-305
executors/src/eoa/store/borrowed.rs (1)
177-179
: LGTM! Well-implemented nonce recycling logic.The addition of nonce recycling when transactions are nacked or failed is well-implemented:
- Uses the established Redis pipeline pattern for atomic operations
- Includes clear comments explaining the purpose of recycling unused nonces
- Correctly places the nonce as both member and score in the sorted set
- Follows the same pattern in both Nack and Fail branches for consistency
This aligns well with the broader EOA store enhancements for nonce management and observability.
Also applies to: 212-214
executors/src/external_bundler/confirm.rs (1)
84-84
: LGTM! String formatting modernization.The changes consistently update error message formatting to use Rust's inline variable interpolation syntax, improving readability while maintaining identical functionality.
Also applies to: 156-156
twmq/tests/delay.rs (1)
26-26
: LGTM! String formatting modernization in test code.The changes consistently update all string formatting throughout the test file to use Rust's inline variable interpolation syntax. This improves code readability while maintaining identical test functionality and behavior.
Also applies to: 112-112, 171-171, 272-272, 282-282, 292-292, 411-411
twmq/tests/nack.rs (1)
29-29
: LGTM! String formatting modernization looks good.The updates to use Rust's inline named argument syntax (
{var}
instead of{}", var
) improve readability and are consistent with modern Rust practices.Also applies to: 110-110, 274-274, 298-298
core/src/userop.rs (1)
118-118
: LGTM! Error message formatting modernization is consistent.The updates to use inline named argument syntax in error messages improve readability while maintaining the same error handling behavior.
Also applies to: 131-131, 150-150, 156-156
executors/src/eip7702_executor/confirm.rs (2)
1-1
: Good cleanup of unused import.Removing the unused
Address
import while keepingTxHash
improves code cleanliness.
110-110
: LGTM! Consistent string formatting modernization.The updates to use Rust's inline named argument syntax in error messages are consistent with the broader codebase improvements and enhance readability.
Also applies to: 174-174, 202-202, 230-230
core/src/execution_options/mod.rs (1)
214-216
: Excellent fix to the test validation logic.The previous test was incorrectly embedding the literal string
"{}"
instead of the actuallarge_metadata
variable, which would have caused the size validation test to pass incorrectly. This fix ensures the test properly validates the 4KB limit by embedding the actual large string.server/src/http/routes/admin/queue.rs (1)
91-92
: LGTM! Consistent string formatting updates.The modernization to use inline named argument syntax in error and success messages improves readability while maintaining the same functionality.
Also applies to: 111-112, 126-127
executors/src/eip7702_executor/send.rs (3)
119-119
: LGTM: String formatting modernization.The update to use inline named argument formatting improves readability without changing functionality.
185-185
: LGTM: String formatting modernization.The inline formatting syntax makes the error message construction more readable.
298-298
: LGTM: String formatting modernization.Consistent application of inline named argument formatting improves code readability.
executors/src/eoa/worker/transaction.rs (6)
214-215
: LGTM: String formatting modernization.The inline formatting makes the error message construction clearer.
227-227
: LGTM: String formatting modernization.Consistent with the formatting improvements throughout the codebase.
335-335
: LGTM: String formatting modernization.The inline formatting improves readability of the error message construction.
346-346
: LGTM: String formatting modernization.Proper use of inline formatting while maintaining the debug formatting specifier.
365-365
: LGTM: String formatting modernization.Consistent application of inline formatting for better readability.
371-371
: LGTM: String formatting modernization.The inline formatting syntax makes the error message construction clearer.
server/src/http/dyn_contract.rs (5)
120-120
: LGTM: String formatting modernization.The inline formatting makes the error message construction more readable.
213-213
: LGTM: String formatting modernization.Consistent with the formatting improvements throughout the codebase.
248-248
: LGTM: String formatting modernization.The inline formatting improves readability of the error message construction.
291-291
: LGTM: String formatting modernization.Consistent application of inline formatting for better code readability.
345-345
: LGTM: String formatting modernization.Proper use of inline formatting while maintaining the hex formatting specifier for Ethereum addresses.
twmq/tests/lease_expiry.rs (2)
26-26
: LGTM: String formatting modernization.The inline formatting makes the Redis key pattern construction more readable.
332-332
: LGTM: String formatting modernization.Consistent with the formatting improvements throughout the test files.
twmq/tests/multilane_batch_pop.rs (15)
168-168
: LGTM: String formatting modernization.The inline formatting makes the Redis key pattern construction more readable.
201-201
: LGTM: String formatting modernization.Consistent application of inline formatting in test data generation.
210-210
: LGTM: String formatting modernization.The inline formatting improves readability of lane ID construction.
248-248
: LGTM: String formatting modernization.Proper use of inline formatting while maintaining the debug formatting specifier for duration.
292-295
: LGTM: String formatting modernization.Consistent formatting improvements in test job creation.
303-303
: LGTM: String formatting modernization.The inline formatting makes the lane ID construction clearer.
331-331
: LGTM: String formatting modernization.Consistent application of inline formatting with debug specifier for duration logging.
336-336
: LGTM: String formatting modernization.The inline formatting improves readability of test output messages.
359-359
: LGTM: String formatting modernization.Consistent formatting improvement in test timing output.
381-381
: LGTM: String formatting modernization.The inline formatting makes the duration logging more readable.
429-429
: LGTM: String formatting modernization.Consistent application of inline formatting in test lane creation.
434-434
: LGTM: String formatting modernization.The inline formatting improves readability of test job data construction.
448-448
: LGTM: String formatting modernization.Consistent formatting improvement in test assertions.
451-451
: LGTM: String formatting modernization.The inline formatting makes the assertion message construction clearer.
456-456
: LGTM: String formatting modernization.Consistent application of inline formatting in test assertion messages.
twmq/src/lib.rs (2)
459-459
: LGTM! String formatting modernized.The update to inline formatting syntax improves readability and follows modern Rust conventions.
555-555
: LGTM! String formatting modernized.The update to inline formatting syntax is consistent with the broader codebase modernization.
executors/src/external_bundler/send.rs (1)
148-148
: LGTM! String formatting modernized consistently.All the format string updates use the modern inline syntax which improves readability and follows current Rust best practices. These changes are consistent with the broader codebase modernization effort.
Also applies to: 263-263, 332-332, 341-341, 353-353, 368-368, 380-380
server/src/http/routes/contract_read.rs (1)
101-101
: LGTM! String formatting modernized consistently.All the format string updates throughout the file use the modern inline syntax which improves readability and follows current Rust conventions. These changes are consistent with the broader codebase modernization effort described in the PR.
Also applies to: 477-477, 515-515, 521-521, 591-591
twmq/tests/basic_hook.rs (2)
26-26
: LGTM - String formatting modernization looks goodThe updates to use Rust's inline named formatting syntax (
{var}
instead of{}
) improve readability and are consistent with the broader modernization effort across the codebase.Also applies to: 40-40, 177-178, 260-260
180-180
: Good fix - Removing unnecessary mutabilityThe
queue_options
variable doesn't need to be mutable since it's only used in clone operations. This change improves code clarity.executors/src/eoa/store/atomic.rs (1)
404-404
: Good enhancement - Optimistic nonce synchronizationThe addition of optimistic nonce fetching and the logic to ensure it never falls behind the chain transaction count is a solid defensive improvement. This will help maintain nonce consistency and prevent potential issues where the optimistic nonce becomes stale.
The warning log when updating the optimistic nonce will provide valuable visibility into when this correction occurs.
Also applies to: 421-431
executors/src/eoa/worker/error.rs (1)
120-120
: LGTM - Error message formatting modernizationThe updates to use inline variable formatting in error messages are correct and consistent with the broader formatting modernization effort.
Also applies to: 299-299
server/src/config.rs (2)
40-40
: Good addition - Diagnostic authentication supportThe new
diagnostic_access_password
field with proper default value supports the diagnostic authentication mechanism. The implementation is clean and follows good practices by making it optional.Also applies to: 73-73
100-100
: LGTM - Error formatting modernizationThe updates to use inline variable formatting in error messages improve readability and are consistent with the codebase-wide formatting modernization.
Also applies to: 107-107, 139-139
executors/src/eoa/store/pending.rs (2)
62-62
: Good clarification - Variable renaming improves readabilityRenaming
current_nonce
tocurrent_optimistic_nonce
better clarifies the specific type of nonce being referenced, which aligns with the broader nonce management improvements in this PR.Also applies to: 77-77
81-81
: LGTM - Error message formatting modernizationThe updates to use inline named formatting syntax in error messages are correct and consistent with the codebase-wide formatting improvements.
Also applies to: 112-112, 226-226
server/src/http/server.rs (4)
13-14
: LGTM: Import added for diagnostic functionality.The import of
eoa_diagnostics_router
is correctly added to support the new diagnostic routes functionality.
32-32
: LGTM: Well-designed optional authentication field.The
diagnostic_access_password
field is appropriately typed asOption<String>
and positioned well within theEngineServerState
struct.
75-84
: LGTM: Proper integration of diagnostic routes.The router setup correctly:
- Clones state appropriately for shared usage
- Creates the diagnostic router with the necessary state
- Merges diagnostic routes after OpenAPI split to keep them hidden from documentation
- Includes clear comments explaining the intent
179-181
: LGTM: Modern string formatting syntax.The update to inline formatting syntax (
{e}
) improves code readability and aligns with modern Rust conventions.core/src/signer.rs (5)
105-111
: LGTM: Modern formatting syntax in error messages.The update to inline formatting syntax improves readability while maintaining identical functionality.
311-311
: LGTM: Consistent formatting modernization.The inline formatting syntax aligns with the broader codebase improvements.
380-380
: LGTM: Modern formatting syntax.Consistent with the codebase-wide formatting improvements.
450-450
: LGTM: Formatting consistency improvement.The modern inline formatting syntax enhances code readability.
524-524
: LGTM: Completes formatting modernization.The final formatting update maintains consistency across all error messages in the file.
twmq/tests/idempotency_modes.rs (3)
71-71
: LGTM: Modern string formatting.The inline formatting syntax improves readability while maintaining identical functionality.
92-96
: LGTM: Improved struct initialization.The refactor to use struct literal syntax with
..Default::default()
is more idiomatic and eliminates unnecessary mutability.
179-183
: LGTM: Consistent struct initialization improvement.Same excellent refactoring pattern applied consistently across test functions.
executors/src/eoa/store/hydrate.rs (3)
23-23
: Verify the rationale for boxing EoaTransactionRequest.The change from
EoaTransactionRequest
toBox<EoaTransactionRequest>
introduces heap allocation. Please confirm this addresses a specific performance concern or memory usage issue rather than being premature optimization.
44-44
: LGTM: Correct dereferencing of boxed value.The dereferencing with
*request
correctly handles the boxedEoaTransactionRequest
and moves the owned value into the struct.
152-154
: LGTM: Proper boxing implementation.The
Box::new(request.clone())
correctly creates the boxed value required by theSubmittedTransactionHydrator::Real
variant.core/src/error.rs (3)
334-349
: LGTM: Comprehensive formatting modernization.All format string updates correctly preserve debug formatting (
{err:?}
) while adopting modern inline syntax for improved readability.
401-402
: LGTM: Consistent error message formatting.The inline formatting syntax maintains identical error message content while improving code readability.
536-575
: LGTM: Complete trait formatting modernization.All format string updates correctly preserve the original error message structure and debug formatting while adopting the modern inline syntax consistently.
executors/src/eoa/worker/mod.rs (6)
143-143
: LGTM: String formatting modernizationThe update to inline formatting syntax
{e}
improves code readability and follows modern Rust conventions.
295-324
: Excellent optimization: Direct count queries replace collection fetchingThe changes replace inefficient collection-then-count operations with direct Redis count queries:
peek_pending_transactions(1000)
→get_pending_transactions_count()
peek_borrowed_transactions()
→get_borrowed_transactions_count()
peek_recycled_nonces()
→get_recycled_nonces_count()
This optimization reduces memory usage and network overhead by avoiding unnecessary data transfer. The variable rename from
recycled_count
torecycled_nonces_count
also improves code clarity.
335-344
: Enhanced logging provides valuable diagnosticsThe detailed logging statement effectively captures key workflow metrics including recovered transactions, confirmations, and current state counts. The inline formatting syntax is consistent with the codebase modernization.
356-356
: LGTM: Consistent variable namingThe update to use
recycled_nonces_count
maintains consistency with the variable rename and improves code clarity.
463-464
: LGTM: Consistent string formatting modernizationThe inline formatting syntax
{engine_error}
aligns with the codebase-wide formatting modernization effort.
498-498
: LGTM: Final string formatting modernizationConsistent application of inline formatting syntax throughout the file improves readability and follows modern Rust conventions.
executors/src/eoa/worker/confirm.rs (4)
11-15
: Improved clarity: Constant renaming and import organizationThe rename from
NONCE_STALL_TIMEOUT
toNONCE_STALL_LIMIT_MS
explicitly indicates the time unit, improving code clarity. The import statement reorganization also enhances readability.
39-49
: Improved nonce synchronization handlingThe changes include:
- String formatting modernization using
{engine_error}
syntax- Method change from
reset_nonces()
toupdate_cached_transaction_count(current_chain_transaction_count)
which provides more precise nonce synchronization by ensuring the optimistic nonce is never behind the fresh chain transaction countThis aligns with the enhanced nonce management introduced in the store layer.
62-70
: Standardized time source and consistent constant usageThe change to
EoaExecutorStore::now()
provides a canonical time representation for the store, ensuring consistency across operations. The updated constant nameNONCE_STALL_LIMIT_MS
maintains consistency with the earlier rename.
158-173
: Enhanced chain state synchronization with re-org handlingThis new logic provides robust handling of chain state changes:
- Re-org Detection: When the fresh chain transaction count is lower than cached, it logs a detailed warning about potential reorganizations or RPC lag
- State Synchronization: Always updates the cached count to match the fresh chain count, ensuring consistency
- Diagnostic Information: The error message clearly explains the implications for nonce management
This is critical for maintaining transaction reliability in the face of chain reorganizations or RPC inconsistencies.
server/src/http/extractors.rs (3)
16-16
: LGTM: Infrastructure for diagnostic authenticationThe import of
EngineServerState
and the new header constantHEADER_DIAGNOSTIC_ACCESS_PASSWORD
properly support the diagnostic authentication functionality.Also applies to: 27-27
172-172
: Consistent string formatting modernizationThe updates to inline formatting syntax (
{e}
,{err}
) throughout error handling improve code readability and follow modern Rust conventions. All changes are consistent with the codebase-wide formatting effort.Also applies to: 278-286
296-339
: Well-implemented diagnostic authentication extractorThe
DiagnosticAuthExtractor
implementation follows security best practices:✅ Configuration Validation: Properly checks that diagnostic password is configured and non-empty
✅ Header Extraction: Safely extracts password from request headers with appropriate error handling
✅ Secure Comparison: Uses direct string comparison (constant-time for equal-length strings in Rust)
✅ Clear Error Messages: Provides appropriate error messages for different failure scenarios
✅ Type Safety: Properly implementsFromRequestParts<EngineServerState>
traitThe implementation integrates well with the Axum framework and provides proper access control for diagnostic endpoints.
server/src/execution_router/mod.rs (3)
100-100
: Consistent string formatting modernizationThe inline formatting updates (
{e}
,{preallocated_nonce}
,{encoded_calldata}
) improve readability throughout the codebase. The regex pattern formatting changes are particularly important as they generate patterns used for Vault access token restrictions.Also applies to: 131-134, 190-190
303-303
: Improved API design: Slice parameter instead of vector referenceThe change from
&Vec<WebhookOptions>
to&[WebhookOptions]
follows Rust best practices by accepting a slice, which is more flexible and idiomatic. The corresponding change from.clone()
to.to_owned()
is more explicit about creating an owned vector from the slice.Also applies to: 315-315
328-328
: Final string formatting modernizationsThe remaining inline formatting updates (
{e}
,{e:?}
) complete the consistent modernization effort throughout the execution router, improving code readability and following modern Rust conventions.Also applies to: 373-373, 406-406, 424-424, 474-474, 482-482
executors/src/eoa/store/mod.rs (3)
140-140
: Bug fix: Removed extra underscore in key name formattingThis fixes a formatting issue in
transaction_data_key_name
where an extraneous underscore would be included in the key name when no namespace is provided, potentially causing key lookup failures.
754-759
: Canonical time source for store operationsThe new
now()
method provides a standardized time representation across all store operations, ensuring consistency and avoiding negative timestamp values. This supports the time standardization effort seen throughout the worker modules.
761-834
: Comprehensive diagnostic and optimization methodsThe new methods provide essential functionality for both diagnostics and performance optimization:
Count Methods (used by worker for optimization):
get_pending_transactions_count()
,get_borrowed_transactions_count()
,get_recycled_nonces_count()
- Replace inefficient peek-then-count operationsData Retrieval Methods (used by diagnostic endpoints):
get_recycled_nonces()
,get_all_submitted_transactions()
get_transaction_attempts_count()
,get_transaction_attempts()
Implementation Quality:
✅ Consistent Patterns: All methods follow the same async/Result pattern
✅ Proper Redis Commands: Uses appropriate Redis operations (ZCARD, HLEN, ZRANGE, LLEN, LRANGE)
✅ Error Handling: Properly wraps Redis and serialization errors
✅ Type Safety: Maintains strong typing throughout the chainThese methods enable both the performance improvements in the worker modules and the new diagnostic capabilities.
let eoa_queue = &state.queue_manager.eoa_executor_queue; | ||
let redis_conn = eoa_queue.redis.clone(); |
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.
Inconsistent Redis connection access pattern
This handler accesses Redis via eoa_queue.redis.clone()
, while all other handlers in this file access it via eoa_queue.handler.redis.clone()
.
Apply this diff to maintain consistency:
- let redis_conn = eoa_queue.redis.clone();
+ let redis_conn = eoa_queue.handler.redis.clone();
📝 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.
let eoa_queue = &state.queue_manager.eoa_executor_queue; | |
let redis_conn = eoa_queue.redis.clone(); | |
let eoa_queue = &state.queue_manager.eoa_executor_queue; | |
- let redis_conn = eoa_queue.redis.clone(); | |
+ let redis_conn = eoa_queue.handler.redis.clone(); |
🤖 Prompt for AI Agents
In server/src/http/routes/admin/eoa_diagnostics.rs around lines 100 to 101, the
Redis connection is accessed inconsistently by using eoa_queue.redis.clone()
instead of the consistent pattern eoa_queue.handler.redis.clone(). Update the
code to access Redis through eoa_queue.handler.redis.clone() to maintain
uniformity with other handlers in this file.
}; | ||
|
||
let offset = pagination.offset.unwrap_or(0); | ||
let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 100 |
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.
Fix inconsistent comment about limit cap
The comment says "Cap at 100" but the code actually caps at 1000.
- let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 100
+ let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 1000
📝 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.
let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 100 | |
let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 1000 |
🤖 Prompt for AI Agents
In server/src/http/routes/admin/eoa_diagnostics.rs at line 241, the comment
about the limit cap is inconsistent with the code; the comment says "Cap at 100"
but the code caps at 1000. Update the comment to correctly reflect the cap of
1000 to maintain clarity and accuracy.
diagnostic_access_password: config.server.diagnostic_access_password, | ||
}) |
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.
Propagate an optional password – but reject empty strings
diagnostic_access_password
is forwarded verbatim. If the env/config omits it or sets an empty string, the diagnostics endpoints become publicly accessible.
Enforce Some(non_empty)
here or let the extractor bail early.
- diagnostic_access_password: config.server.diagnostic_access_password,
+ diagnostic_access_password: config
+ .server
+ .diagnostic_access_password
+ .filter(|s| !s.is_empty()),
📝 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.
diagnostic_access_password: config.server.diagnostic_access_password, | |
}) | |
diagnostic_access_password: config | |
.server | |
.diagnostic_access_password | |
.filter(|s| !s.is_empty()), | |
}) |
🤖 Prompt for AI Agents
In server/src/main.rs around lines 104 to 105, the diagnostic_access_password is
passed directly from config without validation, allowing empty strings which
make diagnostics endpoints publicly accessible. Modify the code to check if
diagnostic_access_password is Some and non-empty; if it is empty or None, reject
it by returning an error or causing the extractor to fail early, ensuring only
valid non-empty passwords are accepted.
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: 0
♻️ Duplicate comments (2)
server/src/http/routes/admin/eoa_diagnostics.rs (2)
100-101
: Inconsistent Redis connection access patternThis handler accesses Redis via
eoa_queue.redis.clone()
, while all other handlers in this file access it viaeoa_queue.handler.redis.clone()
.Apply this diff to maintain consistency:
- let redis_conn = eoa_queue.redis.clone(); + let redis_conn = eoa_queue.handler.redis.clone();
236-236
: Fix inconsistent comment about limit capThe comment says "Cap at 100" but the code actually caps at 1000.
- let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 100 + let limit = pagination.limit.unwrap_or(1000).min(1000); // Cap at 1000
🧹 Nitpick comments (2)
server/src/http/routes/admin/eoa_diagnostics.rs (2)
274-317
: Consider adding pagination to submitted transactions endpointUnlike the pending transactions endpoint, this handler retrieves all submitted transactions without pagination. For EOAs with many submitted transactions, this could cause performance issues or memory problems.
Consider adding pagination similar to the pending transactions handler to improve performance and consistency across the API.
319-362
: Consider adding pagination to borrowed transactions endpointLike the submitted transactions endpoint, this handler retrieves all borrowed transactions without pagination, which could cause performance issues with large datasets.
Consider implementing pagination to maintain consistency with the pending transactions endpoint and improve scalability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
server/src/http/routes/admin/eoa_diagnostics.rs
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: in the eoa executor system, aggressive lock acquisition is safe because every redis state mutation u...
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: In the EOA executor system, aggressive lock acquisition is safe because every Redis state mutation uses WATCH operations on the lock key. If the lock is lost during a transaction, the WATCH causes the transaction to fail and the worker exits gracefully. This provides coordination between workers even when using forceful lock takeover.
Applied to files:
server/src/http/routes/admin/eoa_diagnostics.rs
📚 Learning: the eoa executor store uses comprehensive watch-based coordination where every redis state mutation ...
Learnt from: d4mr
PR: thirdweb-dev/engine-core#5
File: executors/src/eoa/worker.rs:173-176
Timestamp: 2025-07-06T15:44:13.701Z
Learning: The EOA executor store uses comprehensive WATCH-based coordination where every Redis state mutation watches the lock key and validates ownership before proceeding. If the lock is lost during any operation, the transaction fails with LockLost error. This makes aggressive lock acquisition safe because only the actual lock holder can successfully perform state mutations, regardless of who claims the lock.
Applied to files:
server/src/http/routes/admin/eoa_diagnostics.rs
⏰ 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
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Refactor