Fix tests

This commit is contained in:
Vurich
2017-06-28 16:41:08 +02:00
parent 3d8dc11442
commit 01ce28bc9a
24 changed files with 64 additions and 64 deletions

View File

@@ -900,7 +900,7 @@ mod tests {
fn check_header_by_hash() {
let mut header = Header::new();
header.set_number(10_000);
header.set_extra_data(b"test_header".into_vec());
header.set_extra_data(b"test_header".to_vec());
let hash = header.hash();
let raw_header = encoded::Header::new(::rlp::encode(&header).into_vec());
@@ -953,7 +953,7 @@ mod tests {
let mut db = MemoryDB::new();
let mut header = Header::new();
header.set_number(123_456);
header.set_extra_data(b"test_header".into_vec());
header.set_extra_data(b"test_header".to_vec());
let addr = Address::random();
let rand_acc = || {

View File

@@ -746,9 +746,9 @@ mod tests {
let last_hashes = Arc::new(vec![genesis_header.hash()]);
let mut open_block = OpenBlock::new(engine, Default::default(), false, db, &genesis_header, last_hashes.clone(), Address::zero(), (3141562.into(), 31415620.into()), vec![], false).unwrap();
let mut uncle1_header = Header::new();
uncle1_header.set_extra_data(b"uncle1".into_vec());
uncle1_header.set_extra_data(b"uncle1".to_vec());
let mut uncle2_header = Header::new();
uncle2_header.set_extra_data(b"uncle2".into_vec());
uncle2_header.set_extra_data(b"uncle2".to_vec());
open_block.push_uncle(uncle1_header).unwrap();
open_block.push_uncle(uncle2_header).unwrap();
let b = open_block.close_and_lock().seal(engine, vec![]).unwrap();

View File

@@ -698,7 +698,7 @@ mod tests {
vec![
::rlp::encode(&view).into_vec(),
::rlp::encode(&H520::from(signature)).into_vec(),
::rlp::EMPTY_LIST_RLP.into_vec()
::rlp::EMPTY_LIST_RLP.to_vec()
]
}
@@ -812,7 +812,7 @@ mod tests {
let vote_info = message_info_rlp(&VoteStep::new(2, 0, Step::Precommit), Some(header.bare_hash()));
let signature1 = tap.sign(proposer, None, vote_info.sha3()).unwrap();
seal[1] = ::rlp::NULL_RLP.into_vec();
seal[1] = ::rlp::NULL_RLP.to_vec();
seal[2] = ::rlp::encode_list(&vec![H520::from(signature1.clone())]).into_vec();
header.set_seal(seal.clone());

View File

@@ -185,7 +185,7 @@ impl <M: Message + Default + Encodable + Debug> VoteCollector<M> {
guard
.iter()
.take_while(|&(r, _)| r <= round)
.map(|(_, c)| c.messages.iter().filter(|m| m.is_broadcastable()).map(|m| ::rlp::encode(m).into_vec()).collect::<Vec<_>>())
.map(|(_, c)| c.messages.iter().filter(|m| m.is_broadcastable()).map(|m| ::rlp::encode(m).to_vec()).collect::<Vec<_>>())
.fold(Vec::new(), |mut acc, mut messages| { acc.append(&mut messages); acc })
}
@@ -279,7 +279,7 @@ mod tests {
// Wrong round, same signature.
random_vote(&collector, signatures[1].clone(), 7, bh.clone());
assert_eq!(signatures[0..1].into_vec(), collector.round_signatures(&propose_round, &bh.unwrap()));
assert_eq!(signatures[0..1].to_vec(), collector.round_signatures(&propose_round, &bh.unwrap()));
assert_eq!(signatures[1..3].iter().collect::<HashSet<_>>(), collector.round_signatures(&commit_round, &bh.unwrap()).iter().collect::<HashSet<_>>());
}

View File

@@ -123,7 +123,7 @@ impl Ext for FakeExt {
sender_address: None,
receive_address: None,
value: Some(*value),
data: code.into_vec(),
data: code.to_vec(),
code_address: None
});
ContractCreateResult::Failed
@@ -146,7 +146,7 @@ impl Ext for FakeExt {
sender_address: Some(sender_address.clone()),
receive_address: Some(receive_address.clone()),
value: value,
data: data.into_vec(),
data: data.to_vec(),
code_address: Some(code_address.clone())
});
MessageCallResult::Success(*gas, ReturnData::empty())
@@ -163,7 +163,7 @@ impl Ext for FakeExt {
fn log(&mut self, topics: Vec<H256>, data: &[u8]) -> evm::Result<()> {
self.logs.push(FakeLogEntry {
topics: topics,
data: data.into_vec()
data: data.to_vec()
});
Ok(())
}
@@ -463,7 +463,7 @@ fn test_blockhash_eip210(factory: super::Factory) {
value: ActionValue::Transfer(0.into()),
code: Some(blockhash_contract_code.clone()),
code_hash: blockhash_contract_code_hash,
data: Some(H256::from(i - 1).into_vec()),
data: Some(H256::from(i - 1).to_vec()),
call_type: CallType::Call,
};
let mut ex = Executive::new(&mut state, &env_info, &engine);

View File

@@ -118,7 +118,7 @@ impl<'a, T: 'a, V: 'a, B: 'a, E: 'a> Ext for TestExt<'a, T, V, B, E>
fn create(&mut self, gas: &U256, value: &U256, code: &[u8], address: CreateContractAddress) -> ContractCreateResult {
self.callcreates.push(CallCreate {
data: code.into_vec(),
data: code.to_vec(),
destination: None,
gas_limit: *gas,
value: *value
@@ -138,7 +138,7 @@ impl<'a, T: 'a, V: 'a, B: 'a, E: 'a> Ext for TestExt<'a, T, V, B, E>
_call_type: CallType
) -> MessageCallResult {
self.callcreates.push(CallCreate {
data: data.into_vec(),
data: data.to_vec(),
destination: Some(receive_address.clone()),
gas_limit: *gas,
value: value.unwrap()

View File

@@ -339,7 +339,7 @@ mod tests {
assert_eq!(acc, account2);
let (acc, maybe_code) = from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1, H256::zero()).unwrap();
assert_eq!(maybe_code, Some(b"this is definitely code".into_vec()));
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
assert_eq!(acc, account1);
}

View File

@@ -173,7 +173,7 @@ mod tests {
gas_price: U256::from(3000),
gas: U256::from(50_000),
value: U256::from(1),
data: b"Hello!".into_vec()
data: b"Hello!".to_vec()
}.fake_sign(Address::from(0x69));
let t2 = Transaction {

View File

@@ -1826,14 +1826,14 @@ mod tests {
let mut state = get_temp_state();
state.require_or_from(&a, false, ||Account::new_contract(42.into(), 0.into()), |_|{}).unwrap();
state.init_code(&a, vec![1, 2, 3]).unwrap();
assert_eq!(state.code(&a).unwrap(), Some(Arc::new([1u8, 2, 3].into_vec())));
assert_eq!(state.code(&a).unwrap(), Some(Arc::new(vec![1u8, 2, 3])));
state.commit().unwrap();
assert_eq!(state.code(&a).unwrap(), Some(Arc::new([1u8, 2, 3].into_vec())));
assert_eq!(state.code(&a).unwrap(), Some(Arc::new(vec![1u8, 2, 3])));
state.drop()
};
let state = State::from_existing(db, root, U256::from(0u8), Default::default()).unwrap();
assert_eq!(state.code(&a).unwrap(), Some(Arc::new([1u8, 2, 3].into_vec())));
assert_eq!(state.code(&a).unwrap(), Some(Arc::new(vec![1u8, 2, 3])));
}
#[test]
@@ -2040,7 +2040,7 @@ mod tests {
let mut state = get_temp_state();
let a: Address = 0xa.into();
state.init_code(&a, b"abcdefg".into_vec()).unwrap();;
state.init_code(&a, b"abcdefg".to_vec()).unwrap();;
state.add_balance(&a, &256.into(), CleanupMode::NoEmpty).unwrap();
state.set_storage(&a, 0xb.into(), 0xc.into()).unwrap();

View File

@@ -570,7 +570,7 @@ fn signing() {
gas_price: U256::from(3000),
gas: U256::from(50_000),
value: U256::from(1),
data: b"Hello!".into_vec()
data: b"Hello!".to_vec()
}.sign(&key.secret(), None);
assert_eq!(Address::from(key.public().sha3()), t.sender());
assert_eq!(t.network_id(), None);
@@ -584,7 +584,7 @@ fn fake_signing() {
gas_price: U256::from(3000),
gas: U256::from(50_000),
value: U256::from(1),
data: b"Hello!".into_vec()
data: b"Hello!".to_vec()
}.fake_sign(Address::from(0x69));
assert_eq!(Address::from(0x69), t.sender());
assert_eq!(t.network_id(), None);
@@ -604,7 +604,7 @@ fn should_recover_from_network_specific_signing() {
gas_price: U256::from(3000),
gas: U256::from(50_000),
value: U256::from(1),
data: b"Hello!".into_vec()
data: b"Hello!".to_vec()
}.sign(&key.secret(), Some(69));
assert_eq!(Address::from(key.public().sha3()), t.sender());
assert_eq!(t.network_id(), Some(69));

View File

@@ -338,7 +338,7 @@ mod tests {
fn block_header_data(&self, hash: &H256) -> Option<encoded::Header> {
self.block(hash)
.map(|b| b.header_view().rlp().as_raw().into_vec())
.map(|b| b.header_view().rlp().as_raw().to_vec())
.map(encoded::Header::new)
}