Support out-of-order (future-nonce) transaction submission - #227
Open
Storm1289 wants to merge 27 commits into
Open
Support out-of-order (future-nonce) transaction submission#227Storm1289 wants to merge 27 commits into
Storm1289 wants to merge 27 commits into
Conversation
- add per-sender nonceGate: admit in-order txs, park future nonces - release parked txs in nonce order on commit (one per sender in flight) - guard with per-sender cap and TTL gap-eviction - report parked txs as pending in eth_getTransactionByHash Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Storm1289
marked this pull request as ready for review
July 10, 2026 09:05
Contributor
Author
|
Hi @ale-linux, whenever you have some time after reviewing #219, could you please take a look at this one as well? |
Signed-off-by: Storm <divakarsharma2934@gmail.com>
Contributor
|
Hi @Storm1289 , |
- drop unreachable code after Admit that failed go vet (make checks) - reject duplicates (queued or parked) before admitting through the gate - initialize nonceGate in the SendTransaction duplicate test Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Contributor
Author
fixed, please check again. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
==========================================
+ Coverage 30.45% 31.24% +0.79%
==========================================
Files 80 81 +1
Lines 11287 11363 +76
==========================================
+ Hits 3437 3550 +113
+ Misses 7548 7509 -39
- Partials 302 304 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- cover Admit sender-recover error, Released nonce-lookup error, and releaseSender no-op (nonce_parking.go now 100%) - add gateway-level tests: New wires the gate, future-nonce parking via SendTransaction/TransactionByHash, Handle release path Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
- add a queue stub whose Handle fails, covering Handle's error branch - exercise New's workerCount and queue defaults Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
✅ OZ Hardhat Compatibility — 84.4% passing (5144/6094)No regressions, no stale entries. Full breakdown — 5144 passed, 949 failed, 1 skipped (6094 total, 84.4% passing)By suite
Expected failures by cause (943)
|
Contributor
Author
|
Hi @ale-linux, please review this pr whenever you have sometime. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #52.
Adds support for out-of-order (future-nonce) transaction submission by introducing a per-sender nonce parking layer.
Ethereum clients commonly submit multiple transactions back-to-back with sequential nonces, expecting the network to process them in order. Previously, the gateway immediately enqueued any transaction that passed validation, causing future-nonce transactions to fail downstream. This PR parks future-nonce transactions until earlier nonces commit, then releases them in nonce order.
Changes
gateway/core/nonce_parking.go(new)Introduces a per-sender
nonceGateresponsible for ordering transaction admission.AdmitReleasedGuardrails included:
gateway/core/api.goSendTransactionnow admits transactions through the nonce gate.Handlereleases parked transactions after block commit.TransactionByHashreports parked transactions as pending.gateway/core/nonce_parking_test.go(new)Adds dedicated unit tests covering the nonce parking layer.
Scope
This PR intentionally supports one in-flight transaction per sender, releasing the next transaction only after the previous one commits.
This matches the scope of #52.
Higher-throughput same-sender pipelining and dependency-aware scheduling remain out of scope and are expected to build on top of this work in #59. This parking layer sits in front of that scheduling rather than replacing it.
Tests
gateway/core/nonce_parking_test.goadds 10 unit tests covering:All tests pass with
-race, and the fullgateway/coretest suite remains green.Test plan
go test -race ./gateway/core/...