diff --git a/lez/common/src/block.rs b/lez/common/src/block.rs index ed840723..6e956f9f 100644 --- a/lez/common/src/block.rs +++ b/lez/common/src/block.rs @@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize}; use sha2::{Digest as _, Sha256, digest::FixedOutput as _}; use crate::{HashType, transaction::LeeTransaction}; -pub type MantleMsgId = [u8; 32]; pub type BlockHash = HashType; #[derive(Debug, Clone, BorshSerialize, BorshDeserialize)] @@ -54,7 +53,6 @@ pub struct Block { pub header: BlockHeader, pub body: BlockBody, pub bedrock_status: BedrockStatus, - pub bedrock_parent_id: MantleMsgId, } impl Serialize for Block { @@ -79,11 +77,7 @@ pub struct HashableBlockData { impl HashableBlockData { #[must_use] - pub fn into_pending_block( - self, - signing_key: &lee::PrivateKey, - bedrock_parent_id: MantleMsgId, - ) -> Block { + pub fn into_pending_block(self, signing_key: &lee::PrivateKey) -> Block { const PREFIX: &[u8; 32] = b"/LEE/v0.3/Message/Block/\x00\x00\x00\x00\x00\x00\x00\x00"; let data_bytes = borsh::to_vec(&self).unwrap(); @@ -110,7 +104,6 @@ impl HashableBlockData { transactions: self.transactions, }, bedrock_status: BedrockStatus::Pending, - bedrock_parent_id, } } } diff --git a/lez/common/src/test_utils.rs b/lez/common/src/test_utils.rs index f4e185ea..179e9601 100644 --- a/lez/common/src/test_utils.rs +++ b/lez/common/src/test_utils.rs @@ -39,7 +39,7 @@ pub fn produce_dummy_block( transactions, }; - block_data.into_pending_block(&sequencer_sign_key_for_testing(), [0; 32]) + block_data.into_pending_block(&sequencer_sign_key_for_testing()) } #[must_use] diff --git a/lez/explorer_service/src/components/block_preview.rs b/lez/explorer_service/src/components/block_preview.rs index 8fe48f9f..0d3b9e14 100644 --- a/lez/explorer_service/src/components/block_preview.rs +++ b/lez/explorer_service/src/components/block_preview.rs @@ -27,7 +27,6 @@ pub fn BlockPreview(block: Block) -> impl IntoView { }, body: BlockBody { transactions }, bedrock_status, - bedrock_parent_id: _, } = block; let tx_count = transactions.len(); diff --git a/lez/explorer_service/src/pages/block_page.rs b/lez/explorer_service/src/pages/block_page.rs index 8f54fe18..5df3b4dc 100644 --- a/lez/explorer_service/src/pages/block_page.rs +++ b/lez/explorer_service/src/pages/block_page.rs @@ -64,7 +64,6 @@ pub fn BlockPage() -> impl IntoView { transactions, }, bedrock_status, - bedrock_parent_id: _, } = blk; let hash_str = hash.to_string(); diff --git a/lez/indexer/core/src/block_store.rs b/lez/indexer/core/src/block_store.rs index d293637c..878afbe4 100644 --- a/lez/indexer/core/src/block_store.rs +++ b/lez/indexer/core/src/block_store.rs @@ -238,10 +238,8 @@ mod tests { timestamp: 0, transactions: vec![clock_tx], }; - let genesis_block = genesis_block_data.into_pending_block( - &common::test_utils::sequencer_sign_key_for_testing(), - [0; 32], - ); + let genesis_block = genesis_block_data + .into_pending_block(&common::test_utils::sequencer_sign_key_for_testing()); let mut prev_hash = Some(genesis_block.header.hash); storage .put_block(genesis_block, HeaderId::from([0_u8; 32])) diff --git a/lez/indexer/ffi/indexer_ffi.h b/lez/indexer/ffi/indexer_ffi.h index 1562eb15..84aaeae7 100644 --- a/lez/indexer/ffi/indexer_ffi.h +++ b/lez/indexer/ffi/indexer_ffi.h @@ -320,13 +320,10 @@ typedef struct FfiVec_FfiTransaction { typedef struct FfiVec_FfiTransaction FfiBlockBody; -typedef struct FfiBytes32 FfiMsgId; - typedef struct FfiBlock { struct FfiBlockHeader header; FfiBlockBody body; enum FfiBedrockStatus bedrock_status; - FfiMsgId bedrock_parent_id; } FfiBlock; typedef struct FfiOption_FfiBlock { diff --git a/lez/indexer/ffi/src/api/types/block.rs b/lez/indexer/ffi/src/api/types/block.rs index bca2fdb5..e7ae0760 100644 --- a/lez/indexer/ffi/src/api/types/block.rs +++ b/lez/indexer/ffi/src/api/types/block.rs @@ -1,9 +1,7 @@ -use indexer_service_protocol::{ - BedrockStatus, Block, BlockHeader, HashType, MantleMsgId, Signature, -}; +use indexer_service_protocol::{BedrockStatus, Block, BlockHeader, HashType, Signature}; use crate::api::types::{ - FfiBlockId, FfiHashType, FfiMsgId, FfiOption, FfiSignature, FfiTimestamp, FfiVec, + FfiBlockId, FfiHashType, FfiOption, FfiSignature, FfiTimestamp, FfiVec, transaction::free_ffi_transaction_vec, vectors::FfiBlockBody, }; @@ -12,7 +10,6 @@ pub struct FfiBlock { pub header: FfiBlockHeader, pub body: FfiBlockBody, pub bedrock_status: FfiBedrockStatus, - pub bedrock_parent_id: FfiMsgId, } impl From for FfiBlock { @@ -21,7 +18,6 @@ impl From for FfiBlock { header, body, bedrock_status, - bedrock_parent_id, } = value; Self { @@ -33,7 +29,6 @@ impl From for FfiBlock { .collect::>() .into(), bedrock_status: bedrock_status.into(), - bedrock_parent_id: bedrock_parent_id.into(), } } } @@ -126,8 +121,6 @@ pub unsafe extern "C" fn free_ffi_block(val: FfiBlock) { #[expect(clippy::let_underscore_must_use, reason = "No use for this Copy type")] let _: BedrockStatus = val.bedrock_status.into(); - let _ = MantleMsgId(val.bedrock_parent_id.data); - unsafe { free_ffi_transaction_vec(ffi_tx_ffi_vec); }; @@ -166,8 +159,6 @@ pub unsafe extern "C" fn free_ffi_block_opt(val: FfiBlockOpt) { #[expect(clippy::let_underscore_must_use, reason = "No use for this Copy type")] let _: BedrockStatus = value.bedrock_status.into(); - let _ = MantleMsgId(value.bedrock_parent_id.data); - unsafe { free_ffi_transaction_vec(ffi_tx_ffi_vec); }; diff --git a/lez/indexer/ffi/src/api/types/mod.rs b/lez/indexer/ffi/src/api/types/mod.rs index b42b014c..0b3574e6 100644 --- a/lez/indexer/ffi/src/api/types/mod.rs +++ b/lez/indexer/ffi/src/api/types/mod.rs @@ -1,4 +1,4 @@ -use indexer_service_protocol::{AccountId, HashType, MantleMsgId, ProgramId, PublicKey, Signature}; +use indexer_service_protocol::{AccountId, HashType, ProgramId, PublicKey, Signature}; pub mod account; pub mod block; @@ -68,7 +68,6 @@ impl From for u128 { } pub type FfiHashType = FfiBytes32; -pub type FfiMsgId = FfiBytes32; pub type FfiBlockId = u64; pub type FfiTimestamp = u64; pub type FfiSignature = FfiBytes64; @@ -82,12 +81,6 @@ impl From for FfiHashType { } } -impl From for FfiMsgId { - fn from(value: MantleMsgId) -> Self { - Self { data: value.0 } - } -} - impl From for FfiSignature { fn from(value: Signature) -> Self { Self { data: value.0 } diff --git a/lez/indexer/service/protocol/src/convert.rs b/lez/indexer/service/protocol/src/convert.rs index cec8b7bb..cd0bff7e 100644 --- a/lez/indexer/service/protocol/src/convert.rs +++ b/lez/indexer/service/protocol/src/convert.rs @@ -4,8 +4,8 @@ use lee_core::account::Nonce; use crate::{ Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, Ciphertext, Commitment, - CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, MantleMsgId, - Nullifier, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, + CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, Nullifier, + PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction, ProgramId, Proof, PublicKey, PublicMessage, PublicTransaction, Signature, Transaction, ValidityWindow, WitnessSet, }; @@ -630,14 +630,12 @@ impl From for Block { header, body, bedrock_status, - bedrock_parent_id, } = value; Self { header: header.into(), body: body.into(), bedrock_status: bedrock_status.into(), - bedrock_parent_id: MantleMsgId(bedrock_parent_id), } } } @@ -650,14 +648,12 @@ impl TryFrom for common::block::Block { header, body, bedrock_status, - bedrock_parent_id, } = value; Ok(Self { header: header.try_into()?, body: body.try_into()?, bedrock_status: bedrock_status.into(), - bedrock_parent_id: bedrock_parent_id.0, }) } } diff --git a/lez/indexer/service/protocol/src/lib.rs b/lez/indexer/service/protocol/src/lib.rs index 0d94167d..a670dee6 100644 --- a/lez/indexer/service/protocol/src/lib.rs +++ b/lez/indexer/service/protocol/src/lib.rs @@ -145,7 +145,6 @@ pub struct Block { pub header: BlockHeader, pub body: BlockBody, pub bedrock_status: BedrockStatus, - pub bedrock_parent_id: MantleMsgId, } #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] @@ -358,13 +357,6 @@ impl FromStr for HashType { } } -#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] -pub struct MantleMsgId( - #[serde(with = "base64::arr")] - #[schemars(with = "String", description = "base64-encoded Bedrock message id")] - pub [u8; 32], -); - #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub enum BedrockStatus { Pending, diff --git a/lez/indexer/service/src/mock_service.rs b/lez/indexer/service/src/mock_service.rs index a83e9ccc..d9ab9484 100644 --- a/lez/indexer/service/src/mock_service.rs +++ b/lez/indexer/service/src/mock_service.rs @@ -10,10 +10,10 @@ use std::{collections::HashMap, sync::Arc, time::Duration}; use indexer_service_protocol::{ Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, BlockId, Commitment, - CommitmentSetDigest, Data, EncryptedAccountData, HashType, MantleMsgId, - PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, - ProgramDeploymentTransaction, ProgramId, PublicMessage, PublicTransaction, Signature, - Transaction, ValidityWindow, WitnessSet, + CommitmentSetDigest, Data, EncryptedAccountData, HashType, PrivacyPreservingMessage, + PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction, + ProgramId, PublicMessage, PublicTransaction, Signature, Transaction, ValidityWindow, + WitnessSet, }; use jsonrpsee::{ core::{SubscriptionResult, async_trait}, @@ -432,7 +432,6 @@ fn build_mock_block( transactions: block_transactions, }, bedrock_status, - bedrock_parent_id: MantleMsgId([0; 32]), } } diff --git a/lez/sequencer/core/src/block_store.rs b/lez/sequencer/core/src/block_store.rs index e9e216c1..8a2e9265 100644 --- a/lez/sequencer/core/src/block_store.rs +++ b/lez/sequencer/core/src/block_store.rs @@ -209,7 +209,7 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); // Start an empty node store let mut node_store = SequencerStore::create_db_with_genesis( path, @@ -247,7 +247,7 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); let genesis_hash = genesis_block.header.hash; let node_store = SequencerStore::create_db_with_genesis( @@ -277,7 +277,7 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); let mut node_store = SequencerStore::create_db_with_genesis( path, &genesis_block, @@ -313,7 +313,7 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); let mut node_store = SequencerStore::create_db_with_genesis( path, &genesis_block, @@ -362,7 +362,7 @@ mod tests { transactions: vec![], }; - let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_block_hashable_data.into_pending_block(&signing_key); let tx = common::test_utils::produce_dummy_empty_transaction(); { // Create a scope to drop the first store after creating the db diff --git a/lez/sequencer/core/src/lib.rs b/lez/sequencer/core/src/lib.rs index 8c376494..2a8af528 100644 --- a/lez/sequencer/core/src/lib.rs +++ b/lez/sequencer/core/src/lib.rs @@ -96,7 +96,6 @@ impl SequencerCore { db_path.display() ); - let genesis_parent_msg_id = [0; 32]; let (genesis_state, genesis_txs) = build_genesis_state(&config); let hashable_data = HashableBlockData { @@ -105,8 +104,7 @@ impl SequencerCore { prev_block_hash: HashType([0; 32]), timestamp: 0, }; - let genesis_block = - hashable_data.into_pending_block(&signing_key, genesis_parent_msg_id); + let genesis_block = hashable_data.into_pending_block(&signing_key); let store = SequencerStore::create_db_with_genesis( &db_path, @@ -414,12 +412,9 @@ impl SequencerCore { timestamp: new_block_timestamp, }; - // TODO: Remove bedrock_parent_id from Block — it is no longer needed now - // that zone-sdk manages the inscription parent chain internally. - let placeholder_parent_id = [0_u8; 32]; let block = hashable_data .clone() - .into_pending_block(self.store.signing_key(), placeholder_parent_id); + .into_pending_block(self.store.signing_key()); self.chain_height = new_block_height; @@ -831,7 +826,7 @@ mod tests { prev_block_hash: HashType([0; 32]), timestamp: 0, }; - let genesis_block = genesis_hashable_data.into_pending_block(&signing_key, [0; 32]); + let genesis_block = genesis_hashable_data.into_pending_block(&signing_key); SequencerStore::create_db_with_genesis( &config.home.join("rocksdb"),