Skip to content

Commit

Permalink
chore(starknet_batcher): set block timestamp in build block input
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware committed Dec 1, 2024
1 parent 37ca509 commit c65933e
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use starknet_api::block::{
BlockHashAndNumber,
BlockInfo,
BlockNumber,
BlockTimestamp,
GasPriceVector,
GasPrices,
NonzeroGasPrice,
Expand Down Expand Up @@ -144,10 +145,11 @@ impl ConsensusContext for SequencerConsensusContext {
self.proposal_id += 1;
let timeout =
chrono::Duration::from_std(timeout).expect("Can't convert timeout to chrono::Duration");
let now = chrono::Utc::now();
let build_proposal_input = ProposeBlockInput {
proposal_id,
// TODO: Discuss with batcher team passing std Duration instead.
deadline: chrono::Utc::now() + timeout,
deadline: now + timeout,
// TODO: This is not part of Milestone 1.
retrospective_block_hash: Some(BlockHashAndNumber {
number: BlockNumber::default(),
Expand All @@ -157,6 +159,9 @@ impl ConsensusContext for SequencerConsensusContext {
block_info: BlockInfo {
block_number: proposal_init.height,
gas_prices: TEMPORARY_GAS_PRICES,
block_timestamp: BlockTimestamp(
now.timestamp().try_into().expect("Failed to convert timestamp"),
),
..Default::default()
},
};
Expand Down Expand Up @@ -327,9 +332,10 @@ impl SequencerConsensusContext {

let chrono_timeout =
chrono::Duration::from_std(timeout).expect("Can't convert timeout to chrono::Duration");
let now = chrono::Utc::now();
let input = ValidateBlockInput {
proposal_id,
deadline: chrono::Utc::now() + chrono_timeout,
deadline: now + chrono_timeout,
// TODO(Matan 3/11/2024): Add the real value of the retrospective block hash.
retrospective_block_hash: Some(BlockHashAndNumber {
number: BlockNumber::default(),
Expand All @@ -339,6 +345,9 @@ impl SequencerConsensusContext {
block_info: BlockInfo {
block_number: height,
gas_prices: TEMPORARY_GAS_PRICES,
block_timestamp: BlockTimestamp(
now.timestamp().try_into().expect("Failed to convert timestamp"),
),
..Default::default()
},
};
Expand Down

0 comments on commit c65933e

Please sign in to comment.