diff --git a/interpreter/src/runtime.rs b/interpreter/src/runtime.rs index aa5b30eb0..a5cfbb3aa 100644 --- a/interpreter/src/runtime.rs +++ b/interpreter/src/runtime.rs @@ -143,7 +143,7 @@ pub trait RuntimeBackend: RuntimeBaseBackend { /// Fully delete storages of an account. fn reset_storage(&mut self, address: H160); /// Set code of an account. - fn set_code(&mut self, address: H160, code: Vec); + fn set_code(&mut self, address: H160, code: Vec) -> Result<(), ExitError>; /// Reset balance of an account. fn reset_balance(&mut self, address: H160); fn deposit(&mut self, target: H160, value: U256); diff --git a/interpreter/tests/usability.rs b/interpreter/tests/usability.rs index c6aa6da5a..181bd2044 100644 --- a/interpreter/tests/usability.rs +++ b/interpreter/tests/usability.rs @@ -143,7 +143,7 @@ impl<'a> RuntimeBackend for UnimplementedHandler { unimplemented!() } - fn set_code(&mut self, _address: H160, _code: Vec) { + fn set_code(&mut self, _address: H160, _code: Vec) -> Result<(), ExitError> { unimplemented!() } diff --git a/src/backend/in_memory.rs b/src/backend/in_memory.rs index 894d5c6c5..fe696dd55 100644 --- a/src/backend/in_memory.rs +++ b/src/backend/in_memory.rs @@ -214,12 +214,14 @@ impl RuntimeBackend for InMemoryBackend { .storage = Default::default(); } - fn set_code(&mut self, address: H160, code: Vec) { + fn set_code(&mut self, address: H160, code: Vec) -> Result<(), ExitError> { self.current_layer_mut() .state .entry(address) .or_default() .code = code; + + Ok(()) } fn reset_balance(&mut self, address: H160) { diff --git a/src/standard/invoker/routines.rs b/src/standard/invoker/routines.rs index ae4ee6ff1..d0bacd52a 100644 --- a/src/standard/invoker/routines.rs +++ b/src/standard/invoker/routines.rs @@ -238,7 +238,7 @@ where StaticGasometer::record_codedeposit(gasometer, retbuf.len())?; - handler.set_code(address, retbuf.clone()); + handler.set_code(address, retbuf.clone())?; Ok(()) }