From bbb858b3862856bf1d18b559b263075be0149d89 Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Tue, 31 May 2016 21:38:05 +0200 Subject: [PATCH] address small syntax breakages --- ethcore/src/state.rs | 24 ++++++++++++------------ ethcore/src/state_diff.rs | 8 ++++---- ethcore/src/tests/helpers.rs | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ethcore/src/state.rs b/ethcore/src/state.rs index 6e0e4f2f6..c099b17a5 100644 --- a/ethcore/src/state.rs +++ b/ethcore/src/state.rs @@ -389,7 +389,7 @@ fn should_apply_create_transaction() { data: FromHex::from_hex("601080600c6000396000f3006000355415600957005b60203560003555").unwrap(), }.sign(&"".sha3()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -450,7 +450,7 @@ fn should_trace_failed_create_transaction() { data: FromHex::from_hex("5b600056").unwrap(), }.sign(&"".sha3()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -489,7 +489,7 @@ fn should_trace_call_transaction() { }.sign(&"".sha3()); state.init_code(&0xa.into(), FromHex::from_hex("6000").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -531,7 +531,7 @@ fn should_trace_basic_call_transaction() { data: vec![], }.sign(&"".sha3()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -745,7 +745,7 @@ fn should_trace_failed_call_transaction() { }.sign(&"".sha3()); state.init_code(&0xa.into(), FromHex::from_hex("5b600056").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -788,7 +788,7 @@ fn should_trace_call_with_subcall_transaction() { state.init_code(&0xa.into(), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()); state.init_code(&0xb.into(), FromHex::from_hex("6000").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -845,7 +845,7 @@ fn should_trace_call_with_basic_subcall_transaction() { }.sign(&"".sha3()); state.init_code(&0xa.into(), FromHex::from_hex("60006000600060006045600b6000f1").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -899,7 +899,7 @@ fn should_not_trace_call_with_invalid_basic_subcall_transaction() { }.sign(&"".sha3()); state.init_code(&0xa.into(), FromHex::from_hex("600060006000600060ff600b6000f1").unwrap()); // not enough funds. - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -943,7 +943,7 @@ fn should_trace_failed_subcall_transaction() { state.init_code(&0xa.into(), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()); state.init_code(&0xb.into(), FromHex::from_hex("5b600056").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -999,7 +999,7 @@ fn should_trace_call_with_subcall_with_subcall_transaction() { state.init_code(&0xa.into(), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()); state.init_code(&0xb.into(), FromHex::from_hex("60006000600060006000600c602b5a03f1").unwrap()); state.init_code(&0xc.into(), FromHex::from_hex("6000").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { @@ -1032,7 +1032,7 @@ fn should_trace_call_with_subcall_with_subcall_transaction() { depth: 2, action: trace::Action::Call(trace::Call { from: 0xb.into(), - to: 0xb.into(), + to: 0xc.into(), value: 0.into(), gas: 78868.into(), input: vec![], @@ -1072,7 +1072,7 @@ fn should_trace_failed_subcall_with_subcall_transaction() { state.init_code(&0xa.into(), FromHex::from_hex("60006000600060006000600b602b5a03f1").unwrap()); state.init_code(&0xb.into(), FromHex::from_hex("60006000600060006000600c602b5a03f1505b601256").unwrap()); state.init_code(&0xc.into(), FromHex::from_hex("6000").unwrap()); - state.add_balance(t.sender().as_ref().unwrap(), &100.into()); + state.add_balance(t.sender().as_ref().unwrap(), &(100.into())); let vm_factory = Default::default(); let result = state.apply(&info, &engine, &vm_factory, &t, true).unwrap(); let expected_trace = Some(Trace { diff --git a/ethcore/src/state_diff.rs b/ethcore/src/state_diff.rs index 1c1975e70..c362d96d1 100644 --- a/ethcore/src/state_diff.rs +++ b/ethcore/src/state_diff.rs @@ -83,7 +83,7 @@ mod test { let a = PodState::from(map![ 1.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); let b = PodState::from(map![ 1.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]), - 2.into() => PodAccount::new(69.into(), 0.into(),, vec![], map![]) + 2.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); assert_eq!(StateDiff::diff_pod(&a, &b), StateDiff(map![ 2.into() => AccountDiff{ @@ -107,11 +107,11 @@ mod test { fn change_with_unchanged() { let a = PodState::from(map![ 1.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]), - 2.into() => PodAccount::new(69.into(), 0.into(),, vec![], map![]) + 2.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); let b = PodState::from(map![ - 1.into() => PodAccount::new(69.into(), 1.into(),, vec![], map![]), - 2.into() => PodAccount::new(69.into(), 0.into(),, vec![], map![]) + 1.into() => PodAccount::new(69.into(), 1.into(), vec![], map![]), + 2.into() => PodAccount::new(69.into(), 0.into(), vec![], map![]) ]); assert_eq!(StateDiff::diff_pod(&a, &b), StateDiff(map![ 1.into() => AccountDiff{ diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index 6a370e49f..22282ccdd 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -99,7 +99,7 @@ pub fn create_test_block(header: &Header) -> Bytes { fn create_unverifiable_block_header(order: u32, parent_hash: H256) -> Header { let mut header = Header::new(); header.gas_limit = 0.into(); - header.difficulty = order * 100.into(); + header.difficulty = (order * 100).into(); header.timestamp = (order * 10) as u64; header.number = order as u64; header.parent_hash = parent_hash;