-
Notifications
You must be signed in to change notification settings - Fork 577
(feat): preconf + private tx relay #2004
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (71.65%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #2004 +/- ##
===========================================
+ Coverage 49.58% 49.65% +0.07%
===========================================
Files 873 877 +4
Lines 150507 151196 +689
===========================================
+ Hits 74622 75081 +459
- Misses 70850 71067 +217
- Partials 5035 5048 +13
... and 18 files with indirect coverage changes
🚀 New features to boost your workflow:
|
cffls
left a 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.
A question about a hypothetical scenario - if somehow a node receives a transaction but got killed before it broadcasts the txn, that txn will get lost. It seems like a hard edge case where we need to persist the txn data on disk?
Code ReviewFound 3 issues during code review. Issues
Checked for bugs and CLAUDE.md compliance. |
Great point. Yeah, I've kept a note of this to add persistence for storing transactions / preconf tasks. Due to the Amoy rollout next week, I am planning to add this in next iteration. Although, I've discussed the approach to use when restarting bor w/ Devops. It doesn't require persistence and can still ensure that no tx submission requests are dropped. Thanks! |
Code ReviewFound 4 issues during code review. Issue 1: Missing nil check in
|
|
@claude addressed the comments. Related to the last issue of resource accumulation, they're intended to be cleared at the end of function. |
|
Claude finished @manav2401's task in 39s —— View job Verification Results
All issues addressed. Here's my verification: Issue 1: Missing nil check ✅ FixedThe nil check for if s.multiclient == nil {
return false, errRpcClientUnavailable
}Issue 2: Inconsistent preconf status check ✅ FixedBoth
The logic is now consistent across both files. Issue 3: Race condition in test ✅ FixedThe type PrivateTxStore struct {
mu sync.RWMutex
store map[common.Hash]struct{}
}
func (p *PrivateTxStore) IsTxPrivate(hash common.Hash) bool {
p.mu.RLock()
defer p.mu.RUnlock()
_, ok := p.store[hash]
return ok
}All map accesses are now properly protected with mutex locks. Issue 4: Resource accumulation ✅ AcknowledgedUnderstood - the defer statements in loops are intentional since the resources should remain open for the duration of the test function, not just the loop iteration. The test needs all peer connections to remain open throughout the test execution. |
|
@claude can you review this PR, focusing on safety and performance? Provide a summary as a comment highlighting any concerns related to these changes. |
|
Claude finished @manav2401's task in 1m 48s —— View job Safety & Performance Review
SummaryThis PR introduces a solid relay architecture for preconfirmations and private transactions. The implementation follows good practices overall, with proper mutex usage, graceful shutdown handling, and reasonable test coverage. Below are my findings focused on safety and performance. Safety Concerns1.
|
|


Description
This PR introduces a new relay architecture for enabling preconfirmations and private transactions. The relay is intended to act as a middleware between end users / wallets and block producers. It will be able to route transactions for specific purpose directly to block producers. More details below:
Newly introduced flags:
--relay.enable-preconfs: Enables relay to offer preconfirmations--relay.enable-private-tx: Enables relay to route transactions privately--relay-bp-rpc-endpoints: RPC endpoints of all active block producers for transaction submission--accept-preconf-tx: Enables block producers to accept transactions for preconfirmation--accept-private-tx: Enables block producers to accept private txs--disable-tx-propagation: Disables transaction announcement / broadcast in public p2p networkGeneral transaction flow:
eth_sendRawTransactionendpoint.Preconf flow:
eth_sendTransactionForPreconfin all block producers.{ "hash": "0x...00", "preconfirmed": true }eth_checkPreconfStatustxpool_txStatusPrivate tx flow:
eth_sendTransactionPrivatein all block producers.-disable-tx-propagationflag which ensures that no transactions are gossiped in the public p2p network.General nuances of the feature:
TODOs:
Changes
Breaking changes
Please complete this section if any breaking changes have been made, otherwise delete it
Nodes audience
In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)
Checklist
Cross repository changes
Testing
Manual tests
Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it
Additional comments
Please post additional comments in this section if you have them, otherwise delete it