merge with master

This commit is contained in:
Robert Habermeier
2016-07-11 11:19:19 +02:00
7 changed files with 1299 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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

View File

@@ -119,18 +119,18 @@ pub mod engine;
pub mod migrations;
pub mod miner;
pub mod snapshot;
pub mod action_params;
#[macro_use] pub mod evm;
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;