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

Commit 5425011

Browse files
authored
Reject userOps within 30 seconds of expiring (#175)
1 parent 98f1347 commit 5425011

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/compliance.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ jobs:
3131
- name: Checkout bundler spec test
3232
uses: actions/checkout@v3
3333
with:
34-
repository: eth-infinitism/bundler-spec-tests
35-
ref: 94a0634ebd6e6da657e863c134d20bc46724ed0f
34+
# TODO: Revert back to eth-infinitism/bundler-spec-tests once
35+
# https://github.com/eth-infinitism/bundler-spec-tests/pull/23 merged.
36+
repository: hazim-j/bundler-spec-tests
37+
ref: expires-too-soon-case
3638
path: ./bundler-spec-tests
3739
submodules: true
3840

pkg/modules/checks/standalone.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package checks
55
import (
66
"math/big"
77
"sync"
8+
"time"
89

910
"github.com/dgraph-io/badger/v3"
1011
"github.com/ethereum/go-ethereum/common"
@@ -92,6 +93,14 @@ func (s *Standalone) SimulateOp() modules.UserOpHandlerFunc {
9293
nil,
9394
)
9495
}
96+
if sim.ReturnInfo.ValidUntil.Cmp(common.Big0) != 0 &&
97+
time.Now().Unix() >= sim.ReturnInfo.ValidUntil.Int64()-30 {
98+
return errors.NewRPCError(
99+
errors.SHORT_DEADLINE,
100+
"expires too soon",
101+
nil,
102+
)
103+
}
95104
return nil
96105
})
97106
g.Go(func() error {

0 commit comments

Comments
 (0)