V2.5.12 stable (#11336)

* Enable EIP-2384 for ice age hard fork (#11281)
* ethcore/res: activate agharta on classic 9573000 (#11331)
* Istanbul HF in xDai (2019-12-12) (#11299)
* Istanbul HF in POA Core (2019-12-19) (#11298)
* Istanbul HF in POA Sokol (2019-12-05) (#11282)
* Activate ecip-1061 on kotti and mordor (#11338)
* Enable basic verification of local transactions (#11332)
* Disallow EIP-86 style null signatures for transactions outside tests (#11335)
This commit is contained in:
David 2019-12-16 14:53:34 +01:00 committed by s3krit
parent fc129b4a26
commit 29ebddc64f
23 changed files with 382 additions and 105 deletions

View File

@ -1,3 +1,20 @@
## Parity-Ethereum [v2.5.12](https://github.com/paritytech/parity-ethereum/releases/tag/v2.5.12)
Parity Ethereum v2.5.12-stable is a patch release that adds Istanbul hardfork
block numbers for POA and xDai networks, implements ECIP-1056 and implements
EIP-2384/2387 - Muir Glacier.
The full list of included changes:
* Enable EIP-2384 for ice age hard fork (#11281)
* ethcore/res: activate agharta on classic 9573000 (#11331)
* Istanbul HF in xDai (2019-12-12) (#11299)
* Istanbul HF in POA Core (2019-12-19) (#11298)
* Istanbul HF in POA Sokol (2019-12-05) (#11282)
* Activate ecip-1061 on kotti and mordor (#11338)
* Enable basic verification of local transactions (#11332)
* Disallow EIP-86 style null signatures for transactions outside tests (#11335)
## Parity-Ethereum [v2.5.11](https://github.com/paritytech/parity-ethereum/releases/tag/v2.5.11)
Parity Ethereum v2.5.11-stable is an emergency patch release that adds the missing

12
Cargo.lock generated
View File

@ -2726,7 +2726,7 @@ dependencies = [
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"jni 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_hook 0.1.0",
"parity-ethereum 2.5.11",
"parity-ethereum 2.5.12",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2783,7 +2783,7 @@ dependencies = [
[[package]]
name = "parity-ethereum"
version = "2.5.11"
version = "2.5.12"
dependencies = [
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2836,7 +2836,7 @@ dependencies = [
"parity-rpc 1.12.0",
"parity-runtime 0.1.0",
"parity-updater 1.12.0",
"parity-version 2.5.11",
"parity-version 2.5.12",
"parity-whisper 0.1.0",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2982,7 +2982,7 @@ dependencies = [
"parity-crypto 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-runtime 0.1.0",
"parity-updater 1.12.0",
"parity-version 2.5.11",
"parity-version 2.5.12",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3080,7 +3080,7 @@ dependencies = [
"parity-bytes 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-hash-fetch 1.12.0",
"parity-path 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-version 2.5.11",
"parity-version 2.5.12",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3090,7 +3090,7 @@ dependencies = [
[[package]]
name = "parity-version"
version = "2.5.11"
version = "2.5.12"
dependencies = [
"parity-bytes 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rlp 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -2,7 +2,7 @@
description = "Parity Ethereum client"
name = "parity-ethereum"
# NOTE Make sure to update util/version/Cargo.toml as well
version = "2.5.11"
version = "2.5.12"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]

View File

@ -37,7 +37,10 @@
"eip140Transition": "0x85d9a0",
"eip211Transition": "0x85d9a0",
"eip214Transition": "0x85d9a0",
"eip658Transition": "0x85d9a0"
"eip658Transition": "0x85d9a0",
"eip145Transition": "0x921288",
"eip1014Transition": "0x921288",
"eip1052Transition": "0x921288"
},
"genesis": {
"seal": {

View File

@ -136,7 +136,8 @@
"eip100bTransition": "0x42ae50",
"difficultyBombDelays": {
"0x42ae50": "0x2dc6c0",
"0x6f1580": "0x1e8480"
"0x6f1580": "0x1e8480",
"0x8c6180": "0x3d0900"
}
}
}

View File

@ -24,6 +24,10 @@
"eip658Transition": "0xaef49",
"eip1014Transition": "0x1a064d",
"eip1052Transition": "0x1a064d",
"eip1283Transition": "0x1f67cf",
"eip1344Transition": "0x1f67cf",
"eip1706Transition": "0x1f67cf",
"eip2028Transition": "0x1f67cf",
"gasLimitBoundDivisor": "0x400",
"maxCodeSize": "0x6000",
"maxCodeSizeTransition": "0xaef49",
@ -123,7 +127,7 @@
"0xaef49": {
"price": { "alt_bn128_const_operations": { "price": 500 }}
},
"0x7fffffffffffff": {
"0x1f67cf": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 150 }}
}
@ -138,7 +142,7 @@
"0xaef49": {
"price": { "alt_bn128_const_operations": { "price": 40000 }}
},
"0x7fffffffffffff": {
"0x1f67cf": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 6000 }}
}
@ -153,7 +157,7 @@
"0xaef49": {
"price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }}
},
"0x7fffffffffffff": {
"0x1f67cf": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }}
}
@ -161,7 +165,16 @@
}
},
"0x0000000000000000000000000000000000000009": {
"balance": "0x1"
"balance": "0x1",
"builtin": {
"name": "blake2_f",
"activate_at": "0x1f67cf",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
},
"0x000000000000000000000000000000000000000a": {
"balance": "0x1"

View File

@ -37,7 +37,11 @@
"eip658Transition":"0x0",
"eip145Transition":"0x498bb",
"eip1014Transition":"0x498bb",
"eip1052Transition":"0x498bb"
"eip1052Transition":"0x498bb",
"eip1283Transition":"0xbe10b",
"eip1344Transition":"0xbe10b",
"eip1706Transition":"0xbe10b",
"eip2028Transition":"0xbe10b"
},
"genesis":{
"seal":{
@ -59,7 +63,9 @@
"enode://1813e90a0afdd7c1e4892c5376960e3577a9e6c5a4f86fa405a405c7421a4a1608248d77cc90333842f13d8954d82113dec480cfb76b4fef8cb475157cf4d5f2@10.28.224.3:30000",
"enode://2b69a3926f36a7748c9021c34050be5e0b64346225e477fe7377070f6289bd363b2be73a06010fd516e6ea3ee90778dd0399bc007bb1281923a79374f842675a@51.15.116.226:30303",
"enode://621e28e529146fd501709194885f50540c494f1a2985d1fb4ec8769226b5cb0b0d1a11545926077821474c2767cdd87888ead8a2509a2c9069dd5584e4b1c3b8@10.28.223.8:30000",
"enode://a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd@51.15.116.226:30303"
"enode://a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd@51.15.116.226:30303",
"enode://f840b007500f50c98ea6f9c9e56dabf4690bbbbb7036d43682c531204341aff8315013547e5bee54117eb22bd3603585ae6bf713d9fa710659533fcab65d5b84@35.238.101.58:30000",
"enode://19eda672030ad5debb98c9069b3e99d12438b96506325d9f3f82d76c5f8ce4942d345f41700a5223900e75ad48e76713b74c1b694d67a10c2112540035922256@35.238.101.58:30000"
],
"accounts":{
"0x0000000000000000000000000000000000000001":{
@ -128,7 +134,7 @@
}
}
},
"0x7fffffffffffff":{
"0xbe10b":{
"info":"EIP 1108 transition",
"price":{
"alt_bn128_const_operations":{
@ -150,7 +156,7 @@
}
}
},
"0x7fffffffffffff":{
"0xbe10b":{
"info":"EIP 1108 transition",
"price":{
"alt_bn128_const_operations":{
@ -173,7 +179,7 @@
}
}
},
"0x7fffffffffffff":{
"0xbe10b":{
"info":"EIP 1108 transition",
"price":{
"alt_bn128_pairing":{
@ -184,6 +190,17 @@
}
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"activate_at": "0xbe10b",
"pricing": {
"blake2_f": {
"gas_per_round": 1
}
}
}
}
}
}

View File

@ -37,7 +37,12 @@
"eip658Transition": "0x0",
"eip145Transition": 8582254,
"eip1014Transition": 8582254,
"eip1052Transition": 8582254
"eip1052Transition": 8582254,
"eip1283Transition": 12598600,
"eip1344Transition": 12598600,
"eip1706Transition": 12598600,
"eip1884Transition": 12598600,
"eip2028Transition": 12598600
},
"genesis": {
"seal": {
@ -58,57 +63,89 @@
"enode://96678da10ac83769ab3f63114a41b57b700476c5ac02719b878fa89909a936551bb7609aa09b068bf89903206fa03f23e1b5b9117ca278de304c2570b87dcb27@35.175.15.164:30303"
],
"accounts": {
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x0", "pricing": { "modexp": { "divisor": 20 } } } },
"0000000000000000000000000000000000000006": {
"0x0000000000000000000000000000000000000005": {
"builtin": {
"name": "modexp",
"pricing": {
"0": {
"price": {
"modexp": {
"divisor": 20
}
}
}
}
}
},
"0x0000000000000000000000000000000000000006": {
"builtin": {
"name": "alt_bn128_add",
"pricing": {
"0": {
"price": { "alt_bn128_const_operations": { "price": 500 }}
},
"0x7fffffffffffff": {
"12598600": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 150 }}
}
}
}
},
"0000000000000000000000000000000000000007": {
"0x0000000000000000000000000000000000000007": {
"builtin": {
"name": "alt_bn128_mul",
"pricing": {
"0": {
"price": { "alt_bn128_const_operations": { "price": 40000 }}
},
"0x7fffffffffffff": {
"12598600": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 6000 }}
}
}
}
},
"0000000000000000000000000000000000000008": {
"0x0000000000000000000000000000000000000008": {
"builtin": {
"name": "alt_bn128_pairing",
"pricing": {
"0": {
"price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }}
},
"0x7fffffffffffff": {
"12598600": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }}
}
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"pricing": {
"12598600": {
"info": "EIP 1108 transition",
"price": {
"blake2_f": {
"gas_per_round": 1
}
}
}
}
}
},
"0x0000000000000000000000000000000000000001": {
"balance": "1",
"builtin": {
"name": "ecrecover",
"pricing": {
"linear": {
"base": 3000,
"word": 0
"0": {
"price": {
"linear": {
"base": 3000,
"word": 0
}
}
}
}
}
@ -118,9 +155,13 @@
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
"0": {
"price": {
"linear": {
"base": 60,
"word": 12
}
}
}
}
}
@ -130,9 +171,13 @@
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
"0": {
"price": {
"linear": {
"base": 600,
"word": 120
}
}
}
}
}
@ -142,9 +187,13 @@
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
"0": {
"price": {
"linear": {
"base": 15,
"word": 3
}
}
}
}
}

View File

@ -42,7 +42,12 @@
"eip1014Transition": 6464300,
"eip1052Transition": 6464300,
"eip1283Transition": 6464300,
"eip1283DisableTransition": 7026400
"eip1283DisableTransition": 7026400,
"eip1283ReenableTransition": 12095200,
"eip1344Transition": 12095200,
"eip1706Transition": 12095200,
"eip1884Transition": 12095200,
"eip2028Transition": 12095200
},
"genesis": {
"seal": {
@ -55,6 +60,7 @@
"gasLimit": "0x663BE0"
},
"nodes": [
"enode://bdcd6f875583df2bd8094f08ae58c7c2db6ed67795ca8c0e6415a30721d3657291aec9b933d15e17e0b36ad7a76424a1447ddbfc75809a04f7a0ffef5617dd56@3.91.206.172:30303",
"enode://8e0af07c86ec36590bb6368e7ad0c45b6dc658f5fb66ec68889a614affddda5e021bd513bcf4fb2fae4a3bbe08cf0de84f037cd58478a89665dfce1ded2595c7@34.236.37.74:30303",
"enode://f1a5100a81cb73163ae450c584d06b1f644aa4fad4486c6aeb4c384b343c54bb66c744aa5f133af66ea1b25f0f4a454f04878f3e96ee4cd2390c047396d6357b@209.97.158.4:30303",
"enode://0d1e0372f63a3f0b82d66635ea101ecc0f6797788a078805cc933dd93e6a22f7c9fa51ab4e2d21da02d04480ef19f3bbb9a2b41dd1c262085d295a354bb8b0f9@18.217.47.209:30303",
@ -64,7 +70,20 @@
"enode://b022ff70b5fcaf9596ae5efed99a8198b4ae0578ee9d17b733609d803a75cef95d3a2a18e50dca9a7c3b26139f158c59eaf8b5fb8d1d331c9a46934a78acabe8@206.189.76.128:30303"
],
"accounts": {
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x0", "pricing": { "modexp": { "divisor": 20 } } } },
"0000000000000000000000000000000000000005": {
"builtin": {
"name": "modexp",
"pricing": {
"0": {
"price": {
"modexp": {
"divisor": 20
}
}
}
}
}
},
"0000000000000000000000000000000000000006": {
"builtin": {
"name": "alt_bn128_add",
@ -72,7 +91,7 @@
"0": {
"price": { "alt_bn128_const_operations": { "price": 500 }}
},
"0x7fffffffffffff": {
"12095200": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 150 }}
}
@ -86,7 +105,7 @@
"0": {
"price": { "alt_bn128_const_operations": { "price": 40000 }}
},
"0x7fffffffffffff": {
"12095200": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 6000 }}
}
@ -100,21 +119,40 @@
"0": {
"price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }}
},
"0x7fffffffffffff": {
"12095200": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }}
}
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"pricing": {
"12095200": {
"info": "EIP 1108 transition",
"price": {
"blake2_f": {
"gas_per_round": 1
}
}
}
}
}
},
"0x0000000000000000000000000000000000000001": {
"balance": "1",
"builtin": {
"name": "ecrecover",
"pricing": {
"linear": {
"base": 3000,
"word": 0
"0": {
"price": {
"linear": {
"base": 3000,
"word": 0
}
}
}
}
}
@ -124,9 +162,13 @@
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
"0": {
"price": {
"linear": {
"base": 60,
"word": 12
}
}
}
}
}
@ -136,9 +178,13 @@
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
"0": {
"price": {
"linear": {
"base": 600,
"word": 120
}
}
}
}
}
@ -148,9 +194,13 @@
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
"0": {
"price": {
"linear": {
"base": 15,
"word": 3
}
}
}
}
}

View File

@ -16,7 +16,8 @@
"eip100bTransition": "0x19f0a0",
"difficultyBombDelays": {
"0x19f0a0": "0x2dc6c0",
"0x408b70": "0x1e8480"
"0x408b70": "0x1e8480",
"0x6c993d": "0x3d0900"
}
}
}

View File

@ -37,6 +37,11 @@
"eip1052Transition": 1604400,
"eip1283Transition": 1604400,
"eip1283DisableTransition": 2508800,
"eip1283ReenableTransition": 7298030,
"eip1344Transition": 7298030,
"eip1706Transition": 7298030,
"eip1884Transition": 7298030,
"eip2028Transition": 7298030,
"registrar": "0x1ec97dc137f5168af053c24460a1200502e1a9d2"
},
"genesis": {
@ -2865,10 +2870,13 @@
"0x0000000000000000000000000000000000000005": {
"builtin": {
"name": "modexp",
"activate_at": "0x0",
"pricing": {
"modexp": {
"divisor": 20
"0": {
"price": {
"modexp": {
"divisor": 20
}
}
}
}
}
@ -2880,7 +2888,7 @@
"0": {
"price": { "alt_bn128_const_operations": { "price": 500 }}
},
"0x7fffffffffffff": {
"7298030": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 150 }}
}
@ -2894,7 +2902,7 @@
"0": {
"price": { "alt_bn128_const_operations": { "price": 40000 }}
},
"0x7fffffffffffff": {
"7298030": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_const_operations": { "price": 6000 }}
}
@ -2908,21 +2916,40 @@
"0": {
"price": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 }}
},
"0x7fffffffffffff": {
"7298030": {
"info": "EIP 1108 transition",
"price": { "alt_bn128_pairing": { "base": 45000, "pair": 34000 }}
}
}
}
},
"0x0000000000000000000000000000000000000009": {
"builtin": {
"name": "blake2_f",
"pricing": {
"7298030": {
"info": "EIP 1108 transition",
"price": {
"blake2_f": {
"gas_per_round": 1
}
}
}
}
}
},
"0x0000000000000000000000000000000000000001": {
"balance": "1",
"builtin": {
"name": "ecrecover",
"pricing": {
"linear": {
"base": 3000,
"word": 0
"0": {
"price": {
"linear": {
"base": 3000,
"word": 0
}
}
}
}
}
@ -2932,9 +2959,13 @@
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
"0": {
"price": {
"linear": {
"base": 60,
"word": 12
}
}
}
}
}
@ -2944,9 +2975,13 @@
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
"0": {
"price": {
"linear": {
"base": 600,
"word": 120
}
}
}
}
}
@ -2956,9 +2991,13 @@
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
"0": {
"price": {
"linear": {
"base": 15,
"word": 3
}
}
}
}
}

