go-ethereum/beacon/params/config_test.go
Klimov Sergei c55a12197e
beacon/config: ignore nil values in config file (#33065)
YAML supports leaving out the value, so we should handle this condition
in our limited parser.
2025-11-26 16:19:33 +01:00

37 lines
774 B
Go

package params
import (
"bytes"
"testing"
)
func TestChainConfig_LoadForks(t *testing.T) {
const config = `
GENESIS_FORK_VERSION: 0x00000000
ALTAIR_FORK_VERSION: 0x00000001
ALTAIR_FORK_EPOCH: 1
EIP7928_FORK_VERSION: 0xb0000038
EIP7928_FORK_EPOCH: 18446744073709551615
EIP7XXX_FORK_VERSION:
EIP7XXX_FORK_EPOCH:
BLOB_SCHEDULE: []
`
c := &ChainConfig{}
err := c.LoadForks([]byte(config))
if err != nil {
t.Fatal(err)
}
for _, fork := range c.Forks {
if fork.Name == "GENESIS" && (fork.Epoch != 0) {
t.Errorf("unexpected genesis fork epoch %d", fork.Epoch)
}
if fork.Name == "ALTAIR" && (fork.Epoch != 1 || !bytes.Equal(fork.Version, []byte{0, 0, 0, 1})) {
t.Errorf("unexpected altair fork epoch %d version %x", fork.Epoch, fork.Version)
}
}
}