Skip to content

Commit 9059a09

Browse files
authored
Rename new config (#528)
* rename configurator's new config to make config * use new built-in to create new config instance
1 parent c5c1017 commit 9059a09

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

accounts/abi/bind/precompilebind/precompile_module_template.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ func init() {
4949
}
5050
}
5151
52-
// NewConfig returns a new precompile precompileconfig.
53-
// This is required for Marshal/Unmarshal the precompile precompileconfig.
54-
func (*configurator) NewConfig() precompileconfig.Config {
55-
return &Config{}
52+
// MakeConfig returns a new precompile config instance.
53+
// This is required for Marshal/Unmarshal the precompile config.
54+
func (*configurator) MakeConfig() precompileconfig.Config {
55+
return new(Config)
5656
}
5757
5858
// Configure configures [state] with the given [cfg] precompileconfig.

params/precompile_upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (u *PrecompileUpgrade) UnmarshalJSON(data []byte) error {
4646
if !ok {
4747
return fmt.Errorf("unknown precompile config: %s", key)
4848
}
49-
config := module.NewConfig()
49+
config := module.MakeConfig()
5050
if err := json.Unmarshal(value, config); err != nil {
5151
return err
5252
}

params/precompiles.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func (ccp *Precompiles) UnmarshalJSON(data []byte) error {
2525
for _, module := range modules.RegisteredModules() {
2626
key := module.ConfigKey
2727
if value, ok := raw[key]; ok {
28-
conf := module.NewConfig()
28+
conf := module.MakeConfig()
2929
if err := json.Unmarshal(value, conf); err != nil {
3030
return err
3131
}

precompile/allowlist/allowlist_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (d *dummyConfig) Equal(other precompileconfig.Config) bool {
3434

3535
type dummyConfigurator struct{}
3636

37-
func (d *dummyConfigurator) NewConfig() precompileconfig.Config {
37+
func (d *dummyConfigurator) MakeConfig() precompileconfig.Config {
3838
return &dummyConfig{}
3939
}
4040

precompile/allowlist/test_allowlist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func mkConfigWithAllowList(module modules.Module, cfg *AllowListConfig) precompi
3030
panic(err)
3131
}
3232

33-
moduleCfg := module.NewConfig()
33+
moduleCfg := module.MakeConfig()
3434
err = json.Unmarshal(jsonBytes, moduleCfg)
3535
if err != nil {
3636
panic(err)

precompile/contract/interfaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type BlockContext interface {
6969
}
7070

7171
type Configurator interface {
72-
NewConfig() precompileconfig.Config
72+
MakeConfig() precompileconfig.Config
7373
Configure(
7474
chainConfig ChainConfig,
7575
precompileconfig precompileconfig.Config,

precompile/contracts/deployerallowlist/module.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func init() {
3535
}
3636
}
3737

38-
func (*configurator) NewConfig() precompileconfig.Config {
39-
return &Config{}
38+
func (*configurator) MakeConfig() precompileconfig.Config {
39+
return new(Config)
4040
}
4141

4242
// Configure configures [state] with the given [cfg] config.

precompile/contracts/feemanager/module.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func init() {
3535
}
3636
}
3737

38-
func (*configurator) NewConfig() precompileconfig.Config {
39-
return &Config{}
38+
func (*configurator) MakeConfig() precompileconfig.Config {
39+
return new(Config)
4040
}
4141

4242
// Configure configures [state] with the desired admins based on [configIface].

precompile/contracts/nativeminter/module.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func init() {
3636
}
3737
}
3838

39-
func (*configurator) NewConfig() precompileconfig.Config {
40-
return &Config{}
39+
func (*configurator) MakeConfig() precompileconfig.Config {
40+
return new(Config)
4141
}
4242

4343
// Configure configures [state] with the desired admins based on [cfg].

precompile/contracts/rewardmanager/module.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func init() {
3535
}
3636
}
3737

38-
func (*configurator) NewConfig() precompileconfig.Config {
39-
return &Config{}
38+
func (*configurator) MakeConfig() precompileconfig.Config {
39+
return new(Config)
4040
}
4141

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

0 commit comments

Comments
 (0)