Skip to content

Commit de38e8d

Browse files
authored
Merge pull request #182 from bcnmy/feat/gas-limit-sims-buffers
added gas limit sims buffer config
2 parents accf39d + 7dda2f3 commit de38e8d

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/modules/chains/schemas.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ const chainConfigSchemaBase = z.object({
8181
perAuthBaseCost: bigIntLikeSchema.optional(),
8282
})
8383
.default({}),
84+
simulationGasLimitBuffers: z
85+
.object({
86+
callGasLimit: bigIntLikeSchema.optional(),
87+
verificationGasLimit: bigIntLikeSchema.optional(),
88+
})
89+
.default({}),
8490
simulationOverrides: z
8591
.object({
8692
gas: bigIntLikeSchema.optional(),

src/modules/simulator/simulation.service.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ChainsService } from "@/chains";
12
import { BadRequestException, packUint128Pair, withTrace } from "@/common";
23
import { TokenWithPermitAbi } from "@/contracts/resources/erc20-with-permit";
34
import { type ConfigType, InjectConfig } from "@/core/config";
@@ -79,6 +80,7 @@ export class SimulationService {
7980
private readonly nodeService: NodeService,
8081
private readonly tokenSlotDetectionService: TokenSlotDetectionService,
8182
private readonly rpcManagerService: RpcManagerService,
83+
private readonly chainsService: ChainsService,
8284
@InjectConfig(gasEstimatorConfig)
8385
private readonly gasEstimatorConfiguration: ConfigType<
8486
typeof gasEstimatorConfig
@@ -772,6 +774,17 @@ export class SimulationService {
772774
);
773775
}
774776

777+
const { simulationGasLimitBuffers } =
778+
this.chainsService.getChainSettings(chainId);
779+
780+
// Chain specific verification and call gas limit buffers to handle any special cases.
781+
if (simulationGasLimitBuffers.callGasLimit)
782+
callGasLimit += simulationGasLimitBuffers.callGasLimit;
783+
784+
if (simulationGasLimitBuffers.verificationGasLimit)
785+
verificationGasLimit +=
786+
simulationGasLimitBuffers.verificationGasLimit;
787+
775788
return {
776789
userOpIndex,
777790
chainId,

0 commit comments

Comments
 (0)