Skip to content

Commit a942277

Browse files
starknet_api: add fee_proposal_fri to BlockHeaderWithoutHash
1 parent ae5066a commit a942277

8 files changed

Lines changed: 15 additions & 0 deletions

File tree

crates/apollo_p2p_sync/src/client/test.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ fn create_random_sync_block(
345345
sequencer,
346346
l1_da_mode,
347347
starknet_version,
348+
fee_proposal_fri,
348349
} = BlockHeaderWithoutHash::get_test_instance(&mut rng);
349350
let block_header_without_hash = BlockHeaderWithoutHash {
350351
block_number,
@@ -359,6 +360,7 @@ fn create_random_sync_block(
359360
sequencer,
360361
l1_da_mode,
361362
starknet_version,
363+
fee_proposal_fri,
362364
};
363365
let block_header_commitments = BlockHeaderCommitments::get_test_instance(&mut rng);
364366
SyncBlock {

crates/apollo_protobuf/src/converters/header.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use starknet_api::block::{
99
BlockHeaderWithoutHash,
1010
BlockNumber,
1111
BlockSignature,
12+
GasPrice,
1213
GasPricePerToken,
1314
StarknetVersion,
1415
};
@@ -205,6 +206,7 @@ impl TryFrom<protobuf::SignedBlockHeader> for SignedBlockHeader {
205206
timestamp,
206207
l1_da_mode,
207208
starknet_version,
209+
fee_proposal_fri: GasPrice::default(),
208210
},
209211
state_diff_commitment,
210212
state_diff_length,

crates/apollo_starknet_client/src/reader/objects/block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ impl Block {
342342
l1_data_gas_price: self.l1_data_gas_price(),
343343
l1_da_mode: self.l1_da_mode(),
344344
starknet_version: self.starknet_version(),
345+
fee_proposal_fri: GasPrice::default(),
345346
},
346347
state_diff_commitment: self.state_diff_commitment(),
347348
transaction_commitment,

crates/apollo_storage/src/header.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ pub struct StorageBlockHeader {
109109
pub n_transactions: usize,
110110
/// The number of events in this block.
111111
pub n_events: usize,
112+
/// SNIP-35: proposer's oracle-derived recommended fee.
113+
pub fee_proposal_fri: GasPrice,
112114
}
113115

114116
type BlockHashToNumberTable<'env> =
@@ -225,6 +227,7 @@ impl<Mode: TransactionKind> HeaderStorageReader for StorageTxn<'_, Mode> {
225227
timestamp: block_header.timestamp,
226228
l1_da_mode: block_header.l1_da_mode,
227229
starknet_version,
230+
fee_proposal_fri: block_header.fee_proposal_fri,
228231
},
229232
state_diff_commitment: block_header.state_diff_commitment,
230233
transaction_commitment: block_header.transaction_commitment,
@@ -322,6 +325,7 @@ impl HeaderStorageWriter for StorageTxn<'_, RW> {
322325
state_diff_length: block_header.state_diff_length,
323326
n_transactions: block_header.n_transactions,
324327
n_events: block_header.n_events,
328+
fee_proposal_fri: block_header.block_header_without_hash.fee_proposal_fri,
325329
};
326330

327331
headers_table.append(&self.txn, &block_number, &storage_block_header)?;
@@ -429,6 +433,7 @@ impl HeaderStorageWriter for StorageTxn<'_, RW> {
429433
timestamp: reverted_header.timestamp,
430434
l1_da_mode: reverted_header.l1_da_mode,
431435
starknet_version,
436+
fee_proposal_fri: reverted_header.fee_proposal_fri,
432437
},
433438
state_diff_commitment: reverted_header.state_diff_commitment,
434439
transaction_commitment: reverted_header.transaction_commitment,

crates/apollo_storage/src/serialization/serializers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ auto_storage_serde! {
183183
pub state_diff_length: Option<usize>,
184184
pub n_transactions: usize,
185185
pub n_events: usize,
186+
pub fee_proposal_fri: GasPrice,
186187
}
187188
pub struct BlockHeaderCommitments {
188189
pub transaction_commitment: TransactionCommitment,

crates/apollo_storage/src/test_instances.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ auto_impl_get_test_instance! {
4646
pub state_diff_length: Option<usize>,
4747
pub n_transactions: usize,
4848
pub n_events: usize,
49+
pub fee_proposal_fri: GasPrice,
4950
}
5051

5152
struct EventIndex(pub TransactionIndex, pub EventIndexInTransactionOutput);

crates/apollo_test_utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ auto_impl_get_test_instance! {
450450
pub timestamp: BlockTimestamp,
451451
pub l1_da_mode: L1DataAvailabilityMode,
452452
pub starknet_version: StarknetVersion,
453+
pub fee_proposal_fri: GasPrice,
453454
}
454455
pub struct BlockHeaderCommitments {
455456
pub transaction_commitment: TransactionCommitment,

crates/starknet_api/src/block.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ pub struct BlockHeaderWithoutHash {
241241
pub timestamp: BlockTimestamp,
242242
pub l1_da_mode: L1DataAvailabilityMode,
243243
pub starknet_version: StarknetVersion,
244+
/// SNIP-35: proposer's oracle-derived recommended fee.
245+
pub fee_proposal_fri: GasPrice,
244246
}
245247

246248
/// The [transactions](`crate::transaction::Transaction`) and their

0 commit comments

Comments
 (0)