Byzantium updates (#5855)
* EIP-211 updates * benchmarks * blockhash instruction gas cost updated * More benches * EIP-684 * EIP-649 * EIP-658 * Updated some tests * Modexp fixes * STATICCALL fixes * Pairing fixes * More STATICALL fixes * Use paritytech/bn * Fixed REVERTing of contract creation * Fixed more tests * Fixed more tests * Blockchain tests * Enable previously broken tests * Transition test * Updated tests * Fixed modexp reading huge numbers * Enabled max_code_size test * Review fixes * Updated pairing pricing * missing commas (style) * Update test.rs * Small improvements * eip161abc
This commit is contained in:
committed by
Gav Wood
parent
b602fb4a5e
commit
25b35ebddd
@@ -21,6 +21,7 @@ use hash::H256;
|
||||
use blockchain::state::State;
|
||||
use blockchain::header::Header;
|
||||
use blockchain::block::Block;
|
||||
use state::test::ForkSpec;
|
||||
use spec::{Genesis, Seal, Ethereum};
|
||||
|
||||
/// Blockchain deserialization.
|
||||
@@ -42,7 +43,9 @@ pub struct BlockChain {
|
||||
pub pre_state: State,
|
||||
/// Hash of best block.
|
||||
#[serde(rename="lastblockhash")]
|
||||
pub best_block: H256
|
||||
pub best_block: H256,
|
||||
/// Network.
|
||||
pub network: ForkSpec,
|
||||
}
|
||||
|
||||
impl BlockChain {
|
||||
@@ -102,7 +105,7 @@ mod tests {
|
||||
"rlp" : "0xf90285f90219a0f052d217bd5275a5177a3c3b7debdfe2670f1c8394b2965ccd5c1883cc1a524da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefba82560b8456850c2ca00102030405060708091011121314151617181920212223242526272829303132a05266ca43e81d25925a9ba573c3e4f9180bc076d316d90e63c6f8708b272f5ce28859ba4daed1898e21f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0",
|
||||
"transactions" : [
|
||||
{
|
||||
"data" : "0x",
|
||||
"data" : "0x00",
|
||||
"gasLimit" : "0xc350",
|
||||
"gasPrice" : "0x0a",
|
||||
"nonce" : "0x00",
|
||||
@@ -116,6 +119,7 @@ mod tests {
|
||||
"uncleHeaders" : [
|
||||
]
|
||||
}],
|
||||
"network" : "Frontier",
|
||||
"genesisBlockHeader" : {
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1",
|
||||
|
||||
@@ -34,6 +34,15 @@ pub struct Modexp {
|
||||
pub divisor: usize,
|
||||
}
|
||||
|
||||
/// Pricing for alt_bn128_pairing.
|
||||
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||
pub struct AltBn128Pairing {
|
||||
/// Base price.
|
||||
pub base: usize,
|
||||
/// Price per point pair.
|
||||
pub pair: usize,
|
||||
}
|
||||
|
||||
/// Pricing variants.
|
||||
#[derive(Debug, PartialEq, Deserialize, Clone)]
|
||||
pub enum Pricing {
|
||||
@@ -43,6 +52,9 @@ pub enum Pricing {
|
||||
/// Pricing for modular exponentiation.
|
||||
#[serde(rename="modexp")]
|
||||
Modexp(Modexp),
|
||||
/// Pricing for alt_bn128_pairing exponentiation.
|
||||
#[serde(rename="alt_bn128_pairing")]
|
||||
AltBn128Pairing(AltBn128Pairing),
|
||||
}
|
||||
|
||||
/// Spec builtin.
|
||||
|
||||
@@ -111,6 +111,18 @@ pub struct EthashParams {
|
||||
/// See main EthashParams docs.
|
||||
#[serde(rename="minGasPrice")]
|
||||
pub min_gas_price: Option<Uint>,
|
||||
|
||||
/// EIP-649 transition block.
|
||||
#[serde(rename="eip649Transition")]
|
||||
pub eip649_transition: Option<Uint>,
|
||||
|
||||
/// EIP-649 bomb delay.
|
||||
#[serde(rename="eip649Delay")]
|
||||
pub eip649_delay: Option<Uint>,
|
||||
|
||||
/// EIP-649 base reward.
|
||||
#[serde(rename="eip649Reward")]
|
||||
pub eip649_reward: Option<Uint>,
|
||||
}
|
||||
|
||||
/// Ethash engine deserialization.
|
||||
@@ -221,6 +233,9 @@ mod tests {
|
||||
max_gas_limit: None,
|
||||
min_gas_price_transition: None,
|
||||
min_gas_price: None,
|
||||
eip649_transition: None,
|
||||
eip649_delay: None,
|
||||
eip649_reward: None,
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -262,6 +277,9 @@ mod tests {
|
||||
max_gas_limit: None,
|
||||
min_gas_price_transition: None,
|
||||
min_gas_price: None,
|
||||
eip649_transition: None,
|
||||
eip649_delay: None,
|
||||
eip649_reward: None,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ pub struct Params {
|
||||
#[serde(rename="eip214Transition")]
|
||||
pub eip214_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
#[serde(rename="eip658Transition")]
|
||||
pub eip658_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
#[serde(rename="dustProtectionTransition")]
|
||||
pub dust_protection_transition: Option<Uint>,
|
||||
/// See `CommonParams` docs.
|
||||
|
||||
@@ -104,10 +104,12 @@ pub enum ForkSpec {
|
||||
EIP158,
|
||||
Frontier,
|
||||
Homestead,
|
||||
// TODO [ToDr] Deprecated
|
||||
Metropolis,
|
||||
Byzantium,
|
||||
Constantinople,
|
||||
EIP158ToByzantiumAt5,
|
||||
FrontierToHomesteadAt5,
|
||||
HomesteadToDaoAt5,
|
||||
HomesteadToEIP150At5,
|
||||
}
|
||||
|
||||
/// State test indexes deserialization.
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
//! Vm log deserialization.
|
||||
|
||||
use hash::{Address, H256, Bloom};
|
||||
use bytes::Bytes;
|
||||
|
||||
/// Vm log deserialization.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub struct Log {
|
||||
/// Log address.
|
||||
pub address: Address,
|
||||
/// Log bloom.
|
||||
pub bloom: Bloom,
|
||||
/// Data.
|
||||
pub data: Bytes,
|
||||
/// Topics.
|
||||
pub topics: Vec<H256>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json;
|
||||
use vm::Log;
|
||||
|
||||
#[test]
|
||||
fn log_deserialization() {
|
||||
let s = r#"{
|
||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||
"bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000800000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000",
|
||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||
"topics" : [
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
]
|
||||
}"#;
|
||||
let _deserialized: Log = serde_json::from_str(s).unwrap();
|
||||
// TODO: validate all fields
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@
|
||||
pub mod env;
|
||||
pub mod transaction;
|
||||
pub mod vm;
|
||||
pub mod log;
|
||||
pub mod call;
|
||||
pub mod test;
|
||||
|
||||
pub use self::env::Env;
|
||||
pub use self::transaction::Transaction;
|
||||
pub use self::vm::Vm;
|
||||
pub use self::log::Log;
|
||||
pub use self::call::Call;
|
||||
pub use self::test::Test;
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
|
||||
use bytes::Bytes;
|
||||
use uint::Uint;
|
||||
use hash::H256;
|
||||
use blockchain::State;
|
||||
use vm::{Transaction, Log, Call, Env};
|
||||
use vm::{Transaction, Call, Env};
|
||||
|
||||
/// Reporesents vm execution environment before and after exeuction of transaction.
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
@@ -35,8 +36,8 @@ pub struct Vm {
|
||||
/// Gas left after transaction execution.
|
||||
#[serde(rename="gas")]
|
||||
pub gas_left: Option<Uint>,
|
||||
/// Logs created during execution of transaction.
|
||||
pub logs: Option<Vec<Log>>,
|
||||
/// Hash of logs created during execution of transaction.
|
||||
pub logs: Option<H256>,
|
||||
/// Transaction output.
|
||||
#[serde(rename="out")]
|
||||
pub output: Option<Bytes>,
|
||||
@@ -83,9 +84,9 @@ mod tests {
|
||||
"value" : "0x0de0b6b3a7640000"
|
||||
},
|
||||
"gas" : "0x013874",
|
||||
"logs" : [
|
||||
],
|
||||
"logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
||||
"out" : "0x",
|
||||
"network" : "Frontier",
|
||||
"post" : {
|
||||
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
|
||||
Reference in New Issue
Block a user