removed bedrock_parent_id as well

This commit is contained in:
erhant 2026-06-10 11:08:14 +03:00
parent b6ca9b6bbb
commit 85284562b4
13 changed files with 21 additions and 69 deletions

View File

@ -5,7 +5,6 @@ use serde::{Deserialize, Serialize};
use sha2::{Digest as _, Sha256, digest::FixedOutput as _}; use sha2::{Digest as _, Sha256, digest::FixedOutput as _};
use crate::{HashType, transaction::LeeTransaction}; use crate::{HashType, transaction::LeeTransaction};
pub type MantleMsgId = [u8; 32];
pub type BlockHash = HashType; pub type BlockHash = HashType;
#[derive(Debug, Clone, BorshSerialize, BorshDeserialize)] #[derive(Debug, Clone, BorshSerialize, BorshDeserialize)]
@ -54,7 +53,6 @@ pub struct Block {
pub header: BlockHeader, pub header: BlockHeader,
pub body: BlockBody, pub body: BlockBody,
pub bedrock_status: BedrockStatus, pub bedrock_status: BedrockStatus,
pub bedrock_parent_id: MantleMsgId,
} }
impl Serialize for Block { impl Serialize for Block {
@ -79,11 +77,7 @@ pub struct HashableBlockData {
impl HashableBlockData { impl HashableBlockData {
#[must_use] #[must_use]
pub fn into_pending_block( pub fn into_pending_block(self, signing_key: &lee::PrivateKey) -> Block {
self,
signing_key: &lee::PrivateKey,
bedrock_parent_id: MantleMsgId,
) -> Block {
const PREFIX: &[u8; 32] = b"/LEE/v0.3/Message/Block/\x00\x00\x00\x00\x00\x00\x00\x00"; 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(); let data_bytes = borsh::to_vec(&self).unwrap();
@ -110,7 +104,6 @@ impl HashableBlockData {
transactions: self.transactions, transactions: self.transactions,
}, },
bedrock_status: BedrockStatus::Pending, bedrock_status: BedrockStatus::Pending,
bedrock_parent_id,
} }
} }
} }

View File

@ -39,7 +39,7 @@ pub fn produce_dummy_block(
transactions, 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] #[must_use]

View File

@ -27,7 +27,6 @@ pub fn BlockPreview(block: Block) -> impl IntoView {
}, },
body: BlockBody { transactions }, body: BlockBody { transactions },
bedrock_status, bedrock_status,
bedrock_parent_id: _,
} = block; } = block;
let tx_count = transactions.len(); let tx_count = transactions.len();

View File

@ -64,7 +64,6 @@ pub fn BlockPage() -> impl IntoView {
transactions, transactions,
}, },
bedrock_status, bedrock_status,
bedrock_parent_id: _,
} = blk; } = blk;
let hash_str = hash.to_string(); let hash_str = hash.to_string();

View File

@ -238,10 +238,8 @@ mod tests {
timestamp: 0, timestamp: 0,
transactions: vec![clock_tx], transactions: vec![clock_tx],
}; };
let genesis_block = genesis_block_data.into_pending_block( let genesis_block = genesis_block_data
&common::test_utils::sequencer_sign_key_for_testing(), .into_pending_block(&common::test_utils::sequencer_sign_key_for_testing());
[0; 32],
);
let mut prev_hash = Some(genesis_block.header.hash); let mut prev_hash = Some(genesis_block.header.hash);
storage storage
.put_block(genesis_block, HeaderId::from([0_u8; 32])) .put_block(genesis_block, HeaderId::from([0_u8; 32]))

View File

