-
Notifications
You must be signed in to change notification settings - Fork 575
feat: Handle multiple blocks per slot in validators #19240
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: next
Are you sure you want to change the base?
Conversation
Implementation Plan: Multiple Blocks Per Slot (MBPS) P2P and Validator UpdatesOverviewThis plan updates the p2p, validator-client, and sequencer-publisher to handle multiple blocks per slot. The key change is that validators now attest to checkpoints (aggregations of multiple blocks within a slot) rather than individual blocks. Key Design Decisions:
New MBPS FlowProposer Side (from README timing model)Validator Side (parallel execution)Key insight: Validators execute block N while proposer builds block N+1. This parallelism is why we need to broadcast each block immediately after building it. Phase 1: New P2P Message TypesLocation: 1.1 Create
|
| File | Changes |
|---|---|
stdlib/src/p2p/block_proposal.ts |
Update structure for per-block data |
stdlib/src/p2p/checkpoint_proposal.ts |
New file |
stdlib/src/p2p/checkpoint_attestation.ts |
New file |
stdlib/src/p2p/topic_type.ts |
Add new topics |
p2p/src/client/interface.ts |
New methods |
p2p/src/client/p2p_client.ts |
Implement new methods |
p2p/src/services/libp2p/libp2p_service.ts |
New topic handlers |
p2p/src/msg_validators/checkpoint_proposal_validator.ts |
New file |
p2p/src/msg_validators/checkpoint_attestation_validator.ts |
New file |
p2p/src/mem_pools/attestation_pool/*.ts |
Add checkpoint attestation support |
validator-client/src/checkpoint_attestation_job.ts |
New file - core logic |
validator-client/src/validator.ts |
New handlers, job management |
validator-client/src/duties/validation_service.ts |
New creation methods |
sequencer-client/src/sequencer/checkpoint_proposal_job.ts |
Wire new APIs |
Progress Update (2025-12-23)
Completed Work
Phase 1: New P2P Message Types ✅
- Updated
BlockProposalto useBlockHeaderinstead ofCheckpointHeader - Created
CheckpointProposalclass with proper structure - Created
CheckpointAttestationandCheckpointAttestationPayloadclasses - Updated
TopicTypeenum with new topics - Updated signature utilities with new domain separators
- Updated exports in
stdlib/src/p2p/index.ts
Phase 2: P2P Layer Updates ✅
- Updated P2P client interface with new callback types:
P2PBlockReceivedCallbackreturnsPromise<boolean>(validation only)P2PCheckpointReceivedCallbackreturnsPromise<CheckpointAttestation[] | undefined>
- Added
broadcastCheckpointProposalandbroadcastCheckpointAttestationsstubs to P2P interface - Updated
DummyP2Pimplementation in txe package - Updated
registerBlockProposalHandlerand addedregisterCheckpointProposalHandler
Phase 3: Validator Client Updates (Partial) ✅
- Updated
ValidationService:createBlockProposalnow takesBlockHeader,indexWithinCheckpoint,inHash, etc.- Added
attestToCheckpointProposalmethod - Deprecated
attestToProposal(for backward compat with attestation pool)
- Updated
ValidatorClient:validateBlockProposalreturnsPromise<boolean>(no attestations)- Added
attestToCheckpointProposalmethod - Updated
createBlockProposalsignature - Added placeholder
createCheckpointProposal(currently delegates tocreateBlockProposal) - Registered handlers for both block and checkpoint proposals
Phase 4: Sequencer Updates ✅
- Updated
checkpoint_proposal_job.ts:- Added
inHashcomputation from L1 to L2 messages - Updated
createBlockProposalcalls with new signature - Updated
createCheckpointProposalcalls
- Added
Tests Fixed ✅
validation_service.test.ts- Updated to use new APIvalidator.test.ts- FixedinHashmismatch in test setupcheckpoint_proposal_job.test.ts- Updated mock implementationstest/utils.ts- UpdatedcreateBlockProposalhelpere2e_multi_validator_node_key_store.test.ts- Updated wrapper functionreex.test.ts- Updated to useBlockProposal.createProposalFromSignerattestation_pool_test_suite.ts- Updated to use newmakeBlockProposal
Remaining Work
1. Attestation Pool Migration (TODO)
Priority: High
The attestation pool still uses BlockAttestation. Needs to be updated to use CheckpointAttestation:
- Add
CheckpointAttestationmethods to attestation pool interface:addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>getCheckpointAttestationsForSlotAndProposal(slot, proposalId): Promise<CheckpointAttestation[]>
- Implement in
MemoryAttestationPooland KV store versions - Update
collectAttestationsto useCheckpointAttestation - Remove deprecated
attestToProposalmethod inValidationService
Files to update:
p2p/src/mem_pools/attestation_pool/attestation_pool.tsp2p/src/mem_pools/attestation_pool/memory_attestation_pool.tsp2p/src/mem_pools/attestation_pool/kv_attestation_pool.tsvalidator-client/src/duties/validation_service.ts(remove deprecated method)stdlib/src/interfaces/validator.ts(updatecollectAttestationssignature)
See TODOs:
2. Create Actual CheckpointProposal (TODO)
Priority: Medium
Currently createCheckpointProposal in validator.ts just delegates to createBlockProposal. It should:
- Create an actual
CheckpointProposalinstance (notBlockProposal) - Include
CheckpointHeaderfrom the completed checkpoint - Use proper signing with
SignatureDomainSeparator.checkpointProposal
See TODO:
3. Add Checkpoint Proposal Validation (TODO)
Priority: Medium
The attestToCheckpointProposal method currently just blindly attests without validation. Should add:
- Validate proposer matches expected for slot
- Validate checkpoint header fields are consistent
- Re-execute transactions and compare state (similar to block proposal validation)
See TODO:
4. Implement CheckpointAttestationJob (Optional for now)
Priority: Low
The full parallel execution model described in Phase 3.1 (CheckpointAttestationJob) is not yet implemented. Currently validators process proposals synchronously. This is fine for initial MBPS but will need to be added for optimal performance.
5. Double Proposal Prevention (TODO)
Priority: Low
Currently commented out in createBlockProposal. Should properly prevent double proposals for the same slot.
See TODO:
6. E2E Testing
Priority: High
The e2e tests have been updated to compile, but should be run to verify:
e2e_multi_validator_node_key_store.test.tsreex.test.ts- Any other MBPS-related e2e tests
Test Commands
# Unit tests
cd yarn-project/validator-client && yarn test validation_service.test.ts
cd yarn-project/validator-client && yarn test validator.test.ts
cd yarn-project/sequencer-client && yarn test checkpoint_proposal_job.test.ts
cd yarn-project/p2p && yarn test attestation_pool
# E2E tests (run one at a time)
cd yarn-project/end-to-end && yarn test:e2e e2e_multi_validator_node_key_store.test.ts
cd yarn-project/end-to-end && yarn test:e2e reex.test.ts
What happens if you give Claude an overview of what to do and a few Linear issues?