Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: double substate discard in eip-3860 #160

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ pub enum ExitError {
/// Other normal errors.
#[cfg_attr(feature = "with-codec", codec(index = 13))]
Other(Cow<'static, str>),

/// Init code exceeds limit (runtime).
#[cfg_attr(feature = "with-codec", codec(index = 7))]
InitCodeLimit,
}

impl From<ExitError> for ExitReason {
Expand Down
7 changes: 3 additions & 4 deletions src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
// EIP-3860
if init_code.len() > limit {
self.state.metadata_mut().gasometer.fail();
let _ = self.exit_substate(StackExitKind::Failed);
return Err(ExitError::OutOfGas);
return Err(ExitError::CreateContractLimit);
}
return self
.state
Expand Down Expand Up @@ -437,7 +436,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
if init_code.len() > limit {
self.state.metadata_mut().gasometer.fail();
let _ = self.exit_substate(StackExitKind::Failed);
return emit_exit!(ExitError::InitCodeLimit.into(), Vec::new());
return emit_exit!(ExitError::CreateContractLimit.into(), Vec::new());
}
}

Expand Down Expand Up @@ -478,7 +477,7 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
if init_code.len() > limit {
self.state.metadata_mut().gasometer.fail();
let _ = self.exit_substate(StackExitKind::Failed);
return emit_exit!(ExitError::InitCodeLimit.into(), Vec::new());
return emit_exit!(ExitError::CreateContractLimit.into(), Vec::new());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/executor/stack/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ impl<'config> MemoryStackSubstate<'config> {
&mut self.metadata
}

/// Deconstruct the executor, return state to be applied. Panic if the
/// executor is not in the top-level substate.
/// Deconstruct the memory stack substate, return state to be applied. Panic if the
/// substate is not in the top-level substate.
#[must_use]
pub fn deconstruct<B: Backend>(
mut self,
Expand Down
3 changes: 2 additions & 1 deletion src/executor/stack/precompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ pub trait PrecompileHandle {
}

/// A set of precompiles.
/// Checks of the provided address being in the precompile set should be
///
/// Checks if the provided address is in the precompile set. This should be
/// as cheap as possible since it may be called often.
pub trait PrecompileSet {
/// Tries to execute a precompile in the precompile set.
Expand Down