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

Commit

Permalink
[stable] Backports + Kovan HF (#7235)
Browse files Browse the repository at this point in the history
* Merge pull request #7075 from miyao-gmo/feature/estimate_gas_limit

escape inifinite loop in estimte_gas

* Merge pull request #7006 from paritytech/no-uncles

Disable uncles by default

* Maximum uncle count transition (#7196)

* Enable delayed maximum_uncle_count activation.

* Fix tests.

* Defer kovan HF.

* Bump version.

* Kovan HF.

* Update Kovan HF block.

* Fix compilation issues.

* Fix aura test.

* Add missing byzantium builtins.

* Fix tests.

* Bump version for installers.

* Increase allowed time drift to 10s. (#7238)
  • Loading branch information
tomusdrw authored and arkpar committed Dec 8, 2017
1 parent 12940e4 commit f4a496a
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 76 deletions.
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
description = "Parity Ethereum client"
name = "parity"
version = "1.7.9"
version = "1.7.10"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion dapps/node-health/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const UPDATE_TIMEOUT_ERR_SECS: u64 = 60;
const UPDATE_TIMEOUT_INCOMPLETE_SECS: u64 = 10;

/// Maximal valid time drift.
pub const MAX_DRIFT: i64 = 500;
pub const MAX_DRIFT: i64 = 10_000;

#[derive(Debug, Clone)]
/// A time checker.
Expand Down
20 changes: 15 additions & 5 deletions ethcore/res/ethereum/kovan.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@
},
"validateScoreTransition": 1000000,
"eip155Transition": 1000000,
"validateStepTransition": 1500000
}
"validateStepTransition": 1500000,
"maximumUncleCountTransition": 5100000,
"maximumUncleCount": 0
}
}
},
"params": {
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x2A",
"validateReceiptsTransition" : 1000000
"validateReceiptsTransition" : 1000000,
"eip140Transition": 5100000,
"eip211Transition": 5100000,
"eip214Transition": 5100000,
"eip658Transition": 5100000
},
"genesis": {
"seal": {
Expand All @@ -49,8 +55,12 @@
"accounts": {
"0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0x0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": 5100000, "pricing": { "modexp": { "divisor": 20 } } } },
"0x0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": 5100000, "pricing": { "linear": { "base": 500, "word": 0 } } } },
"0x0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": 5100000, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
"0x0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": 5100000, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
"0x00521965e7bd230323c423d96c657db5b79d099f": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
},
"nodes": [
Expand Down
9 changes: 7 additions & 2 deletions ethcore/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,13 @@ impl<'x> OpenBlock<'x> {
/// NOTE Will check chain constraints and the uncle number but will NOT check
/// that the header itself is actually valid.
pub fn push_uncle(&mut self, valid_uncle_header: Header) -> Result<(), BlockError> {
if self.block.uncles.len() + 1 > self.engine.maximum_uncle_count() {
return Err(BlockError::TooManyUncles(OutOfBounds{min: None, max: Some(self.engine.maximum_uncle_count()), found: self.block.uncles.len() + 1}));
let max_uncles = self.engine.maximum_uncle_count(self.block.header().number());
if self.block.uncles.len() + 1 > max_uncles {
return Err(BlockError::TooManyUncles(OutOfBounds{
min: None,
max: Some(max_uncles),
found: self.block.uncles.len() + 1,
}));
}
// TODO: check number
// TODO: check not a direct ancestor (use last_hashes for that)
Expand Down
18 changes: 8 additions & 10 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,12 +1192,12 @@ impl BlockChainClient for Client {
}

fn estimate_gas(&self, t: &SignedTransaction, block: BlockId) -> Result<U256, CallError> {
const UPPER_CEILING: u64 = 1_000_000_000_000u64;
let (mut upper, env_info) = {
let (mut upper, max_upper, env_info) = {
let mut env_info = self.env_info(block).ok_or(CallError::StatePruned)?;
let initial_upper = env_info.gas_limit;
env_info.gas_limit = UPPER_CEILING.into();
(initial_upper, env_info)
let init = env_info.gas_limit;
let max = init * U256::from(10);
env_info.gas_limit = max;
(init, max, env_info)
};

// that's just a copy of the state.
Expand All @@ -1218,9 +1218,7 @@ impl BlockChainClient for Client {
};

if !cond(upper)? {
// impossible at block gas limit - try `UPPER_CEILING` instead.
// TODO: consider raising limit by powers of two.
upper = UPPER_CEILING.into();
upper = max_upper;
if !cond(upper)? {
trace!(target: "estimate_gas", "estimate_gas failed with {}", upper);
let err = ExecutionError::Internal(format!("Requires higher than upper limit of {}", upper));
Expand Down Expand Up @@ -1788,7 +1786,7 @@ impl MiningBlockChainClient for Client {
.find_uncle_headers(&h, engine.maximum_uncle_age())
.unwrap_or_else(Vec::new)
.into_iter()
.take(engine.maximum_uncle_count())
.take(engine.maximum_uncle_count(open_block.header().number()))
.foreach(|h| {
open_block.push_uncle(h).expect("pushing maximum_uncle_count;
open_block was just created;
Expand All @@ -1803,7 +1801,7 @@ impl MiningBlockChainClient for Client {
fn reopen_block(&self, block: ClosedBlock) -> OpenBlock {
let engine = &*self.engine;
let mut block = block.reopen(engine);
let max_uncles = engine.maximum_uncle_count();
let max_uncles = engine.maximum_uncle_count(block.header().number());
if block.uncles().len() < max_uncles {
let chain = self.chain.read();
let h = chain.best_block_hash();
Expand Down
Loading

0 comments on commit f4a496a

Please sign in to comment.