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

Commit

Permalink
Add ENVAR to support Arbstack (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSolante authored Apr 8, 2024
1 parent f2c7f27 commit 85e227c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions internal/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ var (
LyraSepoliaChainID.Uint64(),
Ancient8SepoliaChainID.Uint64(),
)

ArbStackChains = mapset.NewSet(
ArbitrumOneChainID.Uint64(),
ArbitrumGoerliChainID.Uint64(),
ArbitrumSepoliaChainID.Uint64(),
)
)
5 changes: 5 additions & 0 deletions internal/config/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type Values struct {
// Rollup related variables.
IsOpStackNetwork bool
IsRIP7212Supported bool
IsArbStackNetwork bool

// Undocumented variables.
DebugMode bool
Expand Down Expand Up @@ -99,6 +100,7 @@ func GetValues() *Values {
viper.SetDefault("erc4337_bundler_blocks_in_the_future", 6)
viper.SetDefault("erc4337_bundler_otel_insecure_mode", false)
viper.SetDefault("erc4337_bundler_is_op_stack_network", false)
viper.SetDefault("erc4337_bundler_is_arb_stack_network", false)
viper.SetDefault("erc4337_bundler_is_rip7212_supported", false)
viper.SetDefault("erc4337_bundler_debug_mode", false)
viper.SetDefault("erc4337_bundler_gin_mode", gin.ReleaseMode)
Expand Down Expand Up @@ -138,6 +140,7 @@ func GetValues() *Values {
_ = viper.BindEnv("erc4337_bundler_alt_mempool_ipfs_gateway")
_ = viper.BindEnv("erc4337_bundler_alt_mempool_ids")
_ = viper.BindEnv("erc4337_bundler_is_op_stack_network")
_ = viper.BindEnv("erc4337_bundler_is_arb_stack_network")
_ = viper.BindEnv("erc4337_bundler_is_rip7212_supported")
_ = viper.BindEnv("erc4337_bundler_debug_mode")
_ = viper.BindEnv("erc4337_bundler_gin_mode")
Expand Down Expand Up @@ -200,6 +203,7 @@ func GetValues() *Values {
altMempoolIPFSGateway := viper.GetString("erc4337_bundler_alt_mempool_ipfs_gateway")
altMempoolIds := envArrayToStringSlice(viper.GetString("erc4337_bundler_alt_mempool_ids"))
isOpStackNetwork := viper.GetBool("erc4337_bundler_is_op_stack_network")
isArbStackNetwork := viper.GetBool("erc4337_bundler_is_arb_stack_network")
isRIP7212Supported := viper.GetBool("erc4337_bundler_is_rip7212_supported")
debugMode := viper.GetBool("erc4337_bundler_debug_mode")
ginMode := viper.GetString("erc4337_bundler_gin_mode")
Expand All @@ -226,6 +230,7 @@ func GetValues() *Values {
AltMempoolIPFSGateway: altMempoolIPFSGateway,
AltMempoolIds: altMempoolIds,
IsOpStackNetwork: isOpStackNetwork,
IsArbStackNetwork: isArbStackNetwork,
IsRIP7212Supported: isRIP7212Supported,
DebugMode: debugMode,
GinMode: ginMode,
Expand Down
4 changes: 1 addition & 3 deletions internal/start/private.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ func PrivateMode() {
}

ov := gas.NewDefaultOverhead()
if chain.Cmp(config.ArbitrumOneChainID) == 0 ||
chain.Cmp(config.ArbitrumGoerliChainID) == 0 ||
chain.Cmp(config.ArbitrumSepoliaChainID) == 0 {
if conf.IsArbStackNetwork || config.ArbStackChains.Contains(chain.Uint64()) {
ov.SetCalcPreVerificationGasFunc(gas.CalcArbitrumPVGWithEthClient(rpc, conf.SupportedEntryPoints[0]))
ov.SetPreVerificationGasBufferFactor(16)
}
Expand Down

0 comments on commit 85e227c

Please sign in to comment.