fix(core): GethTrace shouldn't have 0x prefix for return_value (#1705)
This commit is contained in:
parent
9773a76dd4
commit
78e406b261
|
@ -1,5 +1,5 @@
|
||||||
use crate::types::{Bytes, H256, U256};
|
use crate::types::{Bytes, H256, U256};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
// https://github.com/ethereum/go-ethereum/blob/a9ef135e2dd53682d106c6a2aede9187026cc1de/eth/tracers/logger/logger.go#L406-L411
|
// https://github.com/ethereum/go-ethereum/blob/a9ef135e2dd53682d106c6a2aede9187026cc1de/eth/tracers/logger/logger.go#L406-L411
|
||||||
|
@ -7,7 +7,7 @@ use std::collections::BTreeMap;
|
||||||
pub struct GethTrace {
|
pub struct GethTrace {
|
||||||
pub failed: bool,
|
pub failed: bool,
|
||||||
pub gas: u64,
|
pub gas: u64,
|
||||||
#[serde(rename = "returnValue")]
|
#[serde(serialize_with = "serialize_bytes", rename = "returnValue")]
|
||||||
pub return_value: Bytes,
|
pub return_value: Bytes,
|
||||||
#[serde(rename = "structLogs")]
|
#[serde(rename = "structLogs")]
|
||||||
pub struct_logs: Vec<StructLog>,
|
pub struct_logs: Vec<StructLog>,
|
||||||
|
@ -54,3 +54,11 @@ pub struct GethDebugTracingOptions {
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub timeout: Option<String>,
|
pub timeout: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn serialize_bytes<S, T>(x: T, s: S) -> Result<S::Ok, S::Error>
|
||||||
|
where
|
||||||
|
S: Serializer,
|
||||||
|
T: AsRef<[u8]>,
|
||||||
|
{
|
||||||
|
s.serialize_str(&hex::encode(x.as_ref()))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue