Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support chain parameters for P8. #221

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,6 +2387,35 @@ pub struct ChainParametersV2 {
pub finalization_committee_parameters: FinalizationCommitteeParameters,
}

#[derive(common::Serialize, Debug)]
/// Values of chain parameters that can be updated via chain updates.
pub struct ChainParametersV3 {
/// Consensus protocol version 2 timeout parameters.
pub timeout_parameters: TimeoutParameters,
/// Minimum time interval between blocks.
pub min_block_time: Duration,
/// Maximum energy allowed per block.
pub block_energy_limit: Energy,
/// Euro per energy exchange rate.
pub euro_per_energy: ExchangeRate,
/// Micro ccd per euro exchange rate.
pub micro_ccd_per_euro: ExchangeRate,
pub cooldown_parameters: CooldownParameters,
pub time_parameters: TimeParameters,
/// The limit for the number of account creations in a block.
pub account_creation_limit: CredentialsPerBlockLimit,
/// Current reward parameters.
pub reward_parameters: RewardParameters<ChainParameterVersion2>,
/// Index of the foundation account.
pub foundation_account_index: AccountIndex,
/// Parameters for baker pools.
pub pool_parameters: PoolParameters,
/// The finalization committee parameters.
pub finalization_committee_parameters: FinalizationCommitteeParameters,
/// Parameter for determining when a validator is considered inactive.
pub validator_score_parameters: ValidatorScoreParameters,
}

pub trait ChainParametersFamily {
type Output: std::fmt::Debug;
}
Expand All @@ -2403,6 +2432,10 @@ impl ChainParametersFamily for ChainParameterVersion2 {
type Output = ChainParametersV2;
}

impl ChainParametersFamily for ChainParameterVersion3 {
type Output = ChainParametersV3;
}

pub type ChainParameters<CPV> = <CPV as ChainParametersFamily>::Output;

#[derive(Debug, SerdeSerialize, SerdeDeserialize)]
Expand Down
Loading