Byzantium updates (#5855)
* EIP-211 updates * benchmarks * blockhash instruction gas cost updated * More benches * EIP-684 * EIP-649 * EIP-658 * Updated some tests * Modexp fixes * STATICCALL fixes * Pairing fixes * More STATICALL fixes * Use paritytech/bn * Fixed REVERTing of contract creation * Fixed more tests * Fixed more tests * Blockchain tests * Enable previously broken tests * Transition test * Updated tests * Fixed modexp reading huge numbers * Enabled max_code_size test * Review fixes * Updated pairing pricing * missing commas (style) * Update test.rs * Small improvements * eip161abc
This commit is contained in:
committed by
Gav Wood
parent
b602fb4a5e
commit
25b35ebddd
@@ -65,6 +65,10 @@ pub enum Error {
|
||||
Internal(String),
|
||||
/// Wasm runtime error
|
||||
Wasm(String),
|
||||
/// Out of bounds access in RETURNDATACOPY.
|
||||
OutOfBounds,
|
||||
/// Execution has been reverted with REVERT.
|
||||
Reverted,
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +97,8 @@ impl fmt::Display for Error {
|
||||
Internal(ref msg) => write!(f, "Internal error: {}", msg),
|
||||
MutableCallInStaticContext => write!(f, "Mutable call in static context"),
|
||||
Wasm(ref msg) => write!(f, "Internal error: {}", msg),
|
||||
OutOfBounds => write!(f, "Out of bounds"),
|
||||
Reverted => write!(f, "Reverted"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,12 @@ pub enum ContractCreateResult {
|
||||
Created(Address, U256),
|
||||
/// Returned when contract creation failed.
|
||||
/// VM doesn't have to know the reason.
|
||||
Failed
|
||||
Failed,
|
||||
/// Returned when contract creation failed.
|
||||
/// VM doesn't have to know the reason.
|
||||
FailedInStaticCall,
|
||||
/// Reverted with REVERT.
|
||||
Reverted(U256, ReturnData),
|
||||
}
|
||||
|
||||
/// Result of externalities call function.
|
||||
@@ -44,7 +49,10 @@ pub enum MessageCallResult {
|
||||
Success(U256, ReturnData),
|
||||
/// Returned when message call failed.
|
||||
/// VM doesn't have to know the reason.
|
||||
Failed
|
||||
Failed,
|
||||
/// Returned when message call was reverted.
|
||||
/// Contains gas left and output data.
|
||||
Reverted(U256, ReturnData),
|
||||
}
|
||||
|
||||
/// Specifies how an address is calculated for a new contract.
|
||||
@@ -114,7 +122,7 @@ pub trait Ext {
|
||||
|
||||
/// Should be called when transaction calls `RETURN` opcode.
|
||||
/// Returns gas_left if cost of returning the data is not too high.
|
||||
fn ret(self, gas: &U256, data: &ReturnData) -> Result<U256>;
|
||||
fn ret(self, gas: &U256, data: &ReturnData, apply_state: bool) -> Result<U256>;
|
||||
|
||||
/// Should be called when contract commits suicide.
|
||||
/// Address to which funds should be refunded.
|
||||
@@ -143,4 +151,7 @@ pub trait Ext {
|
||||
|
||||
/// Trace the finalised execution of a single instruction.
|
||||
fn trace_executed(&mut self, _gas_used: U256, _stack_push: &[U256], _mem_diff: Option<(usize, &[u8])>, _store_diff: Option<(U256, U256)>) {}
|
||||
|
||||
/// Check if running in static context.
|
||||
fn is_static(&self) -> bool;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,8 @@ pub struct Schedule {
|
||||
pub have_return_data: bool,
|
||||
/// Kill basic accounts below this balance if touched.
|
||||
pub kill_dust: CleanDustMode,
|
||||
/// Enable EIP-86 rules
|
||||
pub eip86: bool,
|
||||
}
|
||||
|
||||
/// Dust accounts cleanup mode.
|
||||
@@ -184,17 +186,17 @@ impl Schedule {
|
||||
blockhash_gas: 20,
|
||||
have_static_call: false,
|
||||
kill_dust: CleanDustMode::Off,
|
||||
eip86: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Schedule for the Metropolis of the Ethereum main net.
|
||||
pub fn new_metropolis() -> Schedule {
|
||||
/// Schedule for the Byzantium fork of the Ethereum main net.
|
||||
pub fn new_byzantium() -> Schedule {
|
||||
let mut schedule = Self::new_post_eip150(24576, true, true, true);
|
||||
schedule.have_create2 = true;
|
||||
schedule.have_revert = true;
|
||||
schedule.have_static_call = true;
|
||||
schedule.have_return_data = true;
|
||||
schedule.blockhash_gas = 350;
|
||||
schedule
|
||||
}
|
||||
|
||||
@@ -246,6 +248,7 @@ impl Schedule {
|
||||
blockhash_gas: 20,
|
||||
have_static_call: false,
|
||||
kill_dust: CleanDustMode::Off,
|
||||
eip86: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ impl Ext for FakeExt {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ret(self, _gas: &U256, _data: &ReturnData) -> Result<U256> {
|
||||
fn ret(self, _gas: &U256, _data: &ReturnData, _apply_state: bool) -> Result<U256> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
@@ -185,6 +185,10 @@ impl Ext for FakeExt {
|
||||
self.depth
|
||||
}
|
||||
|
||||
fn is_static(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn inc_sstore_clears(&mut self) {
|
||||
self.sstore_clears += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user