@ -320,13 +320,10 @@ typedef struct FfiVec_FfiTransaction {
typedef struct FfiVec_FfiTransaction FfiBlockBody; typedef struct FfiVec_FfiTransaction FfiBlockBody;
typedef struct FfiBytes32 FfiMsgId;
typedef struct FfiBlock { typedef struct FfiBlock {
struct FfiBlockHeader header; struct FfiBlockHeader header;
FfiBlockBody body; FfiBlockBody body;
enum FfiBedrockStatus bedrock_status; enum FfiBedrockStatus bedrock_status;
FfiMsgId bedrock_parent_id;
} FfiBlock; } FfiBlock;
typedef struct FfiOption_FfiBlock { typedef struct FfiOption_FfiBlock {

View File

@ -1,9 +1,7 @@
use indexer_service_protocol::{ use indexer_service_protocol::{BedrockStatus, Block, BlockHeader, HashType, Signature};
BedrockStatus, Block, BlockHeader, HashType, MantleMsgId, Signature,
};
use crate::api::types::{ use crate::api::types::{
FfiBlockId, FfiHashType, FfiMsgId, FfiOption, FfiSignature, FfiTimestamp, FfiVec, FfiBlockId, FfiHashType, FfiOption, FfiSignature, FfiTimestamp, FfiVec,
transaction::free_ffi_transaction_vec, vectors::FfiBlockBody, transaction::free_ffi_transaction_vec, vectors::FfiBlockBody,
}; };
@ -12,7 +10,6 @@ pub struct FfiBlock {
pub header: FfiBlockHeader, pub header: FfiBlockHeader,
pub body: FfiBlockBody, pub body: FfiBlockBody,
pub bedrock_status: FfiBedrockStatus, pub bedrock_status: FfiBedrockStatus,
pub bedrock_parent_id: FfiMsgId,
} }
impl From<Block> for FfiBlock { impl From<Block> for FfiBlock {
@ -21,7 +18,6 @@ impl From<Block> for FfiBlock {
header, header,
body, body,
bedrock_status, bedrock_status,
bedrock_parent_id,
} = value; } = value;
Self { Self {
@ -33,7 +29,6 @@ impl From<Block> for FfiBlock {
.collect::<Vec<_>>() .collect::<Vec<_>>()
.into(), .into(),
bedrock_status: bedrock_status.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")] #[expect(clippy::let_underscore_must_use, reason = "No use for this Copy type")]
let _: BedrockStatus = val.bedrock_status.into(); let _: BedrockStatus = val.bedrock_status.into();
let _ = MantleMsgId(val.bedrock_parent_id.data);
unsafe { unsafe {
free_ffi_transaction_vec(ffi_tx_ffi_vec); 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")] #[expect(clippy::let_underscore_must_use, reason = "No use for this Copy type")]
let _: BedrockStatus = value.bedrock_status.into(); let _: BedrockStatus = value.bedrock_status.into();
let _ = MantleMsgId(value.bedrock_parent_id.data);
unsafe { unsafe {
free_ffi_transaction_vec(ffi_tx_ffi_vec); free_ffi_transaction_vec(ffi_tx_ffi_vec);
}; };

View File

@ -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 account;
pub mod block; pub mod block;
@ -68,7 +68,6 @@ impl From<FfiU128> for u128 {
} }
pub type FfiHashType = FfiBytes32; pub type FfiHashType = FfiBytes32;
pub type FfiMsgId = FfiBytes32;
pub type FfiBlockId = u64; pub type FfiBlockId = u64;
pub type FfiTimestamp = u64; pub type FfiTimestamp = u64;
pub type FfiSignature = FfiBytes64; pub type FfiSignature = FfiBytes64;
@ -82,12 +81,6 @@ impl From<HashType> for FfiHashType {
} }
} }
impl From<MantleMsgId> for FfiMsgId {
fn from(value: MantleMsgId) -> Self {
Self { data: value.0 }
}
}
impl From<Signature> for FfiSignature { impl From<Signature> for FfiSignature {
fn from(value: Signature) -> Self { fn from(value: Signature) -> Self {
Self { data: value.0 } Self { data: value.0 }

View File

@ -4,8 +4,8 @@ use lee_core::account::Nonce;
use crate::{ use crate::{
Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, Ciphertext, Commitment, Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, Ciphertext, Commitment,
CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, MantleMsgId, CommitmentSetDigest, Data, EncryptedAccountData, EphemeralPublicKey, HashType, Nullifier,
Nullifier, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage,
ProgramDeploymentTransaction, ProgramId, Proof, PublicKey, PublicMessage, PublicTransaction, ProgramDeploymentTransaction, ProgramId, Proof, PublicKey, PublicMessage, PublicTransaction,
Signature, Transaction, ValidityWindow, WitnessSet, Signature, Transaction, ValidityWindow, WitnessSet,
}; };
@ -630,14 +630,12 @@ impl From<common::block::Block> for Block {
header, header,
body, body,
bedrock_status, bedrock_status,
bedrock_parent_id,
} = value; } = value;
Self { Self {
header: header.into(), header: header.into(),
body: body.into(), body: body.into(),
bedrock_status: bedrock_status.into(), bedrock_status: bedrock_status.into(),
bedrock_parent_id: MantleMsgId(bedrock_parent_id),
} }
} }
} }
@ -650,14 +648,12 @@ impl TryFrom<Block> for common::block::Block {
header, header,
body, body,
bedrock_status, bedrock_status,
bedrock_parent_id,
} = value; } = value;
Ok(Self { Ok(Self {
header: header.try_into()?, header: header.try_into()?,
body: body.try_into()?, body: body.try_into()?,
bedrock_status: bedrock_status.into(), bedrock_status: bedrock_status.into(),
bedrock_parent_id: bedrock_parent_id.0,
}) })
} }
} }

