Skip to content

Commit

Permalink
chore(blockifier): add transaction_serde serialize and deserialize to…
Browse files Browse the repository at this point in the history
… several objects
  • Loading branch information
aner-starkware committed Oct 29, 2024
1 parent 179878c commit e86f242
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions crates/blockifier/src/blockifier/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::versioned_constants::VersionedConstants;
#[path = "block_test.rs"]
pub mod block_test;

#[cfg_attr(feature = "transaction_serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug)]
pub struct BlockInfo {
pub block_number: BlockNumber,
Expand All @@ -33,6 +34,7 @@ pub struct BlockInfo {
pub use_kzg_da: bool,
}

#[cfg_attr(feature = "transaction_serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug)]
pub struct GasPrices {
eth_gas_prices: GasPriceVector, // In wei.
Expand Down
1 change: 1 addition & 0 deletions crates/blockifier/src/state/cached_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ impl<'a, U: UpdatableState> TransactionalState<'a, U> {
type StorageDiff = IndexMap<ContractAddress, IndexMap<StorageKey, Felt>>;

/// Holds uncommitted changes induced on Starknet contracts.
#[cfg_attr(feature = "transaction_serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(any(feature = "testing", test), derive(Clone))]
#[derive(Debug, Default, Eq, PartialEq)]
pub struct CommitmentStateDiff {
Expand Down
4 changes: 2 additions & 2 deletions crates/starknet_api/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ impl GasPrice {

/// Utility struct representing a non-zero gas price. Useful when a gas amount must be computed by
/// taking a fee amount and dividing by the gas price.
#[derive(Copy, Clone, Debug, derive_more::Display)]
#[derive(Copy, Clone, Debug, Deserialize, Serialize, derive_more::Display)]
pub struct NonzeroGasPrice(GasPrice);

impl NonzeroGasPrice {
Expand Down Expand Up @@ -433,7 +433,7 @@ macro_rules! impl_try_from_uint_for_nonzero_gas_price {

impl_try_from_uint_for_nonzero_gas_price!(u8, u16, u32, u64, u128);

#[derive(Clone, Debug)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GasPriceVector {
pub l1_gas_price: NonzeroGasPrice,
pub l1_data_gas_price: NonzeroGasPrice,
Expand Down

0 comments on commit e86f242

Please sign in to comment.