Use berlin chainspec for unit test, yolo3 for testnet (#244)
* Fix yolo+berlin specs * fix yolo3 maximumExtraDataSize * fmt
This commit is contained in:
parent
a831379ad8
commit
2e23ca353f
@ -248,7 +248,7 @@ usage! {
|
||||
|
||||
ARG arg_chain: (String) = "foundation", or |c: &Config| c.parity.as_ref()?.chain.clone(),
|
||||
"--chain=[CHAIN]",
|
||||
"Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, morden, ropsten, kovan, rinkeby, goerli, poasokol, testnet, or dev.",
|
||||
"Specify the blockchain type. CHAIN may be either a JSON chain specification file or ethereum, poacore, xdai, volta, ewc, musicoin, ellaism, mix, callisto, morden, ropsten, kovan, rinkeby, goerli, poasokol, testnet, yolo3 or dev.",
|
||||
|
||||
ARG arg_keys_path: (String) = "$BASE/keys", or |c: &Config| c.parity.as_ref()?.keys_path.clone(),
|
||||
"--keys-path=[PATH]",
|
||||
|
@ -51,6 +51,7 @@ pub enum SpecType {
|
||||
Rinkeby,
|
||||
Goerli,
|
||||
Sokol,
|
||||
Yolo3,
|
||||
Dev,
|
||||
Custom(String),
|
||||
}
|
||||
@ -81,6 +82,7 @@ impl str::FromStr for SpecType {
|
||||
"rinkeby" => SpecType::Rinkeby,
|
||||
"goerli" | "görli" | "testnet" => SpecType::Goerli,
|
||||
"sokol" | "poasokol" => SpecType::Sokol,
|
||||
"yolo3" => SpecType::Yolo3,
|
||||
"dev" => SpecType::Dev,
|
||||
other => SpecType::Custom(other.into()),
|
||||
};
|
||||
@ -106,6 +108,7 @@ impl fmt::Display for SpecType {
|
||||
SpecType::Rinkeby => "rinkeby",
|
||||
SpecType::Goerli => "goerli",
|
||||
SpecType::Sokol => "sokol",
|
||||
SpecType::Yolo3 => "yolo3",
|
||||
SpecType::Dev => "dev",
|
||||
SpecType::Custom(ref custom) => custom,
|
||||
})
|
||||
@ -131,6 +134,7 @@ impl SpecType {
|
||||
SpecType::Rinkeby => Ok(ethereum::new_rinkeby(params)),
|
||||
SpecType::Goerli => Ok(ethereum::new_goerli(params)),
|
||||
SpecType::Sokol => Ok(ethereum::new_sokol(params)),
|
||||
SpecType::Yolo3 => Ok(ethereum::new_yolo3(params)),
|
||||
SpecType::Dev => Ok(Spec::new_instant()),
|
||||
SpecType::Custom(ref filename) => {
|
||||
let file = fs::File::open(filename).map_err(|e| {
|
||||
|
@ -35,7 +35,7 @@
|
||||
"gasLimitBoundDivisor": "0x0400",
|
||||
"maxCodeSize": 24576,
|
||||
"maxCodeSizeTransition": "0x0",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"maximumExtraDataSize": "0xffff",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID": "133519467574835",
|
||||
"registrar": "0xc6d9d2cd449a754c494264e1809c50e34d64562b"
|
@ -109,7 +109,6 @@ impl<'a> EvmTestClient<'a> {
|
||||
Some(ethereum::new_byzantium_to_constantinoplefixat5_test())
|
||||
}
|
||||
ForkSpec::Berlin => Some(ethereum::new_berlin_test()),
|
||||
ForkSpec::Yolo3 => Some(ethereum::new_yolo3_test()),
|
||||
ForkSpec::FrontierToHomesteadAt5
|
||||
| ForkSpec::HomesteadToDaoAt5
|
||||
| ForkSpec::HomesteadToEIP150At5
|
||||
|
@ -163,6 +163,13 @@ pub fn new_sokol<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
include_bytes!("../../res/chainspec/poasokol.json"),
|
||||
)
|
||||
}
|
||||
/// Create a new YOLO spec
|
||||
pub fn new_yolo3<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(
|
||||
params.into(),
|
||||
include_bytes!("../../res/chainspec/yolo3.json"),
|
||||
)
|
||||
}
|
||||
|
||||
// For tests
|
||||
|
||||
@ -275,14 +282,6 @@ pub fn new_eip2930_test() -> Spec {
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new YOLO spec
|
||||
pub fn new_yolo3_test() -> Spec {
|
||||
load(
|
||||
None,
|
||||
include_bytes!("../../res/chainspec/test/yolo3_test.json"),
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new Musicoin-MCIP3-era spec.
|
||||
pub fn new_mcip3_test() -> Spec {
|
||||
load(
|
||||
|
@ -39,7 +39,6 @@ pub enum ForkSpec {
|
||||
ByzantiumToConstantinopleAt5,
|
||||
ByzantiumToConstantinopleFixAt5,
|
||||
Berlin,
|
||||
Yolo3,
|
||||
}
|
||||
|
||||
/// Spec deserialization.
|
||||
|
@ -1046,7 +1046,7 @@ fn test_subs_simple(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(18);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let gas_left = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1064,7 +1064,7 @@ fn test_subs_two_levels(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(36);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let gas_left = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1082,7 +1082,7 @@ fn test_subs_invalid_jump(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(24);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let current = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1101,7 +1101,7 @@ fn test_subs_shallow_return_stack(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(24);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let current = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1136,7 +1136,7 @@ fn test_subs_substack_limit(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(1_000_000);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let gas_left = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1154,7 +1154,7 @@ fn test_subs_substack_out(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(1_000_000);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let current = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1175,7 +1175,7 @@ fn test_subs_sub_at_end(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(30);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let gas_left = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1192,7 +1192,7 @@ fn test_subs_walk_into_subroutine(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(100);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_berlin();
|
||||
let mut ext = FakeExt::new_berlin(Address::zero(), Address::zero(), &[]);
|
||||
|
||||
let current = {
|
||||
let vm = factory.create(params, ext.schedule(), ext.depth());
|
||||
@ -1578,7 +1578,7 @@ fn test_access_list_ext_at_precompiles(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(8653);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_yolo3(
|
||||
let mut ext = FakeExt::new_berlin(
|
||||
Address::from("0x0000000000000000000000000000000000000000"),
|
||||
Address::from("0x000000000000000000000000636F6E7472616374"),
|
||||
&[
|
||||
@ -1602,7 +1602,7 @@ fn test_access_list_extcodecopy_twice(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(2835);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_yolo3(
|
||||
let mut ext = FakeExt::new_berlin(
|
||||
Address::from("0x0000000000000000000000000000000000000000"),
|
||||
Address::from("0x000000000000000000000000636F6E7472616374"),
|
||||
&[],
|
||||
@ -1628,7 +1628,7 @@ fn test_access_list_sload_sstore(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(44529);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_yolo3(
|
||||
let mut ext = FakeExt::new_berlin(
|
||||
Address::from("0x0000000000000000000000000000000000000000"),
|
||||
Address::from("0x000000000000000000000000636F6E7472616374"),
|
||||
&[],
|
||||
@ -1648,7 +1648,7 @@ fn test_access_list_cheap_expensive_cheap(factory: super::Factory) {
|
||||
let mut params = ActionParams::default();
|
||||
params.gas = U256::from(2869);
|
||||
params.code = Some(Arc::new(code));
|
||||
let mut ext = FakeExt::new_yolo3(
|
||||
let mut ext = FakeExt::new_berlin(
|
||||
Address::from("0x0000000000000000000000000000000000000000"),
|
||||
Address::from("0x000000000000000000000000636F6E7472616374"),
|
||||
&[Address::from("0x0000000000000000000000000000000000000004")],
|
||||
|
@ -335,16 +335,8 @@ impl Schedule {
|
||||
schedule
|
||||
}
|
||||
|
||||
/// Schedule for the Berlin fork of the Ethereum main net.
|
||||
pub fn new_berlin() -> Schedule {
|
||||
let mut schedule = Self::new_istanbul();
|
||||
schedule.have_subs = true; // EIP 2315
|
||||
|
||||
schedule
|
||||
}
|
||||
|
||||
/// Schedule for the Yolov3 testnet of the Ethereum main net.
|
||||
pub fn new_yolo3() -> Schedule {
|
||||
pub fn new_berlin() -> Schedule {
|
||||
let mut schedule = Self::new_istanbul();
|
||||
schedule.have_subs = true; // EIP 2315
|
||||
|
||||
|
@ -118,16 +118,9 @@ impl FakeExt {
|
||||
}
|
||||
|
||||
/// New fake externalities with Berlin schedule rules
|
||||
pub fn new_berlin() -> Self {
|
||||
pub fn new_berlin(from: Address, to: Address, builtins: &[Address]) -> Self {
|
||||
let mut ext = FakeExt::default();
|
||||
ext.schedule = Schedule::new_berlin();
|
||||
ext
|
||||
}
|
||||
|
||||
/// New fake externalities with YoloV2 schedule rules
|
||||
pub fn new_yolo3(from: Address, to: Address, builtins: &[Address]) -> Self {
|
||||
let mut ext = FakeExt::default();
|
||||
ext.schedule = Schedule::new_yolo3();
|
||||
ext.access_list.enable();
|
||||
ext.access_list.insert_address(from);
|
||||
ext.access_list.insert_address(to);
|
||||
|
Loading…
Reference in New Issue
Block a user