mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-06-11 11:39:34 +00:00
removed bedrock_parent_id as well
This commit is contained in:
parent
b6ca9b6bbb
commit
85284562b4
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -64,7 +64,6 @@ pub fn BlockPage() -> impl IntoView {
|
||||
transactions,
|
||||
},
|
||||
bedrock_status,
|
||||
bedrock_parent_id: _,
|
||||
} = blk;
|
||||
|
||||
let hash_str = hash.to_string();
|
||||
|
||||
@ -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]))
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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<Block> for FfiBlock {
|
||||
@ -21,7 +18,6 @@ impl From<Block> for FfiBlock {
|
||||
header,
|
||||
body,
|
||||
bedrock_status,
|
||||
bedrock_parent_id,
|
||||
} = value;
|
||||
|
||||
Self {
|
||||
@ -33,7 +29,6 @@ impl From<Block> for FfiBlock {
|
||||
.collect::<Vec<_>>()
|
||||
.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);
|
||||
};
|
||||
|
||||
@ -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<FfiU128> 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<HashType> for FfiHashType {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MantleMsgId> for FfiMsgId {
|
||||
fn from(value: MantleMsgId) -> Self {
|
||||
Self { data: value.0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Signature> for FfiSignature {
|
||||
fn from(value: Signature) -> Self {
|
||||
Self { data: value.0 }
|
||||
|
||||
@ -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<common::block::Block> 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<Block> 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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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]),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -96,7 +96,6 @@ impl<BP: BlockPublisherTrait> SequencerCore<BP> {
|
||||
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<BP: BlockPublisherTrait> SequencerCore<BP> {
|
||||
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<BP: BlockPublisherTrait> SequencerCore<BP> {
|
||||
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"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user