View File

@ -145,7 +145,6 @@ pub struct Block {
pub header: BlockHeader, pub header: BlockHeader,
pub body: BlockBody, pub body: BlockBody,
pub bedrock_status: BedrockStatus, pub bedrock_status: BedrockStatus,
pub bedrock_parent_id: MantleMsgId,
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] #[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)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub enum BedrockStatus { pub enum BedrockStatus {
Pending, Pending,

View File

@ -10,10 +10,10 @@ use std::{collections::HashMap, sync::Arc, time::Duration};
use indexer_service_protocol::{ use indexer_service_protocol::{
Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, BlockId, Commitment, Account, AccountId, BedrockStatus, Block, BlockBody, BlockHeader, BlockId, Commitment,
CommitmentSetDigest, Data, EncryptedAccountData, HashType, MantleMsgId, CommitmentSetDigest, Data, EncryptedAccountData, HashType, PrivacyPreservingMessage,
PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction,
ProgramDeploymentTransaction, ProgramId, PublicMessage, PublicTransaction, Signature, ProgramId, PublicMessage, PublicTransaction, Signature, Transaction, ValidityWindow,
Transaction, ValidityWindow, WitnessSet, WitnessSet,
}; };
use jsonrpsee::{ use jsonrpsee::{
core::{SubscriptionResult, async_trait}, core::{SubscriptionResult, async_trait},
@ -432,7 +432,6 @@ fn build_mock_block(
transactions: block_transactions, transactions: block_transactions,
}, },
bedrock_status, bedrock_status,
bedrock_parent_id: MantleMsgId([0; 32]),
} }
} }

View File

@ -209,7 +209,7 @@ mod tests {
transactions: vec![], 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 // Start an empty node store
let mut node_store = SequencerStore::create_db_with_genesis( let mut node_store = SequencerStore::create_db_with_genesis(
path, path,
@ -247,7 +247,7 @@ mod tests {
transactions: vec![], 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 genesis_hash = genesis_block.header.hash;
let node_store = SequencerStore::create_db_with_genesis( let node_store = SequencerStore::create_db_with_genesis(
@ -277,7 +277,7 @@ mod tests {
transactions: vec![], 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( let mut node_store = SequencerStore::create_db_with_genesis(
path, path,
&genesis_block, &genesis_block,
@ -313,7 +313,7 @@ mod tests {
transactions: vec![], 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( let mut node_store = SequencerStore::create_db_with_genesis(
path, path,
&genesis_block, &genesis_block,
@ -362,7 +362,7 @@ mod tests {
transactions: vec![], 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(); let tx = common::test_utils::produce_dummy_empty_transaction();
{ {
// Create a scope to drop the first store after creating the db // Create a scope to drop the first store after creating the db

View File

@ -96,7 +96,6 @@ impl<BP: BlockPublisherTrait> SequencerCore<BP> {
db_path.display() db_path.display()
); );
let genesis_parent_msg_id = [0; 32];
let (genesis_state, genesis_txs) = build_genesis_state(&config); let (genesis_state, genesis_txs) = build_genesis_state(&config);
let hashable_data = HashableBlockData { let hashable_data = HashableBlockData {
@ -105,8 +104,7 @@ impl<BP: BlockPublisherTrait> SequencerCore<BP> {
prev_block_hash: HashType([0; 32]), prev_block_hash: HashType([0; 32]),
timestamp: 0, timestamp: 0,
}; };
let genesis_block = let genesis_block = hashable_data.into_pending_block(&signing_key);
hashable_data.into_pending_block(&signing_key, genesis_parent_msg_id);
let store = SequencerStore::create_db_with_genesis( let store = SequencerStore::create_db_with_genesis(
&db_path, &db_path,
@ -414,12 +412,9 @@ impl<BP: BlockPublisherTrait> SequencerCore<BP> {
timestamp: new_block_timestamp, 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 let block = hashable_data
.clone() .clone()
.into_pending_block(self.store.signing_key(), placeholder_parent_id); .into_pending_block(self.store.signing_key());
self.chain_height = new_block_height; self.chain_height = new_block_height;
@ -831,7 +826,7 @@ mod tests {
prev_block_hash: HashType([0; 32]), prev_block_hash: HashType([0; 32]),
timestamp: 0, 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( SequencerStore::create_db_with_genesis(
&config.home.join("rocksdb"), &config.home.join("rocksdb"),