-
Notifications
You must be signed in to change notification settings - Fork 9
Nonce Lowering Improvements #56
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
WalkthroughExtends validation data for CleanAndGetRecycledNonces to include an optional current_optimistic_tx_count from Redis, updates call sites to destructure the new tuple, and conditionally adjusts the optimistic transaction counter during apply. Adds a warning log when inflight budget is unavailable in send_flow. Minor logging-format changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Caller
participant SubmittedStore
participant Redis
rect rgba(230,240,255,0.5)
note over Caller,SubmittedStore: Validation phase (CleanAndGetRecycledNonces)
Caller->>SubmittedStore: validate()
SubmittedStore->>Redis: GET highest_submitted_nonce, recycled_nonces, current_optimistic_tx_count
Redis-->>SubmittedStore: (u64, Vec<u64>, Option<u64>)
SubmittedStore-->>Caller: ValidationData(h, recycled, opt_count)
end
rect rgba(235,255,235,0.5)
note over Caller,SubmittedStore: Apply phase (update optimistic counter if needed)
Caller->>SubmittedStore: apply(h, recycled, opt_count)
alt opt_count is Some and h+1 < opt_count
SubmittedStore->>Redis: SET optimistic_tx_count = h + 1
else No update needed
SubmittedStore-->>Caller: proceed without changing counter
end
SubmittedStore-->>Caller: done
end
sequenceDiagram
autonumber
participant Worker
participant Budget
Worker->>Budget: check_inflight_budget()
alt budget available
Worker-->>Worker: proceed to send
else no budget
Worker-->>Worker: log warn "No inflight budget, not sending new transactions"
Worker-->>Worker: skip send
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment |
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
🧹 Nitpick comments (1)
executors/src/eoa/store/submitted.rs (1)
649-656: Harden the optimistic count lowering against overflow
highest_submitted_nonce + 1will panic in debug builds if we ever reachu64::MAX. It’s astronomically unlikely on Ethereum today, but the saturating form is a zero-cost guard and avoids the panic should we ever roll the counter that far.- if let Some(current_optimistic_tx_count) = current_optimistic_tx_count { - // if the current optimistic tx count is floating too high, we need to bring it down - if highest_submitted_nonce + 1 < current_optimistic_tx_count { - pipeline.set( - self.keys.optimistic_transaction_count_key_name(), - highest_submitted_nonce + 1, - ); + if let Some(current_optimistic_tx_count) = current_optimistic_tx_count { + // if the current optimistic tx count is floating too high, we need to bring it down + let next_nonce = highest_submitted_nonce.saturating_add(1); + if next_nonce < current_optimistic_tx_count { + pipeline.set( + self.keys.optimistic_transaction_count_key_name(), + next_nonce, + ); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
executors/src/eoa/store/submitted.rs(5 hunks)executors/src/eoa/worker/send.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-20T06:58:40.230Z
Learnt from: d4mr
PR: thirdweb-dev/engine-core#48
File: executors/src/eoa/store/submitted.rs:229-230
Timestamp: 2025-09-20T06:58:40.230Z
Learning: The diff in executors/src/eoa/store/submitted.rs shows correct brace structure - the first closing brace closes the remove_transaction_from_redis_submitted_zset method and the second closing brace closes the impl CleanSubmittedTransactions block. The change only adds whitespace formatting.
Applied to files:
executors/src/eoa/store/submitted.rs
🧬 Code graph analysis (1)
executors/src/eoa/store/submitted.rs (3)
executors/src/eoa/store/borrowed.rs (1)
operation(99-262)executors/src/eoa/store/atomic.rs (4)
operation(39-43)operation(708-735)pipeline(244-245)pipeline(362-363)executors/src/eoa/store/pending.rs (2)
operation(121-149)operation(239-262)
🔇 Additional comments (1)
executors/src/eoa/worker/send.rs (1)
69-73: Appreciate the explicit no-budget warningThe added
warn!gives much-needed visibility into why the worker skips the new-tx path, which will help during incident triage. Good call.
Summary by CodeRabbit
Bug Fixes
Chores