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:
Arkadiy Paronyan
2017-09-15 21:07:54 +02:00
committed by Gav Wood
parent b602fb4a5e
commit 25b35ebddd
47 changed files with 800 additions and 570 deletions

View File

@@ -43,6 +43,10 @@ pub enum Error {
MutableCallInStaticContext,
/// Wasm error
Wasm,
/// Contract tried to access past the return data buffer.
OutOfBounds,
/// Execution has been reverted with REVERT instruction.
Reverted,
}
impl<'a> From<&'a VmError> for Error {
@@ -57,6 +61,8 @@ impl<'a> From<&'a VmError> for Error {
VmError::Wasm { .. } => Error::Wasm,
VmError::Internal(_) => Error::Internal,
VmError::MutableCallInStaticContext => Error::MutableCallInStaticContext,
VmError::OutOfBounds => Error::OutOfBounds,
VmError::Reverted => Error::Reverted,
}
}
}
@@ -80,6 +86,8 @@ impl fmt::Display for Error {
Wasm => "Wasm runtime error",
Internal => "Internal error",
MutableCallInStaticContext => "Mutable Call In Static Context",
OutOfBounds => "Out of bounds",
Reverted => "Reverted",
};
message.fmt(f)
}
@@ -98,6 +106,8 @@ impl Encodable for Error {
BuiltIn => 6,
MutableCallInStaticContext => 7,
Wasm => 8,
OutOfBounds => 9,
Reverted => 10,
};
s.append_internal(&value);
@@ -118,6 +128,8 @@ impl Decodable for Error {
6 => Ok(BuiltIn),
7 => Ok(MutableCallInStaticContext),
8 => Ok(Wasm),
9 => Ok(OutOfBounds),
10 => Ok(Reverted),
_ => Err(DecoderError::Custom("Invalid error type")),
}
}