Skip to content
1 change: 1 addition & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func SetupGenesisBlock(
customrawdb.WriteChainConfig(db, stored, newcfg)
return newcfg, stored, nil
}
params.SetEthUpgrades(storedcfg, params.GetExtra(storedcfg).NetworkUpgrades)
// Check config compatibility and write the config. Compatibility errors
// are returned to the caller unless we're already at block zero.
// we use last accepted block for cfg compatibility check. Note this allows
Expand Down
13 changes: 13 additions & 0 deletions params/extras/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ func (c *ChainConfig) Description() string {
}
banner += fmt.Sprintf("Upgrade Config: %s", string(upgradeConfigBytes))
banner += "\n"

feeBytes, err := json.Marshal(c.FeeConfig)
if err != nil {
feeBytes = []byte("cannot marshal FeeConfig")
}
banner += fmt.Sprintf("Fee Config: %s\n", string(feeBytes))

banner += fmt.Sprintf("Allow Fee Recipients: %v\n", c.AllowFeeRecipients)

return banner
}

Expand Down Expand Up @@ -318,6 +327,10 @@ func checkForks(forks []fork, blockFork bool) error {

// Verify verifies chain config.
func (c *ChainConfig) Verify() error {
if err := c.FeeConfig.Verify(); err != nil {
return fmt.Errorf("invalid fee config: %w", err)
}

// Verify the precompile upgrades are internally consistent given the existing chainConfig.
if err := c.verifyPrecompileUpgrades(); err != nil {
return fmt.Errorf("invalid precompile upgrades: %w", err)
Expand Down
4 changes: 3 additions & 1 deletion params/extras/precompile_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ func TestVerifyPrecompiles(t *testing.T) {

func TestVerifyRequiresSortedTimestamps(t *testing.T) {
admins := []common.Address{{1}}
config := &ChainConfig{}
config := &ChainConfig{
FeeConfig: DefaultFeeConfig,
}
config.PrecompileUpgrades = []PrecompileUpgrade{
{
Config: txallowlist.NewConfig(utils.NewUint64(2), admins, nil, nil),
Expand Down
4 changes: 3 additions & 1 deletion params/extras/precompile_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import (

func TestVerifyUpgradeConfig(t *testing.T) {
admins := []common.Address{{1}}
chainConfig := &ChainConfig{}
chainConfig := &ChainConfig{
FeeConfig: DefaultFeeConfig,
}
chainConfig.GenesisPrecompiles = Precompiles{
txallowlist.ConfigKey: txallowlist.NewConfig(utils.NewUint64(1), admins, nil, nil),
}
Expand Down