Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into dp/chore/new-ethereum-consensus-tests
Browse files Browse the repository at this point in the history
* master:
  ethcore/res: activate Istanbul on Ropsten, Görli, Rinkeby, Kovan (#11068)
  [sync]: rust 2018 (#11067)
  • Loading branch information
dvdplm committed Sep 20, 2019
2 parents ad68b3c + 2627288 commit dfaee44
Show file tree
Hide file tree
Showing 30 changed files with 480 additions and 400 deletions.
22 changes: 18 additions & 4 deletions ethcore/res/ethereum/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"eip1052Transition": "0x0",
"eip1283Transition": "0x0",
"eip1283DisableTransition": "0x0",
"eip1283ReenableTransition": "0x17d433",
"eip1344Transition": "0x17d433",
"eip1706Transition": "0x17d433",
"eip1884Transition": "0x17d433",
"eip2028Transition": "0x17d433",
"gasLimitBoundDivisor": "0x400",
"maxCodeSize": "0x6000",
"maxCodeSizeTransition": "0x0",
Expand Down Expand Up @@ -126,7 +131,7 @@
"builtin": {
"name": "alt_bn128_add",
"activate_at": "0x00",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x17d433",
"pricing": {
"alt_bn128_const_operations": {
"price": 500,
Expand All @@ -140,7 +145,7 @@
"builtin": {
"name": "alt_bn128_mul",
"activate_at": "0x00",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x17d433",
"pricing": {
"alt_bn128_const_operations": {
"price": 40000,
Expand All @@ -154,7 +159,7 @@
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": "0x00",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x17d433",
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
Expand All @@ -166,7 +171,16 @@
}
},
"0x0000000000000000000000000000000000000009": {
"balance": "0x1"
"balance": "0x1",
"builtin": {
"name": "blake2_f",
"activate_at": "0x17d433",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
},
"0x000000000000000000000000000000000000000a": {
"balance": "0x1"
Expand Down
1 change: 1 addition & 0 deletions ethcore/res/ethereum/istanbul_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"eip1014Transition": "0x0",
"eip1052Transition": "0x0",
"eip1283Transition": "0x0",
"eip1283DisableTransition": "0x0",
"eip1283ReenableTransition": "0x0",
"eip1344Transition": "0x0",
"eip1706Transition": "0x0",
Expand Down
22 changes: 19 additions & 3 deletions ethcore/res/ethereum/kovan.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
"eip1052Transition": "0x8c6180",
"eip1283Transition": "0x8c6180",
"eip1283DisableTransition": "0x9c7b61",
"eip1283ReenableTransition": "0xd751a5",
"eip1344Transition": "0xd751a5",
"eip1706Transition": "0xd751a5",
"eip1884Transition": "0xd751a5",
"eip2028Transition": "0xd751a5",
"kip4Transition": "0x8c6180",
"kip6Transition": "0x8c6180"
},
Expand Down Expand Up @@ -6722,7 +6727,7 @@
"builtin": {
"name": "alt_bn128_add",
"activate_at": "0x4d50f8",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0xd751a5",
"pricing": {
"alt_bn128_const_operations": {
"price": 500,
Expand All @@ -6735,7 +6740,7 @@
"builtin": {
"name": "alt_bn128_mul",
"activate_at": "0x4d50f8",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0xd751a5",
"pricing": {
"alt_bn128_const_operations": {
"price": 40000,
Expand All @@ -6748,7 +6753,7 @@
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": "0x4d50f8",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0xd751a5",
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
Expand All @@ -6759,6 +6764,17 @@
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"activate_at": "0xd751a5",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
},
"0x00521965e7bd230323c423d96c657db5b79d099f": {
"balance": "1606938044258990275541962092341162602522202993782792835301376"
}
Expand Down
22 changes: 18 additions & 4 deletions ethcore/res/ethereum/rinkeby.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"eip1052Transition": "0x37db77",
"eip1283Transition": "0x37db77",
"eip1283DisableTransition": "0x41efd2",
"eip1283ReenableTransition": "0x52efd1",
"eip1344Transition": "0x52efd1",
"eip1706Transition": "0x52efd1",
"eip1884Transition": "0x52efd1",
"eip2028Transition": "0x52efd1",
"gasLimitBoundDivisor": "0x400",
"maxCodeSize": "0x6000",
"maxCodeSizeTransition": "0x0",
Expand Down Expand Up @@ -120,7 +125,7 @@
"builtin": {
"name": "alt_bn128_add",
"activate_at": "0xfcc25",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x52efd1",
"pricing": {
"alt_bn128_const_operations": {
"price": 500,
Expand All @@ -133,7 +138,7 @@
"builtin": {
"name": "alt_bn128_mul",
"activate_at": "0xfcc25",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x52efd1",
"pricing": {
"alt_bn128_const_operations": {
"price": 40000,
Expand All @@ -146,7 +151,7 @@
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": "0xfcc25",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x52efd1",
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
Expand All @@ -158,7 +163,16 @@
}
},
"0x0000000000000000000000000000000000000009": {
"balance": "0x1"
"balance": "0x1",
"builtin": {
"name": "blake2_f",
"activate_at": "0x52efd1",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
},
"0x000000000000000000000000000000000000000a": {
"balance": "0x1"
Expand Down
24 changes: 19 additions & 5 deletions ethcore/res/ethereum/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@
"eip1014Transition": "0x408b70",
"eip1052Transition": "0x408b70",
"eip1283Transition": "0x408b70",
"eip1283DisableTransition": "0x4b5e82"
"eip1283DisableTransition": "0x4b5e82",
"eip1283ReenableTransition": "0x62f756",
"eip1344Transition": "0x62f756",
"eip1706Transition": "0x62f756",
"eip1884Transition": "0x62f756",
"eip2028Transition": "0x62f756"
},
"genesis": {
"seal": {
Expand Down Expand Up @@ -2735,7 +2740,7 @@
"builtin": {
"name": "alt_bn128_add",
"activate_at": "0x19f0a0",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x62f756",
"pricing": {
"alt_bn128_const_operations": {
"price": 500,
Expand All @@ -2750,7 +2755,7 @@
"builtin": {
"name": "alt_bn128_mul",
"activate_at": "0x19f0a0",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x62f756",
"pricing": {
"alt_bn128_const_operations": {
"price": 40000,
Expand All @@ -2765,7 +2770,7 @@
"builtin": {
"name": "alt_bn128_pairing",
"activate_at": "0x19f0a0",
"eip1108_transition": "0x7fffffffffffff",
"eip1108_transition": "0x62f756",
"pricing": {
"alt_bn128_pairing": {
"base": 100000,
Expand All @@ -2777,7 +2782,16 @@
}
},
"0x0000000000000000000000000000000000000009": {
"balance": "0x1"
"balance": "0x1",
"builtin": {
"name": "blake2_f",
"activate_at": "0x62f756",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
},
"0x000000000000000000000000000000000000000a": {
"balance": "0x0"
Expand Down
1 change: 1 addition & 0 deletions ethcore/res/ethereum/st_peters_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"eip145Transition": "0x0",
"eip1014Transition": "0x0",
"eip1052Transition": "0x0",
"eip1283Transition": "0x0",
"eip1283DisableTransition": "0x0"
},
"genesis": {
Expand Down
9 changes: 5 additions & 4 deletions ethcore/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@ name = "ethcore-sync"
version = "1.12.0"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[lib]

[dependencies]
bytes = { package = "parity-bytes", version = "0.1" }
client-traits = { path = "../client-traits" }
common-types = { path = "../types" }
devp2p = { package = "ethcore-network-devp2p", path = "../../util/network-devp2p" }
enum_primitive = "0.1.1"
ethcore-io = { path = "../../util/io" }
ethcore-light = { path = "../light" }
ethcore-network = { path = "../../util/network" }
ethcore-network-devp2p = { path = "../../util/network-devp2p" }
ethcore-private-tx = { path = "../private-tx" }
ethereum-types = "0.6.0"
ethkey = { path = "../../accounts/ethkey" }
fastmap = { path = "../../util/fastmap" }
futures = "0.1"
keccak-hash = "0.2.0"
light = { package = "ethcore-light", path = "../light" }
log = "0.4"
macros = { path = "../../util/macros" }
parity-bytes = "0.1"
network = { package = "ethcore-network", path = "../../util/network" }
parity-runtime = { path = "../../util/runtime" }
parity-util-mem = "0.2.0"
parking_lot = "0.8"
Expand Down
66 changes: 37 additions & 29 deletions ethcore/sync/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,54 @@ use std::collections::{HashMap, BTreeMap};
use std::io;
use std::ops::RangeInclusive;
use std::time::Duration;
use std::net::{SocketAddr, AddrParseError};
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};

use crate::sync_io::NetSyncIo;
use crate::light_sync::{self, SyncInfo};
use crate::private_tx::PrivateTxHandler;
use crate::chain::{
sync_packet::SyncPacket::{PrivateTransactionPacket, SignedPrivateTransactionPacket},
ChainSyncApi, SyncState, SyncStatus as EthSyncStatus, ETH_PROTOCOL_VERSION_62,
ETH_PROTOCOL_VERSION_63, PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2,
PAR_PROTOCOL_VERSION_3, PAR_PROTOCOL_VERSION_4,
};

use bytes::Bytes;
use client_traits::{BlockChainClient, ChainNotify};
use devp2p::NetworkService;
use network::{NetworkProtocolHandler, NetworkContext, PeerId, ProtocolId,
NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, Error,
ConnectionFilter};
use network::client_version::ClientVersion;
use ethcore_io::TimerToken;
use ethcore_private_tx::PrivateStateDB;
use ethereum_types::{H256, H512, U256};
use ethkey::Secret;
use futures::sync::mpsc as futures_mpsc;
use futures::Stream;
use io::{TimerToken};
use ethkey::Secret;
use client_traits::{BlockChainClient, ChainNotify};
use snapshot::SnapshotService;
use ethcore_private_tx::PrivateStateDB;
use types::BlockNumber;
use sync_io::NetSyncIo;
use chain::{ChainSyncApi, SyncStatus as EthSyncStatus};
use std::net::{SocketAddr, AddrParseError};
use std::str::FromStr;
use parking_lot::{RwLock, Mutex};
use chain::{ETH_PROTOCOL_VERSION_63, ETH_PROTOCOL_VERSION_62,
PAR_PROTOCOL_VERSION_1, PAR_PROTOCOL_VERSION_2, PAR_PROTOCOL_VERSION_3, PAR_PROTOCOL_VERSION_4, SyncState};
use chain::sync_packet::SyncPacket::{PrivateTransactionPacket, SignedPrivateTransactionPacket};
use light::client::AsLightClient;
use light::Provider;
use light::net::{
self as light_net, LightProtocol, Params as LightParams,
Capabilities, Handler as LightHandler, EventContext, SampleStore,
};
use log::{trace, warn};
use macros::hash_map;
use network::{
client_version::ClientVersion,
NetworkProtocolHandler, NetworkContext, PeerId, ProtocolId,
NetworkConfiguration as BasicNetworkConfiguration, NonReservedPeerMode, Error,
ConnectionFilter, IpFilter
};
use snapshot::SnapshotService;
use parking_lot::{RwLock, Mutex};
use parity_runtime::Executor;
use std::sync::atomic::{AtomicBool, Ordering};
use network::IpFilter;
use private_tx::PrivateTxHandler;
use types::{
use trace_time::trace_time;
use common_types::{
BlockNumber,
chain_notify::{NewBlocks, ChainMessageType},
pruning_info::PruningInfo,
transaction::UnverifiedTransaction,
};

use super::light_sync::SyncInfo;

/// Parity sync protocol
pub const WARP_SYNC_PROTOCOL_ID: ProtocolId = *b"par";
Expand Down Expand Up @@ -646,14 +654,14 @@ impl ChainNotify for EthSync {
struct TxRelay(Arc<dyn BlockChainClient>);

impl LightHandler for TxRelay {
fn on_transactions(&self, ctx: &dyn EventContext, relay: &[::types::transaction::UnverifiedTransaction]) {
fn on_transactions(&self, ctx: &dyn EventContext, relay: &[UnverifiedTransaction]) {
trace!(target: "pip", "Relaying {} transactions from peer {}", relay.len(), ctx.peer());
self.0.queue_transactions(relay.iter().map(|tx| ::rlp::encode(tx)).collect(), ctx.peer())
self.0.queue_transactions(relay.iter().map(|tx| rlp::encode(tx)).collect(), ctx.peer())
}
}

/// Trait for managing network
pub trait ManageNetwork : Send + Sync {
pub trait ManageNetwork: Send + Sync {
/// Set to allow unreserved peers to connect
fn accept_unreserved_peers(&self);
/// Set to deny unreserved peers to connect
Expand Down Expand Up @@ -945,15 +953,15 @@ impl LightSync {

}

impl ::std::ops::Deref for LightSync {
type Target = dyn (::light_sync::SyncInfo);
impl std::ops::Deref for LightSync {
type Target = dyn (light_sync::SyncInfo);

fn deref(&self) -> &Self::Target { &*self.sync }
}


impl LightNetworkDispatcher for LightSync {
fn with_context<F, T>(&self, f: F) -> Option<T> where F: FnOnce(&dyn (::light::net::BasicContext)) -> T {
fn with_context<F, T>(&self, f: F) -> Option<T> where F: FnOnce(&dyn (light::net::BasicContext)) -> T {
self.network.with_context_eval(
self.subprotocol_name,
move |ctx| self.proto.with_context(&ctx, f),
Expand Down
Loading

0 comments on commit dfaee44

Please sign in to comment.