Skip to content

Commit

Permalink
Merge pull request #331 from pimlicolabs/add-second-simulation-logs
Browse files Browse the repository at this point in the history
Add logs to check if the second simulation fails
  • Loading branch information
plusminushalf authored Oct 18, 2024
2 parents e312a2d + dda919c commit f7ccd43
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/rpc/rpcHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export class RpcHandler implements IRpcEndpoint {
entryPoint,
queuedUserOperations,
true,
stateOverrides
deepHexlify({ ...stateOverrides })
)

let { verificationGasLimit, callGasLimit } =
Expand Down Expand Up @@ -527,9 +527,8 @@ export class RpcHandler implements IRpcEndpoint {
callGasLimit = 0n
}

// If a balance override is provided for the sender, perform an additional simulation
// to verify the userOperation succeeds with the specified balance.
if (stateOverrides?.[userOperation.sender]?.balance) {
// Run second time without state overrides
try {
await this.validator.getExecutionResult(
{
...userOperation,
Expand All @@ -542,8 +541,10 @@ export class RpcHandler implements IRpcEndpoint {
entryPoint,
queuedUserOperations,
false,
deepHexlify(stateOverrides)
deepHexlify({ ...stateOverrides })
)
} catch (err) {
this.logger.error(err, "Second simulations fail")
}

if (isVersion07(userOperation)) {
Expand Down

0 comments on commit f7ccd43

Please sign in to comment.