Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename new config #528

Merged
merged 3 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func init() {
}
}

// NewConfig returns a new precompile precompileconfig.
// This is required for Marshal/Unmarshal the precompile precompileconfig.
func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
// MakeConfig returns a new precompile config instance.
// This is required for Marshal/Unmarshal the precompile config.
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the given [cfg] precompileconfig.
Expand Down
2 changes: 1 addition & 1 deletion params/precompile_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (u *PrecompileUpgrade) UnmarshalJSON(data []byte) error {
if !ok {
return fmt.Errorf("unknown precompile config: %s", key)
}
config := module.NewConfig()
config := module.MakeConfig()
if err := json.Unmarshal(value, config); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion params/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (ccp *Precompiles) UnmarshalJSON(data []byte) error {
for _, module := range modules.RegisteredModules() {
key := module.ConfigKey
if value, ok := raw[key]; ok {
conf := module.NewConfig()
conf := module.MakeConfig()
if err := json.Unmarshal(value, conf); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion precompile/allowlist/allowlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (d *dummyConfig) Equal(other precompileconfig.Config) bool {

type dummyConfigurator struct{}

func (d *dummyConfigurator) NewConfig() precompileconfig.Config {
func (d *dummyConfigurator) MakeConfig() precompileconfig.Config {
return &dummyConfig{}
}

Expand Down
2 changes: 1 addition & 1 deletion precompile/allowlist/test_allowlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func mkConfigWithAllowList(module modules.Module, cfg *AllowListConfig) precompi
panic(err)
}

moduleCfg := module.NewConfig()
moduleCfg := module.MakeConfig()
err = json.Unmarshal(jsonBytes, moduleCfg)
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion precompile/contract/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type BlockContext interface {
}

type Configurator interface {
NewConfig() precompileconfig.Config
MakeConfig() precompileconfig.Config
Configure(
chainConfig ChainConfig,
precompileconfig precompileconfig.Config,
Expand Down
4 changes: 2 additions & 2 deletions precompile/contracts/deployerallowlist/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func init() {
}
}

func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the given [cfg] config.
Expand Down
4 changes: 2 additions & 2 deletions precompile/contracts/feemanager/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func init() {
}
}

func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the desired admins based on [configIface].
Expand Down
4 changes: 2 additions & 2 deletions precompile/contracts/nativeminter/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func init() {
}
}

func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the desired admins based on [cfg].
Expand Down
4 changes: 2 additions & 2 deletions precompile/contracts/rewardmanager/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func init() {
}
}

func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the initial state for the precompile.
Expand Down
4 changes: 2 additions & 2 deletions precompile/contracts/txallowlist/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func init() {
}
}

func (*configurator) NewConfig() precompileconfig.Config {
return &Config{}
func (*configurator) MakeConfig() precompileconfig.Config {
return new(Config)
}

// Configure configures [state] with the initial state for the precompile.
Expand Down