[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

@@ -20,7 +20,7 @@ use bytes::Bytes;
use hash::{keccak, KECCAK_EMPTY};
use ethjson;
use action_type::ActionType;
use call_type::CallType;
use std::sync::Arc;
@@ -88,8 +88,8 @@ pub struct ActionParams {
pub code_version: U256,
/// Input data.
pub data: Option<Bytes>,
/// Type of action (e.g. CALL, DELEGATECALL, CREATE, etc.)
pub action_type: ActionType,
/// Type of call
pub call_type: CallType,
/// Param types encoding
pub params_type: ParamsType,
}
@@ -109,7 +109,7 @@ impl Default for ActionParams {
code: None,
code_version: U256::zero(),
data: None,
action_type: ActionType::Create,
call_type: CallType::None,
params_type: ParamsType::Separate,
}
}
@@ -130,7 +130,7 @@ impl From<ethjson::vm::Transaction> for ActionParams {
gas: t.gas.into(),
gas_price: t.gas_price.into(),
value: ActionValue::Transfer(t.value.into()),
action_type: ActionType::Call,
call_type: match address.is_zero() { true => CallType::None, false => CallType::Call }, // TODO @debris is this correct?
params_type: ParamsType::Separate,
}
}

View File

@@ -14,51 +14,47 @@
// You should have received a copy of the GNU General Public License
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
//! EVM action types.
//! EVM call types.
use rlp::{Encodable, Decodable, DecoderError, RlpStream, Rlp};
/// The type of the instruction.
/// The type of the call-like instruction.
#[derive(Debug, PartialEq, Clone)]
pub enum ActionType {
/// CREATE.
Create,
pub enum CallType {
/// Not a CALL.
None,
/// CALL.
Call,
/// CALLCODE.
CallCode,
/// DELEGATECALL.
DelegateCall,
/// STATICCALL.
/// STATICCALL
StaticCall,
/// CREATE2.
Create2
}
impl Encodable for ActionType {
impl Encodable for CallType {
fn rlp_append(&self, s: &mut RlpStream) {
let v = match *self {
ActionType::Create => 0u32,
ActionType::Call => 1,
ActionType::CallCode => 2,
ActionType::DelegateCall => 3,
ActionType::StaticCall => 4,
ActionType::Create2 => 5,
CallType::None => 0u32,
CallType::Call => 1,
CallType::CallCode => 2,
CallType::DelegateCall => 3,
CallType::StaticCall => 4,
};
Encodable::rlp_append(&v, s);
}
}
impl Decodable for ActionType {
impl Decodable for CallType {
fn decode(rlp: &Rlp) -> Result<Self, DecoderError> {
rlp.as_val().and_then(|v| Ok(match v {
0u32 => ActionType::Create,
1 => ActionType::Call,
2 => ActionType::CallCode,
3 => ActionType::DelegateCall,
4 => ActionType::StaticCall,
5 => ActionType::Create2,
_ => return Err(DecoderError::Custom("Invalid value of ActionType item")),
0u32 => CallType::None,
1 => CallType::Call,
2 => CallType::CallCode,
3 => CallType::DelegateCall,
4 => CallType::StaticCall,
_ => return Err(DecoderError::Custom("Invalid value of CallType item")),
}))
}
}
@@ -66,11 +62,11 @@ impl Decodable for ActionType {
#[cfg(test)]
mod tests {
use rlp::*;
use super::ActionType;
use super::CallType;
#[test]
fn encode_call_type() {
let ct = ActionType::Call;
let ct = CallType::Call;
let mut s = RlpStream::new_list(2);
s.append(&ct);
@@ -82,9 +78,9 @@ mod tests {
#[test]
fn should_encode_and_decode_call_type() {
let original = ActionType::Call;
let original = CallType::Call;
let encoded = encode(&original);
let decoded = decode(&encoded).expect("failure decoding ActionType");
let decoded = decode(&encoded).expect("failure decoding CallType");
assert_eq!(original, decoded);
}
}

View File

@@ -19,7 +19,7 @@
use std::sync::Arc;
use ethereum_types::{U256, H256, Address};
use bytes::Bytes;
use action_type::ActionType;
use call_type::CallType;
use env_info::EnvInfo;
use schedule::Schedule;
use return_data::ReturnData;
@@ -115,7 +115,7 @@ pub trait Ext {
value: Option<U256>,
data: &[u8],
code_address: &Address,
call_type: ActionType,
call_type: CallType,
trap: bool
) -> ::std::result::Result<MessageCallResult, TrapKind>;

View File

@@ -24,7 +24,7 @@ extern crate keccak_hash as hash;
extern crate patricia_trie_ethereum as ethtrie;
mod action_params;
mod action_type;
mod call_type;
mod env_info;
mod schedule;
mod ext;
@@ -34,7 +34,7 @@ mod error;
pub mod tests;
pub use action_params::{ActionParams, ActionValue, ParamsType};
pub use action_type::ActionType;
pub use call_type::CallType;
pub use env_info::{EnvInfo, LastHashes};
pub use schedule::{Schedule, VersionedSchedule, CleanDustMode, WasmCosts};
pub use ext::{Ext, MessageCallResult, ContractCreateResult, CreateContractAddress};

View File

@@ -20,7 +20,7 @@ use std::collections::{HashMap, HashSet};
use ethereum_types::{U256, H256, Address};
use bytes::Bytes;
use {
ActionType, Schedule, EnvInfo,
CallType, Schedule, EnvInfo,
ReturnData, Ext, ContractCreateResult, MessageCallResult,
CreateContractAddress, Result, GasLeft,
};
@@ -185,7 +185,7 @@ impl Ext for FakeExt {
value: Option<U256>,
data: &[u8],
code_address: &Address,
_call_type: ActionType,
_call_type: CallType,
_trap: bool,
) -> ::std::result::Result<MessageCallResult, TrapKind> {
self.calls.insert(FakeCall {