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

Commit e78a987

Browse files
authored
stable 2.4.6 (#10642)
* version: bump stable to 2.4.6 * fix(whisper expiry): current time + work + ttl (#10587) * update bootnodes (#10595) * config: update goerli bootnodes * config: update kotti bootnodes * Constantinople HF on POA Core (#10606) * Constantinople HF on POA Core Plan Constantinople/St.Petersfork HF on POA Core network at block 8582254. Original PR in POA repository: poanetwork/poa-chain-spec#110 * Remove extra empty line * evm: add some mulmod benches (#10600) * evm: add blockhash_mulmod bench * evm: use num-bigint for mod ops * Update kovan.json to switch validator set to POA Consensus Contracts (#10628) * Fix publish docs (#10635) * Fix publish docs * this never should be forced, either way compiling previous versions will produce outdated docs * fix array, var was moved to the group project global variables list
1 parent 76d4064 commit e78a987

File tree

11 files changed

+133
-36
lines changed

11 files changed

+133
-36
lines changed

.gitlab-ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ publish-docs:
255255
except:
256256
- nightly
257257
cache: {}
258+
dependencies: []
258259
script:
259260
- scripts/gitlab/publish-docs.sh
260261
tags:

Cargo.lock

+17-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
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.4.5"
5+
version = "2.4.6"
66
license = "GPL-3.0"
77
authors = ["Parity Technologies <admin@parity.io>"]
88

ethcore/evm/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ vm = { path = "../vm" }
1414
keccak-hash = "0.1"
1515
parking_lot = "0.7"
1616
memory-cache = { path = "../../util/memory-cache" }
17+
num-bigint = "0.2"
1718

1819
[dev-dependencies]
1920
rustc-hex = "1.0"

ethcore/evm/benches/basic.rs

+51-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ criterion_group!(
4545
mem_gas_calculation_same_usize,
4646
mem_gas_calculation_same_u256,
4747
mem_gas_calculation_increasing_usize,
48-
mem_gas_calculation_increasing_u256
48+
mem_gas_calculation_increasing_u256,
49+
blockhash_mulmod_small,
50+
blockhash_mulmod_large,
4951
);
5052
criterion_main!(basic);
5153

@@ -150,6 +152,54 @@ fn mem_gas_calculation_increasing(gas: U256, b: &mut Bencher) {
150152
});
151153
}
152154

