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

Commit 3fd58bd

Browse files
authored
Beta 2.5.3 (#10776)
* ethcore/res: activate atlantis classic hf on block 8772000 (#10766) * fix docker tags for publishing (#10741) * fix: aura don't add `SystemTime::now()` (#10720) This commit does the following: - Prevent overflow in `verify_timestamp()` by not adding `now` to found faulty timestamp - Use explicit `CheckedSystemTime::checked_add` to prevent potential consensus issues because SystemTime is platform depedent - remove `#[cfg(not(time_checked_add))]` conditional compilation * Update version * Treat empty account the same as non-exist accounts in EIP-1052 (#10775) * DevP2p: Get node IP address and udp port from Socket, if not included in PING packet (#10705) * get node IP address and udp port from Socket, if not included in PING packet * prevent bootnodes from being added to host nodes * code corrections * code corrections * code corrections * code corrections * docs * code corrections * code corrections * Apply suggestions from code review Co-Authored-By: David <[email protected]> * Add a way to signal shutdown to snapshotting threads (#10744) * Add a way to signal shutdown to snapshotting threads * Pass Progress to fat_rlps() so we can abort from there too. * Checking for abort in a single spot * Remove nightly-only weak/strong counts * fix warning * Fix tests * Add dummy impl to abort snapshots * Add another dummy impl for TestSnapshotService * Remove debugging code * Return error instead of the odd Ok(()) Switch to AtomicU64 * revert .as_bytes() change * fix build * fix build maybe
1 parent ecbafb2 commit 3fd58bd

File tree

29 files changed

+263
-149
lines changed

29 files changed

+263
-149
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Parity Ethereum client"
33
name = "parity-ethereum"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "2.5.2"
5+
version = "2.5.3"
66
license = "GPL-3.0"
77
authors = ["Parity Technologies <[email protected]>"]
88

ethcore/res/ethereum/classic.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"ecip1010PauseTransition": "0x2dc6c0",
1313
"ecip1010ContinueTransition": "0x4c4b40",
1414
"ecip1017EraRounds": "0x4c4b40",
15-
"eip100bTransition": "0x7fffffffffffffff",
15+
"eip100bTransition": "0x85d9a0",
1616
"bombDefuseTransition": "0x5a06e0"
1717
}
1818
}
@@ -29,15 +29,15 @@
2929
"forkCanonHash": "0x94365e3a8c0b35089c1d1195081fe7489b528a84b22199c916180db8b28ade7f",
3030
"eip150Transition": "0x2625a0",
3131
"eip160Transition": "0x2dc6c0",
32-
"eip161abcTransition": "0x7fffffffffffffff",
33-
"eip161dTransition": "0x7fffffffffffffff",
32+
"eip161abcTransition": "0x85d9a0",
33+
"eip161dTransition": "0x85d9a0",
3434
"eip155Transition": "0x2dc6c0",
3535
"maxCodeSize": "0x6000",
36-
"maxCodeSizeTransition": "0x7fffffffffffffff",
37-
"eip140Transition": "0x7fffffffffffffff",
38-
"eip211Transition": "0x7fffffffffffffff",
39-
"eip214Transition": "0x7fffffffffffffff",
40-
"eip658Transition": "0x7fffffffffffffff"
36+
"maxCodeSizeTransition": "0x85d9a0",
37+
"eip140Transition": "0x85d9a0",
38+
"eip211Transition": "0x85d9a0",
39+
"eip214Transition": "0x85d9a0",
40+
"eip658Transition": "0x85d9a0"
4141
},
4242
"genesis": {
4343
"seal": {
@@ -3905,7 +3905,7 @@
39053905
"0x0000000000000000000000000000000000000005": {
39063906
"builtin": {
39073907
"name": "modexp",
3908-
"activate_at": "0x7fffffffffffffff",
3908+
"activate_at": "0x85d9a0",
39093909
"pricing": {
39103910
"modexp": {
39113911
"divisor": 20
@@ -3916,7 +3916,7 @@
39163916
"0x0000000000000000000000000000000000000006": {
39173917
"builtin": {
39183918
"name": "alt_bn128_add",
3919-
"activate_at": "0x7fffffffffffffff",
3919+
"activate_at": "0x85d9a0",
39203920
"pricing": {
39213921
"linear": {
39223922
"base": 500,
@@ -3928,7 +3928,7 @@
39283928
"0x0000000000000000000000000000000000000007": {
39293929
"builtin": {
39303930
"name": "alt_bn128_mul",
3931-
"activate_at": "0x7fffffffffffffff",
3931+
"activate_at": "0x85d9a0",
39323932
"pricing": {
39333933
"linear": {
39343934
"base": 40000,
@@ -3940,7 +3940,7 @@
39403940
"0x0000000000000000000000000000000000000008": {
39413941
"builtin": {
39423942
"name": "alt_bn128_pairing",
3943-
"activate_at": "0x7fffffffffffffff",
3943+
"activate_at": "0x85d9a0",
39443944
"pricing": {
39453945
"alt_bn128_pairing": {
39463946
"base": 100000,

ethcore/service/src/service.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ use blockchain::{BlockChainDB, BlockChainDBHandler};
3030
use ethcore::client::{Client, ClientConfig, ChainNotify, ClientIoMessage};
3131
use ethcore::miner::Miner;
3232
use ethcore::snapshot::service::{Service as SnapshotService, ServiceParams as SnapServiceParams};
33-
use ethcore::snapshot::{SnapshotService as _SnapshotService, RestorationStatus};
33+
use ethcore::snapshot::{SnapshotService as _SnapshotService, RestorationStatus, Error as SnapshotError};
3434
use ethcore::spec::Spec;
35+
use ethcore::error::{Error as EthcoreError, ErrorKind};
36+
3537

3638
use ethcore_private_tx::{self, Importer, Signer};
3739
use Error;
@@ -197,6 +199,7 @@ impl ClientService {
197199

198200
/// Shutdown the Client Service
199201
pub fn shutdown(&self) {
202+
trace!(target: "shutdown", "Shutting down Client Service");
200203
self.snapshot.shutdown();
201204
}
202205
}
@@ -257,7 +260,11 @@ impl IoHandler<ClientIoMessage> for ClientIoHandler {
257260

258261
let res = thread::Builder::new().name("Periodic Snapshot".into()).spawn(move || {
259262
if let Err(e) = snapshot.take_snapshot(&*client, num) {
260-
warn!("Failed to take snapshot at block #{}: {}", num, e);
263+
match e {
264+
EthcoreError(ErrorKind::Snapshot(SnapshotError::SnapshotAborted), _) => info!("Snapshot aborted"),
265+
_ => warn!("Failed to take snapshot at block #{}: {}", num, e),
266+
}
267+
261268
}
262269
});
263270

ethcore/src/client/client.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ impl Client {
764764
liveness: AtomicBool::new(awake),
765765
mode: Mutex::new(config.mode.clone()),
766766
chain: RwLock::new(chain),
767-
tracedb: tracedb,
768-
engine: engine,
767+
tracedb,
768+
engine,
769769
pruning: config.pruning.clone(),
770770
db: RwLock::new(db.clone()),
771771
state_db: RwLock::new(state_db),
@@ -778,8 +778,8 @@ impl Client {
778778
ancient_blocks_import_lock: Default::default(),
779779
queue_consensus_message: IoChannelQueue::new(usize::max_value()),
780780
last_hashes: RwLock::new(VecDeque::new()),
781-
factories: factories,
782-
history: history,
781+
factories,
782+
history,
783783
on_user_defaults_change: Mutex::new(None),
784784
registrar_address,
785785
exit_handler: Mutex::new(None),
@@ -1138,7 +1138,12 @@ impl Client {
11381138

11391139
/// Take a snapshot at the given block.
11401140
/// If the ID given is "latest", this will default to 1000 blocks behind.
1141-
pub fn take_snapshot<W: snapshot_io::SnapshotWriter + Send>(&self, writer: W, at: BlockId, p: &snapshot::Progress) -> Result<(), EthcoreError> {
1141+
pub fn take_snapshot<W: snapshot_io::SnapshotWriter + Send>(
1142+
&self,
1143+
writer: W,
1144+
at: BlockId,
1145+
p: &snapshot::Progress,
1146+
) -> Result<(), EthcoreError> {
11421147
let db = self.state_db.read().journal_db().boxed_clone();
11431148
let best_block_number = self.chain_info().best_block_number;
11441149
let block_number = self.block_number(at).ok_or_else(|| snapshot::Error::InvalidStartingBlock(at))?;
@@ -1168,8 +1173,16 @@ impl Client {
11681173
};
11691174

11701175
let processing_threads = self.config.snapshot.processing_threads;
1171-
snapshot::take_snapshot(&*self.engine, &self.chain.read(), start_hash, db.as_hash_db(), writer, p, processing_threads)?;
1172-
1176+
let chunker = self.engine.snapshot_components().ok_or(snapshot::Error::SnapshotsUnsupported)?;
1177+
snapshot::take_snapshot(
1178+
chunker,
1179+
&self.chain.read(),
1180+
start_hash,
1181+
db.as_hash_db(),
1182+
writer,
1183+
p,
1184+
processing_threads,
1185+
)?;
11731186
Ok(())
11741187
}
11751188

ethcore/src/engines/authority_round/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::iter::FromIterator;
2222
use std::ops::Deref;
2323
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
2424
use std::sync::{Weak, Arc};
25-
use std::time::{UNIX_EPOCH, SystemTime, Duration};
25+
use std::time::{UNIX_EPOCH, Duration};
2626

2727
use block::*;
2828
use client::EngineClient;
@@ -42,14 +42,12 @@ use itertools::{self, Itertools};
4242
use rlp::{encode, Decodable, DecoderError, Encodable, RlpStream, Rlp};
4343
use ethereum_types::{H256, H520, Address, U128, U256};
4444
use parking_lot::{Mutex, RwLock};
45+
use time_utils::CheckedSystemTime;
4546
use types::BlockNumber;
4647
use types::header::{Header, ExtendedHeader};
4748
use types::ancestry_action::AncestryAction;
4849
use unexpected::{Mismatch, OutOfBounds};
4950

50-
#[cfg(not(time_checked_add))]
51-
use time_utils::CheckedSystemTime;
52-
5351
mod finality;
5452

5553
/// `AuthorityRound` params.
@@ -578,10 +576,10 @@ fn verify_timestamp(step: &Step, header_step: u64) -> Result<(), BlockError> {
578576
// Returning it further won't recover the sync process.
579577
trace!(target: "engine", "verify_timestamp: block too early");
580578

581-
let now = SystemTime::now();
582-
let found = now.checked_add(Duration::from_secs(oob.found)).ok_or(BlockError::TimestampOverflow)?;
583-
let max = oob.max.and_then(|m| now.checked_add(Duration::from_secs(m)));
584-
let min = oob.min.and_then(|m| now.checked_add(Duration::from_secs(m)));
579+
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(oob.found))
580+
.ok_or(BlockError::TimestampOverflow)?;
581+
let max = oob.max.and_then(|m| CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(m)));
582+
let min = oob.min.and_then(|m| CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(m)));
585583

586584
let new_oob = OutOfBounds { min, max, found };
587585

ethcore/src/engines/clique/block_state.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ use engines::clique::{VoteType, DIFF_INTURN, DIFF_NOTURN, NULL_AUTHOR, SIGNING_D
2424
use error::{Error, BlockError};
2525
use ethereum_types::{Address, H64};
2626
use rand::Rng;
27+
use time_utils::CheckedSystemTime;
2728
use types::BlockNumber;
2829
use types::header::Header;
2930
use unexpected::Mismatch;
3031

31-
#[cfg(not(feature = "time_checked_add"))]
32-
use time_utils::CheckedSystemTime;
33-
3432
/// Type that keeps track of the state for a given vote
3533
// Votes that go against the proposal aren't counted since it's equivalent to not voting
3634
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
@@ -268,7 +266,7 @@ impl CliqueBlockState {
268266
// This is a quite bad API because we must mutate both variables even when already `inturn` fails
269267
// That's why we can't return early and must have the `if-else` in the end
270268
pub fn calc_next_timestamp(&mut self, timestamp: u64, period: u64) -> Result<(), Error> {
271-
let inturn = UNIX_EPOCH.checked_add(Duration::from_secs(timestamp.saturating_add(period)));
269+
let inturn = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(timestamp.saturating_add(period)));
272270

273271
self.next_timestamp_inturn = inturn;
274272

ethcore/src/engines/clique/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,10 @@ use parking_lot::RwLock;
8282
use rand::Rng;
8383
use super::signer::EngineSigner;
8484
use unexpected::{Mismatch, OutOfBounds};
85+
use time_utils::CheckedSystemTime;
8586
use types::BlockNumber;
8687
use types::header::{ExtendedHeader, Header};
8788

88-
#[cfg(not(feature = "time_checked_add"))]
89-
use time_utils::CheckedSystemTime;
90-
9189
use self::block_state::CliqueBlockState;
9290
use self::params::CliqueParams;
9391
use self::step_service::StepService;
@@ -536,7 +534,7 @@ impl Engine<EthereumMachine> for Clique {
536534

537535
// Don't waste time checking blocks from the future
538536
{
539-
let limit = SystemTime::now().checked_add(Duration::from_secs(self.period))
537+
let limit = CheckedSystemTime::checked_add(SystemTime::now(), Duration::from_secs(self.period))
540538
.ok_or(BlockError::TimestampOverflow)?;
541539

542540
// This should succeed under the contraints that the system clock works
@@ -546,7 +544,7 @@ impl Engine<EthereumMachine> for Clique {
546544

547545
let hdr = Duration::from_secs(header.timestamp());
548546
if hdr > limit_as_dur {
549-
let found = UNIX_EPOCH.checked_add(hdr).ok_or(BlockError::TimestampOverflow)?;
547+
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, hdr).ok_or(BlockError::TimestampOverflow)?;
550548

551549
Err(BlockError::TemporarilyInvalid(OutOfBounds {
552550
min: None,
@@ -657,8 +655,8 @@ impl Engine<EthereumMachine> for Clique {
657655
// Ensure that the block's timestamp isn't too close to it's parent
658656
let limit = parent.timestamp().saturating_add(self.period);
659657
if limit > header.timestamp() {
660-
let max = UNIX_EPOCH.checked_add(Duration::from_secs(header.timestamp()));
661-
let found = UNIX_EPOCH.checked_add(Duration::from_secs(limit))
658+
let max = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(header.timestamp()));
659+
let found = CheckedSystemTime::checked_add(UNIX_EPOCH, Duration::from_secs(limit))
662660
.ok_or(BlockError::TimestampOverflow)?;
663661

664662
Err(BlockError::InvalidTimestamp(OutOfBounds {

ethcore/src/externalities.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
314314
}
315315

316316
fn extcodehash(&self, address: &Address) -> vm::Result<Option<H256>> {
317-
Ok(self.state.code_hash(address)?)
317+
if self.state.exists_and_not_null(address)? {
318+
Ok(self.state.code_hash(address)?)
319+
} else {
320+
Ok(None)
321+
}
318322
}
319323

320324
fn extcodesize(&self, address: &Address) -> vm::Result<Option<usize>> {

ethcore/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
1616

1717
#![warn(missing_docs, unused_extern_crates)]
18-
#![cfg_attr(feature = "time_checked_add", feature(time_checked_add))]
1918

2019
//! Ethcore library
2120
//!
@@ -100,6 +99,7 @@ extern crate rlp;
10099
extern crate rustc_hex;
101100
extern crate serde;
102101
extern crate stats;
102+
extern crate time_utils;
103103
extern crate triehash_ethereum as triehash;
104104
extern crate unexpected;
105105
extern crate using_queue;
@@ -149,9 +149,6 @@ extern crate fetch;
149149
#[cfg(all(test, feature = "price-info"))]
150150
extern crate parity_runtime;
151151

152-
#[cfg(not(time_checked_add))]
153-
extern crate time_utils;
154-
155152
pub mod block;
156153
pub mod builtin;
157154
pub mod client;

0 commit comments

Comments
 (0)