mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-21 19:20:39 +00:00
Add support for amoy testnet (#8674)
Co-authored-by: Mark Holt <mark@distributed.vision> Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
This commit is contained in:
parent
473e0414ef
commit
8d1758ceea
@ -102,8 +102,8 @@ download speed by flag `--torrent.download.rate=20mb`. <code>🔬 See [Downloade
|
||||
|
||||
Use `--datadir` to choose where to store data.
|
||||
|
||||
Use `--chain=gnosis` for [Gnosis Chain](https://www.gnosis.io/), `--chain=bor-mainnet` for Polygon Mainnet,
|
||||
and `--chain=mumbai` for Polygon Mumbai.
|
||||
Use `--chain=gnosis` for [Gnosis Chain](https://www.gnosis.io/), `--chain=bor-mainnet` for Polygon Mainnet,
|
||||
`--chain=mumbai` for Polygon Mumbai and `--chain=amoy` for Polygon Amoy.
|
||||
For Gnosis Chain you need a [Consensus Layer](#beacon-chain-consensus-layer) client alongside
|
||||
Erigon (https://docs.gnosischain.com/node/guide/beacon).
|
||||
|
||||
|
@ -88,6 +88,8 @@ func DataDirForNetwork(datadir string, network string) string {
|
||||
return networkDataDirCheckingLegacy(datadir, "goerli")
|
||||
case networkname.MumbaiChainName:
|
||||
return networkDataDirCheckingLegacy(datadir, "mumbai")
|
||||
case networkname.AmoyChainName:
|
||||
return networkDataDirCheckingLegacy(datadir, "amoy")
|
||||
case networkname.BorMainnetChainName:
|
||||
return networkDataDirCheckingLegacy(datadir, "bor-mainnet")
|
||||
case networkname.BorDevnetChainName:
|
||||
|
17
core/allocs/amoy.json
Normal file
17
core/allocs/amoy.json
Normal file
File diff suppressed because one or more lines are too long
@ -154,6 +154,15 @@ func TestCreation(t *testing.T) {
|
||||
{41874000, 0, ID{Hash: checksumToBytes(0x0c015a91), Next: 0}}, // First Agra block
|
||||
},
|
||||
},
|
||||
// Amoy test cases
|
||||
{
|
||||
params.AmoyChainConfig,
|
||||
params.AmoyGenesisHash,
|
||||
[]testcase{
|
||||
{0, 0, ID{Hash: checksumToBytes(0xbe06a477), Next: 73100}},
|
||||
{73100, 0, ID{Hash: checksumToBytes(0x135d2cd5), Next: 0}}, // First London, Jaipur, Delhi, Indore, Agra
|
||||
},
|
||||
},
|
||||
// Bor mainnet test cases
|
||||
{
|
||||
params.BorMainnetChainConfig,
|
||||
|
@ -380,6 +380,7 @@ func GoerliGenesisBlock() *types.Genesis {
|
||||
}
|
||||
}
|
||||
|
||||
// MumbaiGenesisBlock returns the Amoy network genesis block.
|
||||
func MumbaiGenesisBlock() *types.Genesis {
|
||||
return &types.Genesis{
|
||||
Config: params.MumbaiChainConfig,
|
||||
@ -393,6 +394,20 @@ func MumbaiGenesisBlock() *types.Genesis {
|
||||
}
|
||||
}
|
||||
|
||||
// AmoyGenesisBlock returns the Amoy network genesis block.
|
||||
func AmoyGenesisBlock() *types.Genesis {
|
||||
return &types.Genesis{
|
||||
Config: params.AmoyChainConfig,
|
||||
Nonce: 0,
|
||||
Timestamp: 1700225065,
|
||||
GasLimit: 10000000,
|
||||
Difficulty: big.NewInt(1),
|
||||
Mixhash: libcommon.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
|
||||
Coinbase: libcommon.HexToAddress("0x0000000000000000000000000000000000000000"),
|
||||
Alloc: readPrealloc("allocs/amoy.json"),
|
||||
}
|
||||
}
|
||||
|
||||
// BorMainnetGenesisBlock returns the Bor Mainnet network genesis block.
|
||||
func BorMainnetGenesisBlock() *types.Genesis {
|
||||
return &types.Genesis{
|
||||
@ -650,6 +665,8 @@ func GenesisBlockByChainName(chain string) *types.Genesis {
|
||||
return GoerliGenesisBlock()
|
||||
case networkname.MumbaiChainName:
|
||||
return MumbaiGenesisBlock()
|
||||
case networkname.AmoyChainName:
|
||||
return AmoyGenesisBlock()
|
||||
case networkname.BorMainnetChainName:
|
||||
return BorMainnetGenesisBlock()
|
||||
case networkname.BorDevnetChainName:
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
func init() {
|
||||
// Initialise SystemContractCodeLookup
|
||||
for _, chainName := range []string{networkname.BorMainnetChainName, networkname.MumbaiChainName, networkname.BorDevnetChainName} {
|
||||
for _, chainName := range []string{networkname.BorMainnetChainName, networkname.MumbaiChainName, networkname.AmoyChainName, networkname.BorDevnetChainName} {
|
||||
byChain := map[libcommon.Address][]libcommon.CodeRecord{}
|
||||
systemcontracts.SystemContractCodeLookup[chainName] = byChain
|
||||
// Apply genesis with the block number 0
|
||||
|
@ -7,6 +7,7 @@ const (
|
||||
GoerliChainName = "goerli"
|
||||
DevChainName = "dev"
|
||||
MumbaiChainName = "mumbai"
|
||||
AmoyChainName = "amoy"
|
||||
BorMainnetChainName = "bor-mainnet"
|
||||
BorDevnetChainName = "bor-devnet"
|
||||
GnosisChainName = "gnosis"
|
||||
@ -20,6 +21,7 @@ var All = []string{
|
||||
SepoliaChainName,
|
||||
GoerliChainName,
|
||||
MumbaiChainName,
|
||||
AmoyChainName,
|
||||
BorMainnetChainName,
|
||||
BorDevnetChainName,
|
||||
GnosisChainName,
|
||||
|
@ -19,6 +19,7 @@ var (
|
||||
Sepolia = fromToml(snapshothashes.Sepolia)
|
||||
Goerli = fromToml(snapshothashes.Goerli)
|
||||
Mumbai = fromToml(snapshothashes.Mumbai)
|
||||
Amoy = fromToml(snapshothashes.Amoy)
|
||||
BorMainnet = fromToml(snapshothashes.BorMainnet)
|
||||
Gnosis = fromToml(snapshothashes.Gnosis)
|
||||
Chiado = fromToml(snapshothashes.Chiado)
|
||||
@ -53,6 +54,7 @@ var (
|
||||
SepoliaChainSnapshotCfg = newCfg(Sepolia)
|
||||
GoerliChainSnapshotCfg = newCfg(Goerli)
|
||||
MumbaiChainSnapshotCfg = newCfg(Mumbai)
|
||||
AmoyChainSnapshotCfg = newCfg(Amoy)
|
||||
BorMainnetChainSnapshotCfg = newCfg(BorMainnet)
|
||||
GnosisChainSnapshotCfg = newCfg(Gnosis)
|
||||
ChiadoChainSnapshotCfg = newCfg(Chiado)
|
||||
@ -100,6 +102,7 @@ var KnownCfgs = map[string]*Cfg{
|
||||
networkname.SepoliaChainName: SepoliaChainSnapshotCfg,
|
||||
networkname.GoerliChainName: GoerliChainSnapshotCfg,
|
||||
networkname.MumbaiChainName: MumbaiChainSnapshotCfg,
|
||||
networkname.AmoyChainName: AmoyChainSnapshotCfg,
|
||||
networkname.BorMainnetChainName: BorMainnetChainSnapshotCfg,
|
||||
networkname.GnosisChainName: GnosisChainSnapshotCfg,
|
||||
networkname.ChiadoChainName: ChiadoChainSnapshotCfg,
|
||||
@ -138,6 +141,7 @@ var KnownWebseeds = map[string][]string{
|
||||
networkname.SepoliaChainName: webseedsParse(webseed.Sepolia),
|
||||
networkname.GoerliChainName: webseedsParse(webseed.Goerli),
|
||||
networkname.MumbaiChainName: webseedsParse(webseed.Mumbai),
|
||||
networkname.AmoyChainName: webseedsParse(webseed.Amoy),
|
||||
networkname.BorMainnetChainName: webseedsParse(webseed.BorMainnet),
|
||||
networkname.GnosisChainName: webseedsParse(webseed.Gnosis),
|
||||
networkname.ChiadoChainName: webseedsParse(webseed.Chiado),
|
||||
|
@ -281,6 +281,7 @@ var ChainsWithSnapshots = map[string]struct{}{
|
||||
networkname.SepoliaChainName: {},
|
||||
networkname.GoerliChainName: {},
|
||||
networkname.MumbaiChainName: {},
|
||||
networkname.AmoyChainName: {},
|
||||
networkname.BorMainnetChainName: {},
|
||||
networkname.GnosisChainName: {},
|
||||
networkname.ChiadoChainName: {},
|
||||
|
@ -109,6 +109,8 @@ var V5Bootnodes = []string{
|
||||
"enr:-Ku4QEWzdnVtXc2Q0ZVigfCGggOVB2Vc1ZCPEc6j21NIFLODSJbvNaef1g4PxhPwl_3kax86YPheFUSLXPRs98vvYsoBh2F0dG5ldHOIAAAAAAAAAACEZXRoMpC1MD8qAAAAAP__________gmlkgnY0gmlwhDZBrP2Jc2VjcDI1NmsxoQM6jr8Rb1ktLEsVcKAPa08wCsKUmvoQ8khiOl_SLozf9IN1ZHCCIyg",
|
||||
}
|
||||
|
||||
var AmoyBootnodes = []string{} // Todo: Add BorAmoy bootnodes
|
||||
|
||||
var BorMainnetBootnodes = []string{
|
||||
"enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303",
|
||||
"enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303",
|
||||
@ -172,6 +174,8 @@ func BootnodeURLsOfChain(chain string) []string {
|
||||
return GoerliBootnodes
|
||||
case networkname.MumbaiChainName:
|
||||
return MumbaiBootnodes
|
||||
case networkname.AmoyChainName:
|
||||
return AmoyBootnodes
|
||||
case networkname.BorMainnetChainName:
|
||||
return BorMainnetBootnodes
|
||||
case networkname.GnosisChainName:
|
||||
|
44
params/chainspecs/amoy.json
Normal file
44
params/chainspecs/amoy.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"ChainName": "amoy",
|
||||
"chainId": 80002,
|
||||
"consensus": "bor",
|
||||
"homesteadBlock": 0,
|
||||
"eip150Block": 0,
|
||||
"eip155Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"muirGlacierBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 73100,
|
||||
"burntContract": {
|
||||
"0": "0x000000000000000000000000000000000000dead",
|
||||
"73100": "0xeCDD77cE6f146cCf5dab707941d318Bd50eeD2C9"
|
||||
},
|
||||
"bor": {
|
||||
"period": {
|
||||
"0": 2
|
||||
},
|
||||
"producerDelay": {
|
||||
"0": 4
|
||||
},
|
||||
"sprint": {
|
||||
"0": 16
|
||||
},
|
||||
"backupMultiplier": {
|
||||
"0": 2
|
||||
},
|
||||
"stateSyncConfirmationDelay": {
|
||||
"0": 128
|
||||
},
|
||||
"validatorContract": "0x0000000000000000000000000000000000001000",
|
||||
"stateReceiverContract": "0x0000000000000000000000000000000000001001",
|
||||
"overrideStateSyncRecords": null,
|
||||
"jaipurBlock": 73100,
|
||||
"delhiBlock": 73100,
|
||||
"indoreBlock": 73100,
|
||||
"agraBlock": 73100
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ var (
|
||||
SepoliaGenesisHash = libcommon.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9")
|
||||
GoerliGenesisHash = libcommon.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
|
||||
MumbaiGenesisHash = libcommon.HexToHash("0x7b66506a9ebdbf30d32b43c5f15a3b1216269a1ec3a75aa3182b86176a2b1ca7")
|
||||
AmoyGenesisHash = libcommon.HexToHash("0x7202b2b53c5a0836e773e319d18922cc756dd67432f9a1f65352b61f4406c697")
|
||||
BorMainnetGenesisHash = libcommon.HexToHash("0xa9c28ce2141b56c474f1dc504bee9b01eb1bd7d1a507580d5519d4437a97de1b")
|
||||
BorDevnetGenesisHash = libcommon.HexToHash("0x5a06b25b0c6530708ea0b98a3409290e39dce6be7f558493aeb6e4b99a172a87")
|
||||
GnosisGenesisHash = libcommon.HexToHash("0x4f1dd23188aab3a76b463e4af801b52b1248ef073c648cbdc4c9333d3da79756")
|
||||
@ -123,6 +124,8 @@ var (
|
||||
|
||||
MumbaiChainConfig = readChainSpec("chainspecs/mumbai.json")
|
||||
|
||||
AmoyChainConfig = readChainSpec("chainspecs/amoy.json")
|
||||
|
||||
BorMainnetChainConfig = readChainSpec("chainspecs/bor-mainnet.json")
|
||||
|
||||
BorDevnetChainConfig = readChainSpec("chainspecs/bor-devnet.json")
|
||||
@ -205,6 +208,8 @@ func ChainConfigByChainName(chain string) *chain.Config {
|
||||
return GoerliChainConfig
|
||||
case networkname.MumbaiChainName:
|
||||
return MumbaiChainConfig
|
||||
case networkname.AmoyChainName:
|
||||
return AmoyChainConfig
|
||||
case networkname.BorMainnetChainName:
|
||||
return BorMainnetChainConfig
|
||||
case networkname.BorDevnetChainName:
|
||||
@ -230,6 +235,8 @@ func GenesisHashByChainName(chain string) *libcommon.Hash {
|
||||
return &GoerliGenesisHash
|
||||
case networkname.MumbaiChainName:
|
||||
return &MumbaiGenesisHash
|
||||
case networkname.AmoyChainName:
|
||||
return &AmoyGenesisHash
|
||||
case networkname.BorMainnetChainName:
|
||||
return &BorMainnetGenesisHash
|
||||
case networkname.BorDevnetChainName:
|
||||
@ -255,6 +262,8 @@ func ChainConfigByGenesisHash(genesisHash libcommon.Hash) *chain.Config {
|
||||
return GoerliChainConfig
|
||||
case genesisHash == MumbaiGenesisHash:
|
||||
return MumbaiChainConfig
|
||||
case genesisHash == AmoyGenesisHash:
|
||||
return AmoyChainConfig
|
||||
case genesisHash == BorMainnetGenesisHash:
|
||||
return BorMainnetChainConfig
|
||||
case genesisHash == BorDevnetGenesisHash:
|
||||
|
@ -132,4 +132,9 @@ func TestGetBurntContract(t *testing.T) {
|
||||
addr = MumbaiChainConfig.GetBurntContract(41874000 + 1)
|
||||
require.NotNil(t, addr)
|
||||
assert.Equal(t, common.HexToAddress("0x617b94CCCC2511808A3C9478ebb96f455CF167aA"), *addr)
|
||||
|
||||
// Amoy
|
||||
addr = AmoyChainConfig.GetBurntContract(0)
|
||||
require.NotNil(t, addr)
|
||||
assert.Equal(t, common.HexToAddress("0x000000000000000000000000000000000000dead"), *addr)
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ func NewNodConfigUrfave(ctx *cli.Context, logger log.Logger) *nodecfg.Config {
|
||||
logger.Info("Starting Erigon in ephemeral dev mode...")
|
||||
case networkname.MumbaiChainName:
|
||||
logger.Info("Starting Erigon on Mumbai testnet...")
|
||||
case networkname.AmoyChainName:
|
||||
logger.Info("Starting Erigon on Amoy testnet...")
|
||||
case networkname.BorMainnetChainName:
|
||||
logger.Info("Starting Erigon on Bor Mainnet...")
|
||||
case networkname.BorDevnetChainName:
|
||||
|
@ -103,6 +103,36 @@ func TestSetupGenesis(t *testing.T) {
|
||||
wantHash: params.SepoliaGenesisHash,
|
||||
wantConfig: params.SepoliaChainConfig,
|
||||
},
|
||||
{
|
||||
name: "custom block in DB, genesis == bor-mainnet",
|
||||
fn: func(db kv.RwDB) (*chain.Config, *types.Block, error) {
|
||||
core.MustCommitGenesis(&customg, db, tmpdir)
|
||||
return core.CommitGenesisBlock(db, core.BorMainnetGenesisBlock(), tmpdir, logger)
|
||||
},
|
||||
wantErr: &types.GenesisMismatchError{Stored: customghash, New: params.BorMainnetGenesisHash},
|
||||
wantHash: params.BorMainnetGenesisHash,
|
||||
wantConfig: params.BorMainnetChainConfig,
|
||||
},
|
||||
{
|
||||
name: "custom block in DB, genesis == mumbai",
|
||||
fn: func(db kv.RwDB) (*chain.Config, *types.Block, error) {
|
||||
core.MustCommitGenesis(&customg, db, tmpdir)
|
||||
return core.CommitGenesisBlock(db, core.MumbaiGenesisBlock(), tmpdir, logger)
|
||||
},
|
||||
wantErr: &types.GenesisMismatchError{Stored: customghash, New: params.MumbaiGenesisHash},
|
||||
wantHash: params.MumbaiGenesisHash,
|
||||
wantConfig: params.MumbaiChainConfig,
|
||||
},
|
||||
{
|
||||
name: "custom block in DB, genesis == amoy",
|
||||
fn: func(db kv.RwDB) (*chain.Config, *types.Block, error) {
|
||||
core.MustCommitGenesis(&customg, db, tmpdir)
|
||||
return core.CommitGenesisBlock(db, core.AmoyGenesisBlock(), tmpdir, logger)
|
||||
},
|
||||
wantErr: &types.GenesisMismatchError{Stored: customghash, New: params.AmoyGenesisHash},
|
||||
wantHash: params.AmoyGenesisHash,
|
||||
wantConfig: params.AmoyChainConfig,
|
||||
},
|
||||
{
|
||||
name: "compatible config in DB",
|
||||
fn: func(db kv.RwDB) (*chain.Config, *types.Block, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user