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

Commit ee65197

Browse files
authored
Reject userOp if sigFailed is true during simulation (#120)
1 parent afcf309 commit ee65197

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/errors/rpc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var (
88
BANNED_OR_THROTTLED_PAYMASTER = -32504
99
INVALID_PAYMASTER_STAKE = -32505
1010
INVALID_AGGREGATOR = -32506
11+
INVALID_SIGNATURE = -32507
1112
INVALID_FIELDS = -32602
1213

1314
EXECUTION_REVERTED = -32521

pkg/modules/checks/standalone.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,18 @@ func (s *Standalone) SimulateOp() modules.UserOpHandlerFunc {
7777
gc := getCodeWithEthClient(s.eth)
7878
g := new(errgroup.Group)
7979
g.Go(func() error {
80-
_, err := simulation.SimulateValidation(s.rpc, ctx.EntryPoint, ctx.UserOp)
80+
sim, err := simulation.SimulateValidation(s.rpc, ctx.EntryPoint, ctx.UserOp)
8181

8282
if err != nil {
8383
return errors.NewRPCError(errors.REJECTED_BY_EP_OR_ACCOUNT, err.Error(), err.Error())
8484
}
85+
if sim.ReturnInfo.SigFailed {
86+
return errors.NewRPCError(
87+
errors.INVALID_SIGNATURE,
88+
"invalid userOp or paymaster signature",
89+
nil,
90+
)
91+
}
8592
return nil
8693
})
8794
g.Go(func() error {

0 commit comments

Comments
 (0)