@@ -37,11 +37,11 @@ type SubnetParams struct {
37
37
38
38
// Subnet-EVM parameters to use
39
39
// Do not set SubnetEVM value if you are using Custom VM
40
- SubnetEVM SubnetEVMParams
40
+ SubnetEVM * SubnetEVMParams
41
41
42
42
// Custom VM parameters to use
43
43
// Do not set CustomVM value if you are using Subnet-EVM
44
- CustomVM CustomVMParams
44
+ CustomVM * CustomVMParams
45
45
46
46
Name string
47
47
}
@@ -72,7 +72,7 @@ type SubnetEVMParams struct {
72
72
// information on AWM Relayer
73
73
EnableRelayer bool
74
74
75
- GenesisParams EVMGenesisParams
75
+ GenesisParams * EVMGenesisParams
76
76
}
77
77
78
78
type CustomVMParams struct {
@@ -129,6 +129,12 @@ type EVMGenesisParams struct {
129
129
}
130
130
131
131
func New (client * avalanche.BaseApp , subnetParams * SubnetParams ) (* Subnet , error ) {
132
+ if subnetParams .GenesisFilePath != "" && (subnetParams .CustomVM != nil || subnetParams .SubnetEVM != nil ) {
133
+ return nil , fmt .Errorf ("genesis file path cannot be non-empty if either CustomVM params or SubnetEVM params is not empty" )
134
+ }
135
+ if subnetParams .SubnetEVM == nil && subnetParams .CustomVM != nil {
136
+ return nil , fmt .Errorf ("SubnetEVM params and CustomVM params cannot both be non-empty" )
137
+ }
132
138
genesisBytes , err := createEvmGenesis (
133
139
subnetParams .SubnetEVM .EvmChainID ,
134
140
subnetParams .SubnetEVM .GenesisParams ,
@@ -146,7 +152,7 @@ func New(client *avalanche.BaseApp, subnetParams *SubnetParams) (*Subnet, error)
146
152
// removed usewarp from argument, to use warp add it manualluy to precompile
147
153
func createEvmGenesis (
148
154
chainID uint64 ,
149
- genesisParams EVMGenesisParams ,
155
+ genesisParams * EVMGenesisParams ,
150
156
) ([]byte , error ) {
151
157
genesis := core.Genesis {}
152
158
genesis .Timestamp = * utils .TimeToNewUint64 (time .Now ())
0 commit comments