Check the transactions before pushing them into the new block body#4791
Check the transactions before pushing them into the new block body#4791jackzhhuang wants to merge 7 commits intodual-verse-dagfrom
Conversation
📝 WalkthroughWalkthroughAdds a new StateCheck module and tests, changes fetch_transactions to accept a Changes
Sequence Diagram(s)sequenceDiagram
participant BlockBuilder as Block Builder
participant Chain as BlockChain
participant TxPool as Tx Pool
participant StateCheck as StateCheck
participant VM1 as VM1 State Reader
participant VM2 as VM2 State Reader
rect rgba(200,200,255,0.5)
BlockBuilder->>Chain: fetch_transactions(chain, blue_blocks, max_txns)
end
rect rgba(200,255,200,0.5)
Chain->>TxPool: query pending txs (VM1 + VM2)
TxPool-->>Chain: return aggregated tx list
end
rect rgba(255,220,200,0.5)
Chain->>StateCheck: instantiate with (VM1 reader, VM2 reader)
Chain->>StateCheck: filter_continuous_transactions(all_txns)
StateCheck->>VM1: get_next_expected_sequence(sender_vm1)
VM1-->>StateCheck: next_seq_vm1
StateCheck->>VM2: get_next_expected_sequence(sender_vm2)
VM2-->>StateCheck: next_seq_vm2
StateCheck-->>Chain: return filtered txs
end
rect rgba(240,240,240,0.5)
Chain-->>BlockBuilder: return (VM1 txns, VM2 txns)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ab406dd to
800d940
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@miner/src/create_block_template/block_builder_service.rs`:
- Around line 652-682: The current code appends blue_blocks' transactions into
all_transactions so filter_continuous_transactions may return blue-block txns
back into the new block body; instead, only send txpool transactions
(pending_multi_transactions) to filter_continuous_transactions and use
blue_blocks only to advance/prime the sequence state before filtering.
Concretely: stop pushing blue_blocks' VM1/VM2 txns into all_transactions;
iterate blue_blocks and call a sequence-priming method on state_check (e.g.,
state_check.prime_with_transaction / state_check.advance_sequence or add such a
helper) to update sequence counters from block.transactions() and
block.transactions2(); then call state_check.filter_continuous_transactions on
the txpool-derived all_transactions and proceed to split results into
pending_transactions / pending_transactions2 as before. Ensure
MultiSignedUserTransaction handling and sender/sequence ordering remain
unchanged.
🧹 Nitpick comments (1)
miner/src/create_block_template/block_builder_service.rs (1)
633-650: Rename or remove the “[jacktest]” log tag.
This looks like a temporary debug label; consider aligning with existing log prefixes before merging.Also applies to: 684-689
56b7805 to
d04a759
Compare
d04a759 to
ba6ea09
Compare
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Other information
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.