Skip to content

Commit d518651

Browse files
author
Darioush Jalali
authored
precompiles: adds a regression test for the IsDisabled case in AvalancheRules (#515)
1 parent 81fb4a9 commit d518651

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

params/config_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,24 @@ func TestConfigUnmarshalJSON(t *testing.T) {
206206
require.NoError(err)
207207
require.Equal(c, c2)
208208
}
209+
210+
func TestActivePrecompiles(t *testing.T) {
211+
config := ChainConfig{
212+
UpgradeConfig: UpgradeConfig{
213+
PrecompileUpgrades: []PrecompileUpgrade{
214+
{
215+
nativeminter.NewConfig(common.Big0, nil, nil, nil), // enable at genesis
216+
},
217+
{
218+
nativeminter.NewDisableConfig(common.Big1), // disable at timestamp 1
219+
},
220+
},
221+
},
222+
}
223+
224+
rules0 := config.AvalancheRules(common.Big0, common.Big0)
225+
require.True(t, rules0.IsPrecompileEnabled(nativeminter.Module.Address))
226+
227+
rules1 := config.AvalancheRules(common.Big0, common.Big1)
228+
require.False(t, rules1.IsPrecompileEnabled(nativeminter.Module.Address))
229+
}

0 commit comments

Comments
 (0)