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:
@@ -430,8 +430,6 @@ pub enum AuxiliaryRequest {
|
||||
|
||||
impl super::Machine for EthereumMachine {
|
||||
type EngineClient = ::client::EngineClient;
|
||||
type AuxiliaryRequest = AuxiliaryRequest;
|
||||
type AncestryAction = ::types::ancestry_action::AncestryAction;
|
||||
|
||||
type Error = Error;
|
||||
|
||||
@@ -444,11 +442,6 @@ impl super::Machine for EthereumMachine {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> super::LocalizedMachine<'a> for EthereumMachine {
|
||||
type StateContext = Call<'a>;
|
||||
type AuxiliaryData = AuxiliaryData<'a>;
|
||||
}
|
||||
|
||||
// Try to round gas_limit a bit so that:
|
||||
// 1) it will still be in desired range
|
||||
// 2) it will be a nearest (with tendency to increase) multiple of PARITY_GAS_LIMIT_DETERMINANT
|
||||
|
||||
@@ -21,13 +21,9 @@ use ethereum_types::{U256, Address};
|
||||
use block::ExecutedBlock;
|
||||
|
||||
/// Generalization of types surrounding blockchain-suitable state machines.
|
||||
pub trait Machine: for<'a> LocalizedMachine<'a> {
|
||||
pub trait Machine: Send + Sync {
|
||||
/// A handle to a blockchain client for this machine.
|
||||
type EngineClient: ?Sized;
|
||||
/// A description of needed auxiliary data.
|
||||
type AuxiliaryRequest;
|
||||
/// Actions taken on ancestry blocks when commiting a new block.
|
||||
type AncestryAction;
|
||||
|
||||
/// Errors which can occur when querying or interacting with the machine.
|
||||
type Error;
|
||||
@@ -39,13 +35,3 @@ pub trait Machine: for<'a> LocalizedMachine<'a> {
|
||||
/// Increment the balance of an account in the state of the live block.
|
||||
fn add_balance(&self, live: &mut ExecutedBlock, address: &Address, amount: &U256) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
/// Machine-related types localized to a specific lifetime.
|
||||
// TODO: this is a workaround for a lack of associated type constructors in the language.
|
||||
pub trait LocalizedMachine<'a>: Sync + Send {
|
||||
/// Definition of auxiliary data associated to a specific block.
|
||||
type AuxiliaryData: 'a;
|
||||
/// A context providing access to the state in a controlled capacity.
|
||||
/// Generally also provides verifiable proofs.
|
||||
type StateContext: ?Sized + 'a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user