This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Byzantium updates #5855
Merged
Merged
Byzantium updates #5855
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
aeb9b83
EIP-211 updates
arkpar 76907ad
benchmarks
arkpar becbf6a
blockhash instruction gas cost updated
arkpar 1be68ec
More benches
arkpar 3858c5c
EIP-684
arkpar c1b59cb
EIP-649
arkpar 7208cfc
EIP-658
arkpar b185b68
Updated some tests
arkpar e5fa860
Modexp fixes
arkpar 228edb5
STATICCALL fixes
arkpar 36b8751
Pairing fixes
arkpar e477986
More STATICALL fixes
arkpar 20afa50
Use paritytech/bn
arkpar dded3c7
Fixed REVERTing of contract creation
arkpar 7758cbc
Fixed more tests
arkpar faa4b11
Fixed more tests
arkpar 1d409c3
Blockchain tests
arkpar d9a2d37
Enable previously broken tests
arkpar 7fa6847
Transition test
arkpar ef958df
Updated tests
arkpar 52af887
Fixed modexp reading huge numbers
arkpar 1c043af
Enabled max_code_size test
arkpar bc601ce
Review fixes
arkpar 6054fc4
Updated pairing pricing
arkpar 7091587
Small improvements
arkpar e946ddc
missing commas (style)
NikVolf 79834f1
Update test.rs
NikVolf e8a13ba
eip161abc
arkpar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright 2015-2017 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#![feature(test)] | ||
|
||
extern crate test; | ||
extern crate ethcore_util as util; | ||
extern crate rand; | ||
extern crate bn; | ||
extern crate crypto; | ||
extern crate rustc_serialize; | ||
extern crate ethkey; | ||
|
||
use self::test::{Bencher}; | ||
use rand::{StdRng}; | ||
|
||
|
||
#[bench] | ||
fn bn_128_pairing(b: &mut Bencher) { | ||
use bn::{pairing, G1, G2, Fr, Group}; | ||
|
||
let rng = &mut ::rand::thread_rng(); | ||
|
||
let sk0 = Fr::random(rng); | ||
let sk1 = Fr::random(rng); | ||
|
||
let pk0 = G1::one() * sk0; | ||
let pk1 = G2::one() * sk1; | ||
|
||
b.iter(|| { | ||
let _ = pairing(pk0, pk1); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn bn_128_mul(b: &mut Bencher) { | ||
use bn::{AffineG1, G1, Fr, Group}; | ||
|
||
let mut rng = StdRng::new().unwrap(); | ||
let p: G1 = G1::random(&mut rng); | ||
let fr = Fr::random(&mut rng); | ||
|
||
b.iter(|| { | ||
let _ = AffineG1::from_jacobian(p * fr); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn sha256(b: &mut Bencher) { | ||
use crypto::sha2::Sha256; | ||
use crypto::digest::Digest; | ||
|
||
let mut input: [u8; 256] = [0; 256]; | ||
let mut out = [0; 32]; | ||
|
||
b.iter(|| { | ||
let mut sha = Sha256::new(); | ||
sha.input(&input); | ||
sha.result(&mut input[0..32]); | ||
}); | ||
} | ||
|
||
#[bench] | ||
fn ecrecover(b: &mut Bencher) { | ||
use rustc_serialize::hex::FromHex; | ||
use ethkey::{Signature, recover as ec_recover}; | ||
use util::H256; | ||
let input = FromHex::from_hex("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap(); | ||
let hash = H256::from_slice(&input[0..32]); | ||
let v = H256::from_slice(&input[32..64]); | ||
let r = H256::from_slice(&input[64..96]); | ||
let s = H256::from_slice(&input[96..128]); | ||
|
||
let bit = match v[31] { | ||
27 | 28 if &v.0[..31] == &[0; 31] => v[31] - 27, | ||
_ => { return; }, | ||
}; | ||
|
||
let s = Signature::from_rsv(&r, &s, bit); | ||
b.iter(|| { | ||
let _ = ec_recover(&s, &hash); | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "Byzantium (Test)", | ||
"engine": { | ||
"Ethash": { | ||
"params": { | ||
"minimumDifficulty": "0x020000", | ||
"difficultyBoundDivisor": "0x0800", | ||
"durationLimit": "0x0d", | ||
"homesteadTransition": "0x0", | ||
"eip150Transition": "0x0", | ||
"eip160Transition": "0x0", | ||
"eip161abcTransition": "0x0", | ||
"eip161dTransition": "0x0", | ||
"maxCodeSize": 24576, | ||
"eip649Reward": "0x29A2241AF62C0000", | ||
"eip100bTransition": "0x0", | ||
"eip649Transition": "0x0" | ||
} | ||
} | ||
}, | ||
"params": { | ||
"gasLimitBoundDivisor": "0x0400", | ||
"blockReward": "0x4563918244F40000", | ||
"registrar" : "0xc6d9d2cd449a754c494264e1809c50e34d64562b", | ||
"accountStartNonce": "0x00", | ||
"maximumExtraDataSize": "0x20", | ||
"minGasLimit": "0x1388", | ||
"networkID" : "0x1", | ||
"eip98Transition": "0xffffffffffffffff", | ||
"eip140Transition": "0x0", | ||
"eip211Transition": "0x0", | ||
"eip214Transition": "0x0", | ||
"eip155Transition": "0x0", | ||
"eip658Transition": "0x0" | ||
}, | ||
"genesis": { | ||
"seal": { | ||
"ethereum": { | ||
"nonce": "0x0000000000000042", | ||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
} | ||
}, | ||
"difficulty": "0x400000000", | ||
"author": "0x0000000000000000000000000000000000000000", | ||
"timestamp": "0x00", | ||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", | ||
"gasLimit": "0x1388" | ||
}, | ||
"accounts": { | ||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } }, | ||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } }, | ||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } }, | ||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }, | ||
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": "0x00", "pricing": { "modexp": { "divisor": 20 } } } }, | ||
"0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": "0x00", "pricing": { "linear": { "base": 500, "word": 0 } } } }, | ||
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": "0x00", "pricing": { "linear": { "base": 40000, "word": 0 } } } }, | ||
"0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": "0x00", "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tests
updated
15375 files
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check needed here? Also it seems it doesn't really cover all cases properly (
source_offset = 1
size = 2^256
will be ok)?Shouldn't
copy_data_to_memory
validate that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OutOfBounds
is a special error that is only generated for return data buffer. That's just another odd EIP requirement.copy_data_to_memory
just zero fills out of bounds regions.source_offset = 1, size = 2^256
won't pass gas check.