[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

@@ -23,7 +23,7 @@ use ethcore::test_helpers::TestBlockChainClient;
use ethereum_types::{Address, H256};
use types::transaction::CallError;
use trace::trace::CallType;
use vm::CallType;
use jsonrpc_core::IoHandler;
use v1::tests::helpers::{TestMinerService};
@@ -44,7 +44,7 @@ fn io() -> Tester {
value: 0x1.into(),
gas: 0x100.into(),
input: vec![1, 2, 3],
call_type: Some(CallType::Call),
call_type: CallType::Call,
}),
result: Res::None,
subtraces: 0,

View File

@@ -24,6 +24,7 @@ use serde::ser::SerializeStruct;
use serde::{Serialize, Serializer};
use types::account_diff;
use types::state_diff;
use vm;
use v1::types::Bytes;
@@ -213,7 +214,6 @@ impl From<state_diff::StateDiff> for StateDiff {
/// Create response
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Create {
/// Sender
from: H160,
@@ -223,9 +223,6 @@ pub struct Create {
gas: U256,
/// Initialization code
init: Bytes,
// Create Type
#[serde(skip_serializing_if="Option::is_none")]
creation_method: Option<CreationMethod>,
}
impl From<trace::Create> for Create {
@@ -235,7 +232,6 @@ impl From<trace::Create> for Create {
value: c.value,
gas: c.gas,
init: Bytes::new(c.init),
creation_method: c.creation_method.map(|c| c.into()),
}
}
}
@@ -244,6 +240,8 @@ impl From<trace::Create> for Create {
#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CallType {
/// None
None,
/// Call
Call,
/// Call code
@@ -254,32 +252,14 @@ pub enum CallType {
StaticCall,
}
impl From<trace::CallType> for CallType {
fn from(c: trace::CallType) -> Self {
impl From<vm::CallType> for CallType {
fn from(c: vm::CallType) -> Self {
match c {
trace::CallType::Call => CallType::Call,
trace::CallType::CallCode => CallType::CallCode,
trace::CallType::DelegateCall => CallType::DelegateCall,
trace::CallType::StaticCall => CallType::StaticCall,
}
}
}
/// Create type.
#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CreationMethod {
/// Create
Create,
/// Create2
Create2,
}
impl From<trace::CreationMethod> for CreationMethod {
fn from(c: trace::CreationMethod) -> Self {
match c {
trace::CreationMethod::Create => CreationMethod::Create,
trace::CreationMethod::Create2 => CreationMethod::Create2,
vm::CallType::None => CallType::None,
vm::CallType::Call => CallType::Call,
vm::CallType::CallCode => CallType::CallCode,
vm::CallType::DelegateCall => CallType::DelegateCall,
vm::CallType::StaticCall => CallType::StaticCall,
}
}
}
@@ -299,7 +279,7 @@ pub struct Call {
/// Input data
input: Bytes,
/// The type of the call.
call_type: Option<CallType>,
call_type: CallType,
}
impl From<trace::Call> for Call {
@@ -310,7 +290,7 @@ impl From<trace::Call> for Call {
value: c.value,
gas: c.gas,
input: c.input.into(),
call_type: c.call_type.map(|c| c.into()),
call_type: c.call_type.into(),
}
}
}
@@ -701,7 +681,7 @@ mod tests {
value: 6.into(),
gas: 7.into(),
input: Bytes::new(vec![0x12, 0x34]),
call_type: Some(CallType::Call),
call_type: CallType::Call,
}),
result: Res::Call(CallResult {
gas_used: 8.into(),
@@ -727,7 +707,7 @@ mod tests {
value: 6.into(),
gas: 7.into(),
input: Bytes::new(vec![0x12, 0x34]),
call_type: Some(CallType::Call),
call_type: CallType::Call,
}),
result: Res::FailedCall(TraceError::OutOfGas),
trace_address: vec![10],
@@ -749,7 +729,6 @@ mod tests {
value: 6.into(),
gas: 7.into(),
init: Bytes::new(vec![0x12, 0x34]),
creation_method: Some(CreationMethod::Create),
}),
result: Res::Create(CreateResult {
gas_used: 8.into(),
@@ -764,7 +743,7 @@ mod tests {
block_hash: H256::from_low_u64_be(14),
};
let serialized = serde_json::to_string(&t).unwrap();
assert_eq!(serialized, r#"{"type":"create","action":{"from":"0x0000000000000000000000000000000000000004","value":"0x6","gas":"0x7","init":"0x1234","creationMethod":"create"},"result":{"gasUsed":"0x8","code":"0x5678","address":"0x00000000000000000000000000000000000000ff"},"traceAddress":[10],"subtraces":1,"transactionPosition":11,"transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
assert_eq!(serialized, r#"{"type":"create","action":{"from":"0x0000000000000000000000000000000000000004","value":"0x6","gas":"0x7","init":"0x1234"},"result":{"gasUsed":"0x8","code":"0x5678","address":"0x00000000000000000000000000000000000000ff"},"traceAddress":[10],"subtraces":1,"transactionPosition":11,"transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
}
#[test]
@@ -775,7 +754,6 @@ mod tests {
value: 6.into(),
gas: 7.into(),
init: Bytes::new(vec![0x12, 0x34]),
creation_method: Some(CreationMethod::Create),
}),
result: Res::FailedCreate(TraceError::OutOfGas),
trace_address: vec![10],
@@ -786,7 +764,7 @@ mod tests {
block_hash: H256::from_low_u64_be(14),
};
let serialized = serde_json::to_string(&t).unwrap();
assert_eq!(serialized, r#"{"type":"create","action":{"from":"0x0000000000000000000000000000000000000004","value":"0x6","gas":"0x7","init":"0x1234","creationMethod":"create"},"error":"Out of gas","traceAddress":[10],"subtraces":1,"transactionPosition":11,"transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
assert_eq!(serialized, r#"{"type":"create","action":{"from":"0x0000000000000000000000000000000000000004","value":"0x6","gas":"0x7","init":"0x1234"},"error":"Out of gas","traceAddress":[10],"subtraces":1,"transactionPosition":11,"transactionHash":"0x000000000000000000000000000000000000000000000000000000000000000c","blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#);
}
#[test]