add tendermint seal
This commit is contained in:
@@ -34,7 +34,7 @@ pub use self::builtin::{Builtin, Pricing, Linear};
|
||||
pub use self::genesis::Genesis;
|
||||
pub use self::params::Params;
|
||||
pub use self::spec::Spec;
|
||||
pub use self::seal::{Seal, Ethereum, AuthorityRoundSeal};
|
||||
pub use self::seal::{Seal, Ethereum, AuthorityRoundSeal, TendermintSeal};
|
||||
pub use self::engine::Engine;
|
||||
pub use self::state::State;
|
||||
pub use self::ethash::{Ethash, EthashParams};
|
||||
|
||||
@@ -39,6 +39,17 @@ pub struct AuthorityRoundSeal {
|
||||
pub signature: H520,
|
||||
}
|
||||
|
||||
/// Tendermint seal.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct TendermintSeal {
|
||||
/// Seal round.
|
||||
pub round: Uint,
|
||||
/// Proposal seal signature.
|
||||
pub proposal: H520,
|
||||
/// Proposal seal signature.
|
||||
pub precommits: Vec<H520>,
|
||||
}
|
||||
|
||||
/// Seal variants.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub enum Seal {
|
||||
@@ -48,6 +59,9 @@ pub enum Seal {
|
||||
/// AuthorityRound seal.
|
||||
#[serde(rename="authority_round")]
|
||||
AuthorityRound(AuthorityRoundSeal),
|
||||
/// Tendermint seal.
|
||||
#[serde(rename="tendermint")]
|
||||
Tendermint(TendermintSeal),
|
||||
/// Generic seal.
|
||||
#[serde(rename="generic")]
|
||||
Generic(Bytes),
|
||||
@@ -72,6 +86,14 @@ mod tests {
|
||||
"step": "0x0",
|
||||
"signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
},{
|
||||
"tendermint": {
|
||||
"round": "0x0",
|
||||
"proposal": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"precommits": [
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
]
|
||||
}
|
||||
}]"#;
|
||||
let _deserialized: Vec<Seal> = serde_json::from_str(s).unwrap();
|
||||
// TODO: validate all fields
|
||||
|
||||
Reference in New Issue
Block a user