Remove tendermint engine support (#9980)

* Remove tendermint engine support

* Remove tendermint test json spec

* Fix ethcore test compile

* Remove tendermint test in sync
This commit is contained in:
Wei Tang
2018-11-29 06:47:11 +08:00
committed by GitHub
parent 7f5e6b3a0a
commit f092c10de5
13 changed files with 2 additions and 2211 deletions

View File

@@ -16,7 +16,7 @@
//! Engine deserialization.
use super::{Ethash, BasicAuthority, AuthorityRound, Tendermint, NullEngine, InstantSeal};
use super::{Ethash, BasicAuthority, AuthorityRound, NullEngine, InstantSeal};
/// Engine deserialization.
#[derive(Debug, PartialEq, Deserialize)]
@@ -34,8 +34,6 @@ pub enum Engine {
BasicAuthority(BasicAuthority),
/// AuthorityRound engine.
AuthorityRound(AuthorityRound),
/// Tendermint engine.
Tendermint(Tendermint)
}
#[cfg(test)]
@@ -133,20 +131,5 @@ mod tests {
Engine::AuthorityRound(_) => {}, // AuthorityRound is unit tested in its own file.
_ => panic!(),
};
let s = r#"{
"tendermint": {
"params": {
"validators": {
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
}
}
}
}"#;
let deserialized: Engine = serde_json::from_str(s).unwrap();
match deserialized {
Engine::Tendermint(_) => {}, // Tendermint is unit tested in its own file.
_ => panic!(),
};
}
}

View File

@@ -28,7 +28,6 @@ pub mod ethash;
pub mod validator_set;
pub mod basic_authority;
pub mod authority_round;
pub mod tendermint;
pub mod null_engine;
pub mod instant_seal;
pub mod hardcoded_sync;
@@ -45,7 +44,6 @@ pub use self::ethash::{Ethash, EthashParams, BlockReward};
pub use self::validator_set::ValidatorSet;
pub use self::basic_authority::{BasicAuthority, BasicAuthorityParams};
pub use self::authority_round::{AuthorityRound, AuthorityRoundParams};
pub use self::tendermint::{Tendermint, TendermintParams};
pub use self::null_engine::{NullEngine, NullEngineParams};
pub use self::instant_seal::{InstantSeal, InstantSealParams};
pub use self::hardcoded_sync::HardcodedSync;

View File

@@ -1,71 +0,0 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Tendermint params deserialization.
use uint::Uint;
use super::ValidatorSet;
/// Tendermint params deserialization.
#[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")]
pub struct TendermintParams {
/// Valid validators.
pub validators: ValidatorSet,
/// Propose step timeout in milliseconds.
pub timeout_propose: Option<Uint>,
/// Prevote step timeout in milliseconds.
pub timeout_prevote: Option<Uint>,
/// Precommit step timeout in milliseconds.
pub timeout_precommit: Option<Uint>,
/// Commit step timeout in milliseconds.
pub timeout_commit: Option<Uint>,
/// Reward per block.
pub block_reward: Option<Uint>,
}
/// Tendermint engine deserialization.
#[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Tendermint {
/// Ethash params.
pub params: TendermintParams,
}
#[cfg(test)]
mod tests {
use serde_json;
use ethereum_types::H160;
use hash::Address;
use spec::tendermint::Tendermint;
use spec::validator_set::ValidatorSet;
#[test]
fn tendermint_deserialization() {
let s = r#"{
"params": {
"validators": {
"list": ["0xc6d9d2cd449a754c494264e1809c50e34d64562b"]
}
}
}"#;
let deserialized: Tendermint = serde_json::from_str(s).unwrap();
let vs = ValidatorSet::List(vec![Address(H160::from("0xc6d9d2cd449a754c494264e1809c50e34d64562b"))]);
assert_eq!(deserialized.params.validators, vs);
}
}