Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit efed64e

Browse files
authored
Flag to enable stack specific gas calculation (#368)
1 parent 4031b8a commit efed64e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

internal/config/values.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ type Values struct {
4141
AltMempoolIPFSGateway string
4242
AltMempoolIds []string
4343

44+
// Stack Specific gas calculation variables.
45+
IsOpStackNetwork bool
46+
4447
// Undocumented variables.
4548
DebugMode bool
4649
GinMode string
@@ -91,6 +94,7 @@ func GetValues() *Values {
9194
viper.SetDefault("erc4337_bundler_max_op_ttl_seconds", 180)
9295
viper.SetDefault("erc4337_bundler_blocks_in_the_future", 6)
9396
viper.SetDefault("erc4337_bundler_otel_insecure_mode", false)
97+
viper.SetDefault("erc4337_is_op_stack_network", false)
9498
viper.SetDefault("erc4337_bundler_debug_mode", false)
9599
viper.SetDefault("erc4337_bundler_gin_mode", gin.ReleaseMode)
96100

@@ -126,6 +130,7 @@ func GetValues() *Values {
126130
_ = viper.BindEnv("erc4337_bundler_otel_insecure_mode")
127131
_ = viper.BindEnv("erc4337_bundler_alt_mempool_ipfs_gateway")
128132
_ = viper.BindEnv("erc4337_bundler_alt_mempool_ids")
133+
_ = viper.BindEnv("erc4337_is_op_stack_network")
129134
_ = viper.BindEnv("erc4337_bundler_debug_mode")
130135
_ = viper.BindEnv("erc4337_bundler_gin_mode")
131136

@@ -184,6 +189,7 @@ func GetValues() *Values {
184189
otelInsecureMode := viper.GetBool("erc4337_bundler_otel_insecure_mode")
185190
altMempoolIPFSGateway := viper.GetString("erc4337_bundler_alt_mempool_ipfs_gateway")
186191
altMempoolIds := envArrayToStringSlice(viper.GetString("erc4337_bundler_alt_mempool_ids"))
192+
isOpStackNetwork := viper.GetBool("erc4337_is_op_stack_network")
187193
debugMode := viper.GetBool("erc4337_bundler_debug_mode")
188194
ginMode := viper.GetString("erc4337_bundler_gin_mode")
189195
return &Values{
@@ -206,6 +212,7 @@ func GetValues() *Values {
206212
OTELInsecureMode: otelInsecureMode,
207213
AltMempoolIPFSGateway: altMempoolIPFSGateway,
208214
AltMempoolIds: altMempoolIds,
215+
IsOpStackNetwork: isOpStackNetwork,
209216
DebugMode: debugMode,
210217
GinMode: ginMode,
211218
}

internal/start/private.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func PrivateMode() {
9191
ov.SetPreVerificationGasBufferFactor(16)
9292
}
9393

94-
if config.OpStackChains.Contains(chain) {
94+
if conf.IsOpStackNetwork || config.OpStackChains.Contains(chain) {
9595
ov.SetCalcPreVerificationGasFunc(
9696
gas.CalcOptimismPVGWithEthClient(rpc, chain, conf.SupportedEntryPoints[0]),
9797
)

0 commit comments

Comments
 (0)