Skip to content

Commit 3f7c331

Browse files
starknet_api: add fee_proposal to PartialBlockHashComponents
1 parent ed1364d commit 3f7c331

7 files changed

Lines changed: 19 additions & 1 deletion

File tree

crates/apollo_batcher/src/batcher.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ impl Batcher {
831831
sequencer: block_header_without_hash.sequencer,
832832
timestamp: block_header_without_hash.timestamp,
833833
starknet_version: block_header_without_hash.starknet_version,
834+
fee_proposal: block_header_without_hash.fee_proposal,
834835
})
835836
}
836837
None => return Err(BatcherError::MissingHeaderCommitments { block_number }),

crates/apollo_storage/src/serialization/serializers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ auto_storage_serde! {
381381
pub sequencer: SequencerContractAddress,
382382
pub timestamp: BlockTimestamp,
383383
pub starknet_version: StarknetVersion,
384+
pub fee_proposal: GasPrice,
384385
}
385386
pub struct PaymasterData(pub Vec<Felt>);
386387
pub struct PoseidonHash(pub Felt);

crates/apollo_test_utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ auto_impl_get_test_instance! {
748748
pub sequencer: SequencerContractAddress,
749749
pub timestamp: BlockTimestamp,
750750
pub starknet_version: StarknetVersion,
751+
pub fee_proposal: GasPrice,
751752
}
752753
pub struct PaymasterData(pub Vec<Felt>);
753754
pub struct PoseidonHash(pub Felt);

crates/starknet_api/src/block_hash/block_hash_calculator.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use crate::block::{
1616
BlockInfo,
1717
BlockNumber,
1818
BlockTimestamp,
19+
GasPrice,
1920
GasPricePerToken,
2021
StarknetVersion,
2122
};
@@ -218,6 +219,8 @@ pub struct PartialBlockHashComponents {
218219
pub sequencer: SequencerContractAddress,
219220
pub timestamp: BlockTimestamp,
220221
pub starknet_version: StarknetVersion,
222+
/// SNIP-35: proposer's oracle-derived recommended fee.
223+
pub fee_proposal: GasPrice,
221224
}
222225

223226
impl PartialBlockHashComponents {
@@ -231,6 +234,7 @@ impl PartialBlockHashComponents {
231234
sequencer: SequencerContractAddress(block_info.sequencer_address),
232235
timestamp: block_info.block_timestamp,
233236
starknet_version: block_info.starknet_version,
237+
fee_proposal: GasPrice::default(),
234238
}
235239
}
236240
}

crates/starknet_api/src/block_hash/block_hash_calculator_test.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ use rstest::rstest;
22
use starknet_types_core::felt::Felt;
33

44
use super::{concat_counts, extract_event_count_from_concatenated_counts};
5-
use crate::block::{BlockHash, BlockNumber, BlockTimestamp, GasPricePerToken, StarknetVersion};
5+
use crate::block::{
6+
BlockHash,
7+
BlockNumber,
8+
BlockTimestamp,
9+
GasPrice,
10+
GasPricePerToken,
11+
StarknetVersion,
12+
};
613
use crate::block_hash::block_hash_calculator::{
714
calculate_block_commitments,
815
calculate_block_hash,
@@ -43,6 +50,7 @@ macro_rules! test_hash_changes {
4350
$(
4451
$partial_block_hash_components_field: $partial_block_hash_components_value,
4552
)*
53+
..Default::default()
4654
};
4755
let state_root = $state_root;
4856
let previous_block_hash = $previous_block_hash;
@@ -101,6 +109,7 @@ async fn test_block_hash_regression(
101109
l2_gas_price: GasPricePerToken { price_in_fri: 11_u8.into(), price_in_wei: 12_u8.into() },
102110
starknet_version: block_hash_version.clone().into(),
103111
header_commitments: block_commitments,
112+
fee_proposal: GasPrice::default(),
104113
};
105114

106115
let expected_hash = match block_hash_version {

crates/starknet_committer_and_os_cli/src/committer_cli/block_hash.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ impl BlockHashInput {
3737
l2_gas_price: self.header.l2_gas_price,
3838
sequencer: self.header.sequencer,
3939
timestamp: self.header.timestamp,
40+
fee_proposal: self.header.fee_proposal,
4041
},
4142
self.header.state_root,
4243
self.header.parent_hash,

crates/starknet_os/src/hints/hint_implementation/block_hash/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ fn test_block_hash_cairo() {
136136
},
137137
l2_gas_price: GasPricePerToken { price_in_wei: GasPrice(14), price_in_fri: GasPrice(15) },
138138
starknet_version: StarknetVersion::LATEST,
139+
fee_proposal: GasPrice::default(),
139140
};
140141
let state_root = Felt::from(16);
141142
let previous_block_hash = Felt::from(17);

0 commit comments

Comments
 (0)