[release] v2.7.1 (#11430)

* Revert "[Trace] Distinguish between `create` and `create2` (#11311)" (#11427)

This reverts commit 87e1080581.

* Bump version

* Changelog

* Update publish-docker.sh (#11428)

Add :latest tag to building stable releases

Co-authored-by: s3krit <pugh@s3kr.it>
This commit is contained in:
David
2020-01-30 17:13:40 +01:00
committed by GitHub
parent aa0a703e7c
commit 6885be06a4
28 changed files with 167 additions and 297 deletions

View File

@@ -26,7 +26,7 @@ use rlp::RlpStream;
use log::trace;
use account_state::{Backend as StateBackend, State, CleanupMode};
use evm::{ActionType, Finalize, FinalizationResult};
use evm::{CallType, Finalize, FinalizationResult};
use vm::{
self, EnvInfo, CreateContractAddress, ReturnData, CleanDustMode, ActionParams,
ActionValue, Schedule, TrapError, ResumeCall, ResumeCreate
@@ -241,7 +241,7 @@ impl<'a> CallCreateExecutive<'a> {
trace!("Executive::call(params={:?}) self.env_info={:?}, parent_static={}", params, info, parent_static_flag);
let gas = params.gas;
let static_flag = parent_static_flag || params.action_type == ActionType::StaticCall;
let static_flag = parent_static_flag || params.call_type == CallType::StaticCall;
// if destination is builtin, try to execute it
let kind = if let Some(builtin) = machine.builtin(&params.code_address, info.number) {
@@ -298,7 +298,7 @@ impl<'a> CallCreateExecutive<'a> {
}
} else {
if (static_flag &&
(params.action_type == ActionType::StaticCall || params.action_type == ActionType::Call)) &&
(params.call_type == CallType::StaticCall || params.call_type == CallType::Call)) &&
params.value.value() > U256::zero()
{
return Err(vm::Error::MutableCallInStaticContext);
@@ -909,7 +909,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
code: Some(Arc::new(t.data.clone())),
code_version: schedule.latest_version,
data: None,
action_type: ActionType::Create,
call_type: CallType::None,
params_type: vm::ParamsType::Embedded,
};
let res = self.create(params, &mut substate, &mut tracer, &mut vm_tracer);
@@ -932,7 +932,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
code_hash: self.state.code_hash(address)?,
code_version: self.state.code_version(address)?,
data: Some(t.data.clone()),
action_type: ActionType::Call,
call_type: CallType::Call,
params_type: vm::ParamsType::Separate,
};
let res = self.call(params, &mut substate, &mut tracer, &mut vm_tracer);
@@ -1236,7 +1236,7 @@ mod tests {
use parity_crypto::publickey::{Generator, Random};
use evm::{Factory, evm_test, evm_test_ignore};
use macros::vec_into;
use vm::{ActionParams, ActionValue, EnvInfo, CreateContractAddress};
use vm::{ActionParams, ActionValue, CallType, EnvInfo, CreateContractAddress};
use ::trace::{
trace,
FlatTrace, Tracer, NoopTracer, ExecutiveTracer,
@@ -1414,7 +1414,7 @@ mod tests {
params.gas = U256::from(100_000);
params.code = Some(Arc::new(code));
params.value = ActionValue::Transfer(U256::from(100));
params.action_type = ActionType::Call;
params.call_type = CallType::Call;
let mut state = get_temp_state();
state.add_balance(&sender, &U256::from(100), CleanupMode::NoEmpty).unwrap();
let info = EnvInfo::default();
@@ -1434,7 +1434,7 @@ mod tests {
value: 100.into(),
gas: 100_000.into(),
input: vec![],
call_type: Some(trace::CallType::Call)
call_type: CallType::Call
}),
result: trace::Res::Call(trace::CallResult {
gas_used: 33021.into(),
@@ -1449,7 +1449,7 @@ mod tests {
value: 1.into(),
gas: 66560.into(),
input: vec![],
call_type: Some(trace::CallType::Call)
call_type: CallType::Call
}), result: trace::Res::Call(trace::CallResult {
gas_used: 600.into(),
output: vec![0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 156, 17, 133, 165, 197, 233, 252, 84, 97, 40, 8, 151, 126, 232, 245, 72, 178, 37, 141, 49]
@@ -1498,7 +1498,7 @@ mod tests {
params.gas = U256::from(100_000);
params.code = Some(Arc::new(code));
params.value = ActionValue::Transfer(U256::from(100));
params.action_type = ActionType::Call;
params.call_type = CallType::Call;
let mut state = get_temp_state();
state.add_balance(&sender, &U256::from(100), CleanupMode::NoEmpty).unwrap();
let info = EnvInfo::default();
@@ -1524,7 +1524,7 @@ mod tests {
value: 100.into(),
gas: 100000.into(),
input: vec![],
call_type: Some(trace::CallType::Call),
call_type: CallType::Call,
}),
result: trace::Res::Call(trace::CallResult {
gas_used: U256::from(55_248),
@@ -1537,8 +1537,7 @@ mod tests {
from: Address::from_str("b010143a42d5980c7e5ef0e4a4416dc098a4fed3").unwrap(),
value: 23.into(),
gas: 67979.into(),
init: vec![96, 16, 128, 96, 12, 96, 0, 57, 96, 0, 243, 0, 96, 0, 53, 84, 21, 96, 9, 87, 0, 91, 96, 32, 53, 96, 0, 53, 85],
creation_method: Some(trace::CreationMethod::Create),
init: vec![96, 16, 128, 96, 12, 96, 0, 57, 96, 0, 243, 0, 96, 0, 53, 84, 21, 96, 9, 87, 0, 91, 96, 32, 53, 96, 0, 53, 85]
}),
result: trace::Res::Create(trace::CreateResult {
gas_used: U256::from(3224),
@@ -1615,7 +1614,7 @@ mod tests {
params.gas = U256::from(100_000);
params.code = Some(Arc::new(code));
params.value = ActionValue::Transfer(U256::from(100));
params.action_type = ActionType::Call;
params.call_type = CallType::Call;
let mut state = get_temp_state();
state.add_balance(&sender, &U256::from(100), CleanupMode::NoEmpty).unwrap();
let info = EnvInfo::default();
@@ -1641,7 +1640,7 @@ mod tests {
value: 100.into(),
gas: 100_000.into(),
input: vec![],
call_type: Some(trace::CallType::Call),
call_type: CallType::Call,
}),
result: trace::Res::Call(trace::CallResult {
gas_used: U256::from(37_033),
@@ -1654,8 +1653,7 @@ mod tests {
from: Address::from_str("b010143a42d5980c7e5ef0e4a4416dc098a4fed3").unwrap(),
value: 23.into(),
gas: 66_917.into(),
init: vec![0x60, 0x01, 0x60, 0x00, 0xfd],
creation_method: Some(trace::CreationMethod::Create),
init: vec![0x60, 0x01, 0x60, 0x00, 0xfd]
}),
result: trace::Res::FailedCreate(vm::Error::Reverted.into()),
}];
@@ -1713,7 +1711,6 @@ mod tests {
value: 100.into(),
gas: params.gas,
init: vec![96, 16, 128, 96, 12, 96, 0, 57, 96, 0, 243, 0, 96, 0, 53, 84, 21, 96, 9, 87, 0, 91, 96, 32, 53, 96, 0, 53, 85],
creation_method: Some(trace::CreationMethod::Create),
}),
result: trace::Res::Create(trace::CreateResult {
gas_used: U256::from(3224),

View File

@@ -29,7 +29,7 @@ use common_types::{
};
use trace::{Tracer, VMTracer};
use vm::{
self, ActionParams, ActionValue, EnvInfo, ActionType, Schedule,
self, ActionParams, ActionValue, EnvInfo, CallType, Schedule,
Ext, ContractCreateResult, MessageCallResult, CreateContractAddress,
ReturnData, TrapKind
};
@@ -193,7 +193,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash,
code_version,
data: Some(data.as_bytes().to_vec()),
action_type: ActionType::Call,
call_type: CallType::Call,
params_type: vm::ParamsType::Separate,
};
@@ -241,12 +241,6 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
}
};
let create_type = match address_scheme {
CreateContractAddress::FromSenderAndNonce => ActionType::Create,
CreateContractAddress::FromSenderSaltAndCodeHash(_) => ActionType::Create2,
CreateContractAddress::FromSenderAndCodeHash => ActionType::Create2,
};
// prepare the params
let params = ActionParams {
code_address: address.clone(),
@@ -260,7 +254,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash,
code_version: *parent_version,
data: None,
action_type: create_type,
call_type: CallType::None,
params_type: vm::ParamsType::Embedded,
};
@@ -291,7 +285,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
value: Option<U256>,
data: &[u8],
code_address: &Address,
call_type: ActionType,
call_type: CallType,
trap: bool,
) -> ::std::result::Result<MessageCallResult, TrapKind> {
trace!(target: "externalities", "call");
@@ -317,7 +311,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash,
code_version,
data: Some(data.to_vec()),
action_type: call_type,
call_type,
params_type: vm::ParamsType::Separate,
};
@@ -463,7 +457,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
mod tests {
use std::str::FromStr;
use ethereum_types::{U256, Address};
use evm::{EnvInfo, Ext, ActionType};
use evm::{EnvInfo, Ext, CallType};
use account_state::State;
use ethcore::test_helpers::get_temp_state;
use trace::{NoopTracer, NoopVMTracer};
@@ -597,7 +591,7 @@ mod tests {
Some("0000000000000000000000000000000000000000000000000000000000150000".parse::<U256>().unwrap()),
&[],
&Address::zero(),
ActionType::Call,
CallType::Call,
false,
).ok().unwrap();
}

View File

@@ -34,7 +34,7 @@ use common_types::{
errors::{EngineError, EthcoreError as Error},
transaction::{self, SYSTEM_ADDRESS, UNSIGNED_SENDER, UnverifiedTransaction, SignedTransaction},
};
use vm::{ActionType, ActionParams, ActionValue, ParamsType};
use vm::{CallType, ActionParams, ActionValue, ParamsType};
use vm::{EnvInfo, Schedule};
use account_state::CleanupMode;
@@ -141,7 +141,7 @@ impl Machine {
value: Option<ActionValue>,
gas: U256,
data: Option<Vec<u8>>,
action_type: Option<ActionType>,
call_type: Option<CallType>,
) -> Result<Vec<u8>, Error> {
let env_info = {
let mut env_info = block.env_info();
@@ -163,7 +163,7 @@ impl Machine {
code_hash,
code_version: 0.into(),
data,
action_type: action_type.unwrap_or(ActionType::Call),
call_type: call_type.unwrap_or(CallType::Call),
params_type: ParamsType::Separate,
};
let schedule = self.schedule(env_info.number);