155+
fn blockhash_mulmod_small(b: &mut Criterion) {
156+
b.bench_function("blockhash_mulmod_small", |b| {
157+
let factory = Factory::default();
158+
let mut ext = FakeExt::new();
159+
160+
let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
161+
162+
b.iter(|| {
163+
let code = black_box(
164+
"6080604052348015600f57600080fd5b5060005a90505b60c881111560de5760017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80095060017effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8009505a90506016565b506035806100ed6000396000f3fe6080604052600080fdfea165627a7a72305820bde4a0ac6d0fac28fc879244baf8a6a0eda514bc95fb7ecbcaaebf2556e2687c0029".from_hex().unwrap()
165+
);
166+
167+
let mut params = ActionParams::default();
168+
params.address = address.clone();
169+
params.gas = U256::from(4_000u64);
170+
params.code = Some(Arc::new(code.clone()));
171+
172+
let vm = factory.create(params, ext.schedule(), 0);
173+
174+
result(vm.exec(&mut ext).ok().unwrap())
175+
});
176+
});
177+
}
178+
179+
fn blockhash_mulmod_large(b: &mut Criterion) {
180+
b.bench_function("blockhash_mulmod_large", |b| {
181+
let factory = Factory::default();
182+
let mut ext = FakeExt::new();
183+
184+
let address = Address::from_str("0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6").unwrap();
185+
186+
b.iter(|| {
187+
let code = black_box(
188+
"608060405234801561001057600080fd5b5060005a90505b60c8811115610177577efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009507efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff17efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08009505a9050610017565b506035806101866000396000f3fe6080604052600080fdfea165627a7a72305820dcaec306f67bb96f3044fff25c9af2ec66f01d0954d0656964f046f42f2780670029".from_hex().unwrap()
189+
);
190+
191+
let mut params = ActionParams::default();
192+
params.address = address.clone();
193+
params.gas = U256::from(4_000u64);
194+
params.code = Some(Arc::new(code.clone()));
195+
196+
let vm = factory.create(params, ext.schedule(), 0);
197+
198+
result(vm.exec(&mut ext).ok().unwrap())
199+
});
200+
});
201+
}
202+
153203
fn result(r: Result<evm::GasLeft>) -> U256 {
154204
match r {
155205
Ok(GasLeft::Known(gas_left)) => gas_left,

ethcore/evm/src/interpreter/mod.rs

+25-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use std::{cmp, mem};
2828
use std::sync::Arc;
2929
use hash::keccak;
3030
use bytes::Bytes;
31-
use ethereum_types::{U256, U512, H256, Address};
31+
use ethereum_types::{U256, H256, Address};
32+
use num_bigint::BigUint;
3233

3334
use vm::{
3435
self, ActionParams, ParamsType, ActionValue, CallType, MessageCallResult,
@@ -61,6 +62,17 @@ const TWO_POW_96: U256 = U256([0, 0x100000000, 0, 0]); //0x1 00000000 00000000 0
6162
const TWO_POW_224: U256 = U256([0, 0, 0, 0x100000000]); //0x1 00000000 00000000 00000000 00000000 00000000 00000000 00000000
6263
const TWO_POW_248: U256 = U256([0, 0, 0, 0x100000000000000]); //0x1 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000000
6364

65+
fn to_biguint(x: U256) -> BigUint {
66+
let mut bytes = [0u8; 32];
67+
x.to_little_endian(&mut bytes);
68+
BigUint::from_bytes_le(&bytes)
69+
}
70+
71+
fn from_biguint(x: BigUint) -> U256 {
72+
let bytes = x.to_bytes_le();
73+
U256::from_little_endian(&bytes)
74+
}
75+
6476
/// Abstraction over raw vector of Bytes. Easier state management of PC.
6577
struct CodeReader {
6678
position: ProgramCounter,
@@ -1009,11 +1021,12 @@ impl<Cost: CostType> Interpreter<Cost> {
10091021
let c = self.stack.pop_back();
10101022

10111023
self.stack.push(if !c.is_zero() {
1012-
// upcast to 512
1013-
let a5 = U512::from(a);
1014-
let res = a5.overflowing_add(U512::from(b)).0;
1015-
let x = res % U512::from(c);
1016-
U256::from(x)
1024+
let a_num = to_biguint(a);
1025+
let b_num = to_biguint(b);
1026+
let c_num = to_biguint(c);
1027+
let res = a_num + b_num;
1028+
let x = res % c_num;
1029+
from_biguint(x)
10171030
} else {
10181031
U256::zero()
10191032
});
@@ -1024,10 +1037,12 @@ impl<Cost: CostType> Interpreter<Cost> {
10241037
let c = self.stack.pop_back();
10251038

10261039
self.stack.push(if !c.is_zero() {
1027-
let a5 = U512::from(a);
1028-
let res = a5.overflowing_mul(U512::from(b)).0;
1029-
let x = res % U512::from(c);
1030-
U256::from(x)
1040+
let a_num = to_biguint(a);
1041+
let b_num = to_biguint(b);
1042+
let c_num = to_biguint(c);
1043+
let res = a_num * b_num;
1044+
let x = res % c_num;
1045+
from_biguint(x)
10311046
} else {
10321047
U256::zero()
10331048
});

ethcore/evm/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ extern crate vm;
2424
extern crate keccak_hash as hash;
2525
extern crate memory_cache;
2626
extern crate parity_bytes as bytes;
27+
extern crate num_bigint;
2728

2829
#[macro_use]
2930
extern crate lazy_static;

ethcore/res/ethereum/kovan.json

+26-11
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,31 @@
77
"stepDuration": "0x4",
88
"blockReward": "0x4563918244F40000",
99
"validators": {
10-
"list": [
11-
"0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED",
12-
"0x00427feae2419c15b89d1c21af10d1b6650a4d3d",
13-
"0x4Ed9B08e6354C70fE6F8CB0411b0d3246b424d6c",
14-
"0x0020ee4Be0e2027d76603cB751eE069519bA81A1",
15-
"0x0010f94b296a852aaac52ea6c5ac72e03afd032d",
16-
"0x007733a1FE69CF3f2CF989F81C7b4cAc1693387A",
17-
"0x00E6d2b931F55a3f1701c7389d592a7778897879",
18-
"0x00e4a10650e5a6D6001C38ff8E64F97016a1645c",
19-
"0x00a0a24b9f0e5ec7aa4c7389b8302fd0123194de"
20-
]
10+
"multi": {
11+
"0": {
12+
"list": [
13+
"0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED",
14+
"0x00427feae2419c15b89d1c21af10d1b6650a4d3d",
15+
"0x4Ed9B08e6354C70fE6F8CB0411b0d3246b424d6c",
16+
"0x0020ee4Be0e2027d76603cB751eE069519bA81A1",
17+
"0x0010f94b296a852aaac52ea6c5ac72e03afd032d",
18+
"0x007733a1FE69CF3f2CF989F81C7b4cAc1693387A",
19+
"0x00E6d2b931F55a3f1701c7389d592a7778897879",
20+
"0x00e4a10650e5a6D6001C38ff8E64F97016a1645c",
21+
"0x00a0a24b9f0e5ec7aa4c7389b8302fd0123194de"
22+
]
23+
},
24+
"10960440": {
25+
"list": [
26+
"0x00D6Cc1BA9cf89BD2e58009741f4F7325BAdc0ED",
27+
"0x0010f94b296a852aaac52ea6c5ac72e03afd032d",
28+
"0x00a0a24b9f0e5ec7aa4c7389b8302fd0123194de"
29+
]
30+
},
31+
"10960500": {
32+
"safeContract": "0xaE71807C1B0a093cB1547b682DC78316D945c9B8"
33+
}
34+
}
2135
},
2236
"validateScoreTransition": "0x41a3c4",
2337
"validateStepTransition": "0x16e360",
@@ -5367,6 +5381,7 @@
53675381
}
53685382
},
53695383
"nodes": [
5384+
"enode://f6e37b943bad3a78cb8589b1798d30d210ffd39cfcd2c8f2de4f098467fd49c667980100d919da7ca46cd50505d30989abda87f0b9339377de13d6592c22caf8@34.198.49.72:30303",
53705385
"enode://56abaf065581a5985b8c5f4f88bd202526482761ba10be9bfdcd14846dd01f652ec33fde0f8c0fd1db19b59a4c04465681fcef50e11380ca88d25996191c52de@40.71.221.215:30303",
53715386
"enode://d07827483dc47b368eaf88454fb04b41b7452cf454e194e2bd4c14f98a3278fed5d819dbecd0d010407fc7688d941ee1e58d4f9c6354d3da3be92f55c17d7ce3@52.166.117.77:30303",
53725387
"enode://38e6e7fd416293ed120d567a2675fe078c0205ab0671abf16982ce969823bd1f3443d590c18b321dfae7dcbe1f6ba98ef8702f255c3c9822a188abb82c53adca@51.77.66.187:30303",

ethcore/res/ethereum/poacore.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
"eip140Transition": "0x0",
3535
"eip211Transition": "0x0",
3636
"eip214Transition": "0x0",
37-
"eip658Transition": "0x0"
37+
"eip658Transition": "0x0",
38+
"eip145Transition": 8582254,
39+
"eip1014Transition": 8582254,
40+
"eip1052Transition": 8582254
3841
},
3942
"genesis": {
4043
"seal": {

util/version/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[package]
44
name = "parity-version"
55
# NOTE: this value is used for Parity Ethereum version string (via env CARGO_PKG_VERSION)
6-
version = "2.4.5"
6+
version = "2.4.6"
77
authors = ["Parity Technologies <admin@parity.io>"]
88
build = "build.rs"
99

whisper/src/message.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -264,17 +264,17 @@ impl Message {
264264

265265
let mut rng = {
266266
let mut thread_rng = ::rand::thread_rng();
267-
268267
XorShiftRng::from_seed(thread_rng.gen::<[u32; 4]>())
269268
};
270269

271270
assert!(params.ttl > 0);
272271

273272
let expiry = {
274-
let after_mining = SystemTime::now().checked_sub(Duration::from_millis(params.work))
275-
.ok_or(Error::TimestampOverflow)?;
276-
let since_epoch = after_mining.duration_since(time::UNIX_EPOCH)
277-
.expect("time after now is after unix epoch; qed");
273+
let since_epoch = SystemTime::now()
274+
.checked_add(Duration::from_secs(params.ttl))
275+
.and_then(|t| t.checked_add(Duration::from_millis(params.work)))
276+
.ok_or(Error::TimestampOverflow)?
277+
.duration_since(time::UNIX_EPOCH).expect("time after now is after unix epoch; qed");
278278

279279
// round up the sub-second to next whole second.
280280
since_epoch.as_secs() + if since_epoch.subsec_nanos() == 0 { 0 } else { 1 }

0 commit comments

Comments
 (0)