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

Commit

Permalink
Backports: parity stable 2.0.9 (#9786)
Browse files Browse the repository at this point in the history
* version: bump parity stable to 2.0.9

* ethcore: bump ropsten forkblock checkpoint (#9775)

* ethcore: handle vm exception when estimating gas (#9615)

* update jsonrpc-core to a1b2bb742ce16d1168669ffb13ffe856e8131228

* removed "rustup" & added new runner tag (#9731)

* removed "rustup" & added new runner tag

* exchanged tag "rust-windows" with "windows"

* revert windows tag change

* Allow zero chain id in EIP155 signing process (#9792)

* Allow zero chain id in EIP155 signing process

* Rename test

* Fix test failure

* Insert dev account before unlocking (#9813)
  • Loading branch information
5chdn authored Oct 28, 2018
1 parent ef8f95e commit 09f7757
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 45 deletions.
36 changes: 19 additions & 17 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
Expand Up @@ -2,7 +2,7 @@
description = "Parity Ethereum client"
name = "parity-ethereum"
# NOTE Make sure to update util/version/Cargo.toml as well
version = "2.0.8"
version = "2.0.9"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]

Expand Down
4 changes: 2 additions & 2 deletions ethcore/res/ethereum/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x3",
"forkBlock": 3383558,
"forkCanonHash": "0x6b4b80d65951375a70bc1ecf9a270d152dd355454d57869abbae2e42c213e0f3",
"forkBlock": "0x40E80F",
"forkCanonHash": "0x3e12d5c0f8d63fbc5831cc7f7273bd824fa4d0a9a4102d65d99a7ea5604abc00",
"maxCodeSize": 24576,
"maxCodeSizeTransition": 10,
"eip150Transition": 0,
Expand Down
28 changes: 17 additions & 11 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,28 +1486,34 @@ impl Call for Client {
let sender = t.sender();
let options = || TransactOptions::with_tracing().dont_check_nonce();

let cond = |gas| {
let exec = |gas| {
let mut tx = t.as_unsigned().clone();
tx.gas = gas;
let tx = tx.fake_sign(sender);

let mut clone = state.clone();
Ok(Executive::new(&mut clone, &env_info, self.engine.machine())
Executive::new(&mut clone, &env_info, self.engine.machine())
.transact_virtual(&tx, options())
.ok()
.map(|r| r.exception.is_none())
.unwrap_or(false))
};

if !cond(upper)? {
let cond = |gas| exec(gas).unwrap_or(false);

if !cond(upper) {
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));
return Err(err.into())
match exec(upper) {
Some(false) => return Err(CallError::Exceptional),
None => {
trace!(target: "estimate_gas", "estimate_gas failed with {}", upper);
let err = ExecutionError::Internal(format!("Requires higher than upper limit of {}", upper));
return Err(err.into())
},
_ => {},
}
}
let lower = t.gas_required(&self.engine.schedule(env_info.number)).into();
if cond(lower)? {
if cond(lower) {
trace!(target: "estimate_gas", "estimate_gas succeeded with {}", lower);
return Ok(lower)
}
Expand All @@ -1516,12 +1522,12 @@ impl Call for Client {
/// Returns the lowest value between `lower` and `upper` for which `cond` returns true.
/// We assert: `cond(lower) = false`, `cond(upper) = true`
fn binary_chop<F, E>(mut lower: U256, mut upper: U256, mut cond: F) -> Result<U256, E>
where F: FnMut(U256) -> Result<bool, E>
where F: FnMut(U256) -> bool
{
while upper - lower > 1.into() {
let mid = (lower + upper) / 2.into();
trace!(target: "estimate_gas", "{} .. {} .. {}", lower, mid, upper);
let c = cond(mid)?;
let c = cond(mid);
match c {
true => upper = mid,
false => lower = mid,
Expand Down
27 changes: 24 additions & 3 deletions ethcore/transaction/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ pub mod signature {
match v {
v if v == 27 => 0,
v if v == 28 => 1,
v if v > 36 => ((v - 1) % 2) as u8,
_ => 4
v if v >= 35 => ((v - 1) % 2) as u8,
_ => 4
}
}
}
Expand Down Expand Up @@ -358,7 +358,7 @@ impl UnverifiedTransaction {
pub fn chain_id(&self) -> Option<u64> {
match self.v {
v if self.is_unsigned() => Some(v),
v if v > 36 => Some((v - 35) / 2),
v if v >= 35 => Some((v - 35) / 2),
_ => None,
}
}
Expand Down Expand Up @@ -577,6 +577,27 @@ mod tests {
assert_eq!(t.chain_id(), None);
}

#[test]
fn signing_eip155_zero_chainid() {
use ethkey::{Random, Generator};

let key = Random.generate().unwrap();
let t = Transaction {
action: Action::Create,
nonce: U256::from(42),
gas_price: U256::from(3000),
gas: U256::from(50_000),
value: U256::from(1),
data: b"Hello!".to_vec()
};

let hash = t.hash(Some(0));
let sig = ::ethkey::sign(&key.secret(), &hash).unwrap();
let u = t.with_signature(sig, Some(0));

assert!(SignedTransaction::new(u).is_ok());
}

#[test]
fn signing() {
use ethkey::{Random, Generator};
Expand Down
10 changes: 5 additions & 5 deletions parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,11 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str,
account_settings,
);

// Add development account if running dev chain:
if let SpecType::Dev = *spec {
insert_dev_account(&account_provider);
}

for a in cfg.unlocked_accounts {
// Check if the account exists
if !account_provider.has_account(a) {
Expand All @@ -976,11 +981,6 @@ fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str,
}
}

// Add development account if running dev chain:
if let SpecType::Dev = *spec {
insert_dev_account(&account_provider);
}

Ok(account_provider)
}

Expand Down
2 changes: 0 additions & 2 deletions scripts/gitlab/build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ set -u # treat unset variables as error
set INCLUDE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\vs2015\VC\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"
set LIB="C:\vs2015\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64"

rustup default stable-x86_64-pc-windows-msvc

echo "__________Show ENVIROMENT__________"
echo "CI_SERVER_NAME: " $CI_SERVER_NAME
echo "CARGO_HOME: " $CARGO_HOME
Expand Down
8 changes: 4 additions & 4 deletions util/version/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[package]
name = "parity-version"
# NOTE: this value is used for Parity version string (via env CARGO_PKG_VERSION)
version = "2.0.8"
version = "2.0.9"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"

Expand All @@ -16,9 +16,9 @@ track = "stable"
# Latest supported fork blocks.
# Indicates a critical release in this track (i.e. consensus issue).
[package.metadata.networks]
foundation = { forkBlock = 4370000, critical = true }
ropsten = { forkBlock = 10, critical = true }
kovan = { forkBlock = 6600000, critical = true }
foundation = { forkBlock = 4370000, critical = false }
ropsten = { forkBlock = 4230000, critical = false }
kovan = { forkBlock = 6600000, critical = false }

[dependencies]
parity-bytes = { git = "https://github.com/paritytech/parity-common" }
Expand Down

0 comments on commit 09f7757

Please sign in to comment.