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

Commit

Permalink
Merge branch 'master' into dp/chore/kvdb-no-default-column
Browse files Browse the repository at this point in the history
* master:
  Istanbul activation on xDai (#11299)
  Istanbul activation on POA Core (#11298)
  Adds support for ipc socket permissions (#11273)
  Add check for deserialising hex values over U256 limit (#11309)
  validate-chainspecs: check istanbul eips are in the foundation spec (#11305)
  • Loading branch information
dvdplm committed Dec 9, 2019
2 parents 714c0b9 + 4c6b282 commit bf1bfea
Show file tree
Hide file tree
Showing 12 changed files with 278 additions and 131 deletions.
157 changes: 79 additions & 78 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions ethcore/res/ethereum/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@
"eip145Transition": "0x6f1580",
"eip1014Transition": "0x6f1580",
"eip1052Transition": "0x6f1580",
"eip1283Transition": "0x8a61c8",
"eip1283Transition": "0x0",
"eip1283DisableTransition": "0x0",
"eip1283ReenableTransition": "0x8a61c8",
"eip1344Transition": "0x8a61c8",
"eip1706Transition": "0x8a61c8",
"eip1884Transition": "0x8a61c8",
"eip2028Transition": "0x8a61c8",
"eip1344Transition": "0x8a61c8"
"eip2028Transition": "0x8a61c8"
},
"genesis": {
"seal": {
Expand Down
89 changes: 69 additions & 20 deletions ethcore/res/ethereum/poacore.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5406,57 +5411,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
}
}
}
}
}
Expand All @@ -5466,9 +5503,13 @@
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
"0": {
"price": {
"linear": {
"base": 60,
"word": 12
}
}
}
}
}
Expand All @@ -5478,9 +5519,13 @@
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
"0": {
"price": {
"linear": {
"base": 600,
"word": 120
}
}
}
}
}
Expand All @@ -5490,9 +5535,13 @@
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
"0": {
"price": {
"linear": {
"base": 15,
"word": 3
}
}
}
}
}
Expand Down
75 changes: 57 additions & 18 deletions ethcore/res/ethereum/xdai.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"eip1052Transition": 1604400,
"eip1283Transition": 1604400,
"eip1283DisableTransition": 2508800,
"eip1283ReenableTransition": 7298030,
"eip1344Transition": 7298030,
"eip1706Transition": 7298030,
"eip1884Transition": 7298030,
"eip2028Transition": 7298030,
"registrar": "0x1ec97dc137f5168af053c24460a1200502e1a9d2"
},
"genesis": {
Expand Down Expand Up @@ -2865,10 +2870,13 @@
"0x0000000000000000000000000000000000000005": {
"builtin": {
"name": "modexp",
"activate_at": "0x0",
"pricing": {
"modexp": {
"divisor": 20
"0": {
"price": {
"modexp": {
"divisor": 20
}
}
}
}
}
Expand All @@ -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 }}
}
Expand All @@ -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 }}
}
Expand All @@ -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
}
}
}
}
}
Expand All @@ -2932,9 +2959,13 @@
"builtin": {
"name": "sha256",
"pricing": {
"linear": {
"base": 60,
"word": 12
"0": {
"price": {
"linear": {
"base": 60,
"word": 12
}
}
}
}
}
Expand All @@ -2944,9 +2975,13 @@
"builtin": {
"name": "ripemd160",
"pricing": {
"linear": {
"base": 600,
"word": 120
"0": {
"price": {
"linear": {
"base": 600,
"word": 120
}
}
}
}
}
Expand All @@ -2956,9 +2991,13 @@
"builtin": {
"name": "identity",
"pricing": {
"linear": {
"base": 15,
"word": 3
"0": {
"price": {
"linear": {
"base": 15,
"word": 3
}
}
}
}
}
Expand Down
24 changes: 21 additions & 3 deletions json/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ impl<'a> Visitor<'a> for UintVisitor {
let value = match value.len() {
0 => U256::from(0),
2 if value.starts_with("0x") => U256::from(0),
_ if value.starts_with("0x") => U256::from_str(&value[2..]).map_err(|e| {
Error::custom(format!("Invalid hex value {}: {}", value, e).as_str())
})?,
_ if value.starts_with("0x") => {
if value.len() > 66 {
return Err(Error::custom(format!("Invalid hex value {}: value too big", value).as_str()));
}
U256::from_str(&value[2..]).map_err(|e| {
Error::custom(format!("Invalid hex value {}: {}", value, e).as_str())
})?
},
_ => U256::from_dec_str(value).map_err(|e| {
Error::custom(format!("Invalid decimal value {}: {:?}", value, e).as_str())
})?
Expand Down Expand Up @@ -120,6 +125,7 @@ pub fn validate_optional_non_zero<'de, D>(d: D) -> Result<Option<Uint>, D::Error
mod test {
use super::Uint;
use ethereum_types::U256;
use serde_json::error::Category;

#[test]
fn uint_deserialization() {
Expand All @@ -134,6 +140,18 @@ mod test {
]);
}

#[test]
fn uint_deserialization_error_for_hex_too_large() {
let hex = format!("0x{}", "1".repeat(65));
let result: Result<Uint, _> = serde_json::from_str(&format!(r#""{}""#, hex));
let err = result.unwrap_err();
assert!(err.is_data());
assert_eq!(
err.to_string(),
format!("Invalid hex value {}: value too big at line 1 column 69", hex)
);
}

#[test]
fn uint_into() {
assert_eq!(U256::from(10), Uint(U256::from(10)).into());
Expand Down
Loading

0 comments on commit bf1bfea

Please sign in to comment.