From 9374e310728125dddaa3aef461caab4f5f87b5fa Mon Sep 17 00:00:00 2001 From: Anton Gavrilov Date: Mon, 31 Jul 2017 12:06:38 +0200 Subject: [PATCH] Miner field renamed to author --- ethcore/src/trace/executive_tracer.rs | 4 ++-- ethcore/src/trace/mod.rs | 2 +- ethcore/src/trace/types/filter.rs | 4 ++-- ethcore/src/trace/types/flat.rs | 4 ++-- ethcore/src/trace/types/trace.rs | 10 +++++----- rpc/src/v1/types/trace.rs | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ethcore/src/trace/executive_tracer.rs b/ethcore/src/trace/executive_tracer.rs index 65d8ebe3e..a6a5a95ea 100644 --- a/ethcore/src/trace/executive_tracer.rs +++ b/ethcore/src/trace/executive_tracer.rs @@ -163,11 +163,11 @@ impl Tracer for ExecutiveTracer { self.traces.push(trace); } - fn trace_reward(&mut self, miner: Address, value: U256, reward_type: RewardType) { + fn trace_reward(&mut self, author: Address, value: U256, reward_type: RewardType) { let trace = FlatTrace { subtraces: 0, action: Action::Reward(Reward { - miner: miner, + author: author, value: value, reward_type: reward_type, }), diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index 2b318a260..e3c8a9bf0 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -82,7 +82,7 @@ pub trait Tracer: Send { fn trace_suicide(&mut self, address: Address, balance: U256, refund_address: Address); /// Stores reward info. - fn trace_reward(&mut self, miner: Address, value: U256, reward_type: RewardType); + fn trace_reward(&mut self, author: Address, value: U256, reward_type: RewardType); /// Spawn subtracer which will be used to trace deeper levels of execution. fn subtracer(&self) -> Self where Self: Sized; diff --git a/ethcore/src/trace/types/filter.rs b/ethcore/src/trace/types/filter.rs index 68ab30a31..9ab553eca 100644 --- a/ethcore/src/trace/types/filter.rs +++ b/ethcore/src/trace/types/filter.rs @@ -130,7 +130,7 @@ impl Filter { from_matches && to_matches }, Action::Reward(ref reward) => { - let to_matches = self.to_address.matches(&reward.miner); + let to_matches = self.to_address.matches(&reward.author); to_matches } } @@ -348,7 +348,7 @@ mod tests { let trace = FlatTrace { action: Action::Reward(Reward { - miner: 2.into(), + author: 2.into(), value: 100.into(), reward_type: RewardType::Block, }), diff --git a/ethcore/src/trace/types/flat.rs b/ethcore/src/trace/types/flat.rs index 29d0eddb9..329efc94b 100644 --- a/ethcore/src/trace/types/flat.rs +++ b/ethcore/src/trace/types/flat.rs @@ -241,7 +241,7 @@ mod tests { let flat_trace3 = FlatTrace { action: Action::Reward(Reward { - miner: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(), + author: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(), value: 10.into(), reward_type: RewardType::Uncle, }), @@ -252,7 +252,7 @@ mod tests { let flat_trace4 = FlatTrace { action: Action::Reward(Reward { - miner: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(), + author: "412fda7643b37d436cb40628f6dbbb80a07267ed".parse().unwrap(), value: 10.into(), reward_type: RewardType::Block, }), diff --git a/ethcore/src/trace/types/trace.rs b/ethcore/src/trace/types/trace.rs index faa4ca78f..879f51e49 100644 --- a/ethcore/src/trace/types/trace.rs +++ b/ethcore/src/trace/types/trace.rs @@ -256,8 +256,8 @@ impl Decodable for RewardType { #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "ipc", binary)] pub struct Reward { - /// Miner's address. - pub miner: Address, + /// Author's address. + pub author: Address, /// Reward amount. pub value: U256, /// Reward type. @@ -267,14 +267,14 @@ pub struct Reward { impl Reward { /// Return reward action bloom. pub fn bloom(&self) -> LogBloom { - LogBloom::from_bloomed(&self.miner.sha3()) + LogBloom::from_bloomed(&self.author.sha3()) } } impl Encodable for Reward { fn rlp_append(&self, s: &mut RlpStream) { s.begin_list(3); - s.append(&self.miner); + s.append(&self.author); s.append(&self.value); s.append(&self.reward_type); } @@ -283,7 +283,7 @@ impl Encodable for Reward { impl Decodable for Reward { fn decode(rlp: &UntrustedRlp) -> Result { let res = Reward { - miner: rlp.val_at(0)?, + author: rlp.val_at(0)?, value: rlp.val_at(1)?, reward_type: rlp.val_at(2)?, }; diff --git a/rpc/src/v1/types/trace.rs b/rpc/src/v1/types/trace.rs index 5c656f4ec..aafe39f03 100644 --- a/rpc/src/v1/types/trace.rs +++ b/rpc/src/v1/types/trace.rs @@ -327,8 +327,8 @@ impl From for RewardType { /// Reward action #[derive(Debug, Serialize)] pub struct Reward { - /// Miner's address. - pub miner: H160, + /// Author's address. + pub author: H160, /// Reward amount. pub value: U256, /// Reward type. @@ -339,7 +339,7 @@ pub struct Reward { impl From for Reward { fn from(r: trace::Reward) -> Self { Reward { - miner: r.miner.into(), + author: r.author.into(), value: r.value.into(), reward_type: r.reward_type.into(), } @@ -767,7 +767,7 @@ mod tests { fn test_trace_reward_serialize() { let t = LocalizedTrace { action: Action::Reward(Reward { - miner: 4.into(), + author: 4.into(), value: 6.into(), reward_type: RewardType::Block, }), @@ -780,7 +780,7 @@ mod tests { block_hash: 14.into(), }; let serialized = serde_json::to_string(&t).unwrap(); - assert_eq!(serialized, r#"{"type":"reward","action":{"miner":"0x0000000000000000000000000000000000000004","value":"0x6","rewardType":"block"},"result":null,"traceAddress":[10],"subtraces":1,"transactionPosition":null,"transactionHash":null,"blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#); + assert_eq!(serialized, r#"{"type":"reward","action":{"author":"0x0000000000000000000000000000000000000004","value":"0x6","rewardType":"block"},"result":null,"traceAddress":[10],"subtraces":1,"transactionPosition":null,"transactionHash":null,"blockNumber":13,"blockHash":"0x000000000000000000000000000000000000000000000000000000000000000e"}"#); } #[test]