From 0297a0e91ec1c36693622ae1bc1ca5d7bc46fc81 Mon Sep 17 00:00:00 2001 From: Roman Proskuryakoff Date: Fri, 29 Mar 2024 17:03:33 +0800 Subject: [PATCH] Rename merkle_root to txs_commitment --- bin/citrea/src/test_rpc.rs | 4 +- crates/bitcoin-da/src/spec/header.rs | 4 +- crates/bitcoin-da/src/verifier.rs | 2 +- crates/citrea-stf/src/hooks_impl.rs | 2 +- crates/evm/src/hooks.rs | 2 +- crates/sequencer-client/src/lib.rs | 4 +- crates/sequencer/src/sequencer.rs | 8 ++-- .../adapters/avail/src/spec/header.rs | 2 +- .../adapters/celestia/src/celestia.rs | 2 +- .../adapters/mock-da/src/db_connector.rs | 8 ++-- .../adapters/mock-da/src/service.rs | 4 +- .../adapters/mock-da/src/types/mod.rs | 12 ++--- .../full-node/db/sov-db/src/ledger_db/mod.rs | 2 +- .../full-node/db/sov-db/src/schema/types.rs | 6 +-- .../sov-prover-storage-manager/src/lib.rs | 48 +++++++++---------- .../full-node/sov-stf-runner/src/runner.rs | 2 +- .../sov-stf-runner/tests/prover_tests.rs | 2 +- .../src/tests/helpers.rs | 2 +- .../sov-modules-api/src/hooks.rs | 14 +++--- .../sov-modules-stf-blueprint/src/lib.rs | 2 +- .../rollup-interface/src/node/rpc/mod.rs | 4 +- .../rollup-interface/src/state_machine/da.rs | 4 +- .../src/state_machine/soft_confirmation.rs | 24 +++++----- .../rollup-interface/src/state_machine/stf.rs | 4 +- .../utils/rng-da-service/src/lib.rs | 2 +- 25 files changed, 85 insertions(+), 85 deletions(-) diff --git a/bin/citrea/src/test_rpc.rs b/bin/citrea/src/test_rpc.rs index e6f41ed19..e137324cc 100644 --- a/bin/citrea/src/test_rpc.rs +++ b/bin/citrea/src/test_rpc.rs @@ -98,7 +98,7 @@ fn regular_test_helper(payload: serde_json::Value, expected: &serde_json::Value) header: MockBlockHeader { prev_hash: sha2::Sha256::digest(b"prev_header").into(), hash: sha2::Sha256::digest(b"slot_data").into(), - merkle_root: sha2::Sha256::digest(b"merkle_root").into(), + txs_commitment: sha2::Sha256::digest(b"txs_commitment").into(), height: 0, time: Time::now(), }, @@ -304,7 +304,7 @@ prop_compose! { let mut new_slot = SlotCommit::new(MockBlock { header: MockBlockHeader { hash: hash.into(), - merkle_root: hash.into(), + txs_commitment: hash.into(), prev_hash, height: 0, time: Time::now(), diff --git a/crates/bitcoin-da/src/spec/header.rs b/crates/bitcoin-da/src/spec/header.rs index 01729cb58..843cd987a 100644 --- a/crates/bitcoin-da/src/spec/header.rs +++ b/crates/bitcoin-da/src/spec/header.rs @@ -25,7 +25,7 @@ impl BlockHeaderTrait for HeaderWrapper { BlockHashWrapper(self.header.block_hash()) } - fn merkle_root(&self) -> Self::Hash { + fn txs_commitment(&self) -> Self::Hash { BlockHashWrapper(BlockHash::from_raw_hash(self.header.merkle_root.into())) } @@ -51,7 +51,7 @@ impl HeaderWrapper { self.header.block_hash() } - pub fn merkle_root(&self) -> TxMerkleNode { + pub fn txs_commitment(&self) -> TxMerkleNode { self.header.merkle_root } } diff --git a/crates/bitcoin-da/src/verifier.rs b/crates/bitcoin-da/src/verifier.rs index 054493cd4..19f4ae4fb 100644 --- a/crates/bitcoin-da/src/verifier.rs +++ b/crates/bitcoin-da/src/verifier.rs @@ -249,7 +249,7 @@ impl DaVerifier for BitcoinVerifier { return Err(ValidationError::NonRelevantTxInProof); } - let tx_root = block_header.merkle_root().to_raw_hash().to_byte_array(); + let tx_root = block_header.txs_commitment().to_raw_hash().to_byte_array(); // Inclusion proof is all the txs in the block. let tx_hashes = inclusion_proof diff --git a/crates/citrea-stf/src/hooks_impl.rs b/crates/citrea-stf/src/hooks_impl.rs index cc5117450..6943bf33b 100644 --- a/crates/citrea-stf/src/hooks_impl.rs +++ b/crates/citrea-stf/src/hooks_impl.rs @@ -75,7 +75,7 @@ impl ApplySoftConfirmationHooks for Runtime { self.evm.begin_soft_confirmation_hook( soft_batch.da_slot_hash(), - soft_batch.da_slot_merkle_root(), + soft_batch.da_slot_txs_commitment(), &soft_batch.pre_state_root(), soft_batch.l1_fee_rate(), working_set, diff --git a/crates/evm/src/hooks.rs b/crates/evm/src/hooks.rs index 322db0c95..39c92fed8 100644 --- a/crates/evm/src/hooks.rs +++ b/crates/evm/src/hooks.rs @@ -15,7 +15,7 @@ where pub fn begin_soft_confirmation_hook( &self, da_slot_hash: [u8; 32], - _da_slot_merkle_root: [u8; 32], + _da_slot_txs_commitment: [u8; 32], pre_state_root: &[u8], l1_fee_rate: u64, working_set: &mut WorkingSet, diff --git a/crates/sequencer-client/src/lib.rs b/crates/sequencer-client/src/lib.rs index eb25753e6..00dba52a6 100644 --- a/crates/sequencer-client/src/lib.rs +++ b/crates/sequencer-client/src/lib.rs @@ -75,7 +75,7 @@ pub struct GetSoftBatchResponse { #[serde(with = "hex::serde")] pub da_slot_hash: [u8; 32], #[serde(with = "hex::serde")] - pub da_slot_merkle_root: [u8; 32], + pub da_slot_txs_commitment: [u8; 32], #[serde(skip_serializing_if = "Option::is_none")] pub txs: Option>>, #[serde(with = "hex::serde")] @@ -95,7 +95,7 @@ impl From for SignedSoftConfirmationBatch { val.hash, val.da_slot_height, val.da_slot_hash, - val.da_slot_merkle_root, + val.da_slot_txs_commitment, val.pre_state_root, val.l1_fee_rate, val.txs.unwrap_or_default(), diff --git a/crates/sequencer/src/sequencer.rs b/crates/sequencer/src/sequencer.rs index bcc3263c8..210bfe6a9 100644 --- a/crates/sequencer/src/sequencer.rs +++ b/crates/sequencer/src/sequencer.rs @@ -199,7 +199,7 @@ where let batch_info = HookSoftConfirmationInfo { da_slot_height: da_block.header().height(), da_slot_hash: da_block.header().hash().into(), - da_slot_merkle_root: da_block.header().merkle_root().into(), + da_slot_txs_commitment: da_block.header().txs_commitment().into(), pre_state_root: self.state_root.clone().as_ref().to_vec(), pub_key: self.sov_tx_signer_priv_key.pub_key().try_to_vec().unwrap(), l1_fee_rate, @@ -240,7 +240,7 @@ where let unsigned_batch = UnsignedSoftConfirmationBatch::new( da_block.header().height(), da_block.header().hash().into(), - da_block.header().merkle_root().into(), + da_block.header().txs_commitment().into(), self.state_root.clone().as_ref().to_vec(), txs, l1_fee_rate, @@ -296,7 +296,7 @@ where batch_hash: batch_receipt.batch_hash, da_slot_hash: da_block.header().hash(), da_slot_height: da_block.header().height(), - da_slot_merkle_root: da_block.header().merkle_root(), + da_slot_txs_commitment: da_block.header().txs_commitment(), tx_receipts: batch_receipt.tx_receipts, soft_confirmation_signature: signed_soft_batch.signature().to_vec(), pub_key: signed_soft_batch.pub_key().to_vec(), @@ -525,7 +525,7 @@ where hash, soft_confirmation.da_slot_height(), soft_confirmation.da_slot_hash(), - soft_confirmation.da_slot_merkle_root(), + soft_confirmation.da_slot_txs_commitment(), soft_confirmation.pre_state_root(), soft_confirmation.l1_fee_rate(), soft_confirmation.txs(), diff --git a/crates/sovereign-sdk/adapters/avail/src/spec/header.rs b/crates/sovereign-sdk/adapters/avail/src/spec/header.rs index 41d4773aa..fad021861 100644 --- a/crates/sovereign-sdk/adapters/avail/src/spec/header.rs +++ b/crates/sovereign-sdk/adapters/avail/src/spec/header.rs @@ -53,7 +53,7 @@ impl BlockHeaderTrait for AvailHeader { self.hash.clone() } - fn merkle_root(&self) -> Self::Hash { + fn txs_commitment(&self) -> Self::Hash { AvailHash::new(self.header.state_root) } diff --git a/crates/sovereign-sdk/adapters/celestia/src/celestia.rs b/crates/sovereign-sdk/adapters/celestia/src/celestia.rs index b9d5e0ab5..b22789a27 100644 --- a/crates/sovereign-sdk/adapters/celestia/src/celestia.rs +++ b/crates/sovereign-sdk/adapters/celestia/src/celestia.rs @@ -244,7 +244,7 @@ impl BlockHeader for CelestiaHeader { TmHash(self.header.hash()) } - fn merkle_root(&self) -> Self::Hash { + fn txs_commitment(&self) -> Self::Hash { TmHash(self.header.merkle_root()) } diff --git a/crates/sovereign-sdk/adapters/mock-da/src/db_connector.rs b/crates/sovereign-sdk/adapters/mock-da/src/db_connector.rs index 3094f808b..169f277f0 100644 --- a/crates/sovereign-sdk/adapters/mock-da/src/db_connector.rs +++ b/crates/sovereign-sdk/adapters/mock-da/src/db_connector.rs @@ -37,7 +37,7 @@ impl DbConnector { "CREATE TABLE IF NOT EXISTS blocks ( prev_hash BLOB, hash BLOB, - merkle_root BLOB, + txs_commitment BLOB, height INTEGER unique, time TEXT, is_valid INTEGER, @@ -64,12 +64,12 @@ impl DbConnector { pub fn push_back(&self, block: MockBlock) { self.conn .execute( - "INSERT INTO blocks (prev_hash, hash, merkle_root, height, time, is_valid, blobs) + "INSERT INTO blocks (prev_hash, hash, txs_commitment, height, time, is_valid, blobs) VALUES (?, ?, ?, ?, ?, ?, ?)", params![ block.header.prev_hash.0, block.header.hash.0, - block.header.merkle_root.0, + block.header.txs_commitment.0, block.header.height, serde_json::to_string(&block.header.time) .expect("DbConnector: Failed to serialize time"), @@ -152,7 +152,7 @@ impl DbConnector { header: MockBlockHeader { prev_hash: MockHash(row.get(0).unwrap()), hash: MockHash(row.get(1).unwrap()), - merkle_root: MockHash(row.get(2).unwrap()), + txs_commitment: MockHash(row.get(2).unwrap()), height: row.get(3).unwrap(), time: serde_json::from_str(row.get::<_, String>(4).unwrap().as_str()).unwrap(), }, diff --git a/crates/sovereign-sdk/adapters/mock-da/src/service.rs b/crates/sovereign-sdk/adapters/mock-da/src/service.rs index 98bd3e89b..258ac72d8 100644 --- a/crates/sovereign-sdk/adapters/mock-da/src/service.rs +++ b/crates/sovereign-sdk/adapters/mock-da/src/service.rs @@ -20,7 +20,7 @@ use crate::{MockBlockHeader, MockHash}; const GENESIS_HEADER: MockBlockHeader = MockBlockHeader { prev_hash: MockHash([0; 32]), hash: MockHash([1; 32]), - merkle_root: MockHash([1; 32]), + txs_commitment: MockHash([1; 32]), height: 0, // 2023-01-01T00:00:00Z time: Time::from_secs(1672531200), @@ -202,7 +202,7 @@ impl MockDaService { let header = MockBlockHeader { prev_hash: previous_block_hash, hash: block_hash, - merkle_root: block_hash, + txs_commitment: block_hash, height, time: Time::from_secs(10000000000), // TODO: had to mock this for now, causes different state roots }; diff --git a/crates/sovereign-sdk/adapters/mock-da/src/types/mod.rs b/crates/sovereign-sdk/adapters/mock-da/src/types/mod.rs index 3785a6d17..bddbdac87 100644 --- a/crates/sovereign-sdk/adapters/mock-da/src/types/mod.rs +++ b/crates/sovereign-sdk/adapters/mock-da/src/types/mod.rs @@ -71,8 +71,8 @@ pub struct MockBlockHeader { pub prev_hash: MockHash, /// The hash of this block. pub hash: MockHash, - /// The merkle root of this block. - pub merkle_root: MockHash, + /// The transactions commitment of this block. + pub txs_commitment: MockHash, /// The height of this block pub height: u64, /// The time at which this block was created @@ -85,11 +85,11 @@ impl MockBlockHeader { pub fn from_height(height: u64) -> MockBlockHeader { let prev_hash = u64_to_bytes(height); let hash = u64_to_bytes(height + 1); - let merkle_root = u64_to_bytes(height + 1); + let txs_commitment = u64_to_bytes(height + 1); MockBlockHeader { prev_hash: MockHash(prev_hash), hash: MockHash(hash), - merkle_root: MockHash(merkle_root), + txs_commitment: MockHash(txs_commitment), height, time: Time::now(), } @@ -125,8 +125,8 @@ impl BlockHeaderTrait for MockBlockHeader { self.hash } - fn merkle_root(&self) -> Self::Hash { - self.merkle_root + fn txs_commitment(&self) -> Self::Hash { + self.txs_commitment } fn height(&self) -> u64 { diff --git a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs index 38fade35a..5e7011e79 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs +++ b/crates/sovereign-sdk/full-node/db/sov-db/src/ledger_db/mod.rs @@ -301,7 +301,7 @@ impl LedgerDB { let batch_to_store = StoredSoftBatch { da_slot_height: batch_receipt.da_slot_height, da_slot_hash: batch_receipt.da_slot_hash.into(), - da_slot_merkle_root: batch_receipt.da_slot_merkle_root.into(), + da_slot_txs_commitment: batch_receipt.da_slot_txs_commitment.into(), hash: batch_receipt.batch_hash, tx_range: TxNumber(first_tx_number)..TxNumber(last_tx_number), txs, diff --git a/crates/sovereign-sdk/full-node/db/sov-db/src/schema/types.rs b/crates/sovereign-sdk/full-node/db/sov-db/src/schema/types.rs index 7348c95dc..7ee2aee24 100644 --- a/crates/sovereign-sdk/full-node/db/sov-db/src/schema/types.rs +++ b/crates/sovereign-sdk/full-node/db/sov-db/src/schema/types.rs @@ -76,8 +76,8 @@ pub struct StoredSoftBatch { pub da_slot_height: u64, /// The da hash of the batch pub da_slot_hash: [u8; 32], - /// The da merkle root of the batch - pub da_slot_merkle_root: [u8; 32], + /// The da transactions commitment of the batch + pub da_slot_txs_commitment: [u8; 32], /// The hash of the batch pub hash: DbHash, /// The range of transactions which occurred in this batch. @@ -106,7 +106,7 @@ impl TryFrom for SoftBatchResponse { Ok(Self { da_slot_hash: value.da_slot_hash, da_slot_height: value.da_slot_height, - da_slot_merkle_root: value.da_slot_merkle_root, + da_slot_txs_commitment: value.da_slot_txs_commitment, hash: value.hash, txs: Some(value.txs.into_iter().filter_map(|tx| tx.body).collect()), // Rollup full nodes don't store tx bodies pre_state_root: value.pre_state_root, diff --git a/crates/sovereign-sdk/full-node/sov-prover-storage-manager/src/lib.rs b/crates/sovereign-sdk/full-node/sov-prover-storage-manager/src/lib.rs index 5cca8786a..392000b22 100644 --- a/crates/sovereign-sdk/full-node/sov-prover-storage-manager/src/lib.rs +++ b/crates/sovereign-sdk/full-node/sov-prover-storage-manager/src/lib.rs @@ -540,7 +540,7 @@ mod tests { let block_header = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([2; 32]), - merkle_root: MockHash::from([3; 32]), + txs_commitment: MockHash::from([3; 32]), height: 1, time: Time::now(), }; @@ -580,7 +580,7 @@ mod tests { let block_header = MockBlockHeader { prev_hash: MockHash::from([0; 32]), hash: MockHash::from([1; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; @@ -623,7 +623,7 @@ mod tests { let block_header = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([1; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; @@ -648,14 +648,14 @@ mod tests { let block_a = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([2; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; let block_b = MockBlockHeader { prev_hash: MockHash::from([2; 32]), hash: MockHash::from([1; 32]), - merkle_root: MockHash::from([43; 32]), + txs_commitment: MockHash::from([43; 32]), height: 2, time: Time::now(), }; @@ -684,7 +684,7 @@ mod tests { let block_header = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([2; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; @@ -710,7 +710,7 @@ mod tests { let block_a = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([2; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; @@ -748,7 +748,7 @@ mod tests { let block_a = MockBlockHeader { prev_hash: MockHash::from([0; 32]), hash: MockHash::from([1; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; @@ -756,7 +756,7 @@ mod tests { let block_b = MockBlockHeader { prev_hash: MockHash::from([2; 32]), hash: MockHash::from([3; 32]), - merkle_root: MockHash::from([43; 32]), + txs_commitment: MockHash::from([43; 32]), height: 2, time: Time::now(), }; @@ -827,7 +827,7 @@ mod tests { let block_from_i = |i: u8| MockBlockHeader { prev_hash: MockHash::from([i; 32]), hash: MockHash::from([i + 1; 32]), - merkle_root: MockHash::from([i + 1; 32]), + txs_commitment: MockHash::from([i + 1; 32]), height: i as u64 + 1, time: Time::now(), }; @@ -876,7 +876,7 @@ mod tests { let block = MockBlockHeader { prev_hash: MockHash::from([prev_hash; 32]), hash: MockHash::from([next_hash; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: height as u64, time: Time::now(), }; @@ -888,7 +888,7 @@ mod tests { let block = MockBlockHeader { prev_hash: MockHash::from([prev_hash; 32]), hash: MockHash::from([prev_hash + 1; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: prev_hash as u64 + 1, time: Time::now(), }; @@ -995,77 +995,77 @@ mod tests { let block_a = MockBlockHeader { prev_hash: MockHash::from([0; 32]), hash: MockHash::from([1; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 1, time: Time::now(), }; let block_b = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([2; 32]), - merkle_root: MockHash::from([43; 32]), + txs_commitment: MockHash::from([43; 32]), height: 2, time: Time::now(), }; let block_c = MockBlockHeader { prev_hash: MockHash::from([2; 32]), hash: MockHash::from([3; 32]), - merkle_root: MockHash::from([44; 32]), + txs_commitment: MockHash::from([44; 32]), height: 3, time: Time::now(), }; let block_d = MockBlockHeader { prev_hash: MockHash::from([3; 32]), hash: MockHash::from([4; 32]), - merkle_root: MockHash::from([45; 32]), + txs_commitment: MockHash::from([45; 32]), height: 4, time: Time::now(), }; let block_e = MockBlockHeader { prev_hash: MockHash::from([4; 32]), hash: MockHash::from([5; 32]), - merkle_root: MockHash::from([46; 32]), + txs_commitment: MockHash::from([46; 32]), height: 5, time: Time::now(), }; let block_f = MockBlockHeader { prev_hash: MockHash::from([1; 32]), hash: MockHash::from([32; 32]), - merkle_root: MockHash::from([47; 32]), + txs_commitment: MockHash::from([47; 32]), height: 2, time: Time::now(), }; let block_g = MockBlockHeader { prev_hash: MockHash::from([2; 32]), hash: MockHash::from([23; 32]), - merkle_root: MockHash::from([48; 32]), + txs_commitment: MockHash::from([48; 32]), height: 3, time: Time::now(), }; let block_h = MockBlockHeader { prev_hash: MockHash::from([23; 32]), hash: MockHash::from([24; 32]), - merkle_root: MockHash::from([49; 32]), + txs_commitment: MockHash::from([49; 32]), height: 4, time: Time::now(), }; let block_k = MockBlockHeader { prev_hash: MockHash::from([32; 32]), hash: MockHash::from([33; 32]), - merkle_root: MockHash::from([50; 32]), + txs_commitment: MockHash::from([50; 32]), height: 3, time: Time::now(), }; let block_l = MockBlockHeader { prev_hash: MockHash::from([2; 32]), hash: MockHash::from([13; 32]), - merkle_root: MockHash::from([51; 32]), + txs_commitment: MockHash::from([51; 32]), height: 3, time: Time::now(), }; let block_m = MockBlockHeader { prev_hash: MockHash::from([13; 32]), hash: MockHash::from([14; 32]), - merkle_root: MockHash::from([52; 32]), + txs_commitment: MockHash::from([52; 32]), height: 4, time: Time::now(), }; @@ -1344,7 +1344,7 @@ mod tests { let new_block_after_e = MockBlockHeader { prev_hash: MockHash::from([5; 32]), hash: MockHash::from([6; 32]), - merkle_root: MockHash::from([42; 32]), + txs_commitment: MockHash::from([42; 32]), height: 6, time: Time::now(), }; diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs b/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs index 0a408b810..cb9379cfe 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/src/runner.rs @@ -492,7 +492,7 @@ where batch_hash: batch_receipt.batch_hash, da_slot_hash: filtered_block.header().hash(), da_slot_height: filtered_block.header().height(), - da_slot_merkle_root: filtered_block.header().merkle_root(), + da_slot_txs_commitment: filtered_block.header().txs_commitment(), tx_receipts: batch_receipt.tx_receipts, soft_confirmation_signature: soft_batch.soft_confirmation_signature, pub_key: soft_batch.pub_key, diff --git a/crates/sovereign-sdk/full-node/sov-stf-runner/tests/prover_tests.rs b/crates/sovereign-sdk/full-node/sov-stf-runner/tests/prover_tests.rs index 44849ed57..432265b29 100644 --- a/crates/sovereign-sdk/full-node/sov-stf-runner/tests/prover_tests.rs +++ b/crates/sovereign-sdk/full-node/sov-stf-runner/tests/prover_tests.rs @@ -226,7 +226,7 @@ fn make_transition_data( da_block_header: MockBlockHeader { prev_hash: [0; 32].into(), hash: header_hash, - merkle_root: header_hash, + txs_commitment: header_hash, height: 0, time: Time::now(), }, diff --git a/crates/sovereign-sdk/module-system/module-implementations/sov-attester-incentives/src/tests/helpers.rs b/crates/sovereign-sdk/module-system/module-implementations/sov-attester-incentives/src/tests/helpers.rs index 21b98bbb5..571d9f9c3 100644 --- a/crates/sovereign-sdk/module-system/module-implementations/sov-attester-incentives/src/tests/helpers.rs +++ b/crates/sovereign-sdk/module-system/module-implementations/sov-attester-incentives/src/tests/helpers.rs @@ -186,7 +186,7 @@ pub(crate) fn execution_simulation, /// Public key of signer @@ -128,7 +128,7 @@ impl From for HookSoftConfirmationInfo { HookSoftConfirmationInfo { da_slot_height: signed_soft_confirmation_batch.da_slot_height(), da_slot_hash: signed_soft_confirmation_batch.da_slot_hash(), - da_slot_merkle_root: signed_soft_confirmation_batch.da_slot_merkle_root(), + da_slot_txs_commitment: signed_soft_confirmation_batch.da_slot_txs_commitment(), pre_state_root: signed_soft_confirmation_batch.pre_state_root(), pub_key: signed_soft_confirmation_batch.sequencer_pub_key().to_vec(), l1_fee_rate: signed_soft_confirmation_batch.l1_fee_rate(), @@ -142,7 +142,7 @@ impl From for SignedSoftConfirmationBatch { [0u8; 32], val.da_slot_height, val.da_slot_hash(), - val.da_slot_merkle_root(), + val.da_slot_txs_commitment(), val.pre_state_root(), val.l1_fee_rate, vec![], @@ -158,9 +158,9 @@ impl HookSoftConfirmationInfo { self.da_slot_hash } - /// DA block merkle root - pub fn da_slot_merkle_root(&self) -> [u8; 32] { - self.da_slot_merkle_root + /// DA block transactions commitment + pub fn da_slot_txs_commitment(&self) -> [u8; 32] { + self.da_slot_txs_commitment } /// Previous batch's pre state root diff --git a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs index b893d9ec7..7f31994c7 100644 --- a/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs +++ b/crates/sovereign-sdk/module-system/sov-modules-stf-blueprint/src/lib.rs @@ -576,7 +576,7 @@ fn verify_soft_batch_signature( let unsigned = UnsignedSoftConfirmationBatch::new( soft_batch.da_slot_height(), soft_batch.da_slot_hash(), - soft_batch.da_slot_merkle_root(), + soft_batch.da_slot_txs_commitment(), soft_batch.pre_state_root(), soft_batch.txs(), soft_batch.l1_fee_rate(), diff --git a/crates/sovereign-sdk/rollup-interface/src/node/rpc/mod.rs b/crates/sovereign-sdk/rollup-interface/src/node/rpc/mod.rs index 2b18afd6e..e40bd62a3 100644 --- a/crates/sovereign-sdk/rollup-interface/src/node/rpc/mod.rs +++ b/crates/sovereign-sdk/rollup-interface/src/node/rpc/mod.rs @@ -172,8 +172,8 @@ pub struct SoftBatchResponse { #[serde(with = "hex::serde")] pub da_slot_hash: [u8; 32], #[serde(with = "hex::serde")] - /// The DA slot merkle root of the soft batch. - pub da_slot_merkle_root: [u8; 32], + /// The DA slot transaction commitment of the soft batch. + pub da_slot_txs_commitment: [u8; 32], /// The hash of the soft batch. #[serde(with = "hex::serde")] pub hash: [u8; 32], diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs index c2bddb0e4..9c09bf339 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs @@ -223,8 +223,8 @@ pub trait BlockHeaderTrait: PartialEq + Debug + Clone + Serialize + DeserializeO /// Hash the type to get the digest. fn hash(&self) -> Self::Hash; - /// Merkle root of the block. - fn merkle_root(&self) -> Self::Hash; + /// Transactions commitment of the block. + fn txs_commitment(&self) -> Self::Hash; /// The current header height fn height(&self) -> u64; diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/soft_confirmation.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/soft_confirmation.rs index 25681eda1..78c553ffa 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/soft_confirmation.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/soft_confirmation.rs @@ -13,7 +13,7 @@ use crate::maybestd::vec::Vec; pub struct UnsignedSoftConfirmationBatch { da_slot_height: u64, da_slot_hash: [u8; 32], - da_slot_merkle_root: [u8; 32], + da_slot_txs_commitment: [u8; 32], pre_state_root: Vec, txs: Vec>, l1_fee_rate: u64, @@ -24,7 +24,7 @@ impl UnsignedSoftConfirmationBatch { pub fn new( da_slot_height: u64, da_slot_hash: [u8; 32], - da_slot_merkle_root: [u8; 32], + da_slot_txs_commitment: [u8; 32], pre_state_root: Vec, txs: Vec>, l1_fee_rate: u64, @@ -32,7 +32,7 @@ impl UnsignedSoftConfirmationBatch { Self { da_slot_height, da_slot_hash, - da_slot_merkle_root, + da_slot_txs_commitment, pre_state_root, txs, l1_fee_rate, @@ -46,9 +46,9 @@ impl UnsignedSoftConfirmationBatch { pub fn da_slot_hash(&self) -> [u8; 32] { self.da_slot_hash } - /// DA block merkle root - pub fn da_slot_merkle_root(&self) -> [u8; 32] { - self.da_slot_merkle_root + /// DA block transactions commitment + pub fn da_slot_txs_commitment(&self) -> [u8; 32] { + self.da_slot_txs_commitment } /// Previous batch's pre state root pub fn pre_state_root(&self) -> Vec { @@ -71,7 +71,7 @@ pub struct SignedSoftConfirmationBatch { hash: [u8; 32], da_slot_height: u64, da_slot_hash: [u8; 32], - da_slot_merkle_root: [u8; 32], + da_slot_txs_commitment: [u8; 32], pre_state_root: Vec, l1_fee_rate: u64, txs: Vec>, @@ -86,7 +86,7 @@ impl SignedSoftConfirmationBatch { hash: [u8; 32], da_slot_height: u64, da_slot_hash: [u8; 32], - da_slot_merkle_root: [u8; 32], + da_slot_txs_commitment: [u8; 32], pre_state_root: Vec, l1_fee_rate: u64, txs: Vec>, @@ -97,7 +97,7 @@ impl SignedSoftConfirmationBatch { hash, da_slot_height, da_slot_hash, - da_slot_merkle_root, + da_slot_txs_commitment, pre_state_root, l1_fee_rate, txs, @@ -121,9 +121,9 @@ impl SignedSoftConfirmationBatch { self.da_slot_hash } - /// DA block merkle root - pub fn da_slot_merkle_root(&self) -> [u8; 32] { - self.da_slot_merkle_root + /// DA block transactions commitment + pub fn da_slot_txs_commitment(&self) -> [u8; 32] { + self.da_slot_txs_commitment } /// Previous batch's pre state root diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/stf.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/stf.rs index c5b6371b5..f85657d19 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/stf.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/stf.rs @@ -83,8 +83,8 @@ pub struct SoftBatchReceipt pub da_slot_height: u64, /// DA layer block hash pub da_slot_hash: ::SlotHash, - /// DA layer merkle root - pub da_slot_merkle_root: ::SlotHash, + /// DA layer transactions commitment + pub da_slot_txs_commitment: ::SlotHash, /// The canonical hash of this batch pub batch_hash: [u8; 32], /// The receipts of all the transactions in this batch. diff --git a/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs b/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs index 91d30bd9e..8f3d19767 100644 --- a/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs +++ b/crates/sovereign-sdk/utils/rng-da-service/src/lib.rs @@ -88,7 +88,7 @@ impl DaService for RngDaService { let block = MockBlock { header: MockBlockHeader { hash: barray.into(), - merkle_root: barray.into(), + txs_commitment: barray.into(), prev_hash: [0u8; 32].into(), height, time: Time::now(),