2019-01-07 11:33:07 +01:00
|
|
|
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
|
|
// This file is part of Parity Ethereum.
|
2017-08-01 12:37:57 +02:00
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is free software: you can redistribute it and/or modify
|
2017-08-01 12:37:57 +02:00
|
|
|
// 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.
|
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is distributed in the hope that it will be useful,
|
2017-08-01 12:37:57 +02:00
|
|
|
// 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
|
2019-01-07 11:33:07 +01:00
|
|
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2017-08-01 12:37:57 +02:00
|
|
|
|
|
|
|
//! Virtual machines support library
|
|
|
|
|
2018-01-10 13:35:18 +01:00
|
|
|
extern crate ethereum_types;
|
Delete crates from parity-ethereum and fetch them from parity-common instead (#9083)
Use crates from parity-common: hashdb, keccak-hash, kvdb, kvdb-memorydb, kvdb-rocksdb, memorydb, parity-bytes, parity-crypto, path, patricia_trie, plain_hasher, rlp, target, test-support, trie-standardmap, triehash
2018-07-10 14:59:19 +02:00
|
|
|
extern crate parity_bytes as bytes;
|
2017-08-01 12:37:57 +02:00
|
|
|
extern crate ethjson;
|
|
|
|
extern crate rlp;
|
2017-11-10 19:04:55 +01:00
|
|
|
extern crate keccak_hash as hash;
|
2018-07-02 18:50:05 +02:00
|
|
|
extern crate patricia_trie_ethereum as ethtrie;
|
2019-02-20 19:09:34 +01:00
|
|
|
extern crate trie_db as trie;
|
2017-08-01 12:37:57 +02:00
|
|
|
|
|
|
|
mod action_params;
|
|
|
|
mod call_type;
|
|
|
|
mod env_info;
|
|
|
|
mod schedule;
|
|
|
|
mod ext;
|
|
|
|
mod return_data;
|
|
|
|
mod error;
|
|
|
|
|
2017-08-01 13:33:49 +02:00
|
|
|
pub mod tests;
|
|
|
|
|
2017-11-02 12:49:57 +01:00
|
|
|
pub use action_params::{ActionParams, ActionValue, ParamsType};
|
2017-08-01 12:37:57 +02:00
|
|
|
pub use call_type::CallType;
|
|
|
|
pub use env_info::{EnvInfo, LastHashes};
|
2018-02-19 12:27:42 +01:00
|
|
|
pub use schedule::{Schedule, CleanDustMode, WasmCosts};
|
2017-08-01 12:37:57 +02:00
|
|
|
pub use ext::{Ext, MessageCallResult, ContractCreateResult, CreateContractAddress};
|
|
|
|
pub use return_data::{ReturnData, GasLeft};
|
2018-10-02 16:33:19 +02:00
|
|
|
pub use error::{Error, Result, TrapResult, TrapError, TrapKind, ExecTrapResult, ExecTrapError};
|
2017-08-01 12:37:57 +02:00
|
|
|
|
|
|
|
/// Virtual Machine interface
|
2018-10-02 16:33:19 +02:00
|
|
|
pub trait Exec: Send {
|
2017-08-01 12:37:57 +02:00
|
|
|
/// This function should be used to execute transaction.
|
|
|
|
/// It returns either an error, a known amount of gas left, or parameters to be used
|
|
|
|
/// to compute the final gas left.
|
2018-10-02 16:33:19 +02:00
|
|
|
fn exec(self: Box<Self>, ext: &mut Ext) -> ExecTrapResult<GasLeft>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Resume call interface
|
|
|
|
pub trait ResumeCall: Send {
|
|
|
|
/// Resume an execution for call, returns back the Vm interface.
|
|
|
|
fn resume_call(self: Box<Self>, result: MessageCallResult) -> Box<Exec>;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Resume create interface
|
|
|
|
pub trait ResumeCreate: Send {
|
|
|
|
/// Resume an execution from create, returns back the Vm interface.
|
|
|
|
fn resume_create(self: Box<Self>, result: ContractCreateResult) -> Box<Exec>;
|
2017-08-30 19:18:28 +02:00
|
|
|
}
|