feat: compact block proposals for faster block propagation#1
Open
thang1119 wants to merge 6 commits intodydx-fork-v0.38.5from
Open
feat: compact block proposals for faster block propagation#1thang1119 wants to merge 6 commits intodydx-fork-v0.38.5from
thang1119 wants to merge 6 commits intodydx-fork-v0.38.5from
Conversation
Add fields 8-14 to the Proposal protobuf message for compact block propagation. These optional fields carry tx hashes, app-injected txs, block header, last commit, evidence, and proposer address — enabling validators to reconstruct blocks from their local mempool without waiting for block parts to gossip. Fields are NOT included in CanonicalProposal, so signing is unaffected. Backward compatible: old validators ignore unknown fields.
…erialization Add TxKeys, NonMempoolTxs, NonMempoolIndices, CompactHeader, CompactLastCommit, CompactEvidence, and ProposerAddress fields to the native Proposal type. Update ToProto/ProposalFromProto for serialization. Add HasCompactData() helper and headerFromProtoNoValidate() for safe deserialization without premature validation.
Default true. When enabled, proposers include compact block data in Proposal messages and receivers attempt mempool-based reconstruction.
Add GetTxsForKeys(keys []TxKey) to the Mempool interface for O(1) batch tx lookup by SHA-256 key. CListMempool uses the existing txsMap (sync.Map) for lock-free reads. NopMempool returns all missing.
Proposer side: populate TxKeys, NonMempoolTxs, CompactHeader, etc. in defaultDecideProposal when compact_proposals is enabled. Receiver side: on proposal receipt, attempt block reconstruction via tryReconstructBlock(). If hash matches proposal.BlockID, set ProposalBlock immediately and trigger enterPrevote without waiting for block parts. Falls back to traditional gossip on failure. Add 3 metrics: compact_reconstructed, compact_missed, compact_hash_mismatch. Wire mempool into consensus State via StateMempool option.
- Rename proto/dydxcometbft to proto/perpxcometbft - Update README.md to PerpX/perpx-chain branding - Update organization references to 1119-Labs - Update branch naming to perpx-fork - Regenerate protobuf files with new package names - Update mempool import path for new proto package location
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
Implements compact block proposals (Sei Twin-Turbo style) to reduce block propagation latency. The proposer includes tx hashes + block metadata in the Proposal message itself, enabling validators to reconstruct blocks from their local mempool instantly — without waiting for block parts to gossip.
TxKeys(SHA-256 hashes),NonMempoolTxs(app-injected txs),CompactHeader,CompactLastCommit,CompactEvidence, andProposerAddressin Proposalproposal.BlockID.Hash, enters prevote immediatelyChanges
tx_keys,non_mempool_txs,non_mempool_indices,compact_header,compact_last_commit,proposer_address,compact_evidence)ToProto/FromProtoserialization,HasCompactData()helpercompact_proposals = true(default) consensus config flagGetTxsForKeys(keys []TxKey)batch lookup interface + CListMempool/NopMempool implementationsdefaultDecideProposal, receiver reconstructs indefaultSetProposalviatryReconstructBlock(), triggershandleCompleteProposalon successcompact_reconstructed,compact_missed,compact_hash_mismatchcountersStateMempooloption,node/setup.gopasses mempool to consensus StateTest plan
TestProposalCompactDataRoundTrip)HasCompactDatalogic test (TestProposalHasCompactData)