From 99b628ae5c23a4e592a14c0a8d77b618287f5877 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Feb 2023 09:25:05 -0800 Subject: [PATCH 1/5] alternative renaming for precompile configs --- params/config.go | 6 +++--- params/precompile_upgrade.go | 9 ++++----- params/precompiles.go | 4 ++-- precompile/allowlist/config.go | 10 +++++----- precompile/config/config.go | 2 +- precompile/config/mock_config.go | 3 +-- precompile/config/upgradeable.go | 2 +- precompile/contract/interfaces.go | 6 +++--- precompile/contract/utils.go | 4 ++-- .../contracts/deployerallowlist/config.go | 20 +++++++++---------- .../contracts/deployerallowlist/module.go | 8 ++++---- precompile/contracts/feemanager/config.go | 20 +++++++++---------- precompile/contracts/feemanager/module.go | 8 ++++---- precompile/contracts/nativeminter/config.go | 20 +++++++++---------- .../contracts/nativeminter/config_test.go | 10 +++++----- precompile/contracts/nativeminter/module.go | 8 ++++---- precompile/contracts/rewardmanager/config.go | 20 +++++++++---------- precompile/contracts/rewardmanager/module.go | 6 +++--- precompile/contracts/txallowlist/config.go | 18 ++++++++--------- .../contracts/txallowlist/config_test.go | 8 ++++---- precompile/contracts/txallowlist/module.go | 8 ++++---- 21 files changed, 99 insertions(+), 101 deletions(-) diff --git a/params/config.go b/params/config.go index 2ff5581565..4637b310a4 100644 --- a/params/config.go +++ b/params/config.go @@ -34,7 +34,7 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/subnet-evm/commontype" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" @@ -558,7 +558,7 @@ type Rules struct { // for this rule set. // Note: none of these addresses should conflict with the address space used by // any existing precompiles. - ActivePrecompiles map[common.Address]config.Config + ActivePrecompiles map[common.Address]precompileConfig.Config } // IsPrecompileEnabled returns true if the precompile at [addr] is enabled for this rule set. @@ -594,7 +594,7 @@ func (c *ChainConfig) AvalancheRules(blockNum, blockTimestamp *big.Int) Rules { rules.IsSubnetEVM = c.IsSubnetEVM(blockTimestamp) // Initialize the stateful precompiles that should be enabled at [blockTimestamp]. - rules.ActivePrecompiles = make(map[common.Address]config.Config) + rules.ActivePrecompiles = make(map[common.Address]precompileConfig.Config) for _, module := range modules.RegisteredModules() { if config := c.GetActivePrecompileConfig(module.Address, blockTimestamp); config != nil && !config.IsDisabled() { rules.ActivePrecompiles[module.Address] = config diff --git a/params/precompile_upgrade.go b/params/precompile_upgrade.go index 66dfee0202..ff2028763b 100644 --- a/params/precompile_upgrade.go +++ b/params/precompile_upgrade.go @@ -9,7 +9,6 @@ import ( "fmt" "math/big" - "github.com/ava-labs/subnet-evm/precompile/config" precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ava-labs/subnet-evm/utils" @@ -23,7 +22,7 @@ var errNoKey = errors.New("PrecompileUpgrade cannot be empty") // based on the key. Keys are defined in each precompile module, and registered in // precompile/registry/registry.go. type PrecompileUpgrade struct { - config.Config + precompileConfig.Config } // UnmarshalJSON unmarshals the json into the correct precompile config type @@ -152,7 +151,7 @@ func (c *ChainConfig) verifyPrecompileUpgrades() error { // GetActivePrecompileConfig returns the most recent precompile config corresponding to [address]. // If none have occurred, returns nil. -func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTimestamp *big.Int) config.Config { +func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTimestamp *big.Int) precompileConfig.Config { configs := c.GetActivatingPrecompileConfigs(address, nil, blockTimestamp, c.PrecompileUpgrades) if len(configs) == 0 { return nil @@ -162,13 +161,13 @@ func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTim // GetActivatingPrecompileConfigs returns all upgrades configured to activate during the state transition from a block with timestamp [from] // to a block with timestamp [to]. -func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *big.Int, to *big.Int, upgrades []PrecompileUpgrade) []config.Config { +func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *big.Int, to *big.Int, upgrades []PrecompileUpgrade) []precompileConfig.Config { // Get key from address. module, ok := modules.GetPrecompileModuleByAddress(address) if !ok { return nil } - configs := make([]config.Config, 0) + configs := make([]precompileConfig.Config, 0) key := module.ConfigKey // First check the embedded [upgrade] for precompiles configured // in the genesis chain config. diff --git a/params/precompiles.go b/params/precompiles.go index 4ad0bf3a8f..ecdf7fdfaa 100644 --- a/params/precompiles.go +++ b/params/precompiles.go @@ -6,11 +6,11 @@ package params import ( "encoding/json" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" ) -type Precompiles map[string]config.Config +type Precompiles map[string]precompileConfig.Config // UnmarshalJSON parses the JSON-encoded data into the ChainConfigPrecompiles. // ChainConfigPrecompiles is a map of precompile module keys to their diff --git a/precompile/allowlist/config.go b/precompile/allowlist/config.go index c11f86afc2..ad414b036a 100644 --- a/precompile/allowlist/config.go +++ b/precompile/allowlist/config.go @@ -10,15 +10,15 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// Config specifies the initial set of addresses with Admin or Enabled roles. -type Config struct { +// AllowList specifies the initial set of addresses with Admin or Enabled roles. +type AllowList struct { AdminAddresses []common.Address `json:"adminAddresses,omitempty"` // initial admin addresses EnabledAddresses []common.Address `json:"enabledAddresses,omitempty"` // initial enabled addresses } // Configure initializes the address space of [precompileAddr] by initializing the role of each of // the addresses in [AllowListAdmins]. -func (c *Config) Configure(state contract.StateDB, precompileAddr common.Address) error { +func (c *AllowList) Configure(state contract.StateDB, precompileAddr common.Address) error { for _, enabledAddr := range c.EnabledAddresses { SetAllowListRole(state, precompileAddr, enabledAddr, EnabledRole) } @@ -29,7 +29,7 @@ func (c *Config) Configure(state contract.StateDB, precompileAddr common.Address } // Equal returns true iff [other] has the same admins in the same order in its allow list. -func (c *Config) Equal(other *Config) bool { +func (c *AllowList) Equal(other *AllowList) bool { if other == nil { return false } @@ -52,7 +52,7 @@ func areEqualAddressLists(current []common.Address, other []common.Address) bool } // Verify returns an error if there is an overlapping address between admin and enabled roles -func (c *Config) Verify() error { +func (c *AllowList) Verify() error { addressMap := make(map[common.Address]Role) // tracks which addresses we have seen and their role // check for duplicates in enabled list diff --git a/precompile/config/config.go b/precompile/config/config.go index 63ccf43dad..60540f98b1 100644 --- a/precompile/config/config.go +++ b/precompile/config/config.go @@ -2,7 +2,7 @@ // See the file LICENSE for licensing terms. // Defines the stateless interface for unmarshalling an arbitrary config of a precompile -package config +package precompileConfig import ( "math/big" diff --git a/precompile/config/mock_config.go b/precompile/config/mock_config.go index cb1f1f9a91..81b34a7e10 100644 --- a/precompile/config/mock_config.go +++ b/precompile/config/mock_config.go @@ -2,8 +2,7 @@ // See the file LICENSE for licensing terms. // TODO: replace with gomock - -package config +package precompileConfig import ( "math/big" diff --git a/precompile/config/upgradeable.go b/precompile/config/upgradeable.go index 66a4381694..2952b0d6ee 100644 --- a/precompile/config/upgradeable.go +++ b/precompile/config/upgradeable.go @@ -1,7 +1,7 @@ // (c) 2022 Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package config +package precompileConfig import ( "math/big" diff --git a/precompile/contract/interfaces.go b/precompile/contract/interfaces.go index 75f48980a1..0982e5369c 100644 --- a/precompile/contract/interfaces.go +++ b/precompile/contract/interfaces.go @@ -9,7 +9,7 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/subnet-evm/commontype" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" ) @@ -69,10 +69,10 @@ type BlockContext interface { } type Configurator interface { - NewConfig() config.Config + NewConfig() precompileConfig.Config Configure( chainConfig ChainConfig, - precompileConfig config.Config, + precompileConfig precompileConfig.Config, state StateDB, blockContext BlockContext, ) error diff --git a/precompile/contract/utils.go b/precompile/contract/utils.go index 1718eb2dca..a48b9a3a35 100644 --- a/precompile/contract/utils.go +++ b/precompile/contract/utils.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/ava-labs/subnet-evm/accounts/abi" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/vmerrs" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" @@ -39,7 +39,7 @@ type PrecompileTest struct { // It should be the same precompile config that is used in the // precompile's configurator. // If nil, Configure on the Configurator will not be called. - Config config.Config + Config precompileConfig.Config // BeforeHook is called before the precompile is called. BeforeHook func(t *testing.T, state StateDB) // AfterHook is called after the precompile is called. diff --git a/precompile/contracts/deployerallowlist/config.go b/precompile/contracts/deployerallowlist/config.go index 4f624de1f6..ffb403cad0 100644 --- a/precompile/contracts/deployerallowlist/config.go +++ b/precompile/contracts/deployerallowlist/config.go @@ -7,28 +7,28 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" ) -var _ config.Config = &Config{} +var _ precompileConfig.Config = &Config{} // Config contains the configuration for the ContractDeployerAllowList precompile, // consisting of the initial allowlist and the timestamp for the network upgrade. type Config struct { - allowlist.Config - config.Upgrade + allowlist.AllowList + precompileConfig.Upgrade } // NewConfig returns a config for a network upgrade at [blockTimestamp] that enables // ContractDeployerAllowList with [admins] and [enableds] as members of the allowlist. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address) *Config { return &Config{ - Config: allowlist.Config{ + AllowList: allowlist.AllowList{ AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: config.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, } } @@ -36,7 +36,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables ContractDeployerAllowList. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: config.Upgrade{ + Upgrade: precompileConfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -46,13 +46,13 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*ContractDeployerAllowListConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg config.Config) bool { +func (c *Config) Equal(cfg precompileConfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { return false } - return c.Upgrade.Equal(&other.Upgrade) && c.Config.Equal(&other.Config) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) } -func (c *Config) Verify() error { return c.Config.Verify() } +func (c *Config) Verify() error { return c.AllowList.Verify() } diff --git a/precompile/contracts/deployerallowlist/module.go b/precompile/contracts/deployerallowlist/module.go index 73bd720bed..c444feccc0 100644 --- a/precompile/contracts/deployerallowlist/module.go +++ b/precompile/contracts/deployerallowlist/module.go @@ -6,7 +6,7 @@ package deployerallowlist import ( "fmt" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ethereum/go-ethereum/common" @@ -35,15 +35,15 @@ func init() { } } -func (*configurator) NewConfig() config.Config { +func (*configurator) NewConfig() precompileConfig.Config { return &Config{} } // Configure configures [state] with the given [cfg] config. -func (c *configurator) Configure(_ contract.ChainConfig, cfg config.Config, state contract.StateDB, _ contract.BlockContext) error { +func (c *configurator) Configure(_ contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) } - return config.Config.Configure(state, ContractAddress) + return config.AllowList.Configure(state, ContractAddress) } diff --git a/precompile/contracts/feemanager/config.go b/precompile/contracts/feemanager/config.go index 05d04991f5..3f9b2f177b 100644 --- a/precompile/contracts/feemanager/config.go +++ b/precompile/contracts/feemanager/config.go @@ -8,17 +8,17 @@ import ( "github.com/ava-labs/subnet-evm/commontype" "github.com/ava-labs/subnet-evm/precompile/allowlist" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" ) -var _ config.Config = &Config{} +var _ precompileConfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // FeeManager specific precompile config. type Config struct { - allowlist.Config // Config for the fee config manager allow list - config.Upgrade + allowlist.AllowList // Config for the fee config manager allow list + precompileConfig.Upgrade InitialFeeConfig *commontype.FeeConfig `json:"initialFeeConfig,omitempty"` // initial fee config to be immediately activated } @@ -27,11 +27,11 @@ type Config struct { // allowlist with [initialConfig] as initial fee config if specified. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialConfig *commontype.FeeConfig) *Config { return &Config{ - Config: allowlist.Config{ + AllowList: allowlist.AllowList{ AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: config.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialFeeConfig: initialConfig, } } @@ -40,7 +40,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables FeeManager. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: config.Upgrade{ + Upgrade: precompileConfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -50,13 +50,13 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*FeeManagerConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg config.Config) bool { +func (c *Config) Equal(cfg precompileConfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { return false } - eq := c.Upgrade.Equal(&other.Upgrade) && c.Config.Equal(&other.Config) + eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) if !eq { return false } @@ -69,7 +69,7 @@ func (c *Config) Equal(cfg config.Config) bool { } func (c *Config) Verify() error { - if err := c.Config.Verify(); err != nil { + if err := c.AllowList.Verify(); err != nil { return err } if c.InitialFeeConfig == nil { diff --git a/precompile/contracts/feemanager/module.go b/precompile/contracts/feemanager/module.go index a725bb3f3d..e19617f26d 100644 --- a/precompile/contracts/feemanager/module.go +++ b/precompile/contracts/feemanager/module.go @@ -6,7 +6,7 @@ package feemanager import ( "fmt" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ethereum/go-ethereum/common" @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() config.Config { +func (*configurator) NewConfig() precompileConfig.Config { return &Config{} } // Configure configures [state] with the desired admins based on [configIface]. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg config.Config, state contract.StateDB, blockContext contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, blockContext contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) @@ -57,5 +57,5 @@ func (*configurator) Configure(chainConfig contract.ChainConfig, cfg config.Conf return fmt.Errorf("cannot configure fee config in chain config: %w", err) } } - return config.Config.Configure(state, ContractAddress) + return config.AllowList.Configure(state, ContractAddress) } diff --git a/precompile/contracts/nativeminter/config.go b/precompile/contracts/nativeminter/config.go index 21278e8de6..a193f60a30 100644 --- a/precompile/contracts/nativeminter/config.go +++ b/precompile/contracts/nativeminter/config.go @@ -8,19 +8,19 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" ) -var _ config.Config = &Config{} +var _ precompileConfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // ContractNativeMinter specific precompile config. type Config struct { - allowlist.Config - config.Upgrade + allowlist.AllowList + precompileConfig.Upgrade InitialMint map[common.Address]*math.HexOrDecimal256 `json:"initialMint,omitempty"` // addresses to receive the initial mint mapped to the amount to mint } @@ -28,11 +28,11 @@ type Config struct { // ContractNativeMinter with the given [admins] and [enableds] as members of the allowlist. Also mints balances according to [initialMint] when the upgrade activates. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialMint map[common.Address]*math.HexOrDecimal256) *Config { return &Config{ - Config: allowlist.Config{ + AllowList: allowlist.AllowList{ AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: config.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialMint: initialMint, } } @@ -41,7 +41,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables ContractNativeMinter. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: config.Upgrade{ + Upgrade: precompileConfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -50,13 +50,13 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*ContractNativeMinterConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg config.Config) bool { +func (c *Config) Equal(cfg precompileConfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { return false } - eq := c.Upgrade.Equal(&other.Upgrade) && c.Config.Equal(&other.Config) + eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) if !eq { return false } @@ -91,5 +91,5 @@ func (c *Config) Verify() error { return fmt.Errorf("initial mint cannot contain invalid amount %v for address %s", bigIntAmount, addr) } } - return c.Config.Verify() + return c.AllowList.Verify() } diff --git a/precompile/contracts/nativeminter/config_test.go b/precompile/contracts/nativeminter/config_test.go index 08227a9be1..20b3891ff2 100644 --- a/precompile/contracts/nativeminter/config_test.go +++ b/precompile/contracts/nativeminter/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/stretchr/testify/require" @@ -18,7 +18,7 @@ func TestVerifyContractNativeMinterConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config + config precompileConfig.Config ExpectedError string }{ { @@ -74,8 +74,8 @@ func TestEqualContractNativeMinterConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config - other config.Config + config precompileConfig.Config + other precompileConfig.Config expected bool }{ { @@ -87,7 +87,7 @@ func TestEqualContractNativeMinterConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: config.NewNoopStatefulPrecompileConfig(), + other: precompileConfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/nativeminter/module.go b/precompile/contracts/nativeminter/module.go index 76987071cd..0cc0630e90 100644 --- a/precompile/contracts/nativeminter/module.go +++ b/precompile/contracts/nativeminter/module.go @@ -7,7 +7,7 @@ import ( "fmt" "math/big" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ethereum/go-ethereum/common" @@ -36,12 +36,12 @@ func init() { } } -func (*configurator) NewConfig() config.Config { +func (*configurator) NewConfig() precompileConfig.Config { return &Config{} } // Configure configures [state] with the desired admins based on [cfg]. -func (*configurator) Configure(_ contract.ChainConfig, cfg config.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(_ contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) @@ -53,5 +53,5 @@ func (*configurator) Configure(_ contract.ChainConfig, cfg config.Config, state } } - return config.Config.Configure(state, ContractAddress) + return config.AllowList.Configure(state, ContractAddress) } diff --git a/precompile/contracts/rewardmanager/config.go b/precompile/contracts/rewardmanager/config.go index 80adc93429..37c34692ed 100644 --- a/precompile/contracts/rewardmanager/config.go +++ b/precompile/contracts/rewardmanager/config.go @@ -10,12 +10,12 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ethereum/go-ethereum/common" ) -var _ config.Config = &Config{} +var _ precompileConfig.Config = &Config{} type InitialRewardConfig struct { AllowFeeRecipients bool `json:"allowFeeRecipients"` @@ -57,8 +57,8 @@ func (i *InitialRewardConfig) Configure(state contract.StateDB) error { // Config implements the StatefulPrecompileConfig interface while adding in the // RewardManager specific precompile config. type Config struct { - allowlist.Config - config.Upgrade + allowlist.AllowList + precompileConfig.Upgrade InitialRewardConfig *InitialRewardConfig `json:"initialRewardConfig,omitempty"` } @@ -66,11 +66,11 @@ type Config struct { // RewardManager with the given [admins] and [enableds] as members of the allowlist with [initialConfig] as initial rewards config if specified. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialConfig *InitialRewardConfig) *Config { return &Config{ - Config: allowlist.Config{ + AllowList: allowlist.AllowList{ AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: config.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialRewardConfig: initialConfig, } } @@ -79,7 +79,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables RewardManager. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: config.Upgrade{ + Upgrade: precompileConfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -94,11 +94,11 @@ func (c *Config) Verify() error { return err } } - return c.Config.Verify() + return c.AllowList.Verify() } // Equal returns true if [cfg] is a [*RewardManagerConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg config.Config) bool { +func (c *Config) Equal(cfg precompileConfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { @@ -114,5 +114,5 @@ func (c *Config) Equal(cfg config.Config) bool { } } - return c.Upgrade.Equal(&other.Upgrade) && c.Config.Equal(&other.Config) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) } diff --git a/precompile/contracts/rewardmanager/module.go b/precompile/contracts/rewardmanager/module.go index 83788648e5..d5e977ac81 100644 --- a/precompile/contracts/rewardmanager/module.go +++ b/precompile/contracts/rewardmanager/module.go @@ -6,7 +6,7 @@ package rewardmanager import ( "fmt" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ethereum/go-ethereum/common" @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() config.Config { +func (*configurator) NewConfig() precompileConfig.Config { return &Config{} } // Configure configures [state] with the initial state for the precompile. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg config.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/contracts/txallowlist/config.go b/precompile/contracts/txallowlist/config.go index 93042c46da..d0058574e9 100644 --- a/precompile/contracts/txallowlist/config.go +++ b/precompile/contracts/txallowlist/config.go @@ -7,28 +7,28 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" ) -var _ config.Config = &Config{} +var _ precompileConfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // TxAllowList specific precompile config. type Config struct { - allowlist.Config - config.Upgrade + allowlist.AllowList + precompileConfig.Upgrade } // NewConfig returns a config for a network upgrade at [blockTimestamp] that enables // TxAllowList with the given [admins] and [enableds] as members of the allowlist. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address) *Config { return &Config{ - Config: allowlist.Config{ + AllowList: allowlist.AllowList{ AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: config.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, } } @@ -36,7 +36,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables TxAllowList. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: config.Upgrade{ + Upgrade: precompileConfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -46,11 +46,11 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (c *Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*TxAllowListConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg config.Config) bool { +func (c *Config) Equal(cfg precompileConfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { return false } - return c.Upgrade.Equal(&other.Upgrade) && c.Config.Equal(&other.Config) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) } diff --git a/precompile/contracts/txallowlist/config_test.go b/precompile/contracts/txallowlist/config_test.go index e6cf062414..6250358128 100644 --- a/precompile/contracts/txallowlist/config_test.go +++ b/precompile/contracts/txallowlist/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ func TestVerifyTxAllowlistConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config + config precompileConfig.Config ExpectedError string }{ { @@ -60,8 +60,8 @@ func TestEqualTxAllowListConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config - other config.Config + config precompileConfig.Config + other precompileConfig.Config expected bool }{ { diff --git a/precompile/contracts/txallowlist/module.go b/precompile/contracts/txallowlist/module.go index 0da9721eb6..e545782670 100644 --- a/precompile/contracts/txallowlist/module.go +++ b/precompile/contracts/txallowlist/module.go @@ -6,7 +6,7 @@ package txallowlist import ( "fmt" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" "github.com/ethereum/go-ethereum/common" @@ -35,15 +35,15 @@ func init() { } } -func (*configurator) NewConfig() config.Config { +func (*configurator) NewConfig() precompileConfig.Config { return &Config{} } // Configure configures [state] with the initial state for the precompile. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg config.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) } - return config.Config.Configure(state, ContractAddress) + return config.AllowList.Configure(state, ContractAddress) } From a42e486d17c36db96ade083e97bcb48baba9a13b Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Feb 2023 09:39:35 -0800 Subject: [PATCH 2/5] fixes --- precompile/allowlist/allow_list_test.go | 6 ++-- precompile/allowlist/config_test.go | 32 +++++++++---------- .../deployerallowlist/config_test.go | 10 +++--- .../contracts/feemanager/config_test.go | 10 +++--- .../contracts/rewardmanager/config_test.go | 10 +++--- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/precompile/allowlist/allow_list_test.go b/precompile/allowlist/allow_list_test.go index 3a9f4f2dd3..550c9cd36c 100644 --- a/precompile/allowlist/allow_list_test.go +++ b/precompile/allowlist/allow_list_test.go @@ -25,7 +25,7 @@ func TestAllowListRun(t *testing.T) { expectedRes []byte expectedErr string - config *Config + config *AllowList assertState func(t *testing.T, state *state.StateDB) } @@ -221,7 +221,7 @@ func TestAllowListRun(t *testing.T) { expectedErr: vmerrs.ErrOutOfGas.Error(), }, "initial config sets admins": { - config: &Config{ + config: &AllowList{ AdminAddresses: []common.Address{noRoleAddr, enabledAddr}, }, suppliedGas: 0, @@ -233,7 +233,7 @@ func TestAllowListRun(t *testing.T) { }, }, "initial config sets enabled": { - config: &Config{ + config: &AllowList{ EnabledAddresses: []common.Address{noRoleAddr, adminAddr}, }, suppliedGas: 0, diff --git a/precompile/allowlist/config_test.go b/precompile/allowlist/config_test.go index b9fdb24053..42fe2b0dc0 100644 --- a/precompile/allowlist/config_test.go +++ b/precompile/allowlist/config_test.go @@ -10,32 +10,32 @@ import ( "github.com/stretchr/testify/require" ) -func TestVerifyAllowlistConfig(t *testing.T) { +func TestVerifyAllowlistAllowList(t *testing.T) { admins := []common.Address{{1}} enableds := []common.Address{{2}} tests := []struct { name string - config Config + config AllowList expectedError string }{ { name: "invalid allow list config in allowlist", - config: Config{admins, admins}, + config: AllowList{admins, admins}, expectedError: "cannot set address", }, { name: "nil member allow list config in allowlist", - config: Config{nil, nil}, + config: AllowList{nil, nil}, expectedError: "", }, { name: "empty member allow list config in allowlist", - config: Config{[]common.Address{}, []common.Address{}}, + config: AllowList{[]common.Address{}, []common.Address{}}, expectedError: "", }, { name: "valid allow list config in allowlist", - config: Config{admins, enableds}, + config: AllowList{admins, enableds}, expectedError: "", }, } @@ -53,37 +53,37 @@ func TestVerifyAllowlistConfig(t *testing.T) { } } -func TestEqualAllowListConfig(t *testing.T) { +func TestEqualAllowListAllowList(t *testing.T) { admins := []common.Address{{1}} enableds := []common.Address{{2}} tests := []struct { name string - config *Config - other *Config + config *AllowList + other *AllowList expected bool }{ { name: "non-nil config and nil other", - config: &Config{admins, enableds}, + config: &AllowList{admins, enableds}, other: nil, expected: false, }, { name: "different admin", - config: &Config{admins, enableds}, - other: &Config{[]common.Address{{3}}, enableds}, + config: &AllowList{admins, enableds}, + other: &AllowList{[]common.Address{{3}}, enableds}, expected: false, }, { name: "different enabled", - config: &Config{admins, enableds}, - other: &Config{admins, []common.Address{{3}}}, + config: &AllowList{admins, enableds}, + other: &AllowList{admins, []common.Address{{3}}}, expected: false, }, { name: "same config", - config: &Config{admins, enableds}, - other: &Config{admins, enableds}, + config: &AllowList{admins, enableds}, + other: &AllowList{admins, enableds}, expected: true, }, } diff --git a/precompile/contracts/deployerallowlist/config_test.go b/precompile/contracts/deployerallowlist/config_test.go index 46bba193d6..90a3c04247 100644 --- a/precompile/contracts/deployerallowlist/config_test.go +++ b/precompile/contracts/deployerallowlist/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -16,7 +16,7 @@ func TestVerifyContractDeployerConfig(t *testing.T) { admins := []common.Address{{1}} tests := []struct { name string - config config.Config + config precompileConfig.Config ExpectedError string }{ { @@ -44,8 +44,8 @@ func TestEqualContractDeployerAllowListConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config - other config.Config + config precompileConfig.Config + other precompileConfig.Config expected bool }{ { @@ -57,7 +57,7 @@ func TestEqualContractDeployerAllowListConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds), - other: config.NewNoopStatefulPrecompileConfig(), + other: precompileConfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/feemanager/config_test.go b/precompile/contracts/feemanager/config_test.go index 41b1e1ff3d..aff300e4b6 100644 --- a/precompile/contracts/feemanager/config_test.go +++ b/precompile/contracts/feemanager/config_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/ava-labs/subnet-evm/commontype" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -32,7 +32,7 @@ func TestVerifyFeeManagerConfig(t *testing.T) { invalidFeeConfig.GasLimit = big.NewInt(0) tests := []struct { name string - config config.Config + config precompileConfig.Config ExpectedError string }{ { @@ -70,8 +70,8 @@ func TestEqualFeeManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config - other config.Config + config precompileConfig.Config + other precompileConfig.Config expected bool }{ { @@ -83,7 +83,7 @@ func TestEqualFeeManagerConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: config.NewNoopStatefulPrecompileConfig(), + other: precompileConfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/rewardmanager/config_test.go b/precompile/contracts/rewardmanager/config_test.go index 249fb85a16..1d4ac0b1d1 100644 --- a/precompile/contracts/rewardmanager/config_test.go +++ b/precompile/contracts/rewardmanager/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - "github.com/ava-labs/subnet-evm/precompile/config" + precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ func TestVerifyRewardManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config + config precompileConfig.Config ExpectedError string }{ { @@ -53,8 +53,8 @@ func TestEqualRewardManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config config.Config - other config.Config + config precompileConfig.Config + other precompileConfig.Config expected bool }{ { @@ -66,7 +66,7 @@ func TestEqualRewardManagerConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: config.NewNoopStatefulPrecompileConfig(), + other: precompileConfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { From 5a00ececb882f9b5e3748049441ce00170fa8549 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Feb 2023 09:46:42 -0800 Subject: [PATCH 3/5] update naming --- params/config.go | 6 +++--- params/precompile_upgrade.go | 12 ++++++------ params/precompiles.go | 4 ++-- precompile/contract/interfaces.go | 6 +++--- precompile/contract/utils.go | 4 ++-- precompile/contracts/deployerallowlist/config.go | 12 ++++++------ .../contracts/deployerallowlist/config_test.go | 10 +++++----- precompile/contracts/deployerallowlist/module.go | 6 +++--- precompile/contracts/feemanager/config.go | 12 ++++++------ precompile/contracts/feemanager/config_test.go | 10 +++++----- precompile/contracts/feemanager/module.go | 6 +++--- precompile/contracts/nativeminter/config.go | 12 ++++++------ precompile/contracts/nativeminter/config_test.go | 10 +++++----- precompile/contracts/nativeminter/module.go | 6 +++--- precompile/contracts/rewardmanager/config.go | 12 ++++++------ precompile/contracts/rewardmanager/config_test.go | 10 +++++----- precompile/contracts/rewardmanager/module.go | 6 +++--- precompile/contracts/txallowlist/config.go | 12 ++++++------ precompile/contracts/txallowlist/config_test.go | 8 ++++---- precompile/contracts/txallowlist/module.go | 6 +++--- precompile/{config => precompileconfig}/config.go | 2 +- .../{config => precompileconfig}/mock_config.go | 2 +- .../{config => precompileconfig}/upgradeable.go | 2 +- 23 files changed, 88 insertions(+), 88 deletions(-) rename precompile/{config => precompileconfig}/config.go (97%) rename precompile/{config => precompileconfig}/mock_config.go (97%) rename precompile/{config => precompileconfig}/upgradeable.go (97%) diff --git a/params/config.go b/params/config.go index 4637b310a4..1f2289f2a9 100644 --- a/params/config.go +++ b/params/config.go @@ -34,8 +34,8 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/subnet-evm/commontype" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" ) @@ -558,7 +558,7 @@ type Rules struct { // for this rule set. // Note: none of these addresses should conflict with the address space used by // any existing precompiles. - ActivePrecompiles map[common.Address]precompileConfig.Config + ActivePrecompiles map[common.Address]precompileconfig.Config } // IsPrecompileEnabled returns true if the precompile at [addr] is enabled for this rule set. @@ -594,7 +594,7 @@ func (c *ChainConfig) AvalancheRules(blockNum, blockTimestamp *big.Int) Rules { rules.IsSubnetEVM = c.IsSubnetEVM(blockTimestamp) // Initialize the stateful precompiles that should be enabled at [blockTimestamp]. - rules.ActivePrecompiles = make(map[common.Address]precompileConfig.Config) + rules.ActivePrecompiles = make(map[common.Address]precompileconfig.Config) for _, module := range modules.RegisteredModules() { if config := c.GetActivePrecompileConfig(module.Address, blockTimestamp); config != nil && !config.IsDisabled() { rules.ActivePrecompiles[module.Address] = config diff --git a/params/precompile_upgrade.go b/params/precompile_upgrade.go index ff2028763b..16792c6781 100644 --- a/params/precompile_upgrade.go +++ b/params/precompile_upgrade.go @@ -9,8 +9,8 @@ import ( "fmt" "math/big" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" ) @@ -22,7 +22,7 @@ var errNoKey = errors.New("PrecompileUpgrade cannot be empty") // based on the key. Keys are defined in each precompile module, and registered in // precompile/registry/registry.go. type PrecompileUpgrade struct { - precompileConfig.Config + precompileconfig.Config } // UnmarshalJSON unmarshals the json into the correct precompile config type @@ -58,7 +58,7 @@ func (u *PrecompileUpgrade) UnmarshalJSON(data []byte) error { // MarshalJSON marshal the precompile config into json based on the precompile key. // Ex: {"feeManagerConfig": {...}} where "feeManagerConfig" is the key func (u *PrecompileUpgrade) MarshalJSON() ([]byte, error) { - res := make(map[string]precompileConfig.Config) + res := make(map[string]precompileconfig.Config) res[u.Key()] = u.Config return json.Marshal(res) } @@ -151,7 +151,7 @@ func (c *ChainConfig) verifyPrecompileUpgrades() error { // GetActivePrecompileConfig returns the most recent precompile config corresponding to [address]. // If none have occurred, returns nil. -func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTimestamp *big.Int) precompileConfig.Config { +func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTimestamp *big.Int) precompileconfig.Config { configs := c.GetActivatingPrecompileConfigs(address, nil, blockTimestamp, c.PrecompileUpgrades) if len(configs) == 0 { return nil @@ -161,13 +161,13 @@ func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, blockTim // GetActivatingPrecompileConfigs returns all upgrades configured to activate during the state transition from a block with timestamp [from] // to a block with timestamp [to]. -func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *big.Int, to *big.Int, upgrades []PrecompileUpgrade) []precompileConfig.Config { +func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *big.Int, to *big.Int, upgrades []PrecompileUpgrade) []precompileconfig.Config { // Get key from address. module, ok := modules.GetPrecompileModuleByAddress(address) if !ok { return nil } - configs := make([]precompileConfig.Config, 0) + configs := make([]precompileconfig.Config, 0) key := module.ConfigKey // First check the embedded [upgrade] for precompiles configured // in the genesis chain config. diff --git a/params/precompiles.go b/params/precompiles.go index ecdf7fdfaa..fcb7604e5b 100644 --- a/params/precompiles.go +++ b/params/precompiles.go @@ -6,11 +6,11 @@ package params import ( "encoding/json" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" ) -type Precompiles map[string]precompileConfig.Config +type Precompiles map[string]precompileconfig.Config // UnmarshalJSON parses the JSON-encoded data into the ChainConfigPrecompiles. // ChainConfigPrecompiles is a map of precompile module keys to their diff --git a/precompile/contract/interfaces.go b/precompile/contract/interfaces.go index 0982e5369c..66a449fe91 100644 --- a/precompile/contract/interfaces.go +++ b/precompile/contract/interfaces.go @@ -9,7 +9,7 @@ import ( "github.com/ava-labs/avalanchego/snow" "github.com/ava-labs/subnet-evm/commontype" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -69,10 +69,10 @@ type BlockContext interface { } type Configurator interface { - NewConfig() precompileConfig.Config + NewConfig() precompileconfig.Config Configure( chainConfig ChainConfig, - precompileConfig precompileConfig.Config, + precompileconfig precompileconfig.Config, state StateDB, blockContext BlockContext, ) error diff --git a/precompile/contract/utils.go b/precompile/contract/utils.go index a48b9a3a35..f4b7c7db9c 100644 --- a/precompile/contract/utils.go +++ b/precompile/contract/utils.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/ava-labs/subnet-evm/accounts/abi" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ava-labs/subnet-evm/vmerrs" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" @@ -39,7 +39,7 @@ type PrecompileTest struct { // It should be the same precompile config that is used in the // precompile's configurator. // If nil, Configure on the Configurator will not be called. - Config precompileConfig.Config + Config precompileconfig.Config // BeforeHook is called before the precompile is called. BeforeHook func(t *testing.T, state StateDB) // AfterHook is called after the precompile is called. diff --git a/precompile/contracts/deployerallowlist/config.go b/precompile/contracts/deployerallowlist/config.go index ffb403cad0..0226bc7dc8 100644 --- a/precompile/contracts/deployerallowlist/config.go +++ b/precompile/contracts/deployerallowlist/config.go @@ -7,17 +7,17 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) -var _ precompileConfig.Config = &Config{} +var _ precompileconfig.Config = &Config{} // Config contains the configuration for the ContractDeployerAllowList precompile, // consisting of the initial allowlist and the timestamp for the network upgrade. type Config struct { allowlist.AllowList - precompileConfig.Upgrade + precompileconfig.Upgrade } // NewConfig returns a config for a network upgrade at [blockTimestamp] that enables @@ -28,7 +28,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileconfig.Upgrade{BlockTimestamp: blockTimestamp}, } } @@ -36,7 +36,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables ContractDeployerAllowList. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: precompileConfig.Upgrade{ + Upgrade: precompileconfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -46,7 +46,7 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*ContractDeployerAllowListConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg precompileConfig.Config) bool { +func (c *Config) Equal(cfg precompileconfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { diff --git a/precompile/contracts/deployerallowlist/config_test.go b/precompile/contracts/deployerallowlist/config_test.go index 90a3c04247..fad2e8b2c9 100644 --- a/precompile/contracts/deployerallowlist/config_test.go +++ b/precompile/contracts/deployerallowlist/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -16,7 +16,7 @@ func TestVerifyContractDeployerConfig(t *testing.T) { admins := []common.Address{{1}} tests := []struct { name string - config precompileConfig.Config + config precompileconfig.Config ExpectedError string }{ { @@ -44,8 +44,8 @@ func TestEqualContractDeployerAllowListConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config - other precompileConfig.Config + config precompileconfig.Config + other precompileconfig.Config expected bool }{ { @@ -57,7 +57,7 @@ func TestEqualContractDeployerAllowListConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds), - other: precompileConfig.NewNoopStatefulPrecompileConfig(), + other: precompileconfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/deployerallowlist/module.go b/precompile/contracts/deployerallowlist/module.go index c444feccc0..52b03d33a1 100644 --- a/precompile/contracts/deployerallowlist/module.go +++ b/precompile/contracts/deployerallowlist/module.go @@ -6,9 +6,9 @@ package deployerallowlist import ( "fmt" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() precompileConfig.Config { +func (*configurator) NewConfig() precompileconfig.Config { return &Config{} } // Configure configures [state] with the given [cfg] config. -func (c *configurator) Configure(_ contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { +func (c *configurator) Configure(_ contract.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/contracts/feemanager/config.go b/precompile/contracts/feemanager/config.go index 3f9b2f177b..58c49d7073 100644 --- a/precompile/contracts/feemanager/config.go +++ b/precompile/contracts/feemanager/config.go @@ -8,17 +8,17 @@ import ( "github.com/ava-labs/subnet-evm/commontype" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) -var _ precompileConfig.Config = &Config{} +var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // FeeManager specific precompile config. type Config struct { allowlist.AllowList // Config for the fee config manager allow list - precompileConfig.Upgrade + precompileconfig.Upgrade InitialFeeConfig *commontype.FeeConfig `json:"initialFeeConfig,omitempty"` // initial fee config to be immediately activated } @@ -31,7 +31,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileconfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialFeeConfig: initialConfig, } } @@ -40,7 +40,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables FeeManager. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: precompileConfig.Upgrade{ + Upgrade: precompileconfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -50,7 +50,7 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*FeeManagerConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg precompileConfig.Config) bool { +func (c *Config) Equal(cfg precompileconfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { diff --git a/precompile/contracts/feemanager/config_test.go b/precompile/contracts/feemanager/config_test.go index aff300e4b6..aee7d0c2a9 100644 --- a/precompile/contracts/feemanager/config_test.go +++ b/precompile/contracts/feemanager/config_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/ava-labs/subnet-evm/commontype" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -32,7 +32,7 @@ func TestVerifyFeeManagerConfig(t *testing.T) { invalidFeeConfig.GasLimit = big.NewInt(0) tests := []struct { name string - config precompileConfig.Config + config precompileconfig.Config ExpectedError string }{ { @@ -70,8 +70,8 @@ func TestEqualFeeManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config - other precompileConfig.Config + config precompileconfig.Config + other precompileconfig.Config expected bool }{ { @@ -83,7 +83,7 @@ func TestEqualFeeManagerConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: precompileConfig.NewNoopStatefulPrecompileConfig(), + other: precompileconfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/feemanager/module.go b/precompile/contracts/feemanager/module.go index e19617f26d..c12637b2bc 100644 --- a/precompile/contracts/feemanager/module.go +++ b/precompile/contracts/feemanager/module.go @@ -6,9 +6,9 @@ package feemanager import ( "fmt" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() precompileConfig.Config { +func (*configurator) NewConfig() precompileconfig.Config { return &Config{} } // Configure configures [state] with the desired admins based on [configIface]. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, blockContext contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, blockContext contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/contracts/nativeminter/config.go b/precompile/contracts/nativeminter/config.go index a193f60a30..9925109bca 100644 --- a/precompile/contracts/nativeminter/config.go +++ b/precompile/contracts/nativeminter/config.go @@ -8,19 +8,19 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" ) -var _ precompileConfig.Config = &Config{} +var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // ContractNativeMinter specific precompile config. type Config struct { allowlist.AllowList - precompileConfig.Upgrade + precompileconfig.Upgrade InitialMint map[common.Address]*math.HexOrDecimal256 `json:"initialMint,omitempty"` // addresses to receive the initial mint mapped to the amount to mint } @@ -32,7 +32,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileconfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialMint: initialMint, } } @@ -41,7 +41,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables ContractNativeMinter. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: precompileConfig.Upgrade{ + Upgrade: precompileconfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -50,7 +50,7 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (*Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*ContractNativeMinterConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg precompileConfig.Config) bool { +func (c *Config) Equal(cfg precompileconfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { diff --git a/precompile/contracts/nativeminter/config_test.go b/precompile/contracts/nativeminter/config_test.go index 20b3891ff2..1927a93b9b 100644 --- a/precompile/contracts/nativeminter/config_test.go +++ b/precompile/contracts/nativeminter/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/stretchr/testify/require" @@ -18,7 +18,7 @@ func TestVerifyContractNativeMinterConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config + config precompileconfig.Config ExpectedError string }{ { @@ -74,8 +74,8 @@ func TestEqualContractNativeMinterConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config - other precompileConfig.Config + config precompileconfig.Config + other precompileconfig.Config expected bool }{ { @@ -87,7 +87,7 @@ func TestEqualContractNativeMinterConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: precompileConfig.NewNoopStatefulPrecompileConfig(), + other: precompileconfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/nativeminter/module.go b/precompile/contracts/nativeminter/module.go index 0cc0630e90..f459cddddd 100644 --- a/precompile/contracts/nativeminter/module.go +++ b/precompile/contracts/nativeminter/module.go @@ -7,9 +7,9 @@ import ( "fmt" "math/big" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -36,12 +36,12 @@ func init() { } } -func (*configurator) NewConfig() precompileConfig.Config { +func (*configurator) NewConfig() precompileconfig.Config { return &Config{} } // Configure configures [state] with the desired admins based on [cfg]. -func (*configurator) Configure(_ contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(_ contract.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/contracts/rewardmanager/config.go b/precompile/contracts/rewardmanager/config.go index 37c34692ed..65a3026181 100644 --- a/precompile/contracts/rewardmanager/config.go +++ b/precompile/contracts/rewardmanager/config.go @@ -10,12 +10,12 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) -var _ precompileConfig.Config = &Config{} +var _ precompileconfig.Config = &Config{} type InitialRewardConfig struct { AllowFeeRecipients bool `json:"allowFeeRecipients"` @@ -58,7 +58,7 @@ func (i *InitialRewardConfig) Configure(state contract.StateDB) error { // RewardManager specific precompile config. type Config struct { allowlist.AllowList - precompileConfig.Upgrade + precompileconfig.Upgrade InitialRewardConfig *InitialRewardConfig `json:"initialRewardConfig,omitempty"` } @@ -70,7 +70,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileconfig.Upgrade{BlockTimestamp: blockTimestamp}, InitialRewardConfig: initialConfig, } } @@ -79,7 +79,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables RewardManager. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: precompileConfig.Upgrade{ + Upgrade: precompileconfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -98,7 +98,7 @@ func (c *Config) Verify() error { } // Equal returns true if [cfg] is a [*RewardManagerConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg precompileConfig.Config) bool { +func (c *Config) Equal(cfg precompileconfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { diff --git a/precompile/contracts/rewardmanager/config_test.go b/precompile/contracts/rewardmanager/config_test.go index 1d4ac0b1d1..f69868eb95 100644 --- a/precompile/contracts/rewardmanager/config_test.go +++ b/precompile/contracts/rewardmanager/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ func TestVerifyRewardManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config + config precompileconfig.Config ExpectedError string }{ { @@ -53,8 +53,8 @@ func TestEqualRewardManagerConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config - other precompileConfig.Config + config precompileconfig.Config + other precompileconfig.Config expected bool }{ { @@ -66,7 +66,7 @@ func TestEqualRewardManagerConfig(t *testing.T) { { name: "different type", config: NewConfig(big.NewInt(3), admins, enableds, nil), - other: precompileConfig.NewNoopStatefulPrecompileConfig(), + other: precompileconfig.NewNoopStatefulPrecompileConfig(), expected: false, }, { diff --git a/precompile/contracts/rewardmanager/module.go b/precompile/contracts/rewardmanager/module.go index d5e977ac81..57739af6c8 100644 --- a/precompile/contracts/rewardmanager/module.go +++ b/precompile/contracts/rewardmanager/module.go @@ -6,9 +6,9 @@ package rewardmanager import ( "fmt" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() precompileConfig.Config { +func (*configurator) NewConfig() precompileconfig.Config { return &Config{} } // Configure configures [state] with the initial state for the precompile. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/contracts/txallowlist/config.go b/precompile/contracts/txallowlist/config.go index d0058574e9..a8db8be1ef 100644 --- a/precompile/contracts/txallowlist/config.go +++ b/precompile/contracts/txallowlist/config.go @@ -7,17 +7,17 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) -var _ precompileConfig.Config = &Config{} +var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // TxAllowList specific precompile config. type Config struct { allowlist.AllowList - precompileConfig.Upgrade + precompileconfig.Upgrade } // NewConfig returns a config for a network upgrade at [blockTimestamp] that enables @@ -28,7 +28,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm AdminAddresses: admins, EnabledAddresses: enableds, }, - Upgrade: precompileConfig.Upgrade{BlockTimestamp: blockTimestamp}, + Upgrade: precompileconfig.Upgrade{BlockTimestamp: blockTimestamp}, } } @@ -36,7 +36,7 @@ func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []comm // that disables TxAllowList. func NewDisableConfig(blockTimestamp *big.Int) *Config { return &Config{ - Upgrade: precompileConfig.Upgrade{ + Upgrade: precompileconfig.Upgrade{ BlockTimestamp: blockTimestamp, Disable: true, }, @@ -46,7 +46,7 @@ func NewDisableConfig(blockTimestamp *big.Int) *Config { func (c *Config) Key() string { return ConfigKey } // Equal returns true if [cfg] is a [*TxAllowListConfig] and it has been configured identical to [c]. -func (c *Config) Equal(cfg precompileConfig.Config) bool { +func (c *Config) Equal(cfg precompileconfig.Config) bool { // typecast before comparison other, ok := (cfg).(*Config) if !ok { diff --git a/precompile/contracts/txallowlist/config_test.go b/precompile/contracts/txallowlist/config_test.go index 6250358128..54ab46ac34 100644 --- a/precompile/contracts/txallowlist/config_test.go +++ b/precompile/contracts/txallowlist/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) @@ -17,7 +17,7 @@ func TestVerifyTxAllowlistConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config + config precompileconfig.Config ExpectedError string }{ { @@ -60,8 +60,8 @@ func TestEqualTxAllowListConfig(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config precompileConfig.Config - other precompileConfig.Config + config precompileconfig.Config + other precompileconfig.Config expected bool }{ { diff --git a/precompile/contracts/txallowlist/module.go b/precompile/contracts/txallowlist/module.go index e545782670..404dd53038 100644 --- a/precompile/contracts/txallowlist/module.go +++ b/precompile/contracts/txallowlist/module.go @@ -6,9 +6,9 @@ package txallowlist import ( "fmt" - precompileConfig "github.com/ava-labs/subnet-evm/precompile/config" "github.com/ava-labs/subnet-evm/precompile/contract" "github.com/ava-labs/subnet-evm/precompile/modules" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) @@ -35,12 +35,12 @@ func init() { } } -func (*configurator) NewConfig() precompileConfig.Config { +func (*configurator) NewConfig() precompileconfig.Config { return &Config{} } // Configure configures [state] with the initial state for the precompile. -func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileConfig.Config, state contract.StateDB, _ contract.BlockContext) error { +func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, _ contract.BlockContext) error { config, ok := cfg.(*Config) if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) diff --git a/precompile/config/config.go b/precompile/precompileconfig/config.go similarity index 97% rename from precompile/config/config.go rename to precompile/precompileconfig/config.go index 60540f98b1..fcee72fc95 100644 --- a/precompile/config/config.go +++ b/precompile/precompileconfig/config.go @@ -2,7 +2,7 @@ // See the file LICENSE for licensing terms. // Defines the stateless interface for unmarshalling an arbitrary config of a precompile -package precompileConfig +package precompileconfig import ( "math/big" diff --git a/precompile/config/mock_config.go b/precompile/precompileconfig/mock_config.go similarity index 97% rename from precompile/config/mock_config.go rename to precompile/precompileconfig/mock_config.go index 81b34a7e10..8abca06f88 100644 --- a/precompile/config/mock_config.go +++ b/precompile/precompileconfig/mock_config.go @@ -2,7 +2,7 @@ // See the file LICENSE for licensing terms. // TODO: replace with gomock -package precompileConfig +package precompileconfig import ( "math/big" diff --git a/precompile/config/upgradeable.go b/precompile/precompileconfig/upgradeable.go similarity index 97% rename from precompile/config/upgradeable.go rename to precompile/precompileconfig/upgradeable.go index 2952b0d6ee..3ad8c0498b 100644 --- a/precompile/config/upgradeable.go +++ b/precompile/precompileconfig/upgradeable.go @@ -1,7 +1,7 @@ // (c) 2022 Ava Labs, Inc. All rights reserved. // See the file LICENSE for licensing terms. -package precompileConfig +package precompileconfig import ( "math/big" From 5f686a4e4ca6391329158b309028a2810126dca9 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Feb 2023 09:47:21 -0800 Subject: [PATCH 4/5] rename to AllowListConfig --- precompile/allowlist/allow_list_test.go | 6 ++-- precompile/allowlist/config.go | 10 +++---- precompile/allowlist/config_test.go | 28 +++++++++---------- .../contracts/deployerallowlist/config.go | 8 +++--- .../contracts/deployerallowlist/module.go | 2 +- precompile/contracts/feemanager/config.go | 8 +++--- precompile/contracts/feemanager/module.go | 2 +- precompile/contracts/nativeminter/config.go | 8 +++--- precompile/contracts/nativeminter/module.go | 2 +- precompile/contracts/rewardmanager/config.go | 8 +++--- precompile/contracts/txallowlist/config.go | 6 ++-- precompile/contracts/txallowlist/module.go | 2 +- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/precompile/allowlist/allow_list_test.go b/precompile/allowlist/allow_list_test.go index 550c9cd36c..6122a7c818 100644 --- a/precompile/allowlist/allow_list_test.go +++ b/precompile/allowlist/allow_list_test.go @@ -25,7 +25,7 @@ func TestAllowListRun(t *testing.T) { expectedRes []byte expectedErr string - config *AllowList + config *AllowListConfig assertState func(t *testing.T, state *state.StateDB) } @@ -221,7 +221,7 @@ func TestAllowListRun(t *testing.T) { expectedErr: vmerrs.ErrOutOfGas.Error(), }, "initial config sets admins": { - config: &AllowList{ + config: &AllowListConfig{ AdminAddresses: []common.Address{noRoleAddr, enabledAddr}, }, suppliedGas: 0, @@ -233,7 +233,7 @@ func TestAllowListRun(t *testing.T) { }, }, "initial config sets enabled": { - config: &AllowList{ + config: &AllowListConfig{ EnabledAddresses: []common.Address{noRoleAddr, adminAddr}, }, suppliedGas: 0, diff --git a/precompile/allowlist/config.go b/precompile/allowlist/config.go index ad414b036a..3ab68d374f 100644 --- a/precompile/allowlist/config.go +++ b/precompile/allowlist/config.go @@ -10,15 +10,15 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// AllowList specifies the initial set of addresses with Admin or Enabled roles. -type AllowList struct { +// AllowListConfig specifies the initial set of addresses with Admin or Enabled roles. +type AllowListConfig struct { AdminAddresses []common.Address `json:"adminAddresses,omitempty"` // initial admin addresses EnabledAddresses []common.Address `json:"enabledAddresses,omitempty"` // initial enabled addresses } // Configure initializes the address space of [precompileAddr] by initializing the role of each of // the addresses in [AllowListAdmins]. -func (c *AllowList) Configure(state contract.StateDB, precompileAddr common.Address) error { +func (c *AllowListConfig) Configure(state contract.StateDB, precompileAddr common.Address) error { for _, enabledAddr := range c.EnabledAddresses { SetAllowListRole(state, precompileAddr, enabledAddr, EnabledRole) } @@ -29,7 +29,7 @@ func (c *AllowList) Configure(state contract.StateDB, precompileAddr common.Addr } // Equal returns true iff [other] has the same admins in the same order in its allow list. -func (c *AllowList) Equal(other *AllowList) bool { +func (c *AllowListConfig) Equal(other *AllowListConfig) bool { if other == nil { return false } @@ -52,7 +52,7 @@ func areEqualAddressLists(current []common.Address, other []common.Address) bool } // Verify returns an error if there is an overlapping address between admin and enabled roles -func (c *AllowList) Verify() error { +func (c *AllowListConfig) Verify() error { addressMap := make(map[common.Address]Role) // tracks which addresses we have seen and their role // check for duplicates in enabled list diff --git a/precompile/allowlist/config_test.go b/precompile/allowlist/config_test.go index 42fe2b0dc0..8473115400 100644 --- a/precompile/allowlist/config_test.go +++ b/precompile/allowlist/config_test.go @@ -15,27 +15,27 @@ func TestVerifyAllowlistAllowList(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config AllowList + config AllowListConfig expectedError string }{ { name: "invalid allow list config in allowlist", - config: AllowList{admins, admins}, + config: AllowListConfig{admins, admins}, expectedError: "cannot set address", }, { name: "nil member allow list config in allowlist", - config: AllowList{nil, nil}, + config: AllowListConfig{nil, nil}, expectedError: "", }, { name: "empty member allow list config in allowlist", - config: AllowList{[]common.Address{}, []common.Address{}}, + config: AllowListConfig{[]common.Address{}, []common.Address{}}, expectedError: "", }, { name: "valid allow list config in allowlist", - config: AllowList{admins, enableds}, + config: AllowListConfig{admins, enableds}, expectedError: "", }, } @@ -58,32 +58,32 @@ func TestEqualAllowListAllowList(t *testing.T) { enableds := []common.Address{{2}} tests := []struct { name string - config *AllowList - other *AllowList + config *AllowListConfig + other *AllowListConfig expected bool }{ { name: "non-nil config and nil other", - config: &AllowList{admins, enableds}, + config: &AllowListConfig{admins, enableds}, other: nil, expected: false, }, { name: "different admin", - config: &AllowList{admins, enableds}, - other: &AllowList{[]common.Address{{3}}, enableds}, + config: &AllowListConfig{admins, enableds}, + other: &AllowListConfig{[]common.Address{{3}}, enableds}, expected: false, }, { name: "different enabled", - config: &AllowList{admins, enableds}, - other: &AllowList{admins, []common.Address{{3}}}, + config: &AllowListConfig{admins, enableds}, + other: &AllowListConfig{admins, []common.Address{{3}}}, expected: false, }, { name: "same config", - config: &AllowList{admins, enableds}, - other: &AllowList{admins, enableds}, + config: &AllowListConfig{admins, enableds}, + other: &AllowListConfig{admins, enableds}, expected: true, }, } diff --git a/precompile/contracts/deployerallowlist/config.go b/precompile/contracts/deployerallowlist/config.go index 0226bc7dc8..70b9663c29 100644 --- a/precompile/contracts/deployerallowlist/config.go +++ b/precompile/contracts/deployerallowlist/config.go @@ -16,7 +16,7 @@ var _ precompileconfig.Config = &Config{} // Config contains the configuration for the ContractDeployerAllowList precompile, // consisting of the initial allowlist and the timestamp for the network upgrade. type Config struct { - allowlist.AllowList + allowlist.AllowListConfig precompileconfig.Upgrade } @@ -24,7 +24,7 @@ type Config struct { // ContractDeployerAllowList with [admins] and [enableds] as members of the allowlist. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address) *Config { return &Config{ - AllowList: allowlist.AllowList{ + AllowListConfig: allowlist.AllowListConfig{ AdminAddresses: admins, EnabledAddresses: enableds, }, @@ -52,7 +52,7 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { if !ok { return false } - return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowListConfig.Equal(&other.AllowListConfig) } -func (c *Config) Verify() error { return c.AllowList.Verify() } +func (c *Config) Verify() error { return c.AllowListConfig.Verify() } diff --git a/precompile/contracts/deployerallowlist/module.go b/precompile/contracts/deployerallowlist/module.go index 52b03d33a1..623eb27e0f 100644 --- a/precompile/contracts/deployerallowlist/module.go +++ b/precompile/contracts/deployerallowlist/module.go @@ -45,5 +45,5 @@ func (c *configurator) Configure(_ contract.ChainConfig, cfg precompileconfig.Co if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) } - return config.AllowList.Configure(state, ContractAddress) + return config.AllowListConfig.Configure(state, ContractAddress) } diff --git a/precompile/contracts/feemanager/config.go b/precompile/contracts/feemanager/config.go index 58c49d7073..c9b3aaef30 100644 --- a/precompile/contracts/feemanager/config.go +++ b/precompile/contracts/feemanager/config.go @@ -17,7 +17,7 @@ var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // FeeManager specific precompile config. type Config struct { - allowlist.AllowList // Config for the fee config manager allow list + allowlist.AllowListConfig // Config for the fee config manager allow list precompileconfig.Upgrade InitialFeeConfig *commontype.FeeConfig `json:"initialFeeConfig,omitempty"` // initial fee config to be immediately activated } @@ -27,7 +27,7 @@ type Config struct { // allowlist with [initialConfig] as initial fee config if specified. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialConfig *commontype.FeeConfig) *Config { return &Config{ - AllowList: allowlist.AllowList{ + AllowListConfig: allowlist.AllowListConfig{ AdminAddresses: admins, EnabledAddresses: enableds, }, @@ -56,7 +56,7 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { if !ok { return false } - eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) + eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowListConfig.Equal(&other.AllowListConfig) if !eq { return false } @@ -69,7 +69,7 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { } func (c *Config) Verify() error { - if err := c.AllowList.Verify(); err != nil { + if err := c.AllowListConfig.Verify(); err != nil { return err } if c.InitialFeeConfig == nil { diff --git a/precompile/contracts/feemanager/module.go b/precompile/contracts/feemanager/module.go index c12637b2bc..fa5cf5ccad 100644 --- a/precompile/contracts/feemanager/module.go +++ b/precompile/contracts/feemanager/module.go @@ -57,5 +57,5 @@ func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompilec return fmt.Errorf("cannot configure fee config in chain config: %w", err) } } - return config.AllowList.Configure(state, ContractAddress) + return config.AllowListConfig.Configure(state, ContractAddress) } diff --git a/precompile/contracts/nativeminter/config.go b/precompile/contracts/nativeminter/config.go index 9925109bca..5a4e7b87bd 100644 --- a/precompile/contracts/nativeminter/config.go +++ b/precompile/contracts/nativeminter/config.go @@ -19,7 +19,7 @@ var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // ContractNativeMinter specific precompile config. type Config struct { - allowlist.AllowList + allowlist.AllowListConfig precompileconfig.Upgrade InitialMint map[common.Address]*math.HexOrDecimal256 `json:"initialMint,omitempty"` // addresses to receive the initial mint mapped to the amount to mint } @@ -28,7 +28,7 @@ type Config struct { // ContractNativeMinter with the given [admins] and [enableds] as members of the allowlist. Also mints balances according to [initialMint] when the upgrade activates. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialMint map[common.Address]*math.HexOrDecimal256) *Config { return &Config{ - AllowList: allowlist.AllowList{ + AllowListConfig: allowlist.AllowListConfig{ AdminAddresses: admins, EnabledAddresses: enableds, }, @@ -56,7 +56,7 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { if !ok { return false } - eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) + eq := c.Upgrade.Equal(&other.Upgrade) && c.AllowListConfig.Equal(&other.AllowListConfig) if !eq { return false } @@ -91,5 +91,5 @@ func (c *Config) Verify() error { return fmt.Errorf("initial mint cannot contain invalid amount %v for address %s", bigIntAmount, addr) } } - return c.AllowList.Verify() + return c.AllowListConfig.Verify() } diff --git a/precompile/contracts/nativeminter/module.go b/precompile/contracts/nativeminter/module.go index f459cddddd..8648c1f119 100644 --- a/precompile/contracts/nativeminter/module.go +++ b/precompile/contracts/nativeminter/module.go @@ -53,5 +53,5 @@ func (*configurator) Configure(_ contract.ChainConfig, cfg precompileconfig.Conf } } - return config.AllowList.Configure(state, ContractAddress) + return config.AllowListConfig.Configure(state, ContractAddress) } diff --git a/precompile/contracts/rewardmanager/config.go b/precompile/contracts/rewardmanager/config.go index 65a3026181..9dcff94489 100644 --- a/precompile/contracts/rewardmanager/config.go +++ b/precompile/contracts/rewardmanager/config.go @@ -57,7 +57,7 @@ func (i *InitialRewardConfig) Configure(state contract.StateDB) error { // Config implements the StatefulPrecompileConfig interface while adding in the // RewardManager specific precompile config. type Config struct { - allowlist.AllowList + allowlist.AllowListConfig precompileconfig.Upgrade InitialRewardConfig *InitialRewardConfig `json:"initialRewardConfig,omitempty"` } @@ -66,7 +66,7 @@ type Config struct { // RewardManager with the given [admins] and [enableds] as members of the allowlist with [initialConfig] as initial rewards config if specified. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address, initialConfig *InitialRewardConfig) *Config { return &Config{ - AllowList: allowlist.AllowList{ + AllowListConfig: allowlist.AllowListConfig{ AdminAddresses: admins, EnabledAddresses: enableds, }, @@ -94,7 +94,7 @@ func (c *Config) Verify() error { return err } } - return c.AllowList.Verify() + return c.AllowListConfig.Verify() } // Equal returns true if [cfg] is a [*RewardManagerConfig] and it has been configured identical to [c]. @@ -114,5 +114,5 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { } } - return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowListConfig.Equal(&other.AllowListConfig) } diff --git a/precompile/contracts/txallowlist/config.go b/precompile/contracts/txallowlist/config.go index a8db8be1ef..b2f792ce38 100644 --- a/precompile/contracts/txallowlist/config.go +++ b/precompile/contracts/txallowlist/config.go @@ -16,7 +16,7 @@ var _ precompileconfig.Config = &Config{} // Config implements the StatefulPrecompileConfig interface while adding in the // TxAllowList specific precompile config. type Config struct { - allowlist.AllowList + allowlist.AllowListConfig precompileconfig.Upgrade } @@ -24,7 +24,7 @@ type Config struct { // TxAllowList with the given [admins] and [enableds] as members of the allowlist. func NewConfig(blockTimestamp *big.Int, admins []common.Address, enableds []common.Address) *Config { return &Config{ - AllowList: allowlist.AllowList{ + AllowListConfig: allowlist.AllowListConfig{ AdminAddresses: admins, EnabledAddresses: enableds, }, @@ -52,5 +52,5 @@ func (c *Config) Equal(cfg precompileconfig.Config) bool { if !ok { return false } - return c.Upgrade.Equal(&other.Upgrade) && c.AllowList.Equal(&other.AllowList) + return c.Upgrade.Equal(&other.Upgrade) && c.AllowListConfig.Equal(&other.AllowListConfig) } diff --git a/precompile/contracts/txallowlist/module.go b/precompile/contracts/txallowlist/module.go index 404dd53038..b1ae6a096e 100644 --- a/precompile/contracts/txallowlist/module.go +++ b/precompile/contracts/txallowlist/module.go @@ -45,5 +45,5 @@ func (*configurator) Configure(chainConfig contract.ChainConfig, cfg precompilec if !ok { return fmt.Errorf("incorrect config %T: %v", config, config) } - return config.AllowList.Configure(state, ContractAddress) + return config.AllowListConfig.Configure(state, ContractAddress) } From 9e321268a682e4ef89f19ddb75c2f934a47a04d0 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 17 Feb 2023 11:07:02 -0800 Subject: [PATCH 5/5] simplify --- precompile/contracts/deployerallowlist/config.go | 2 +- precompile/contracts/deployerallowlist/config_test.go | 2 +- precompile/contracts/feemanager/config.go | 2 +- precompile/contracts/feemanager/config_test.go | 2 +- precompile/contracts/nativeminter/config.go | 2 +- precompile/contracts/rewardmanager/config.go | 2 +- precompile/contracts/rewardmanager/config_test.go | 2 +- precompile/contracts/txallowlist/config.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/precompile/contracts/deployerallowlist/config.go b/precompile/contracts/deployerallowlist/config.go index 70b9663c29..c2d5bf28dd 100644 --- a/precompile/contracts/deployerallowlist/config.go +++ b/precompile/contracts/deployerallowlist/config.go @@ -7,7 +7,7 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) diff --git a/precompile/contracts/deployerallowlist/config_test.go b/precompile/contracts/deployerallowlist/config_test.go index fad2e8b2c9..caa3d8995a 100644 --- a/precompile/contracts/deployerallowlist/config_test.go +++ b/precompile/contracts/deployerallowlist/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) diff --git a/precompile/contracts/feemanager/config.go b/precompile/contracts/feemanager/config.go index c9b3aaef30..9debfa7b1f 100644 --- a/precompile/contracts/feemanager/config.go +++ b/precompile/contracts/feemanager/config.go @@ -8,7 +8,7 @@ import ( "github.com/ava-labs/subnet-evm/commontype" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) diff --git a/precompile/contracts/feemanager/config_test.go b/precompile/contracts/feemanager/config_test.go index aee7d0c2a9..4b5654d5d9 100644 --- a/precompile/contracts/feemanager/config_test.go +++ b/precompile/contracts/feemanager/config_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/ava-labs/subnet-evm/commontype" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) diff --git a/precompile/contracts/nativeminter/config.go b/precompile/contracts/nativeminter/config.go index 5a4e7b87bd..e2df6bbc82 100644 --- a/precompile/contracts/nativeminter/config.go +++ b/precompile/contracts/nativeminter/config.go @@ -8,7 +8,7 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ava-labs/subnet-evm/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" diff --git a/precompile/contracts/rewardmanager/config.go b/precompile/contracts/rewardmanager/config.go index 9dcff94489..9b7a8bb238 100644 --- a/precompile/contracts/rewardmanager/config.go +++ b/precompile/contracts/rewardmanager/config.go @@ -11,7 +11,7 @@ import ( "github.com/ava-labs/subnet-evm/precompile/allowlist" "github.com/ava-labs/subnet-evm/precompile/contract" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" ) diff --git a/precompile/contracts/rewardmanager/config_test.go b/precompile/contracts/rewardmanager/config_test.go index f69868eb95..c78dec4c6f 100644 --- a/precompile/contracts/rewardmanager/config_test.go +++ b/precompile/contracts/rewardmanager/config_test.go @@ -7,7 +7,7 @@ import ( "math/big" "testing" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" ) diff --git a/precompile/contracts/txallowlist/config.go b/precompile/contracts/txallowlist/config.go index b2f792ce38..c6204b41c5 100644 --- a/precompile/contracts/txallowlist/config.go +++ b/precompile/contracts/txallowlist/config.go @@ -7,7 +7,7 @@ import ( "math/big" "github.com/ava-labs/subnet-evm/precompile/allowlist" - precompileconfig "github.com/ava-labs/subnet-evm/precompile/precompileconfig" + "github.com/ava-labs/subnet-evm/precompile/precompileconfig" "github.com/ethereum/go-ethereum/common" )