From f0cbe7a91048e9158417c7b0965d3ac0528fef96 Mon Sep 17 00:00:00 2001 From: Andrei Maiboroda Date: Wed, 24 Jul 2019 12:45:20 +0200 Subject: [PATCH] Add Istanbul config for tests --- libethashseal/GenesisInfo.cpp | 4 ++ libethashseal/GenesisInfo.h | 4 +- libethashseal/genesis/test/istanbulTest.cpp | 54 +++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 libethashseal/genesis/test/istanbulTest.cpp diff --git a/libethashseal/GenesisInfo.cpp b/libethashseal/GenesisInfo.cpp index c69a5f76241..900d7630e00 100644 --- a/libethashseal/GenesisInfo.cpp +++ b/libethashseal/GenesisInfo.cpp @@ -36,6 +36,7 @@ using namespace dev; #include "genesis/test/frontierNoProofTest.cpp" #include "genesis/test/frontierTest.cpp" #include "genesis/test/homesteadTest.cpp" +#include "genesis/test/istanbulTest.cpp" #include "genesis/test/istanbulTransitionTest.cpp" #include "genesis/test/mainNetworkNoProofTest.cpp" #include "genesis/test/mainNetworkTest.cpp" @@ -78,6 +79,8 @@ std::string const& dev::eth::genesisInfo(Network _n) return c_genesisInfoExperimentalTransitionTest; case Network::ConstantinopleFixTest: return c_genesisInfoConstantinopleFixTest; + case Network::IstanbulTest: + return c_genesisInfoIstanbulTest; case Network::IstanbulTransitionTest: return c_genesisInfoIstanbulTransitionTest; @@ -111,6 +114,7 @@ h256 const& dev::eth::genesisStateRoot(Network _n) case Network::ByzantiumTest: case Network::ConstantinopleTest: case Network::ConstantinopleFixTest: + case Network::IstanbulTest: case Network::IstanbulTransitionTest: case Network::ExperimentalTransitionTest: return c_genesisDefaultStateRoot; diff --git a/libethashseal/GenesisInfo.h b/libethashseal/GenesisInfo.h index de17bc436e5..f380125017f 100644 --- a/libethashseal/GenesisInfo.h +++ b/libethashseal/GenesisInfo.h @@ -67,8 +67,10 @@ enum class Network ConstantinopleNoProofTest = 82, /// Byzantium + Constantinople + ConstantinopleFix active from block 0 ConstantinopleFixTest = 83, + /// Istanbul active from block 0 + IstanbulTest = 84, /// ConstantinopleFixTest + Istanbul active from block 2 - IstanbulTransitionTest = 84, + IstanbulTransitionTest = 85, // TransitionTest networks FrontierToHomesteadAt5 = 100, diff --git a/libethashseal/genesis/test/istanbulTest.cpp b/libethashseal/genesis/test/istanbulTest.cpp new file mode 100644 index 00000000000..738b0b987f1 --- /dev/null +++ b/libethashseal/genesis/test/istanbulTest.cpp @@ -0,0 +1,54 @@ +// Aleth: Ethereum C++ client, tools and libraries. +// Copyright 2019 Aleth Authors. +// Licensed under the GNU General Public License, Version 3. + +#include "../../GenesisInfo.h" + +static std::string const c_genesisInfoIstanbulTest = std::string() + +R"E( +{ + "sealEngine": "Ethash", + "params": { + "accountStartNonce": "0x00", + "maximumExtraDataSize": "0x20", + "homesteadForkBlock": "0x00", + "EIP150ForkBlock": "0x00", + "EIP158ForkBlock": "0x00", + "byzantiumForkBlock": "0x00", + "constantinopleForkBlock": "0x00", + "constantinopleFixForkBlock": "0x00", + "istanbulForkBlock": "0x00", + "minGasLimit": "0x1388", + "maxGasLimit": "7fffffffffffffff", + "tieBreakingGas": false, + "gasLimitBoundDivisor": "0x0400", + "minimumDifficulty": "0x020000", + "difficultyBoundDivisor": "0x0800", + "durationLimit": "0x0d", + "blockReward": "0x4563918244F40000", + "networkID" : "0x1", + "chainID": "0x01", + "allowFutureBlocks" : true + }, + "genesis": { + "nonce": "0x0000000000000042", + "difficulty": "0x020000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "author": "0x0000000000000000000000000000000000000000", + "timestamp": "0x00", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa", + "gasLimit": "0x1388" + }, + "accounts": { + "0000000000000000000000000000000000000001": { "precompiled": { "name": "ecrecover", "linear": { "base": 3000, "word": 0 } } }, + "0000000000000000000000000000000000000002": { "precompiled": { "name": "sha256", "linear": { "base": 60, "word": 12 } } }, + "0000000000000000000000000000000000000003": { "precompiled": { "name": "ripemd160", "linear": { "base": 600, "word": 120 } } }, + "0000000000000000000000000000000000000004": { "precompiled": { "name": "identity", "linear": { "base": 15, "word": 3 } } }, + "0000000000000000000000000000000000000005": { "precompiled": { "name": "modexp" } }, + "0000000000000000000000000000000000000006": { "precompiled": { "name": "alt_bn128_G1_add", "linear": { "base": 500, "word": 0 } } }, + "0000000000000000000000000000000000000007": { "precompiled": { "name": "alt_bn128_G1_mul", "linear": { "base": 40000, "word": 0 } } }, + "0000000000000000000000000000000000000008": { "precompiled": { "name": "alt_bn128_pairing_product" } } + } +} +)E";