EIP-2315: Simple Subroutines for the EVM (#11629)
This commit is contained in:
committed by
Artem Vorotnikov
parent
751210c963
commit
1460f6cc27
@@ -435,6 +435,9 @@ impl<'a> CallCreateExecutive<'a> {
|
||||
| Err(vm::Error::MutableCallInStaticContext)
|
||||
| Err(vm::Error::OutOfBounds)
|
||||
| Err(vm::Error::Reverted)
|
||||
| Err(vm::Error::SubStackUnderflow { .. })
|
||||
| Err(vm::Error::OutOfSubStack { .. })
|
||||
| Err(vm::Error::InvalidSubEntry)
|
||||
| Ok(FinalizationResult {
|
||||
apply_state: false, ..
|
||||
}) => {
|
||||
|
||||
@@ -126,6 +126,8 @@ pub struct CommonParams {
|
||||
pub eip1884_transition: BlockNumber,
|
||||
/// Number of first block where EIP-2028 rules begin.
|
||||
pub eip2028_transition: BlockNumber,
|
||||
/// Number of first block where EIP-2315 rules begin.
|
||||
pub eip2315_transition: BlockNumber,
|
||||
/// Number of first block where dust cleanup rules (EIP-168 and EIP169) begin.
|
||||
pub dust_protection_transition: BlockNumber,
|
||||
/// Nonce cap increase per block. Nonce cap is only checked if dust protection is enabled.
|
||||
@@ -197,6 +199,7 @@ impl CommonParams {
|
||||
&& !(block_number >= self.eip1283_disable_transition))
|
||||
|| block_number >= self.eip1283_reenable_transition;
|
||||
schedule.eip1706 = block_number >= self.eip1706_transition;
|
||||
schedule.have_subs = block_number >= self.eip2315_transition;
|
||||
|
||||
if block_number >= self.eip1884_transition {
|
||||
schedule.have_selfbalance = true;
|
||||
@@ -329,6 +332,9 @@ impl From<ethjson::spec::Params> for CommonParams {
|
||||
eip2028_transition: p
|
||||
.eip2028_transition
|
||||
.map_or_else(BlockNumber::max_value, Into::into),
|
||||
eip2315_transition: p
|
||||
.eip2315_transition
|
||||
.map_or_else(BlockNumber::max_value, Into::into),
|
||||
dust_protection_transition: p
|
||||
.dust_protection_transition
|
||||
.map_or_else(BlockNumber::max_value, Into::into),
|
||||
|
||||
@@ -34,6 +34,12 @@ pub enum Error {
|
||||
StackUnderflow,
|
||||
/// When execution would exceed defined Stack Limit
|
||||
OutOfStack,
|
||||
/// When there is not enough subroutine stack elements to return from
|
||||
SubStackUnderflow,
|
||||
/// When execution would exceed defined subroutine Stack Limit
|
||||
OutOfSubStack,
|
||||
/// When the code walks into a subroutine, that is not allowed
|
||||
InvalidSubEntry,
|
||||
/// When builtin contract failed on input data
|
||||
BuiltIn,
|
||||
/// Returned on evm internal error. Should never be ignored during development.
|
||||
@@ -57,6 +63,9 @@ impl<'a> From<&'a VmError> for Error {
|
||||
VmError::BadInstruction { .. } => Error::BadInstruction,
|
||||
VmError::StackUnderflow { .. } => Error::StackUnderflow,
|
||||
VmError::OutOfStack { .. } => Error::OutOfStack,
|
||||
VmError::SubStackUnderflow { .. } => Error::SubStackUnderflow,
|
||||
VmError::OutOfSubStack { .. } => Error::OutOfSubStack,
|
||||
VmError::InvalidSubEntry { .. } => Error::InvalidSubEntry,
|
||||
VmError::BuiltIn { .. } => Error::BuiltIn,
|
||||
VmError::Wasm { .. } => Error::Wasm,
|
||||
VmError::Internal(_) => Error::Internal,
|
||||
@@ -82,7 +91,10 @@ impl fmt::Display for Error {
|
||||
BadInstruction => "Bad instruction",
|
||||
StackUnderflow => "Stack underflow",
|
||||
OutOfStack => "Out of stack",
|
||||
SubStackUnderflow => "Subroutine stack underflow",
|
||||
OutOfSubStack => "Subroutine stack overflow",
|
||||
BuiltIn => "Built-in failed",
|
||||
InvalidSubEntry => "Invalid subroutine entry",
|
||||
Wasm => "Wasm runtime error",
|
||||
Internal => "Internal error",
|
||||
MutableCallInStaticContext => "Mutable Call In Static Context",
|
||||
@@ -108,6 +120,9 @@ impl Encodable for Error {
|
||||
Wasm => 8,
|
||||
OutOfBounds => 9,
|
||||
Reverted => 10,
|
||||
SubStackUnderflow => 11,
|
||||
OutOfSubStack => 12,
|
||||
InvalidSubEntry => 13,
|
||||
};
|
||||
|
||||
s.append_internal(&value);
|
||||
@@ -130,6 +145,9 @@ impl Decodable for Error {
|
||||
8 => Ok(Wasm),
|
||||
9 => Ok(OutOfBounds),
|
||||
10 => Ok(Reverted),
|
||||
11 => Ok(SubStackUnderflow),
|
||||
12 => Ok(OutOfSubStack),
|
||||
13 => Ok(InvalidSubEntry),
|
||||
_ => Err(DecoderError::Custom("Invalid error type")),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user