From 8084e1b6d7288db1c6e6f91d8f1ffdb138217ab2 Mon Sep 17 00:00:00 2001 From: Tomusdrw Date: Wed, 20 Jan 2016 17:01:58 +0100 Subject: [PATCH] Removing value from delegatecall function --- src/evm/ext.rs | 1 - src/evm/interpreter.rs | 4 +--- src/evm/tests.rs | 1 - src/externalities.rs | 5 +++-- src/tests/executive.rs | 3 +-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/evm/ext.rs b/src/evm/ext.rs index b7bf609ca..7e2f0f47f 100644 --- a/src/evm/ext.rs +++ b/src/evm/ext.rs @@ -68,7 +68,6 @@ pub trait Ext { /// and true if subcall was successfull. fn delegatecall(&mut self, gas: &U256, - value: &U256, data: &[u8], code_address: &Address, output: &mut [u8]) -> MessageCallResult; diff --git a/src/evm/interpreter.rs b/src/evm/interpreter.rs index c7d2bfda8..a5e8efc91 100644 --- a/src/evm/interpreter.rs +++ b/src/evm/interpreter.rs @@ -569,8 +569,6 @@ impl Interpreter { let code_address = stack.pop_back(); let code_address = u256_to_address(&code_address); - let value = params.value; - let in_off = stack.pop_back(); let in_size = stack.pop_back(); let out_off = stack.pop_back(); @@ -587,7 +585,7 @@ impl Interpreter { // and we don't want to copy let input = unsafe { ::std::mem::transmute(mem.read_slice(in_off, in_size)) }; let output = mem.writeable_slice(out_off, out_size); - ext.delegatecall(&call_gas, &value, input, &code_address, output) + ext.delegatecall(&call_gas, input, &code_address, output) }; return match call_result { diff --git a/src/evm/tests.rs b/src/evm/tests.rs index 7eb9d484c..83c58bbf8 100644 --- a/src/evm/tests.rs +++ b/src/evm/tests.rs @@ -71,7 +71,6 @@ impl Ext for FakeExt { fn delegatecall(&mut self, _gas: &U256, - _value: &U256, _data: &[u8], _address: &Address, _output: &mut [u8]) -> MessageCallResult { diff --git a/src/externalities.rs b/src/externalities.rs index 110b965d7..20326fe03 100644 --- a/src/externalities.rs +++ b/src/externalities.rs @@ -18,6 +18,7 @@ pub enum OutputPolicy<'a> { /// Transaction properties that externalities need to know about. pub struct OriginInfo { sender: Address, + value: U256, address: Address, origin: Address, gas_price: U256 @@ -28,6 +29,7 @@ impl OriginInfo { pub fn from(params: &ActionParams) -> Self { OriginInfo { sender: params.sender.clone(), + value: params.value.clone(), address: params.address.clone(), origin: params.origin.clone(), gas_price: params.gas_price.clone() @@ -134,7 +136,6 @@ impl<'a> Ext for Externalities<'a> { fn delegatecall(&mut self, gas: &U256, - value: &U256, data: &[u8], code_address: &Address, output: &mut [u8]) -> MessageCallResult { @@ -146,7 +147,7 @@ impl<'a> Ext for Externalities<'a> { origin: self.origin_info.origin.clone(), gas: *gas, gas_price: self.origin_info.gas_price.clone(), - value: value.clone(), + value: self.origin_info.value.clone(), is_value_transfer: false, code: self.state.code(code_address), data: Some(data.to_vec()), diff --git a/src/tests/executive.rs b/src/tests/executive.rs index ca18850c4..17cfb7df5 100644 --- a/src/tests/executive.rs +++ b/src/tests/executive.rs @@ -117,7 +117,6 @@ impl<'a> Ext for TestExt<'a> { fn delegatecall(&mut self, gas: &U256, - value: &U256, data: &[u8], _code_address: &Address, _output: &mut [u8]) -> MessageCallResult { @@ -126,7 +125,7 @@ impl<'a> Ext for TestExt<'a> { data: data.to_vec(), destination: None, gas_limit: *gas, - value: *value + value: U256::zero() }); MessageCallResult::Success(*gas) }