{"record":{"id":"f431f0b8a7ef08f1","repo":"diem/diem","slug":"we-must-not-accept-genesis-from-others","errorCode":null,"errorMessage":"We must not accept genesis from others","messagePattern":"We must not accept genesis from others","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"consensus/consensus-types/src/block.rs","lineNumber":240,"sourceCode":"    pub fn validate_signature(&self, validator: &ValidatorVerifier) -> anyhow::Result<()> {\n        match self.block_data.block_type() {\n            BlockType::Genesis => bail!(\"We should not accept genesis from others\"),\n            BlockType::NilBlock => self.quorum_cert().verify(validator),\n            BlockType::Proposal { author, .. } => {\n                let signature = self\n                    .signature\n                    .as_ref()\n                    .ok_or_else(|| format_err!(\"Missing signature in Proposal\"))?;\n                validator.verify(*author, &self.block_data, signature)?;\n                self.quorum_cert().verify(validator)\n            }\n        }\n    }\n\n    /// Makes sure that the proposal makes sense, independently of the current state.\n    /// If this is the genesis block, we skip these checks.\n    pub fn verify_well_formed(&self) -> anyhow::Result<()> {\n        ensure!(\n            !self.is_genesis_block(),\n            \"We must not accept genesis from others\"\n        );\n        let parent = self.quorum_cert().certified_block();\n        ensure!(\n            parent.round() < self.round(),\n            \"Block must have a greater round than parent's block\"\n        );\n        ensure!(\n            parent.epoch() == self.epoch(),\n            \"block's parent should be in the same epoch\"\n        );\n        if parent.has_reconfiguration() {\n            ensure!(\n                self.payload().map_or(true, |p| p.is_empty()),\n                \"Reconfiguration suffix should not carry payload\"\n            );\n        }","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/diem/diem/blob/fc4714a8ea273b6efe8b13dbce72ea60aad9a16c/consensus/consensus-types/src/block.rs#L222-L258","documentation":"Block::verify_well_formed() performs state-independent sanity checks and first ensures the block is not a genesis block (via is_genesis_block()). Genesis must come from local configuration, not from peers, so a genesis check here fails with 'We must not accept genesis from others'.","triggerScenarios":"Calling block.verify_well_formed() when is_genesis_block() is true — the QC/block being checked wraps the genesis block received or constructed as an incoming proposal.","commonSituations":"A peer proposes/syncs genesis, test harness reusing the genesis block as a proposal, initial sync pulling a block that should be loaded from the local genesis file.","solutions":["Filter out genesis blocks before calling verify_well_formed; initialize from the local genesis/waypoint instead.","Reject the offending message and penalize/disconnect the peer sending genesis.","Fix sync logic to source the parent chain head from local storage rather than network payloads.","Ensure tests construct fresh proposal blocks rather than reusing genesis."],"exampleFix":"// before\nblock.verify_well_formed()?;\n// after\nensure!(!block.is_genesis_block(), \"genesis must come from local config\");\nblock.verify_well_formed()?;","handlingStrategy":"validation","validationCode":"if block.is_genesis_block() {\n    return Err(anyhow::anyhow!(\"genesis must be loaded locally, not from peers\"));\n}\nblock.verify_well_formed()?;","typeGuard":"fn is_network_block(block: &Block) -> bool {\n    !block.is_genesis_block()\n}","tryCatchPattern":"match block.verify_well_formed() {\n    Ok(()) => { /* continue processing */ }\n    Err(e) if e.to_string().contains(\"genesis\") => {\n        drop_peer(peer_id);\n        metrics.genesis_offenses.inc();\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Filter genesis blocks at the network ingress boundary.","Bootstrap chain state only from local genesis/waypoint files.","Write tests that assert genesis is never serialized over the wire.","Reject and log peers that send genesis blocks."],"tags":["consensus","protocol-violation","validation","security"],"backgroundTag":"invalid-block-received","analyzedSha":"fc4714a8ea273b6efe8b13dbce72ea60aad9a16c","analyzedAt":"2026-09-04T21:07:05.890Z","contentChangedAt":"2026-09-04T21:07:05.890Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}