Very basic EVM binary. (#1574)
* EVM binary - initial version * Adding missing documentation * Fixing warnings * Basic evmbin options * EVMbin crate.
This commit is contained in:
@@ -95,11 +95,17 @@ impl<'a> Finalize for Result<GasLeft<'a>> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Cost calculation type. For low-gas usage we calculate costs using usize instead of U256
|
||||
pub trait CostType: ops::Mul<Output=Self> + ops::Div<Output=Self> + ops::Add<Output=Self> + ops::Sub<Output=Self> + ops::Shr<usize, Output=Self> + ops::Shl<usize, Output=Self> + cmp::Ord + Sized + From<usize> + Copy {
|
||||
/// Converts this cost into `U256`
|
||||
fn as_u256(&self) -> U256;
|
||||
/// Tries to fit `U256` into this `Cost` type
|
||||
fn from_u256(val: U256) -> Result<Self>;
|
||||
/// Convert to usize (may panic)
|
||||
fn as_usize(&self) -> usize;
|
||||
/// Add with overflow
|
||||
fn overflow_add(self, other: Self) -> (Self, bool);
|
||||
/// Multiple with overflow
|
||||
fn overflow_mul(self, other: Self) -> (Self, bool);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
///! Rust VM implementation
|
||||
//! Rust VM implementation
|
||||
|
||||
#[cfg(not(feature = "evm-debug"))]
|
||||
macro_rules! evm_debug {
|
||||
@@ -182,6 +182,7 @@ impl<Cost: CostType> Interpreter<Cost> {
|
||||
instruction: instruction
|
||||
});
|
||||
}
|
||||
|
||||
if info.tier == instructions::GasPriceTier::Invalid {
|
||||
return Err(evm::Error::BadInstruction {
|
||||
instruction: instruction
|
||||
|
||||
@@ -118,18 +118,18 @@ pub mod pod_state;
|
||||
pub mod engine;
|
||||
pub mod migrations;
|
||||
pub mod miner;
|
||||
#[macro_use] pub mod evm;
|
||||
pub mod action_params;
|
||||
|
||||
mod blooms;
|
||||
mod db;
|
||||
mod common;
|
||||
mod basic_types;
|
||||
#[macro_use] mod evm;
|
||||
mod env_info;
|
||||
mod pod_account;
|
||||
mod state;
|
||||
mod account;
|
||||
mod account_db;
|
||||
mod action_params;
|
||||
mod null_engine;
|
||||
mod builtin;
|
||||
mod substate;
|
||||
|
||||
Reference in New Issue
Block a user