Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion params/precompile_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (c *ChainConfig) verifyPrecompileUpgrades() error {
disabled bool
)
// check the genesis chain config for any enabled upgrade
if config, ok := c.PrecompileUpgrade.getByKey(key); ok {
if config, ok := c.PrecompileUpgrade.getByKey(key); ok && config.Timestamp() != nil {
if err := config.Verify(); err != nil {
return err
}
Expand Down
20 changes: 20 additions & 0 deletions params/precompile_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,26 @@ func TestVerifyWithChainConfig(t *testing.T) {
assert.ErrorContains(t, err, "disable should be [true]")
}

func TestVerifyWithChainConfigAtNilTimestamp(t *testing.T) {
admins := []common.Address{{1}}
baseConfig := *SubnetEVMDefaultChainConfig
config := &baseConfig
config.PrecompileUpgrade = PrecompileUpgrade{
// this does NOT enable the precompile, so it should be upgradeable.
TxAllowListConfig: precompile.NewTxAllowListConfig(nil, nil, nil),
}
require.False(t, config.IsTxAllowList(common.Big0)) // check the precompile is not enabled.
config.PrecompileUpgrades = []PrecompileUpgrade{
{
// enable TxAllowList at timestamp 5
TxAllowListConfig: precompile.NewTxAllowListConfig(big.NewInt(5), admins, nil),
},
}

// check this config is valid
require.NoError(t, config.Verify())
}

func TestVerifyPrecompileUpgrades(t *testing.T) {
admins := []common.Address{{1}}
tests := []struct {
Expand Down