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

feat: add Parlia genesis config for BSC #740

Merged
merged 3 commits into from
May 15, 2024
Merged
Changes from 2 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
19 changes: 19 additions & 0 deletions crates/genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ pub struct ChainConfig {
#[serde(skip_serializing_if = "Option::is_none")]
pub clique: Option<CliqueConfig>,

/// Parlia parameters.
prestwich marked this conversation as resolved.
Show resolved Hide resolved
#[serde(skip_serializing_if = "Option::is_none")]
pub parlia: Option<ParliaConfig>,

/// Additional fields specific to each chain.
#[serde(flatten, default)]
pub extra_fields: BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -541,6 +545,21 @@ pub struct CliqueConfig {
pub epoch: Option<u64>,
}

/// Consensus configuration for Parlia.
/// Parlia is the consensus engine for BNB Smart Chain.
/// For the general introduction: https://docs.bnbchain.org/docs/learn/consensus/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc nit again:
for links you should follow recommendation here:

https://doc.rust-lang.org/rustdoc/lints.html?highlight=http%3A%2F%2F#bare_urls

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks a lot

/// For the specification: https://github.com/bnb-chain/bsc/blob/master/params/config.go#L558
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct ParliaConfig {
/// Number of seconds between blocks to enforce.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub period: Option<u64>,

/// Epoch length to update validator set.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub epoch: Option<u64>,
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading