-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(concensus): add versioned constants to Concensus
- Loading branch information
1 parent
f6f7f30
commit e9d58e3
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
crates/sequencing/papyrus_consensus_orchestrator/resources/versioned_constants_0_13_4.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"gas_price_max_change_denominator": 48, | ||
"gas_target": 2000000000, | ||
"max_block_size": 4000000000, | ||
"min_gas_price": 100000 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
crates/sequencing/papyrus_consensus_orchestrator/src/versioned_constants.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use serde::Deserialize; | ||
use starknet_api::define_versioned_constants; | ||
|
||
/// Versioned constants for the Consensus. | ||
#[derive(Clone, Deserialize)] | ||
pub struct VersionedConstants { | ||
/// This is used to calculate the base gas price for the next block according to EIP-1559 and | ||
/// serves as a sensitivity parameter that limits the maximum rate of change of the gas price | ||
/// between consecutive blocks. | ||
pub gas_price_max_change_denominator: u128, | ||
/// The minimum gas price in fri. | ||
pub min_gas_price: u64, | ||
/// The maximum block size in gas units. | ||
pub max_block_size: u64, | ||
/// The target gas usage per block (usually half of a block's gas limit). | ||
pub gas_target: u64, | ||
} | ||
|
||
// TODO(Ayelet): Change version and path to 0.14 once added. | ||
define_versioned_constants!( | ||
VersionedConstants, | ||
(V0_13_4, "../resources/versioned_constants_0_13_4.json"), | ||
); |