Upgrade ethereum types (#10670)
* cargo upgrade "ethereum-types" --all --allow-prerelease * [ethash] fix compilation errors * [ethkey] fix compilation errors * [journaldb] fix compilation errors * [dir] fix compilation errors * [ethabi] update to 0.7 * wip * [eip-712] fix compilation errors * [ethjson] fix compilation errors * [Cargo.toml] add TODO to remove patches * [ethstore] fix compilation errors * use patched keccak-hash with new primitive-types * wip * [ethcore-network-devp2p] fix compilation errors * [vm] fix compilation errors * [common-types, evm, wasm] fix compilation errors * [ethcore-db] Require AsRef instead of Deref for keys * [ethcore-blockchain] fix some compilation errors * [blooms-db] fix compilation errors Thanks a lot @dvdplm :) * we don't need no rlp ethereum feature * [ethcore] fix some compilation errors * [parity-ipfs-api] fix compilation error * [ethcore-light] fix compilation errors * [Cargo.lock] update parity-common * [ethcore-private-tx] fix some compilation errors * wip * [ethcore-private-tx] fix compilation errors * [parity-updater] fix compilation errors * [parity-rpc] fix compilation errors * [parity-bin] fix other compilation errors * update to new ethereum-types * update keccak-hash * [fastmap] fix compilation in tests * [blooms-db] fix compilation in tests * [common-types] fix compilation in tests * [triehash-ethereum] fix compilation in tests * [ethkey] fix compilation in tests * [pwasm-run-test] fix compilation errors * [wasm] fix compilation errors * [ethjson] fix compilation in tests * [eip-712] fix compilation in tests * [ethcore-blockchain] fix compilation in tests * [ethstore] fix compilation in tests * [ethstore-accounts] fix compilation in tests * [parity-hash-fetch] fix compilation in tests * [parity-whisper] fix compilation in tests * [ethcore-miner] fix compilation in tests * [ethcore-network-devp2p] fix compilation in tests * [*] upgrade rand to 0.6 * [evm] get rid of num-bigint conversions * [ethcore] downgrade trie-standardmap and criterion * [ethcore] fix some warnings * [ethcore] fix compilation in tests * [evmbin] fix compilation in tests * [updater] fix compilation in tests * [ethash] fix compilation in tests * [ethcore-secretstore] fix compilation in tests * [ethcore-sync] fix compilation in tests * [parity-rpc] fix compilation in tests * [ethcore] finally fix compilation in tests FUCK YEAH!!! * [ethstore] lazy_static is unused * [ethcore] fix test * fix up bad merge * [Cargo.toml] remove unused patches * [*] replace some git dependencies with crates.io * [Cargo.toml] remove unused lazy_static * [*] clean up * [ethcore] fix transaction_filter_deprecated test * [private-tx] fix serialization tests * fix more serialization tests * [ethkey] fix smoky test * [rpc] fix tests, please? * [ethcore] remove commented out code * Apply suggestions from code review Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * [ethstore] remove unused dev-dependency * [ethcore] remove resolved TODO * [*] resolve keccak-hash TODO * [*] s/Address::default()/Address::zero() * [rpc] remove Subscribers::new_test * [rpc] remove EthPubSubClient::new_test * [ethcore] use trie-standardmap from crates.io * [dir] fix db_root_path * [ethcore] simplify snapshot::tests::helpers::fill_storage * Apply suggestions from code review Co-Authored-By: David <dvdplm@gmail.com> * [ethcore-secretstore] resolve TODO in serialization * [ethcore-network-devp2p] resolve TODO in save_key * [Cargo.lock] update triehash * [*] use ethabi from crates.io * [ethkey] use secp256k1 from master branch * [Cargo.lock] update eth-secp256k1
This commit is contained in:
@@ -33,7 +33,7 @@ use itertools::Itertools;
|
||||
use journaldb;
|
||||
use kvdb::{DBValue, KeyValueDB, DBTransaction};
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use rand::OsRng;
|
||||
use rand::rngs::OsRng;
|
||||
use types::transaction::{self, LocalizedTransaction, UnverifiedTransaction, SignedTransaction, Action};
|
||||
use trie::{TrieSpec, TrieFactory, Trie};
|
||||
use types::ancestry_action::AncestryAction;
|
||||
@@ -456,7 +456,7 @@ impl Importer {
|
||||
{
|
||||
trace_time!("import_old_block");
|
||||
// verify the block, passing the chain for updating the epoch verifier.
|
||||
let mut rng = OsRng::new()?;
|
||||
let mut rng = OsRng::new().map_err(|e| format!("{}", e))?;
|
||||
self.ancient_verifier.verify(&mut rng, &unverified.header, &chain)?;
|
||||
|
||||
// Commit results
|
||||
@@ -908,12 +908,12 @@ impl Client {
|
||||
let hashes = self.last_hashes.read();
|
||||
if hashes.front().map_or(false, |h| h == parent_hash) {
|
||||
let mut res = Vec::from(hashes.clone());
|
||||
res.resize(256, H256::default());
|
||||
res.resize(256, H256::zero());
|
||||
return Arc::new(res);
|
||||
}
|
||||
}
|
||||
let mut last_hashes = LastHashes::new();
|
||||
last_hashes.resize(256, H256::default());
|
||||
last_hashes.resize(256, H256::zero());
|
||||
last_hashes[0] = parent_hash.clone();
|
||||
let chain = self.chain.read();
|
||||
for i in 0..255 {
|
||||
@@ -1223,7 +1223,7 @@ impl Client {
|
||||
// transaction for calling contracts from services like engine.
|
||||
// from the null sender, with 50M gas.
|
||||
fn contract_call_tx(&self, block_id: BlockId, address: Address, data: Bytes) -> SignedTransaction {
|
||||
let from = Address::default();
|
||||
let from = Address::zero();
|
||||
transaction::Transaction {
|
||||
nonce: self.nonce(&from, block_id).unwrap_or_else(|| self.engine.account_start_nonce(0)),
|
||||
action: Action::Call(address),
|
||||
@@ -1341,8 +1341,8 @@ impl BlockChainReset for Client {
|
||||
best_block_hash = current_header.parent_hash();
|
||||
|
||||
let (number, hash) = (current_header.number(), current_header.hash());
|
||||
batch.delete(::db::COL_HEADERS, &hash);
|
||||
batch.delete(::db::COL_BODIES, &hash);
|
||||
batch.delete(::db::COL_HEADERS, hash.as_bytes());
|
||||
batch.delete(::db::COL_BODIES, hash.as_bytes());
|
||||
Writable::delete::<BlockDetails, H264>
|
||||
(&mut batch, ::db::COL_EXTRA, &hash);
|
||||
Writable::delete::<H256, BlockNumberKey>
|
||||
@@ -1375,7 +1375,7 @@ impl BlockChainReset for Client {
|
||||
&best_block_details
|
||||
);
|
||||
// update the new best block hash
|
||||
batch.put(::db::COL_EXTRA, b"best", &best_block_hash);
|
||||
batch.put(::db::COL_EXTRA, b"best", best_block_hash.as_bytes());
|
||||
|
||||
self.db.read()
|
||||
.key_value()
|
||||
@@ -1822,7 +1822,7 @@ impl BlockChainClient for Client {
|
||||
};
|
||||
|
||||
if let Some(after) = after {
|
||||
if let Err(e) = iter.seek(after) {
|
||||
if let Err(e) = iter.seek(after.as_bytes()) {
|
||||
trace!(target: "fatdb", "list_accounts: Couldn't seek the DB: {:?}", e);
|
||||
} else {
|
||||
// Position the iterator after the `after` element
|
||||
@@ -1870,7 +1870,7 @@ impl BlockChainClient for Client {
|
||||
};
|
||||
|
||||
if let Some(after) = after {
|
||||
if let Err(e) = iter.seek(after) {
|
||||
if let Err(e) = iter.seek(after.as_bytes()) {
|
||||
trace!(target: "fatdb", "list_storage: Couldn't seek the DB: {:?}", e);
|
||||
} else {
|
||||
// Position the iterator after the `after` element
|
||||
@@ -2592,6 +2592,7 @@ fn transaction_receipt(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ethereum_types::{H256, Address};
|
||||
|
||||
#[test]
|
||||
fn should_not_cache_details_before_commit() {
|
||||
@@ -2667,19 +2668,19 @@ mod tests {
|
||||
use types::transaction::{Transaction, LocalizedTransaction, Action};
|
||||
|
||||
// given
|
||||
let key = KeyPair::from_secret_slice(&keccak("test")).unwrap();
|
||||
let key = KeyPair::from_secret_slice(keccak("test").as_bytes()).unwrap();
|
||||
let secret = key.secret();
|
||||
let machine = ::ethereum::new_frontier_test_machine();
|
||||
|
||||
let block_number = 1;
|
||||
let block_hash = 5.into();
|
||||
let state_root = 99.into();
|
||||
let block_hash = H256::from_low_u64_be(5);
|
||||
let state_root = H256::from_low_u64_be(99);
|
||||
let gas_used = 10.into();
|
||||
let raw_tx = Transaction {
|
||||
nonce: 0.into(),
|
||||
gas_price: 0.into(),
|
||||
gas: 21000.into(),
|
||||
action: Action::Call(10.into()),
|
||||
action: Action::Call(Address::from_low_u64_be(10)),
|
||||
value: 0.into(),
|
||||
data: vec![],
|
||||
};
|
||||
@@ -2692,11 +2693,11 @@ mod tests {
|
||||
cached_sender: Some(tx1.sender()),
|
||||
};
|
||||
let logs = vec![LogEntry {
|
||||
address: 5.into(),
|
||||
address: Address::from_low_u64_be(5),
|
||||
topics: vec![],
|
||||
data: vec![],
|
||||
}, LogEntry {
|
||||
address: 15.into(),
|
||||
address: Address::from_low_u64_be(15),
|
||||
topics: vec![],
|
||||
data: vec![],
|
||||
}];
|
||||
|
||||
@@ -204,7 +204,7 @@ impl<'a> EvmTestClient<'a> {
|
||||
author: *genesis.author(),
|
||||
timestamp: genesis.timestamp(),
|
||||
difficulty: *genesis.difficulty(),
|
||||
last_hashes: Arc::new([H256::default(); 256].to_vec()),
|
||||
last_hashes: Arc::new([H256::zero(); 256].to_vec()),
|
||||
gas_used: 0.into(),
|
||||
gas_limit: *genesis.gas_limit(),
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Test client.
|
||||
|
||||
use std::str::FromStr;
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder};
|
||||
use std::sync::Arc;
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
@@ -167,9 +168,9 @@ impl TestBlockChainClient {
|
||||
let mut client = TestBlockChainClient {
|
||||
blocks: RwLock::new(HashMap::new()),
|
||||
numbers: RwLock::new(HashMap::new()),
|
||||
genesis_hash: H256::new(),
|
||||
genesis_hash: H256::zero(),
|
||||
extra_data: extra_data,
|
||||
last_hash: RwLock::new(H256::new()),
|
||||
last_hash: RwLock::new(H256::zero()),
|
||||
difficulty: RwLock::new(spec.genesis_header().difficulty().clone()),
|
||||
balances: RwLock::new(HashMap::new()),
|
||||
nonces: RwLock::new(HashMap::new()),
|
||||
@@ -326,7 +327,7 @@ impl TestBlockChainClient {
|
||||
pub fn corrupt_block_parent(&self, n: BlockNumber) {
|
||||
let hash = self.block_hash(BlockId::Number(n)).unwrap();
|
||||
let mut header: Header = self.block_header(BlockId::Number(n)).unwrap().decode().expect("decoding failed");
|
||||
header.set_parent_hash(H256::from(42));
|
||||
header.set_parent_hash(H256::from_low_u64_be(42));
|
||||
let mut rlp = RlpStream::new_list(3);
|
||||
rlp.append(&header);
|
||||
rlp.append_raw(&::rlp::NULL_RLP, 1);
|
||||
@@ -432,7 +433,7 @@ impl ScheduleInfo for TestBlockChainClient {
|
||||
|
||||
impl ImportSealedBlock for TestBlockChainClient {
|
||||
fn import_sealed_block(&self, _block: SealedBlock) -> EthcoreResult<H256> {
|
||||
Ok(H256::default())
|
||||
Ok(H256::zero())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +662,15 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
}
|
||||
|
||||
fn replay_block_transactions(&self, _block: BlockId, _analytics: CallAnalytics) -> Result<Box<Iterator<Item = (H256, Executed)>>, CallError> {
|
||||
Ok(Box::new(self.traces.read().clone().unwrap().into_iter().map(|t| t.transaction_hash.unwrap_or(H256::new())).zip(self.execution_result.read().clone().unwrap().into_iter())))
|
||||
Ok(Box::new(
|
||||
self.traces
|
||||
.read()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.map(|t| t.transaction_hash.unwrap_or_default())
|
||||
.zip(self.execution_result.read().clone().unwrap().into_iter())
|
||||
))
|
||||
}
|
||||
|
||||
fn block_total_difficulty(&self, _id: BlockId) -> Option<U256> {
|
||||
@@ -685,7 +694,8 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
|
||||
fn storage_at(&self, address: &Address, position: &H256, state: StateOrBlock) -> Option<H256> {
|
||||
match state {
|
||||
StateOrBlock::Block(BlockId::Latest) => Some(self.storage.read().get(&(address.clone(), position.clone())).cloned().unwrap_or_else(H256::new)),
|
||||
StateOrBlock::Block(BlockId::Latest) =>
|
||||
Some(self.storage.read().get(&(address.clone(), position.clone())).cloned().unwrap_or_default()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -773,7 +783,7 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
// works only if blocks are one after another 1 -> 2 -> 3
|
||||
fn tree_route(&self, from: &H256, to: &H256) -> Option<TreeRoute> {
|
||||
Some(TreeRoute {
|
||||
ancestor: H256::new(),
|
||||
ancestor: H256::zero(),
|
||||
index: 0,
|
||||
blocks: {
|
||||
let numbers_read = self.numbers.read();
|
||||
@@ -808,7 +818,7 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
// TODO: returns just hashes instead of node state rlp(?)
|
||||
fn state_data(&self, hash: &H256) -> Option<Bytes> {
|
||||
// starts with 'f' ?
|
||||
if *hash > H256::from("f000000000000000000000000000000000000000000000000000000000000000") {
|
||||
if *hash > H256::from_str("f000000000000000000000000000000000000000000000000000000000000000").unwrap() {
|
||||
let mut rlp = RlpStream::new();
|
||||
rlp.append(&hash.clone());
|
||||
return Some(rlp.out());
|
||||
@@ -818,7 +828,7 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
|
||||
fn block_receipts(&self, hash: &H256) -> Option<BlockReceipts> {
|
||||
// starts with 'f' ?
|
||||
if *hash > H256::from("f000000000000000000000000000000000000000000000000000000000000000") {
|
||||
if *hash > H256::from_str("f000000000000000000000000000000000000000000000000000000000000000").unwrap() {
|
||||
let receipt = BlockReceipts::new(vec![Receipt::new(
|
||||
TransactionOutcome::StateRoot(H256::zero()),
|
||||
U256::zero(),
|
||||
|
||||
Reference in New Issue
Block a user