Hardcoded GenesisValidatorsRoot (#14365)

* hardcoded GenesisValidatorsRoot

* added in mainnet.config

* updated desc

* added it in all testnets

* minor change

* added roots instead of empty and fn to compute byte32 from hex

* added in e2e testnet_config

* fixed test

* minor fix

* removed fn and added bytes output directly

* Add test for genesis validator root mainnet value

* removed root from minimal and testnet

* removed root

* Update CHANGELOG.md

* Fix bazel package visiblity

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
Co-authored-by: Preston Van Loon <preston@pvl.dev>
This commit is contained in:
Md Amaan
2024-08-26 22:20:29 +05:30
committed by GitHub
parent 19d9a1915d
commit 2399451869
8 changed files with 23 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ go_test(
gotags = ["develop"],
tags = ["CI_race_detection"],
deps = [
"//beacon-chain/state/genesis:go_default_library",
"//consensus-types/primitives:go_default_library",
"//encoding/bytesutil:go_default_library",
"//io/file:go_default_library",

View File

@@ -128,6 +128,7 @@ type BeaconChainConfig struct {
DomainConsolidation [4]byte `yaml:"DOMAIN_CONSOLIDATION" spec:"true"`
// Prysm constants.
GenesisValidatorsRoot [32]byte // GenesisValidatorsRoot is the root hash of the genesis validators.
GweiPerEth uint64 // GweiPerEth is the amount of gwei corresponding to 1 eth.
BLSSecretKeyLength int // BLSSecretKeyLength defines the expected length of BLS secret keys in bytes.
BLSPubkeyLength int // BLSPubkeyLength defines the expected length of BLS public keys in bytes.

View File

@@ -1,9 +1,11 @@
package params_test
import (
"bytes"
"sync"
"testing"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state/genesis"
"github.com/prysmaticlabs/prysm/v5/config/params"
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v5/testing/require"
@@ -92,3 +94,14 @@ func TestConfig_WithinDAPeriod(t *testing.T) {
})
}
}
func TestConfigGenesisValidatorRoot(t *testing.T) {
g, err := genesis.State(params.MainnetName)
require.NoError(t, err)
gvr := g.GenesisValidatorsRoot()
if !bytes.Equal(gvr, params.BeaconConfig().GenesisValidatorsRoot[:]) {
t.Fatal("mainnet params genesis validator root does not match the mainnet genesis state value")
}
}

View File

@@ -174,6 +174,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
DomainConsolidation: bytesutil.Uint32ToBytes4(0x0B000000),
// Prysm constants.
GenesisValidatorsRoot: [32]byte{75, 54, 61, 185, 78, 40, 97, 32, 215, 110, 185, 5, 52, 15, 221, 78, 84, 191, 233, 240, 107, 243, 63, 246, 207, 90, 210, 127, 81, 27, 254, 149},
GweiPerEth: 1000000000,
BLSSecretKeyLength: 32,
BLSPubkeyLength: 48,

View File

@@ -26,6 +26,7 @@ func HoleskyConfig() *BeaconChainConfig {
cfg.MinGenesisTime = 1695902100
cfg.GenesisDelay = 300
cfg.ConfigName = HoleskyName
cfg.GenesisValidatorsRoot = [32]byte{145, 67, 170, 124, 97, 90, 127, 113, 21, 226, 182, 170, 195, 25, 192, 53, 41, 223, 130, 66, 174, 112, 95, 186, 157, 243, 155, 121, 197, 159, 168, 177}
cfg.GenesisForkVersion = []byte{0x01, 0x01, 0x70, 0x00}
cfg.SecondsPerETH1Block = 14
cfg.DepositChainID = 17000

View File

@@ -26,6 +26,7 @@ func SepoliaConfig() *BeaconChainConfig {
cfg.MinGenesisTime = 1655647200
cfg.GenesisDelay = 86400
cfg.MinGenesisActiveValidatorCount = 1300
cfg.GenesisValidatorsRoot = [32]byte{216, 234, 23, 31, 60, 148, 174, 162, 30, 188, 66, 161, 237, 97, 5, 42, 207, 63, 146, 9, 192, 14, 78, 251, 170, 221, 172, 9, 237, 155, 128, 120}
cfg.ConfigName = SepoliaName
cfg.GenesisForkVersion = []byte{0x90, 0x00, 0x00, 0x69}
cfg.SecondsPerETH1Block = 14