diff --git a/ethcore/res/tendermint.json b/ethcore/res/tendermint.json
deleted file mode 100644
index 3c60097a4..000000000
--- a/ethcore/res/tendermint.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "name": "TestBFT",
- "engine": {
- "tendermint": {
- "params": {
- "validators" : {
- "list": [
- "0x82a978b3f5962a5b0957d9ee9eef472ee55b42f1",
- "0x7d577a597b2742b498cb5cf0c26cdcd726d39e6e"
- ]
- },
- "timeoutPropose": 10000,
- "timeoutPrevote": 10000,
- "timeoutPrecommit": 10000,
- "timeoutCommit": 10000
- }
- }
- },
- "params": {
- "gasLimitBoundDivisor": "0x0400",
- "accountStartNonce": "0x0",
- "maximumExtraDataSize": "0x20",
- "minGasLimit": "0x1388",
- "networkID" : "0x2323",
- "eip140Transition": "0x0",
- "eip211Transition": "0x0",
- "eip214Transition": "0x0",
- "eip658Transition": "0x0"
- },
- "genesis": {
- "seal": {
- "tendermint": {
- "round": "0x0",
- "proposal": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
- "precommits": [
- "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- ]
- }
- },
- "difficulty": "0x20000",
- "author": "0x0000000000000000000000000000000000000000",
- "timestamp": "0x00",
- "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
- "extraData": "0x",
- "gasLimit": "0x222222"
- },
- "accounts": {
- "0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
- "0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
- "0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
- "0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
- "0000000000000000000000000000000000000005": { "balance": "1", "builtin": { "name": "modexp", "activate_at": 0, "pricing": { "modexp": { "divisor": 20 } } } },
- "0000000000000000000000000000000000000006": { "balance": "1", "builtin": { "name": "alt_bn128_add", "activate_at": 0, "pricing": { "linear": { "base": 500, "word": 0 } } } },
- "0000000000000000000000000000000000000007": { "balance": "1", "builtin": { "name": "alt_bn128_mul", "activate_at": 0, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
- "0000000000000000000000000000000000000008": { "balance": "1", "builtin": { "name": "alt_bn128_pairing", "activate_at": 0, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
- "9cce34f7ab185c7aba1b7c8140d620b4bda941d6": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
- }
-}
diff --git a/ethcore/src/engines/mod.rs b/ethcore/src/engines/mod.rs
index 39f3ac204..2d47002d1 100644
--- a/ethcore/src/engines/mod.rs
+++ b/ethcore/src/engines/mod.rs
@@ -21,10 +21,7 @@ mod basic_authority;
mod instant_seal;
mod null_engine;
mod signer;
-mod tendermint;
-mod transition;
mod validator_set;
-mod vote_collector;
pub mod block_reward;
pub mod epoch;
@@ -34,7 +31,6 @@ pub use self::basic_authority::BasicAuthority;
pub use self::epoch::{EpochVerifier, Transition as EpochTransition};
pub use self::instant_seal::{InstantSeal, InstantSealParams};
pub use self::null_engine::NullEngine;
-pub use self::tendermint::Tendermint;
use std::sync::{Weak, Arc};
use std::collections::{BTreeMap, HashMap};
diff --git a/ethcore/src/engines/signer.rs b/ethcore/src/engines/signer.rs
index 670c0959c..c28e44451 100644
--- a/ethcore/src/engines/signer.rs
+++ b/ethcore/src/engines/signer.rs
@@ -57,11 +57,6 @@ impl EngineSigner {
self.address.clone()
}
- /// Check if the given address is the signing address.
- pub fn is_address(&self, address: &Address) -> bool {
- self.address.map_or(false, |a| a == *address)
- }
-
/// Check if the signing address was set.
pub fn is_some(&self) -> bool {
self.address.is_some()
diff --git a/ethcore/src/engines/tendermint/message.rs b/ethcore/src/engines/tendermint/message.rs
deleted file mode 100644
index 137148667..000000000
--- a/ethcore/src/engines/tendermint/message.rs
+++ /dev/null
@@ -1,298 +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 .
-
-//! Tendermint message handling.
-
-use bytes::Bytes;
-use error::Error;
-use ethereum_types::{H256, H520, Address};
-use ethkey::{recover, public_to_address};
-use hash::keccak;
-use header::Header;
-use rlp::{Rlp, RlpStream, Encodable, Decodable, DecoderError};
-use std::cmp;
-use super::{Height, View, BlockHash, Step};
-use super::super::vote_collector::Message;
-
-/// Message transmitted between consensus participants.
-#[derive(Debug, PartialEq, Eq, Clone, Hash, Default)]
-pub struct ConsensusMessage {
- pub vote_step: VoteStep,
- pub block_hash: Option,
- pub signature: H520,
-}
-
-/// Complete step of the consensus process.
-#[derive(Debug, PartialEq, Eq, Clone, Hash)]
-pub struct VoteStep {
- pub height: Height,
- pub view: View,
- pub step: Step,
-}
-
-impl VoteStep {
- pub fn new(height: Height, view: View, step: Step) -> Self {
- VoteStep { height: height, view: view, step: step }
- }
-
- pub fn is_height(&self, height: Height) -> bool {
- self.height == height
- }
-
- pub fn is_view(&self, height: Height, view: View) -> bool {
- self.height == height && self.view == view
- }
-}
-
-/// Header consensus view.
-pub fn consensus_view(header: &Header) -> Result {
- let view_rlp = header.seal().get(0).expect("seal passed basic verification; seal has 3 fields; qed");
- Rlp::new(view_rlp.as_slice()).as_val()
-}
-
-/// Proposal signature.
-pub fn proposal_signature(header: &Header) -> Result {
- Rlp::new(header.seal().get(1).expect("seal passed basic verification; seal has 3 fields; qed").as_slice()).as_val()
-}
-
-impl Message for ConsensusMessage {
- type Round = VoteStep;
-
- fn signature(&self) -> H520 { self.signature }
-
- fn block_hash(&self) -> Option { self.block_hash }
-
- fn round(&self) -> &VoteStep { &self.vote_step }
-
- fn is_broadcastable(&self) -> bool { self.vote_step.step.is_pre() }
-}
-
-impl ConsensusMessage {
- pub fn new(signature: H520, height: Height, view: View, step: Step, block_hash: Option) -> Self {
- ConsensusMessage {
- signature: signature,
- block_hash: block_hash,
- vote_step: VoteStep::new(height, view, step),
- }
- }
-
- pub fn new_proposal(header: &Header) -> Result {
- Ok(ConsensusMessage {
- signature: proposal_signature(header)?,
- vote_step: VoteStep::new(header.number() as Height, consensus_view(header)?, Step::Propose),
- block_hash: Some(header.bare_hash()),
- })
- }
-
- pub fn verify(&self) -> Result {
- let full_rlp = ::rlp::encode(self);
- let block_info = Rlp::new(&full_rlp).at(1)?;
- let public_key = recover(&self.signature.into(), &keccak(block_info.as_raw()))?;
- Ok(public_to_address(&public_key))
- }
-}
-
-impl Default for VoteStep {
- fn default() -> Self {
- VoteStep::new(0, 0, Step::Propose)
- }
-}
-
-impl PartialOrd for VoteStep {
- fn partial_cmp(&self, m: &VoteStep) -> Option {
- Some(self.cmp(m))
- }
-}
-
-impl Ord for VoteStep {
- fn cmp(&self, m: &VoteStep) -> cmp::Ordering {
- if self.height != m.height {
- self.height.cmp(&m.height)
- } else if self.view != m.view {
- self.view.cmp(&m.view)
- } else {
- self.step.number().cmp(&m.step.number())
- }
- }
-}
-
-impl Step {
- fn number(&self) -> u8 {
- match *self {
- Step::Propose => 0,
- Step::Prevote => 1,
- Step::Precommit => 2,
- Step::Commit => 3,
- }
- }
-}
-
-impl Decodable for Step {
- fn decode(rlp: &Rlp) -> Result {
- match rlp.as_val()? {
- 0u8 => Ok(Step::Propose),
- 1 => Ok(Step::Prevote),
- 2 => Ok(Step::Precommit),
- _ => Err(DecoderError::Custom("Invalid step.")),
- }
- }
-}
-
-impl Encodable for Step {
- fn rlp_append(&self, s: &mut RlpStream) {
- s.append_internal(&self.number());
- }
-}
-
-/// (signature, (height, view, step, block_hash))
-impl Decodable for ConsensusMessage {
- fn decode(rlp: &Rlp) -> Result {
- let m = rlp.at(1)?;
- let block_message: H256 = m.val_at(3)?;
- Ok(ConsensusMessage {
- vote_step: VoteStep::new(m.val_at(0)?, m.val_at(1)?, m.val_at(2)?),
- block_hash: match block_message.is_zero() {
- true => None,
- false => Some(block_message),
- },
- signature: rlp.val_at(0)?,
- })
- }
-}
-
-impl Encodable for ConsensusMessage {
- fn rlp_append(&self, s: &mut RlpStream) {
- let info = message_info_rlp(&self.vote_step, self.block_hash);
- s.begin_list(2)
- .append(&self.signature)
- .append_raw(&info, 1);
- }
-}
-
-pub fn message_info_rlp(vote_step: &VoteStep, block_hash: Option) -> Bytes {
- let mut s = RlpStream::new_list(4);
- s.append(&vote_step.height).append(&vote_step.view).append(&vote_step.step).append(&block_hash.unwrap_or_else(H256::zero));
- s.out()
-}
-
-pub fn message_full_rlp(signature: &H520, vote_info: &Bytes) -> Bytes {
- let mut s = RlpStream::new_list(2);
- s.append(signature).append_raw(vote_info, 1);
- s.out()
-}
-
-pub fn message_hash(vote_step: VoteStep, block_hash: H256) -> H256 {
- keccak(message_info_rlp(&vote_step, Some(block_hash)))
-}
-
-#[cfg(test)]
-mod tests {
- use std::sync::Arc;
- use hash::keccak;
- use rlp::*;
- use account_provider::AccountProvider;
- use header::Header;
- use super::super::Step;
- use super::*;
-
- #[test]
- fn encode_step() {
- let step = Step::Precommit;
-
- let mut s = RlpStream::new_list(2);
- s.append(&step);
- assert!(!s.is_finished(), "List shouldn't finished yet");
- s.append(&step);
- assert!(s.is_finished(), "List should be finished now");
- s.out();
- }
-
- #[test]
- fn encode_decode() {
- let message = ConsensusMessage {
- signature: H520::default(),
- vote_step: VoteStep {
- height: 10,
- view: 123,
- step: Step::Precommit,
- },
- block_hash: Some(keccak("1")),
- };
- let raw_rlp = ::rlp::encode(&message);
- let rlp = Rlp::new(&raw_rlp);
- assert_eq!(Ok(message), rlp.as_val());
-
- let message = ConsensusMessage {
- signature: H520::default(),
- vote_step: VoteStep {
- height: 1314,
- view: 0,
- step: Step::Prevote,
- },
- block_hash: None
- };
- let raw_rlp = ::rlp::encode(&message);
- let rlp = Rlp::new(&raw_rlp);
- assert_eq!(Ok(message), rlp.as_val());
- }
-
- #[test]
- fn generate_and_verify() {
- let tap = Arc::new(AccountProvider::transient_provider());
- let addr = tap.insert_account(keccak("0").into(), &"0".into()).unwrap();
- tap.unlock_account_permanently(addr, "0".into()).unwrap();
-
- let mi = message_info_rlp(&VoteStep::new(123, 2, Step::Precommit), Some(H256::default()));
-
- let raw_rlp = message_full_rlp(&tap.sign(addr, None, keccak(&mi)).unwrap().into(), &mi);
-
- let rlp = Rlp::new(&raw_rlp);
- let message: ConsensusMessage = rlp.as_val().unwrap();
- match message.verify() { Ok(a) if a == addr => {}, _ => panic!(), };
- }
-
- #[test]
- fn proposal_message() {
- let mut header = Header::default();
- let seal = vec![
- ::rlp::encode(&0u8),
- ::rlp::encode(&H520::default()),
- Vec::new()
- ];
-
- header.set_seal(seal);
- let message = ConsensusMessage::new_proposal(&header).unwrap();
- assert_eq!(
- message,
- ConsensusMessage {
- signature: Default::default(),
- vote_step: VoteStep {
- height: 0,
- view: 0,
- step: Step::Propose,
- },
- block_hash: Some(header.bare_hash())
- }
- );
- }
-
- #[test]
- fn step_ordering() {
- assert!(VoteStep::new(10, 123, Step::Precommit) < VoteStep::new(11, 123, Step::Precommit));
- assert!(VoteStep::new(10, 123, Step::Propose) < VoteStep::new(11, 123, Step::Precommit));
- assert!(VoteStep::new(10, 122, Step::Propose) < VoteStep::new(11, 123, Step::Propose));
- }
-}
diff --git a/ethcore/src/engines/tendermint/mod.rs b/ethcore/src/engines/tendermint/mod.rs
deleted file mode 100644
index a3710222a..000000000
--- a/ethcore/src/engines/tendermint/mod.rs
+++ /dev/null
@@ -1,1144 +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 .
-
-/// Tendermint BFT consensus engine with round robin proof-of-authority.
-/// At each blockchain `Height` there can be multiple `View`s of voting.
-/// Signatures always sign `Height`, `View`, `Step` and `BlockHash` which is a block hash without seal.
-/// First a block with `Seal::Proposal` is issued by the designated proposer.
-/// Next the `View` proceeds through `Prevote` and `Precommit` `Step`s.
-/// Block is issued when there is enough `Precommit` votes collected on a particular block at the end of a `View`.
-/// Once enough votes have been gathered the proposer issues that block in the `Commit` step.
-
-mod message;
-mod params;
-
-use std::sync::{Weak, Arc};
-use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
-use std::collections::HashSet;
-use hash::keccak;
-use ethereum_types::{H256, H520, U128, U256, Address};
-use parking_lot::RwLock;
-use unexpected::{OutOfBounds, Mismatch};
-use client::EngineClient;
-use bytes::Bytes;
-use error::{Error, BlockError};
-use header::{Header, BlockNumber, ExtendedHeader};
-use rlp::Rlp;
-use ethkey::{self, Password, Message, Signature};
-use account_provider::AccountProvider;
-use block::*;
-use engines::{Engine, Seal, EngineError, ConstructedVerifier};
-use engines::block_reward::{self, RewardKind};
-use io::IoService;
-use super::signer::EngineSigner;
-use super::validator_set::{ValidatorSet, SimpleList};
-use super::transition::TransitionHandler;
-use super::vote_collector::VoteCollector;
-use self::message::*;
-use self::params::TendermintParams;
-use machine::{AuxiliaryData, EthereumMachine};
-
-#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
-pub enum Step {
- Propose,
- Prevote,
- Precommit,
- Commit
-}
-
-impl Step {
- pub fn is_pre(self) -> bool {
- match self {
- Step::Prevote | Step::Precommit => true,
- _ => false,
- }
- }
-}
-
-pub type Height = usize;
-pub type View = usize;
-pub type BlockHash = H256;
-
-/// Engine using `Tendermint` consensus algorithm, suitable for EVM chain.
-pub struct Tendermint {
- step_service: IoService,
- client: RwLock