further simplify machine (#10472)

* removed AuxiliaryRequest from Machin trait

* removed AncestryAction from Machine trait

* removed AuxiliaryData from Machine trait

* removed LocalizedMachine trait
This commit is contained in:
Marek Kotewicz
2019-03-14 11:28:15 +01:00
committed by Wei Tang
parent a16bad4175
commit c9db8ea21d
3 changed files with 6 additions and 29 deletions

View File

@@ -49,13 +49,12 @@ use spec::CommonParams;
use types::transaction::{self, UnverifiedTransaction, SignedTransaction};
use ethkey::{Signature};
use machine::{Machine, LocalizedMachine as Localized};
use machine::{self, Machine, AuxiliaryRequest, AuxiliaryData};
use ethereum_types::{H256, U256, Address};
use unexpected::{Mismatch, OutOfBounds};
use bytes::Bytes;
use types::ancestry_action::AncestryAction;
use block::ExecutedBlock;
use machine;
/// Default EIP-210 contract code.
/// As defined in https://github.com/ethereum/EIPs/pull/210
@@ -177,8 +176,7 @@ pub type PendingTransitionStore<'a> = Fn(H256) -> Option<epoch::PendingTransitio
/// Proof dependent on state.
pub trait StateDependentProof<M: Machine>: Send + Sync {
/// Generate a proof, given the state.
// TODO: make this into an &M::StateContext
fn generate_proof<'a>(&self, state: &<M as Localized<'a>>::StateContext) -> Result<Vec<u8>, String>;
fn generate_proof<'a>(&self, state: &machine::Call) -> Result<Vec<u8>, String>;
/// Check a proof generated elsewhere (potentially by a peer).
// `engine` needed to check state proofs, while really this should
// just be state machine params.
@@ -218,7 +216,7 @@ impl<'a, M: Machine> ConstructedVerifier<'a, M> {
/// Results of a query of whether an epoch change occurred at the given block.
pub enum EpochChange<M: Machine> {
/// Cannot determine until more data is passed.
Unsure(M::AuxiliaryRequest),
Unsure(AuxiliaryRequest),
/// No epoch change.
No,
/// The epoch will change, with proof.
@@ -310,7 +308,7 @@ pub trait Engine<M: Machine>: Sync + Send {
fn verify_block_external(&self, _header: &Header) -> Result<(), M::Error> { Ok(()) }
/// Genesis epoch data.
fn genesis_epoch_data<'a>(&self, _header: &Header, _state: &<M as Localized<'a>>::StateContext) -> Result<Vec<u8>, String> { Ok(Vec::new()) }
fn genesis_epoch_data<'a>(&self, _header: &Header, _state: &machine::Call) -> Result<Vec<u8>, String> { Ok(Vec::new()) }
/// Whether an epoch change is signalled at the given header but will require finality.
/// If a change can be enacted immediately then return `No` from this function but
@@ -321,7 +319,7 @@ pub trait Engine<M: Machine>: Sync + Send {
/// Return `Yes` or `No` when the answer is definitively known.
///
/// Should not interact with state.
fn signals_epoch_end<'a>(&self, _header: &Header, _aux: <M as Localized<'a>>::AuxiliaryData)
fn signals_epoch_end<'a>(&self, _header: &Header, _aux: AuxiliaryData<'a>)
-> EpochChange<M>
{
EpochChange::No