View File

@ -245,7 +245,7 @@ impl<'a> EvmTestClient<'a> {
) -> std::result::Result<TransactSuccess<T::Output, V::Output>, TransactErr> {
let initial_gas = transaction.gas;
// Verify transaction
let is_ok = transaction.verify_basic(true, None, false);
let is_ok = transaction.verify_basic(true, None);
if let Err(error) = is_ok {
return Err(
TransactErr{

View File

@ -367,7 +367,7 @@ impl EthereumMachine {
} else {
None
};
t.verify_basic(check_low_s, chain_id, false)?;
t.verify_basic(check_low_s, chain_id)?;
Ok(())
}

View File

@ -1600,6 +1600,30 @@ mod tests {
assert_eq!(miner.prepare_pending_block(&client), BlockPreparationStatus::NotPrepared);
}
#[test]
fn should_reject_local_transaction_with_invalid_chain_id() {
let spec = Spec::new_test();
let miner = Miner::new_for_tests(&spec, None);
let client = TestBlockChainClient::default();
let chain_id = spec.chain_id();
// chain_id + 100500 is invalid
let import = miner.import_claimed_local_transaction(
&client,
PendingTransaction::new(transaction_with_chain_id(chain_id + 10500), None),
false,
);
assert_eq!(import, Err(transaction::Error::InvalidChainId));
// chain_id is valid
let import = miner.import_claimed_local_transaction(
&client,
PendingTransaction::new(transaction_with_chain_id(chain_id), None),
false,
);
assert_eq!(import, Ok(()));
}
#[test]
fn should_prioritize_locals() {
let client = TestBlockChainClient::default();

View File

@ -136,7 +136,12 @@ impl<'a, C: 'a> pool::client::Client for PoolClient<'a, C> where
self.chain.transaction_block(TransactionId::Hash(*hash)).is_some()
}
fn verify_transaction(&self, tx: UnverifiedTransaction)-> Result<SignedTransaction, transaction::Error> {
fn verify_transaction_basic(&self, tx: &UnverifiedTransaction) -> Result<(), transaction::Error> {
self.engine.verify_transaction_basic(tx, &self.best_block_header)?;
Ok(())
}
fn verify_transaction(&self, tx: UnverifiedTransaction) -> Result<SignedTransaction, transaction::Error> {
self.engine.verify_transaction_basic(&tx, &self.best_block_header)?;
let tx = self.engine.verify_transaction_unordered(tx, &self.best_block_header)?;

View File

@ -143,6 +143,7 @@ impl HeapSizeOf for Transaction {
}
}
#[cfg(any(test, feature = "test-helpers"))]
impl From<ethjson::state::Transaction> for SignedTransaction {
fn from(t: ethjson::state::Transaction) -> Self {
let to: Option<ethjson::hash::Address> = t.to.into();
@ -242,7 +243,10 @@ impl Transaction {
}
}
/// Add EIP-86 compatible empty signature.
/// Legacy EIP-86 compatible empty signature.
/// This method is used in json tests as well as
/// signature verification tests.
#[cfg(any(test, feature = "test-helpers"))]
pub fn null_sign(self, chain_id: u64) -> SignedTransaction {
SignedTransaction {
transaction: UnverifiedTransaction {
@ -306,7 +310,7 @@ impl rlp::Decodable for UnverifiedTransaction {
v: d.val_at(6)?,
r: d.val_at(7)?,
s: d.val_at(8)?,
hash: hash,
hash,
})
}
}
@ -323,7 +327,7 @@ impl UnverifiedTransaction {
self
}
/// Checks is signature is empty.
/// Checks if the signature is empty.
pub fn is_unsigned(&self) -> bool {
self.r.is_zero() && self.s.is_zero()
}
@ -387,17 +391,12 @@ impl UnverifiedTransaction {
}
/// Verify basic signature params. Does not attempt sender recovery.
pub fn verify_basic(&self, check_low_s: bool, chain_id: Option<u64>, allow_empty_signature: bool) -> Result<(), error::Error> {
if check_low_s && !(allow_empty_signature && self.is_unsigned()) {
self.check_low_s()?;
}
// Disallow unsigned transactions in case EIP-86 is disabled.
if !allow_empty_signature && self.is_unsigned() {
pub fn verify_basic(&self, check_low_s: bool, chain_id: Option<u64>) -> Result<(), error::Error> {
if self.is_unsigned() {
return Err(ethkey::Error::InvalidSignature.into());
}
// EIP-86: Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account 0.
if allow_empty_signature && self.is_unsigned() && !(self.gas_price.is_zero() && self.value.is_zero() && self.nonce.is_zero()) {
return Err(ethkey::Error::InvalidSignature.into())
if check_low_s {
self.check_low_s()?;
}
match (self.chain_id(), chain_id) {
(None, _) => {},
@ -443,20 +442,15 @@ impl SignedTransaction {
/// Try to verify transaction and recover sender.
pub fn new(transaction: UnverifiedTransaction) -> Result<Self, ethkey::Error> {
if transaction.is_unsigned() {
Ok(SignedTransaction {
transaction: transaction,
sender: UNSIGNED_SENDER,
public: None,
})
} else {
let public = transaction.recover_public()?;
let sender = public_to_address(&public);
Ok(SignedTransaction {
transaction: transaction,
sender: sender,
public: Some(public),
})
return Err(ethkey::Error::InvalidSignature);
}
let public = transaction.recover_public()?;
let sender = public_to_address(&public);
Ok(SignedTransaction {
transaction,
sender,
public: Some(public),
})
}
/// Returns transaction sender.
@ -646,6 +640,25 @@ mod tests {
assert_eq!(t.chain_id(), None);
}
#[test]
fn should_reject_null_signature() {
use std::str::FromStr;
let t = Transaction {
nonce: U256::zero(),
gas_price: U256::from(10000000000u64),
gas: U256::from(21000),
action: Action::Call(Address::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap()),
value: U256::from(1),
data: vec![]
}.null_sign(1);
let res = SignedTransaction::new(t.transaction);
match res {
Err(ethkey::Error::InvalidSignature) => {}
_ => panic!("null signature should be rejected"),
}
}
#[test]
fn should_recover_from_chain_specific_signing() {
use ethkey::{Random, Generator};

View File

@ -9,7 +9,7 @@ name = "parity-evm"
path = "./src/main.rs"
[dependencies]
common-types = { path = "../ethcore/types" }
common-types = { path = "../ethcore/types", features = ["test-helpers"] }
docopt = "1.0"
env_logger = "0.5"
ethcore = { path = "../ethcore", features = ["test-helpers", "json-tests", "to-pod-full"] }

View File

@ -203,6 +203,28 @@ mod tests {
]);
}
#[test]
fn deserialization_alt_bn128_const_operations() {
let s = r#"{
"name": "alt_bn128_mul",
"pricing": {
"100500": {
"price": { "alt_bn128_const_operations": { "price": 123 }}
}
}
}"#;
let builtin: Builtin = serde_json::from_str::<BuiltinCompat>(s).unwrap().into();
assert_eq!(builtin.name, "alt_bn128_mul");
assert_eq!(builtin.pricing, map![
100500 => PricingAt {
info: None,
price: Pricing::AltBn128ConstOperations(AltBn128ConstOperations {
price: 123,
}),
}
]);
}
#[test]
fn activate_at() {
let s = r#"{

View File

@ -97,6 +97,7 @@ impl<'a> Visitor<'a> for UintVisitor {
}
}
/// Deserialize and validate that the value is non-zero
pub fn validate_non_zero<'de, D>(d: D) -> Result<Uint, D::Error> where D: Deserializer<'de> {
let value = Uint::deserialize(d)?;
@ -107,6 +108,7 @@ pub fn validate_non_zero<'de, D>(d: D) -> Result<Uint, D::Error> where D: Deseri
Ok(value)
}
/// Deserialize and validate that the value is non-zero
pub fn validate_optional_non_zero<'de, D>(d: D) -> Result<Option<Uint>, D::Error> where D: Deserializer<'de> {
let value: Option<Uint> = Option::deserialize(d)?;

View File

@ -50,6 +50,15 @@ pub trait Client: fmt::Debug + Sync {
/// Is transaction with given hash already in the blockchain?
fn transaction_already_included(&self, hash: &H256) -> bool;
/// Perform basic/cheap transaction verification.
///
/// This should include all cheap checks that can be done before
/// actually checking the signature, like chain-replay protection.
///
/// This method is currently used only for verifying local transactions.
fn verify_transaction_basic(&self, t: &transaction::UnverifiedTransaction)
-> Result<(), transaction::Error>;
/// Structurarily verify given transaction.
fn verify_transaction(&self, tx: transaction::UnverifiedTransaction)
-> Result<transaction::SignedTransaction, transaction::Error>;

View File

@ -103,6 +103,12 @@ impl pool::client::Client for TestClient {
false
}
fn verify_transaction_basic(&self, _tx: &UnverifiedTransaction)
-> Result<(), transaction::Error>
{
Ok(())
}
fn verify_transaction(&self, tx: UnverifiedTransaction)
-> Result<SignedTransaction, transaction::Error>
{

View File

@ -250,7 +250,13 @@ impl<C: Client> txpool::Verifier<Transaction> for Verifier<C, ::pool::scoring::N
bail!(err)
},
},
Transaction::Local(tx) => tx,
Transaction::Local(tx) => match self.client.verify_transaction_basic(&**tx) {
Ok(()) => tx,
Err(err) => {
warn!(target: "txqueue", "[{:?}] Rejected local tx {:?}", hash, err);
return Err(err)
}
},
};
// Verify RLP payload

View File

@ -3,7 +3,7 @@
[package]
name = "parity-version"
# NOTE: this value is used for Parity Ethereum version string (via env CARGO_PKG_VERSION)
version = "2.5.11"
version = "2.5.12"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"