Skip to content

Commit

Permalink
precompiles: adds a regression test for the IsDisabled case in Avalan…
Browse files Browse the repository at this point in the history
…cheRules (#515)
  • Loading branch information
darioush authored Feb 17, 2023
1 parent 81fb4a9 commit d518651
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions params/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,24 @@ func TestConfigUnmarshalJSON(t *testing.T) {
require.NoError(err)
require.Equal(c, c2)
}

func TestActivePrecompiles(t *testing.T) {
config := ChainConfig{
UpgradeConfig: UpgradeConfig{
PrecompileUpgrades: []PrecompileUpgrade{
{
nativeminter.NewConfig(common.Big0, nil, nil, nil), // enable at genesis
},
{
nativeminter.NewDisableConfig(common.Big1), // disable at timestamp 1
},
},
},
}

rules0 := config.AvalancheRules(common.Big0, common.Big0)
require.True(t, rules0.IsPrecompileEnabled(nativeminter.Module.Address))

rules1 := config.AvalancheRules(common.Big0, common.Big1)
require.False(t, rules1.IsPrecompileEnabled(nativeminter.Module.Address))
}

0 comments on commit d518651

Please sign in to comment.