erigon-pulse/params/config.go

327 lines
25 KiB
Go
Raw Normal View History

// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package params
import (
"embed"
"encoding/json"
"fmt"
"math/big"
"path"
"github.com/ledgerwatch/erigon-lib/chain"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/hexutility"
"github.com/ledgerwatch/erigon/common/paths"
"github.com/ledgerwatch/erigon/params/networkname"
)
//go:embed chainspecs
var chainspecs embed.FS
func readChainSpec(filename string) *chain.Config {
f, err := chainspecs.Open(filename)
if err != nil {
panic(fmt.Sprintf("Could not open chainspec for %s: %v", filename, err))
}
defer f.Close()
decoder := json.NewDecoder(f)
spec := &chain.Config{}
err = decoder.Decode(&spec)
if err != nil {
panic(fmt.Sprintf("Could not parse chainspec for %s: %v", filename, err))
}
return spec
}
// Genesis hashes to enforce below configs on.
var (
MainnetGenesisHash = libcommon.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")
SepoliaGenesisHash = libcommon.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
RinkebyGenesisHash = libcommon.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
GoerliGenesisHash = libcommon.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
SokolGenesisHash = libcommon.HexToHash("0x5b28c1bfd3a15230c9a46b399cd0f9a6920d432e85381cc6a140b06e8410112f")
BSCGenesisHash = libcommon.HexToHash("0x0d21840abff46b96c84b2ac9e10e4f5cdaeb5693cb665db62a2f3b02d2d57b5b")
ChapelGenesisHash = libcommon.HexToHash("0x6d3c66c5357ec91d5c43af47e234a939b22557cbb552dc45bebbceeed90fbe34")
RialtoGenesisHash = libcommon.HexToHash("0xee835a629f9cf5510b48b6ba41d69e0ff7d6ef10f977166ef939db41f59f5501")
MumbaiGenesisHash = libcommon.HexToHash("0x7b66506a9ebdbf30d32b43c5f15a3b1216269a1ec3a75aa3182b86176a2b1ca7")
BorMainnetGenesisHash = libcommon.HexToHash("0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b")
BorDevnetGenesisHash = libcommon.HexToHash("0x5a06b25b0c6530708ea0b98a3409290e39dce6be7f558493aeb6e4b99a172a87")
GnosisGenesisHash = libcommon.HexToHash("0x4f1dd23188aab3a76b463e4af801b52b1248ef073c648cbdc4c9333d3da79756")
ChiadoGenesisHash = libcommon.HexToHash("0xada44fd8d2ecab8b08f256af07ad3e777f17fb434f8f8e678b312f576212ba9a")
)
var (
SokolGenesisEpochProof = hexutility.FromHex("0xf91a8c80b91a87f91a84f9020da00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0fad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200008083663be080808080b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f91871b914c26060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303aca79214610101578063108552691461016457806340a141ff1461019d57806340c9cdeb146101d65780634110a489146101ff57806345199e0a1461025757806349285b58146102c15780634d238c8e14610316578063752862111461034f578063900eb5a8146103645780639a573786146103c7578063a26a47d21461041c578063ae4b1b5b14610449578063b3f05b971461049e578063b7ab4db5146104cb578063d3e848f114610535578063fa81b2001461058a578063facd743b146105df575b600080fd5b341561010c57600080fd5b6101226004808035906020019091905050610630565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561016f57600080fd5b61019b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061066f565b005b34156101a857600080fd5b6101d4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610807565b005b34156101e157600080fd5b6101e9610bb7565b6040518082815260200191505060405180910390f35b341561020a57600080fd5b610236600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bbd565b60405180831515151581526020018281526020019250505060405180910390f35b341561026257600080fd5b61026a610bee565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102ad578082015181840152602081019050610292565b505050509050019250505060405180910390f35b34156102cc57600080fd5b6102d4610c82565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561032157600080fd5b61034d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d32565b005b341561035a57600080fd5b610362610fcc565b005b341561036f57600080fd5b61038560048080359060200190919050506110fc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103d257600080fd5b6103da61113b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042757600080fd5b61042f6111eb565b604051808215151515815260200191505060405180910390f35b341561045457600080fd5b61045c6111fe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a957600080fd5b6104b1611224565b604051808215151515815260200191505060405180910390f35b34156104d657600080fd5b6104de611237565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610521578082015181840152602081019050610506565b505050509050019250505060405180910390f35b341561054057600080fd5b6105486112cb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561059557600080fd5b61059d6112f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673fffffffffffffffffffffffffff
)
var (
SokolGenesisStateRoot = libcommon.HexToHash("0xfad4af258fd11939fae0c6c6eec9d340b1caac0b0196fd9a1bc3f489c5bf00b3")
GnosisGenesisStateRoot = libcommon.HexToHash("0x40cf4430ecaa733787d1a65154a3b9efb560c95d9e324a23b97f0609b539133b")
ChiadoGenesisStateRoot = libcommon.HexToHash("0x9ec3eaf4e6188dfbdd6ade76eaa88289b57c63c9a2cde8d35291d5a29e143d31")
)
var (
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = readChainSpec("chainspecs/mainnet.json")
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
SepoliaChainConfig = readChainSpec("chainspecs/sepolia.json")
2022-05-13 20:22:48 +00:00
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig = readChainSpec("chainspecs/rinkeby.json")
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
GoerliChainConfig = readChainSpec("chainspecs/goerli.json")
BSCChainConfig = readChainSpec("chainspecs/bsc.json")
Full BSC support with validator mode (#3233) * migrated consensus and chain config files for bsc support * migrated more files from bsc * fixed consensus crashing * updated erigon lib for parlia snapshot prefix * added staticpeers for bsc * [+] added system contracts [*] fixed bug with loading snapshot [+] enabled gas bailout [+] added fix to prevent syncing more than 1000 headers (for testing only) [*] fixed bug with crashing sender recover sometimes * migrated system contract calls * [*] fixed bug with returning mutable balance object [+] migrated lightclient contracts from bsc [*] fixed parlia consensus config param * [*] fixed tendermint deps * [+] added some logs * [+] enabled bsc forks [*] fixed syscalls from coinbase [*] more logging * Fix call sys contract gas calculation * [*] fixed executing system transactions * [*] enabled receipt hash, gas and bloom filter checks * [-] removed some logging scripts [*] set header checkpoint to 10 million blocks (for testing forks) * [*] fixed bug with commiting dirty inter block state state after system transaction execution [-] removed some extra logs and comments * [+] added chapel and rialto testnet support * [*] fixed chapel allocs * [-] removed 6 mil block limit for headers sync * Fix hardforks on chapel and other testnets * [*] fixed header sync issue after merge * [*] tiny code cleanup * [-] removed some comments * [*] increased mdbx map size to 4 TB * [*] increased max chaindata size to 6 tb * [*] bring more compatibility with origin erigon and some code cleanup * [+] added support of validator mode for BSC chain * [*] enable private key load for bsc, rialto and chapel chains * [*] fixed running BSC validator node * Fix the branch list * [*] tiny fixes for linter * [*] formatted imports for core and parlia packages * [*] fixed import rules in other files * Revert "[*] formatted imports for core and parlia packages" This reverts commit c764b58b34fedc2b14d69458583ba0dad114f227. * [*] changed import rules in more packages * [*] fixed type mismatch in hack command * [*] fixed crash on new epoch, enabled bootstrap flags * [*] fixed linter errors * [*] fixed missing err check for syscalls * [*] now BSC implementation is fully compatible with erigon original sources * Revert "Add chain config and CLI changes for Binance Smart Chain support (#3131)" This reverts commit 3d048b7f1a5e74ca318af96268472e2fb0262d3b. * Revert "Add Parlia consensus engine for Binance Smart Chain support (#3086)" This reverts commit ee99f17fbe0889483004f0ee113e37ad0c5c8283. * [*] fixed several issues after merge * [*] fixed integration compilation * Revert "Fix the branch list" This reverts commit 8150ca57e5f2707a84a9f6a1c5b809b7cc84547b. * [-] removed receipt repair migration * [*] fixed parlia fork numbers output * [*] bring more devel compatibility, fixed bsc address list for access list calculation * [*] fixed bug with commiting state transition for bad blocks in BSC * [*] fixed bsc changes apply for integration command and updated config print for parlia * [*] fixed bug with applying bsc forks for chapel and rialto testnet chains [*] let's use finalize and assemble for mining to let consensus know for what it's finalizing block * Fix compilation errors in hack.go * Fix lint * reset changes in erigon-snapshots to devel * Remove unrelated changes * Fix embed * Remove more unrelated changes * Remove more unrelated changes * Restore clique and aura miner config * Refactor interfaces not to use slice pointers * Refactor parlia functions to return tx and receipt instead of dealing with slices * Fix for header panic * Fix lint, restore system contract addresses * Remove more unrelated changes, unify GatherForks Co-authored-by: Dmitry Ivanov <convexman18@gmail.com> Co-authored-by: j75689 <j75689@gmail.com> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-01-14 19:06:35 +00:00
ChapelChainConfig = readChainSpec("chainspecs/chapel.json")
Full BSC support with validator mode (#3233) * migrated consensus and chain config files for bsc support * migrated more files from bsc * fixed consensus crashing * updated erigon lib for parlia snapshot prefix * added staticpeers for bsc * [+] added system contracts [*] fixed bug with loading snapshot [+] enabled gas bailout [+] added fix to prevent syncing more than 1000 headers (for testing only) [*] fixed bug with crashing sender recover sometimes * migrated system contract calls * [*] fixed bug with returning mutable balance object [+] migrated lightclient contracts from bsc [*] fixed parlia consensus config param * [*] fixed tendermint deps * [+] added some logs * [+] enabled bsc forks [*] fixed syscalls from coinbase [*] more logging * Fix call sys contract gas calculation * [*] fixed executing system transactions * [*] enabled receipt hash, gas and bloom filter checks * [-] removed some logging scripts [*] set header checkpoint to 10 million blocks (for testing forks) * [*] fixed bug with commiting dirty inter block state state after system transaction execution [-] removed some extra logs and comments * [+] added chapel and rialto testnet support * [*] fixed chapel allocs * [-] removed 6 mil block limit for headers sync * Fix hardforks on chapel and other testnets * [*] fixed header sync issue after merge * [*] tiny code cleanup * [-] removed some comments * [*] increased mdbx map size to 4 TB * [*] increased max chaindata size to 6 tb * [*] bring more compatibility with origin erigon and some code cleanup * [+] added support of validator mode for BSC chain * [*] enable private key load for bsc, rialto and chapel chains * [*] fixed running BSC validator node * Fix the branch list * [*] tiny fixes for linter * [*] formatted imports for core and parlia packages * [*] fixed import rules in other files * Revert "[*] formatted imports for core and parlia packages" This reverts commit c764b58b34fedc2b14d69458583ba0dad114f227. * [*] changed import rules in more packages * [*] fixed type mismatch in hack command * [*] fixed crash on new epoch, enabled bootstrap flags * [*] fixed linter errors * [*] fixed missing err check for syscalls * [*] now BSC implementation is fully compatible with erigon original sources * Revert "Add chain config and CLI changes for Binance Smart Chain support (#3131)" This reverts commit 3d048b7f1a5e74ca318af96268472e2fb0262d3b. * Revert "Add Parlia consensus engine for Binance Smart Chain support (#3086)" This reverts commit ee99f17fbe0889483004f0ee113e37ad0c5c8283. * [*] fixed several issues after merge * [*] fixed integration compilation * Revert "Fix the branch list" This reverts commit 8150ca57e5f2707a84a9f6a1c5b809b7cc84547b. * [-] removed receipt repair migration * [*] fixed parlia fork numbers output * [*] bring more devel compatibility, fixed bsc address list for access list calculation * [*] fixed bug with commiting state transition for bad blocks in BSC * [*] fixed bsc changes apply for integration command and updated config print for parlia * [*] fixed bug with applying bsc forks for chapel and rialto testnet chains [*] let's use finalize and assemble for mining to let consensus know for what it's finalizing block * Fix compilation errors in hack.go * Fix lint * reset changes in erigon-snapshots to devel * Remove unrelated changes * Fix embed * Remove more unrelated changes * Remove more unrelated changes * Restore clique and aura miner config * Refactor interfaces not to use slice pointers * Refactor parlia functions to return tx and receipt instead of dealing with slices * Fix for header panic * Fix lint, restore system contract addresses * Remove more unrelated changes, unify GatherForks Co-authored-by: Dmitry Ivanov <convexman18@gmail.com> Co-authored-by: j75689 <j75689@gmail.com> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-01-14 19:06:35 +00:00
RialtoChainConfig = readChainSpec("chainspecs/rialto.json")
Full BSC support with validator mode (#3233) * migrated consensus and chain config files for bsc support * migrated more files from bsc * fixed consensus crashing * updated erigon lib for parlia snapshot prefix * added staticpeers for bsc * [+] added system contracts [*] fixed bug with loading snapshot [+] enabled gas bailout [+] added fix to prevent syncing more than 1000 headers (for testing only) [*] fixed bug with crashing sender recover sometimes * migrated system contract calls * [*] fixed bug with returning mutable balance object [+] migrated lightclient contracts from bsc [*] fixed parlia consensus config param * [*] fixed tendermint deps * [+] added some logs * [+] enabled bsc forks [*] fixed syscalls from coinbase [*] more logging * Fix call sys contract gas calculation * [*] fixed executing system transactions * [*] enabled receipt hash, gas and bloom filter checks * [-] removed some logging scripts [*] set header checkpoint to 10 million blocks (for testing forks) * [*] fixed bug with commiting dirty inter block state state after system transaction execution [-] removed some extra logs and comments * [+] added chapel and rialto testnet support * [*] fixed chapel allocs * [-] removed 6 mil block limit for headers sync * Fix hardforks on chapel and other testnets * [*] fixed header sync issue after merge * [*] tiny code cleanup * [-] removed some comments * [*] increased mdbx map size to 4 TB * [*] increased max chaindata size to 6 tb * [*] bring more compatibility with origin erigon and some code cleanup * [+] added support of validator mode for BSC chain * [*] enable private key load for bsc, rialto and chapel chains * [*] fixed running BSC validator node * Fix the branch list * [*] tiny fixes for linter * [*] formatted imports for core and parlia packages * [*] fixed import rules in other files * Revert "[*] formatted imports for core and parlia packages" This reverts commit c764b58b34fedc2b14d69458583ba0dad114f227. * [*] changed import rules in more packages * [*] fixed type mismatch in hack command * [*] fixed crash on new epoch, enabled bootstrap flags * [*] fixed linter errors * [*] fixed missing err check for syscalls * [*] now BSC implementation is fully compatible with erigon original sources * Revert "Add chain config and CLI changes for Binance Smart Chain support (#3131)" This reverts commit 3d048b7f1a5e74ca318af96268472e2fb0262d3b. * Revert "Add Parlia consensus engine for Binance Smart Chain support (#3086)" This reverts commit ee99f17fbe0889483004f0ee113e37ad0c5c8283. * [*] fixed several issues after merge * [*] fixed integration compilation * Revert "Fix the branch list" This reverts commit 8150ca57e5f2707a84a9f6a1c5b809b7cc84547b. * [-] removed receipt repair migration * [*] fixed parlia fork numbers output * [*] bring more devel compatibility, fixed bsc address list for access list calculation * [*] fixed bug with commiting state transition for bad blocks in BSC * [*] fixed bsc changes apply for integration command and updated config print for parlia * [*] fixed bug with applying bsc forks for chapel and rialto testnet chains [*] let's use finalize and assemble for mining to let consensus know for what it's finalizing block * Fix compilation errors in hack.go * Fix lint * reset changes in erigon-snapshots to devel * Remove unrelated changes * Fix embed * Remove more unrelated changes * Remove more unrelated changes * Restore clique and aura miner config * Refactor interfaces not to use slice pointers * Refactor parlia functions to return tx and receipt instead of dealing with slices * Fix for header panic * Fix lint, restore system contract addresses * Remove more unrelated changes, unify GatherForks Co-authored-by: Dmitry Ivanov <convexman18@gmail.com> Co-authored-by: j75689 <j75689@gmail.com> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-01-14 19:06:35 +00:00
SokolChainConfig = readChainSpec("chainspecs/sokol.json")
// AllProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the main net protocol.
AllProtocolChanges = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.EtHashConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: libcommon.Hash{},
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
ShanghaiTime: big.NewInt(0),
Ethash: new(chain.EthashConfig),
}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
AllCliqueProtocolChanges = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.CliqueConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: libcommon.Hash{},
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
Clique: &chain.CliqueConfig{Period: 0, Epoch: 30000},
}
MumbaiChainConfig = readChainSpec("chainspecs/mumbai.json")
Merging Turbo bor into devel (#3372) * implemented bor consensus * add bor flags to default * change bucket into snapshot to clique * enable stateSync * bypass reciept checks * fix receipt calculation and bor logs * fix: contract call wrt bor * Update mumbai config * Add: bor-mainnet flag and config * Add bor consensus to integration * use header coinbase in block context * london fork mumbai changes * fix genesis error * Jaipur fork for mumbai * add sysCall to verifyHeader * added bor related rpc method implementation * added bor specific rpc extensions * fixes in snapshot implementation, major refactor for bor rpc * modify consensus specific db path for bor * fix: remove parallel compute for get root hash rpc method * Added bor-receipt flow * Use turbo-bor-lib and bor tables * Use bor table in RPC snapshot * Update README.md * Update README.md * Update README.md * Update README.md * update rpc readme * link rpc docs in readme * Update Readme * Update Readme * move erigon namespace rpc methods to eth * rm: erigon namespace * rm: erigon namespace, update list of available rpc methods, add example * fix: binary name in rpc readme * fix: max db size * Add london to bor-mainnet * updated node.go * add system req to readme * golang version fix readme * added networknames in correct place * nil * ran gofmt * erigon * fixed fake.go * dont need turbor-lib * old readme * fixing readme * half * other half * changed return * fixing return * fixed return * fixed flags * gofmt * merge with devel * latest erigon-lib * fixed context.coinbase * took out syscall * fixed params in hash * bor type now is consensus.Engine * parlia is consensus.Engine * missing arg and repeated importation * repeated importation * fixed eth_receipts.go * deleted duplicate issuance * part of consensus.Engine type * added eth_api issuance * networkname * added erigon_system file * fork struct taken out * added erigon block * getLogByHash for erigonImpl * gofmt * fixed lint * ops * gofmt * gofmt * added APIImple functions * fixed clique test * took out print * fixed state added balance * fixed README * fixed rpcDaemon README * fixed integration README * updated blockchain.go * lint * added bor back into blockchain.go * took out comment * lint * updated daemon * updated wtb * removed duplicate * removed VerifyHeaders * prevent use of wrong Transfer * fixed state_processor.go * fixed state_transition.go * fixed headers * returning err * error handling in bor read tx look up * put for txLookUp * dealing with error * lint * traces * more traces * fixed receipt in execution * getTrasanction receipt for bor or others * nil * lint * ops * deleted syscall * took out else * Merge branch 'devel * tests syscalls * changed borReceipt to receipt * reset header algos * arguments fix * took out prefixes * lint * erigon-named * borReceiptKey = blocknumber * reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33. * correct hashing tx * dont need it here * lint * added txlookup for bor * change to uint256 * outputs for isBor * wrapper * added isBor and isParlia * isBor * fixed BorTransfer * not readBody * correct prefix * added blockNum * added readStorageBody * readStorageBody * lint * got rid of unnecessary bor_receipt func * onlny if bor * use clone * append * writeToSlice * added isBor flag * fixed writeToSlice * normal sorting * lint * Reset erigon-snapshots * Move bor prefix into if Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-07 21:30:46 +00:00
BorMainnetChainConfig = readChainSpec("chainspecs/bor-mainnet.json")
Merging Turbo bor into devel (#3372) * implemented bor consensus * add bor flags to default * change bucket into snapshot to clique * enable stateSync * bypass reciept checks * fix receipt calculation and bor logs * fix: contract call wrt bor * Update mumbai config * Add: bor-mainnet flag and config * Add bor consensus to integration * use header coinbase in block context * london fork mumbai changes * fix genesis error * Jaipur fork for mumbai * add sysCall to verifyHeader * added bor related rpc method implementation * added bor specific rpc extensions * fixes in snapshot implementation, major refactor for bor rpc * modify consensus specific db path for bor * fix: remove parallel compute for get root hash rpc method * Added bor-receipt flow * Use turbo-bor-lib and bor tables * Use bor table in RPC snapshot * Update README.md * Update README.md * Update README.md * Update README.md * update rpc readme * link rpc docs in readme * Update Readme * Update Readme * move erigon namespace rpc methods to eth * rm: erigon namespace * rm: erigon namespace, update list of available rpc methods, add example * fix: binary name in rpc readme * fix: max db size * Add london to bor-mainnet * updated node.go * add system req to readme * golang version fix readme * added networknames in correct place * nil * ran gofmt * erigon * fixed fake.go * dont need turbor-lib * old readme * fixing readme * half * other half * changed return * fixing return * fixed return * fixed flags * gofmt * merge with devel * latest erigon-lib * fixed context.coinbase * took out syscall * fixed params in hash * bor type now is consensus.Engine * parlia is consensus.Engine * missing arg and repeated importation * repeated importation * fixed eth_receipts.go * deleted duplicate issuance * part of consensus.Engine type * added eth_api issuance * networkname * added erigon_system file * fork struct taken out * added erigon block * getLogByHash for erigonImpl * gofmt * fixed lint * ops * gofmt * gofmt * added APIImple functions * fixed clique test * took out print * fixed state added balance * fixed README * fixed rpcDaemon README * fixed integration README * updated blockchain.go * lint * added bor back into blockchain.go * took out comment * lint * updated daemon * updated wtb * removed duplicate * removed VerifyHeaders * prevent use of wrong Transfer * fixed state_processor.go * fixed state_transition.go * fixed headers * returning err * error handling in bor read tx look up * put for txLookUp * dealing with error * lint * traces * more traces * fixed receipt in execution * getTrasanction receipt for bor or others * nil * lint * ops * deleted syscall * took out else * Merge branch 'devel * tests syscalls * changed borReceipt to receipt * reset header algos * arguments fix * took out prefixes * lint * erigon-named * borReceiptKey = blocknumber * reverts e3b60c2e159d03efcb855f7ab3da5a098dd60c33. * correct hashing tx * dont need it here * lint * added txlookup for bor * change to uint256 * outputs for isBor * wrapper * added isBor and isParlia * isBor * fixed BorTransfer * not readBody * correct prefix * added blockNum * added readStorageBody * readStorageBody * lint * got rid of unnecessary bor_receipt func * onlny if bor * use clone * append * writeToSlice * added isBor flag * fixed writeToSlice * normal sorting * lint * Reset erigon-snapshots * Move bor prefix into if Co-authored-by: Krishna Upadhyaya <krishnau1604@gmail.com> Co-authored-by: Manav Darji <manavdarji.india@gmail.com> Co-authored-by: Uttam Singh <uttamkhanduja@yahoo.in> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-02-07 21:30:46 +00:00
BorDevnetChainConfig = readChainSpec("chainspecs/bor-devnet.json")
GnosisChainConfig = readChainSpec("chainspecs/gnosis.json")
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
ChiadoChainConfig = readChainSpec("chainspecs/chiado.json")
2021-06-16 10:57:58 +00:00
CliqueSnapshot = NewSnapshotConfig(10, 1024, 16384, true, "")
TestChainConfig = &chain.Config{
ChainID: big.NewInt(1337),
Consensus: chain.EtHashConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: libcommon.Hash{},
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
Ethash: new(chain.EthashConfig),
}
TestChainAuraConfig = &chain.Config{
ChainID: big.NewInt(1),
Consensus: chain.AuRaConsensus,
HomesteadBlock: big.NewInt(0),
TangerineWhistleBlock: big.NewInt(0),
TangerineWhistleHash: libcommon.Hash{},
SpuriousDragonBlock: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
Aura: &chain.AuRaConfig{},
}
TestRules = TestChainConfig.Rules(0, 0)
)
type ConsensusSnapshotConfig struct {
CheckpointInterval uint64 // Number of blocks after which to save the vote snapshot to the database
InmemorySnapshots int // Number of recent vote snapshots to keep in memory
InmemorySignatures int // Number of recent block signatures to keep in memory
DBPath string
InMemory bool
}
const cliquePath = "clique"
func NewSnapshotConfig(checkpointInterval uint64, inmemorySnapshots int, inmemorySignatures int, inmemory bool, dbPath string) *ConsensusSnapshotConfig {
if len(dbPath) == 0 {
dbPath = paths.DefaultDataDir()
}
return &ConsensusSnapshotConfig{
checkpointInterval,
inmemorySnapshots,
inmemorySignatures,
path.Join(dbPath, cliquePath),
inmemory,
}
}
func ChainConfigByChainName(chain string) *chain.Config {
switch chain {
case networkname.MainnetChainName:
return MainnetChainConfig
case networkname.SepoliaChainName:
return SepoliaChainConfig
case networkname.RinkebyChainName:
return RinkebyChainConfig
case networkname.GoerliChainName:
return GoerliChainConfig
case networkname.SokolChainName:
return SokolChainConfig
case networkname.BSCChainName:
return BSCChainConfig
case networkname.ChapelChainName:
return ChapelChainConfig
case networkname.RialtoChainName:
return RialtoChainConfig
case networkname.MumbaiChainName:
return MumbaiChainConfig
case networkname.BorMainnetChainName:
return BorMainnetChainConfig
case networkname.BorDevnetChainName:
return BorDevnetChainConfig
case networkname.GnosisChainName:
return GnosisChainConfig
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case networkname.ChiadoChainName:
return ChiadoChainConfig
default:
return nil
}
}
func GenesisHashByChainName(chain string) *libcommon.Hash {
switch chain {
case networkname.MainnetChainName:
return &MainnetGenesisHash
case networkname.SepoliaChainName:
return &SepoliaGenesisHash
case networkname.RinkebyChainName:
return &RinkebyGenesisHash
case networkname.GoerliChainName:
return &GoerliGenesisHash
case networkname.SokolChainName:
return &SokolGenesisHash
case networkname.BSCChainName:
return &BSCGenesisHash
case networkname.ChapelChainName:
return &ChapelGenesisHash
case networkname.RialtoChainName:
return &RialtoGenesisHash
case networkname.MumbaiChainName:
return &MumbaiGenesisHash
case networkname.BorMainnetChainName:
return &BorMainnetGenesisHash
case networkname.BorDevnetChainName:
return &BorDevnetGenesisHash
case networkname.GnosisChainName:
return &GnosisGenesisHash
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case networkname.ChiadoChainName:
return &ChiadoGenesisHash
default:
return nil
}
}
func ChainConfigByGenesisHash(genesisHash libcommon.Hash) *chain.Config {
switch {
case genesisHash == MainnetGenesisHash:
return MainnetChainConfig
case genesisHash == SepoliaGenesisHash:
return SepoliaChainConfig
case genesisHash == RinkebyGenesisHash:
return RinkebyChainConfig
case genesisHash == GoerliGenesisHash:
return GoerliChainConfig
case genesisHash == SokolGenesisHash:
return SokolChainConfig
case genesisHash == BSCGenesisHash:
return BSCChainConfig
case genesisHash == ChapelGenesisHash:
return ChapelChainConfig
case genesisHash == RialtoGenesisHash:
return RialtoChainConfig
case genesisHash == MumbaiGenesisHash:
return MumbaiChainConfig
case genesisHash == BorMainnetGenesisHash:
return BorMainnetChainConfig
case genesisHash == BorDevnetGenesisHash:
return BorDevnetChainConfig
case genesisHash == GnosisGenesisHash:
return GnosisChainConfig
feat: add chiado config (#6058) Hey guys, I'm trying to add the Chiado network ([Gnosis' testnet](https://docs.gnosischain.com/about/networks/chiado)) now that Gnosis can be synced fully with Erigon, so we can test it on the testnet as well. This is mostly inspired from https://github.com/ledgerwatch/erigon/commit/cd5ef32f379ff51043b7ce1b0c3c471e18b99459. Probably missing: - [ ] The right consensus config (currently only a copy of Gnosis) - [ ] Fixes to the chainspec? - [ ] Presumably something in `cl/clparams/config.go` Current state: ``` $ ./build/bin/erigon --chain=chiado --log.console.verbosity=debug WARN[11-16|11:52:28.188] no log dir set, console logging only WARN[11-16|11:52:28.193] no log dir set, console logging only INFO[11-16|11:52:28.193] Build info git_branch=feat/chiado git_tag=v2021.10.03-2291-g17fae73f8 git_commit=17fae73f8af5348ba7c04684f2a2978daf81b67e INFO[11-16|11:52:28.193] Starting Erigon on devnet=chiado INFO[11-16|11:52:28.194] Maximum peer count ETH=100 total=100 INFO[11-16|11:52:28.194] starting HTTP APIs APIs=eth,erigon,engine INFO[11-16|11:52:28.194] torrent verbosity level=WRN INFO[11-16|11:52:30.300] Set global gas cap cap=50000000 INFO[11-16|11:52:30.302] Opening Database label=chaindata path=/home/filoozom/.local/share/erigon/chiado/chaindata INFO[11-16|11:52:30.310] Initialised chain configuration config="{ChainID: 10200, Homestead: 0, DAO: <nil>, DAO Support: false, Tangerine Whistle: 0, Spurious Dragon: 0, Byzantium: 0, Constantinople: 0, Petersburg: 0, Istanbul: 0, Muir Glacier: <nil>, Berlin: 0, London: 0, Arrow Glacier: <nil>, Gray Glacier: <nil>, Terminal Total Difficulty: <nil>, Merge Netsplit: <nil>, Shanghai: <nil>, Cancun: <nil>, Engine: aura}" genesis=0xf463abeb7ee27fa62be3ac36a264e8174ee3458da451e6403df47618fd2cf415 WARN[11-16|11:52:30.311] Incorrect snapshot enablement got=true change_to=false INFO[11-16|11:52:30.311] Effective prune_flags= snapshot_flags= history.v3=false INFO[11-16|11:52:30.312] Initialising Ethereum protocol network=10200 INFO[11-16|11:52:30.329] Starting private RPC server on=127.0.0.1:9090 INFO[11-16|11:52:30.329] new subscription to logs established INFO[11-16|11:52:30.329] rpc filters: subscribing to Erigon events DBUG[11-16|11:52:30.330] Establishing event subscription channel with the RPC daemon ... INFO[11-16|11:52:30.330] New txs subscriber joined INFO[11-16|11:52:30.330] new subscription to newHeaders established INFO[11-16|11:52:30.330] Reading JWT secret path=/home/filoozom/.local/share/erigon/chiado/jwt.hex INFO[11-16|11:52:30.331] HTTP endpoint opened for Engine API url=localhost:8551 ws=true ws.compression=true INFO[11-16|11:52:30.332] HTTP endpoint opened url=localhost:8545 ws=false ws.compression=true grpc=false DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=tcp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] Couldn't add port mapping proto=udp extport=30304 intport=30304 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.336] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.341] [1/16 Snapshots] DONE in=134.7µs INFO[11-16|11:52:30.341] [txpool] Started INFO[11-16|11:52:30.341] [2/16 Headers] Waiting for headers... from=0 DBUG[11-16|11:52:30.341] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=tcp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.343] Couldn't add port mapping proto=udp extport=30303 intport=30303 interface="UPnP or NAT-PMP" err="no UPnP or NAT-PMP router discovered" DBUG[11-16|11:52:30.344] QuerySeeds read nodes from the node DB count=0 DBUG[11-16|11:52:30.346] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.347] Started P2P networking version=67 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30304 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:30.351] QuerySeeds read nodes from the node DB count=0 INFO[11-16|11:52:30.351] Started P2P networking version=66 self=enode://47d2e31d90fe140bfd967f147c1d4e8a4834b4c6b895a4bb7082100be60aa5e9a73e98e996da9b0257f02f9ad39b683755abe6ca3e9aefe0170a478a8559dcfb@127.0.0.1:30303 name=erigon/v2.30.0-dev-17fae73f/linux-amd64/go1.18.1 DBUG[11-16|11:52:31.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:52:32.342] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 INFO[11-16|11:37:00.062] [p2p] GoodPeers eth66=0 eth67=0 INFO[11-16|11:37:00.077] [txpool] stat block=0 pending=0 baseFee=0 queued=0 alloc=42.7MB sys=79.5MB INFO[11-16|11:37:00.089] [2/16 Headers] No block headers to write in this log period block number=0 INFO[11-16|11:37:00.089] Req/resp stats req=0 reqMin=0 reqMax=0 skel=0 skelMin=0 skelMax=0 resp=0 respMin=0 respMax=0 dups=0 DBUG[11-16|11:37:00.089] [Downloader] Queue sizes anchors=0 links=0 persisted=1 DBUG[11-16|11:37:00.089] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 [...] DBUG[11-16|11:37:06.095] [Downloader] Request skeleton anchors=0 top seen height=0 highestInDb=0 ``` I guess it comes down to: ``` --- FAIL: TestDefaultBSCGenesisBlock (0.34s) genesis_test.go:27: Error Trace: /home/filoozom/projects/erigon/core/genesis_test.go:27 /home/filoozom/projects/erigon/core/genesis_test.go:30 Error: Not equal: expected: []byte{0xe8, 0x72, 0x46, 0x2c, 0x6b, 0xd5, 0xf4, 0x2, 0xec, 0x81, 0xde, 0x7c, 0x5b, 0xd2, 0x82, 0x3e, 0x13, 0x7c, 0x66, 0x6b, 0x78, 0xe8, 0x2b, 0x7e, 0xb0, 0xbe, 0x95, 0xaf, 0x5e, 0xce, 0xa1, 0x8d} actual : []byte{0xad, 0xa4, 0x4f, 0xd8, 0xd2, 0xec, 0xab, 0x8b, 0x8, 0xf2, 0x56, 0xaf, 0x7, 0xad, 0x3e, 0x77, 0x7f, 0x17, 0xfb, 0x43, 0x4f, 0x8f, 0x8e, 0x67, 0x8b, 0x31, 0x2f, 0x57, 0x62, 0x12, 0xba, 0x9a} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ ([]uint8) (len=32) { - 00000000 e8 72 46 2c 6b d5 f4 02 ec 81 de 7c 5b d2 82 3e |.rF,k......|[..>| - 00000010 13 7c 66 6b 78 e8 2b 7e b0 be 95 af 5e ce a1 8d |.|fkx.+~....^...| + 00000000 ad a4 4f d8 d2 ec ab 8b 08 f2 56 af 07 ad 3e 77 |..O.......V...>w| + 00000010 7f 17 fb 43 4f 8f 8e 67 8b 31 2f 57 62 12 ba 9a |...CO..g.1/Wb...| } Test: TestDefaultBSCGenesisBlock Messages: chiado FAIL FAIL github.com/ledgerwatch/erigon/core 0.823s ``` ---------- Turns out that the `code` in Erigon's chainspec is not the same as `constructor` in Nethermind for example. Comparison for Sokol: - Erigon: https://github.com/ledgerwatch/erigon/blob/devel/core/allocs/sokol.json#L20-L34 - Nethermind: https://github.com/NethermindEth/nethermind/blob/master/src/Nethermind/Chains/sokol.json#L248-L252
2022-11-18 11:54:18 +00:00
case genesisHash == ChiadoGenesisHash:
return ChiadoChainConfig
default:
return nil
}
}
func NetworkIDByChainName(chain string) uint64 {
switch chain {
case networkname.RialtoChainName:
return 97
case networkname.DevChainName:
return 1337
default:
config := ChainConfigByChainName(chain)
if config == nil {
return 0
}
return config.ChainID.Uint64()
}
}