Skip to content

Commit e8b71ff

Browse files
authored
refactor: replace starknet-rs BlockId with types-rs BlockId (#384)
1 parent 9db5cef commit e8b71ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+239
-379
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Next release
44

5+
- refactor: replace starknet-rs BlockId with types-rs BlockId and remove redundant mp_block::BlockId
56
- feat(fgw): added `add_transaction` for gateway client
67
- fix(fgw): include `l1_to_l2_consumed_message` in L1 handler receipt
78
- build: up starknet-rs, starknet-types, blockifier(v0.8.0), cairo

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/client/block_import/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use anyhow::Context;
4242
use mc_db::{MadaraBackend, MadaraStorageError};
4343
use metrics::BlockMetrics;
4444
use mp_class::{class_hash::ComputeClassHashError, compile::ClassCompilationError};
45-
use starknet_core::types::Felt;
45+
use starknet_types_core::felt::Felt;
4646
use std::{borrow::Cow, sync::Arc};
4747

4848
mod metrics;

crates/client/block_import/src/pre_validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use mp_transactions::Transaction;
1111
use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator};
1212
use rayon::prelude::*;
1313
use starknet_api::core::ChainId;
14-
use starknet_core::types::Felt;
14+
use starknet_types_core::felt::Felt;
1515
use starknet_types_core::hash::{Pedersen, Poseidon, StarkHash};
1616
use std::mem;
1717
use std::sync::Arc;

crates/client/block_import/src/tests/block_import_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use mp_block::header::{GasPrices, L1DataAvailabilityMode};
22
use mp_block::Header;
33
use mp_chain_config::StarknetVersion;
44
use mp_state_update::StateDiff;
5-
use starknet_core::types::Felt;
5+
use starknet_types_core::felt::Felt;
66

77
use crate::{
88
BlockValidationContext, PreValidatedBlock, PreValidatedPendingBlock, UnverifiedCommitments, UnverifiedFullBlock,

crates/client/block_import/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use mp_state_update::StateDiff;
1515
use mp_transactions::Transaction;
1616
use serde::{Deserialize, Serialize};
1717
use starknet_api::core::ChainId;
18-
use starknet_core::types::Felt;
18+
use starknet_types_core::felt::Felt;
1919

2020
#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)]
2121
pub struct UnverifiedHeader {

crates/client/block_import/src/verify_apply.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ use crate::{
44
};
55
use itertools::Itertools;
66
use mc_db::{MadaraBackend, MadaraStorageError};
7+
use mp_block::BlockTag;
78
use mp_block::{
8-
header::PendingHeader, BlockId, BlockTag, Header, MadaraBlockInfo, MadaraBlockInner, MadaraMaybePendingBlock,
9+
header::PendingHeader, BlockId, Header, MadaraBlockInfo, MadaraBlockInner, MadaraMaybePendingBlock,
910
MadaraMaybePendingBlockInfo, MadaraPendingBlockInfo,
1011
};
1112
use mp_convert::{FeltHexDisplay, ToFelt};
1213
use starknet_api::core::ChainId;
13-
use starknet_core::types::Felt;
14+
use starknet_types_core::felt::Felt;
1415
use starknet_types_core::hash::{Poseidon, StarkHash};
1516
use std::{borrow::Cow, sync::Arc};
1617

crates/client/db/src/contract_db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::sync::Arc;
55
use rayon::{iter::ParallelIterator, slice::ParallelSlice};
66
use rocksdb::{BoundColumnFamily, IteratorMode, ReadOptions, WriteOptions};
77
use serde::Serialize;
8-
use starknet_core::types::Felt;
8+
use starknet_types_core::felt::Felt;
99

1010
use crate::{
1111
db_block_id::{DbBlockId, DbBlockIdResolvable},

crates/client/db/src/db_block_id.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ impl DbBlockIdResolvable for BlockId {
2626
}
2727
}
2828

29-
impl DbBlockIdResolvable for starknet_core::types::BlockId {
30-
fn resolve_db_block_id(&self, backend: &MadaraBackend) -> Result<Option<DbBlockId>, MadaraStorageError> {
31-
backend.id_to_storage_type(&(*self).into())
32-
}
33-
}
34-
3529
impl DbBlockIdResolvable for DbBlockId {
3630
fn resolve_db_block_id(&self, _backend: &MadaraBackend) -> Result<Option<DbBlockId>, MadaraStorageError> {
3731
Ok(Some(*self))

crates/client/db/src/devnet_db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::DatabaseExt;
22
use crate::{Column, MadaraBackend, MadaraStorageError};
33
use rocksdb::WriteOptions;
44
use serde::{Deserialize, Serialize};
5-
use starknet_core::types::Felt;
5+
use starknet_types_core::felt::Felt;
66

77
pub const DEVNET_KEYS: &[u8] = b"DEVNET_KEYS";
88

0 commit comments

Comments
 (0)