diff --git a/beacon_node/beacon_chain/src/lib.rs b/beacon_node/beacon_chain/src/lib.rs index 69824a9b2a1..f4e85707d62 100644 --- a/beacon_node/beacon_chain/src/lib.rs +++ b/beacon_node/beacon_chain/src/lib.rs @@ -38,13 +38,13 @@ mod observed_aggregates; mod observed_attesters; mod observed_blob_sidecars; pub mod observed_block_producers; -pub mod proposer_signature_cache; pub mod observed_operations; pub mod otb_verification_service; mod persisted_beacon_chain; mod persisted_fork_choice; mod pre_finalization_cache; pub mod proposer_prep_service; +pub mod proposer_signature_cache; pub mod schema_change; pub mod shuffling_cache; mod snapshot_cache; diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index 4ada45c7ab3..faa35849bd4 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -19,9 +19,6 @@ pub type KzgCommitmentOpts = /// Index of the `blob_kzg_commitments` leaf in the `BeaconBlockBody` tree post-deneb. pub const BLOB_KZG_COMMITMENTS_INDEX: usize = 11; -/// Depth of the `BeaconBlockBody` merkle tree. -pub const BEACON_BLOCK_BODY_TREE_DEPTH: usize = 4; - /// The body of a `BeaconChain` block, containing operations. /// /// This *superstruct* abstracts over the hard-fork. @@ -130,9 +127,10 @@ impl<'a, T: EthSpec, Payload: AbstractExecPayload> BeaconBlockBodyRef<'a, T, body.bls_to_execution_changes.tree_hash_root(), body.blob_kzg_commitments.tree_hash_root(), ]; - let tree = MerkleTree::create(&leaves, BEACON_BLOCK_BODY_TREE_DEPTH); + let depth = leaves.len().next_power_of_two().ilog2() as usize; + let tree = MerkleTree::create(&leaves, depth); let (_, proof_body) = tree - .generate_proof(BLOB_KZG_COMMITMENTS_INDEX, BEACON_BLOCK_BODY_TREE_DEPTH) + .generate_proof(BLOB_KZG_COMMITMENTS_INDEX, depth) .map_err(Error::MerkleTreeError)?; Ok(proof_body) } diff --git a/testing/ef_tests/src/cases/merkle_proof_validity.rs b/testing/ef_tests/src/cases/merkle_proof_validity.rs index a1c4d20daf3..09599780739 100644 --- a/testing/ef_tests/src/cases/merkle_proof_validity.rs +++ b/testing/ef_tests/src/cases/merkle_proof_validity.rs @@ -142,7 +142,7 @@ impl Case for KzgInclusionMerkleProofValidity { let expected_leaf = self.merkle_proof.branch[i]; if *proof_leaf != expected_leaf { return Err(Error::NotEqual(format!( - "Leaves not equal in merke proof computed: {}, expected: {}", + "Leaves not equal in merkle proof computed: {}, expected: {}", hex::encode(proof_leaf), hex::encode(expected_leaf) )));