diff --git a/accounts/abi/bind/precompile_config_template.go b/accounts/abi/bind/precompile_config_template.go index d7c730e06c..6cc5208610 100644 --- a/accounts/abi/bind/precompile_config_template.go +++ b/accounts/abi/bind/precompile_config_template.go @@ -147,7 +147,7 @@ func NewModule() precompile.StatefulPrecompileModule { // Address returns the address of the {{.Contract.Type}}. // Select a non-conflicting address and set it in generated contract.go -func (c {{.Contract.Type}}Config) Address() common.Address { +func ({{.Contract.Type}}Config) Address() common.Address { return ContractAddress } diff --git a/params/precompile_config.go b/params/precompile_config.go index 559ecb74d7..5b81c12119 100644 --- a/params/precompile_config.go +++ b/params/precompile_config.go @@ -80,6 +80,10 @@ func (c *ChainConfig) verifyPrecompileUpgrades() error { if err := config.Verify(); err != nil { return err } + // if the precompile is disabled at genesis, skip it. + if config.Timestamp() == nil { + continue + } // check the genesis chain config for any enabled upgrade lastUpgradeMap[key] = lastUpgradeData{ disabled: false, diff --git a/params/precompile_modules.go b/params/precompile_modules.go index d9e0bacb58..3e888af721 100644 --- a/params/precompile_modules.go +++ b/params/precompile_modules.go @@ -1,5 +1,5 @@ -// // (c) 2022, Ava Labs, Inc. All rights reserved. -// // See the file LICENSE for licensing terms. +// (c) 2023, Ava Labs, Inc. All rights reserved. +// See the file LICENSE for licensing terms. package params @@ -27,10 +27,10 @@ import ( // ContractDeployerAllowListAddress = common.HexToAddress("0x0200000000000000000000000000000000000000") // ContractNativeMinterAddress = common.HexToAddress("0x0200000000000000000000000000000000000001") // TxAllowListAddress = common.HexToAddress("0x0200000000000000000000000000000000000002") -// FeeManagerAddress = common.HexToAddress("0x0200000000000000000000000000000000000003") +// FeeManagerAddress = common.HexToAddress("0x0200000000000000000000000000000000000003") // RewardManagerAddress = common.HexToAddress("0x0200000000000000000000000000000000000004") // ADD YOUR PRECOMPILE HERE -// {YourPrecompile}Address = common.HexToAddress("0x03000000000000000000000000000000000000??") +// {YourPrecompile}Address = common.HexToAddress("0x03000000000000000000000000000000000000??") func init() { // Order matters here. precompile.RegisterModule(deployerallowlist.NewModule()) diff --git a/precompile/deployerallowlist/config.go b/precompile/deployerallowlist/config.go index 31b5435173..8544ea3bf0 100644 --- a/precompile/deployerallowlist/config.go +++ b/precompile/deployerallowlist/config.go @@ -63,7 +63,7 @@ func (ContractDeployerAllowListConfig) Contract() precompile.StatefulPrecompiled } // Key returns the key used in json config files to specify this precompile config. -func (c ContractDeployerAllowListConfig) Key() string { +func (ContractDeployerAllowListConfig) Key() string { return ConfigKey } diff --git a/precompile/feemanager/config.go b/precompile/feemanager/config.go index 94cca34635..35123b4b71 100644 --- a/precompile/feemanager/config.go +++ b/precompile/feemanager/config.go @@ -57,17 +57,17 @@ func NewDisableFeeManagerConfig(blockTimestamp *big.Int) *FeeManagerConfig { } // Address returns the address of the fee manager contract. -func (c FeeManagerConfig) Address() common.Address { +func (FeeManagerConfig) Address() common.Address { return ContractAddress } // Contract returns the singleton stateful precompiled contract to be used for the fee manager. -func (c FeeManagerConfig) Contract() precompile.StatefulPrecompiledContract { +func (FeeManagerConfig) Contract() precompile.StatefulPrecompiledContract { return FeeManagerPrecompile } // Key returns the key used in json config files to specify this precompile config. -func (c FeeManagerConfig) Key() string { +func (FeeManagerConfig) Key() string { return ConfigKey } diff --git a/precompile/nativeminter/config.go b/precompile/nativeminter/config.go index 56cd41b0a2..b410018e04 100644 --- a/precompile/nativeminter/config.go +++ b/precompile/nativeminter/config.go @@ -58,7 +58,7 @@ func NewDisableContractNativeMinterConfig(blockTimestamp *big.Int) *ContractNati } // Address returns the address of the native minter contract. -func (c ContractNativeMinterConfig) Address() common.Address { +func (ContractNativeMinterConfig) Address() common.Address { return ContractAddress } diff --git a/precompile/rewardmanager/config.go b/precompile/rewardmanager/config.go index 1c10aacf3d..b41a7f3ead 100644 --- a/precompile/rewardmanager/config.go +++ b/precompile/rewardmanager/config.go @@ -96,22 +96,22 @@ func NewDisableRewardManagerConfig(blockTimestamp *big.Int) *RewardManagerConfig // Address returns the address of the RewardManager. Addresses reside under the precompile/params.go // Select a non-conflicting address and set it in the params.go. -func (*RewardManagerConfig) Address() common.Address { +func (RewardManagerConfig) Address() common.Address { return ContractAddress } // Contract returns the singleton stateful precompiled contract to be used for RewardManager. -func (*RewardManagerConfig) Contract() precompile.StatefulPrecompiledContract { +func (RewardManagerConfig) Contract() precompile.StatefulPrecompiledContract { return RewardManagerPrecompile } // Key returns the key used in json config files to specify this precompile config. -func (*RewardManagerConfig) Key() string { +func (RewardManagerConfig) Key() string { return ConfigKey } // NewConfig returns a new instance of RewardManagerConfig. -func (*RewardManagerConfig) NewConfig() precompile.StatefulPrecompileConfig { +func (RewardManagerConfig) NewConfig() precompile.StatefulPrecompileConfig { return new(RewardManagerConfig) } diff --git a/precompile/stateful_precompile_module.go b/precompile/stateful_precompile_module.go index d9b4146333..acfa374220 100644 --- a/precompile/stateful_precompile_module.go +++ b/precompile/stateful_precompile_module.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package precompile diff --git a/tests/statefulprecompiles/allow_list_test.go b/tests/statefulprecompiles/allow_list_test.go index 99252c8721..7f16a42d35 100644 --- a/tests/statefulprecompiles/allow_list_test.go +++ b/tests/statefulprecompiles/allow_list_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles diff --git a/tests/statefulprecompiles/contract_deployer_test.go b/tests/statefulprecompiles/contract_deployer_test.go index b1b8bb7792..9c0f2cc112 100644 --- a/tests/statefulprecompiles/contract_deployer_test.go +++ b/tests/statefulprecompiles/contract_deployer_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles diff --git a/tests/statefulprecompiles/fee_manager_test.go b/tests/statefulprecompiles/fee_manager_test.go index 3999fe76ff..713ecbe74d 100644 --- a/tests/statefulprecompiles/fee_manager_test.go +++ b/tests/statefulprecompiles/fee_manager_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles diff --git a/tests/statefulprecompiles/native_minter_test.go b/tests/statefulprecompiles/native_minter_test.go index 8de29b9f31..841c19e65b 100644 --- a/tests/statefulprecompiles/native_minter_test.go +++ b/tests/statefulprecompiles/native_minter_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles diff --git a/tests/statefulprecompiles/reward_manager_test.go b/tests/statefulprecompiles/reward_manager_test.go index df5f053112..3bbba6a33e 100644 --- a/tests/statefulprecompiles/reward_manager_test.go +++ b/tests/statefulprecompiles/reward_manager_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles diff --git a/tests/statefulprecompiles/tx_allowlist_test.go b/tests/statefulprecompiles/tx_allowlist_test.go index 86f25541fe..beea2a7f20 100644 --- a/tests/statefulprecompiles/tx_allowlist_test.go +++ b/tests/statefulprecompiles/tx_allowlist_test.go @@ -1,4 +1,4 @@ -// (c) 2019-2020, Ava Labs, Inc. All rights reserved. +// (c) 2019-2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. package statefulprecompiles