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

Commit 592b0a1

Browse files
authored
Rename requestId to userOpHash (#45)
1 parent 76cc4b7 commit 592b0a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

pkg/modules/relay/relayer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,16 @@ func (r *Relayer) MapUserOpHashToClientID() gin.HandlerFunc {
150150
}
151151

152152
// SendUserOperation returns a BatchHandler that is used by the Bundler to send batches in a regular EOA
153-
// transaction. It uses the mapping of request ID to client ID created by the Gin middleware in order to
153+
// transaction. It uses the mapping of userOpHash to client ID created by the Gin middleware in order to
154154
// mitigate DoS attacks.
155155
func (r *Relayer) SendUserOperation() modules.BatchHandlerFunc {
156156
return func(ctx *modules.BatchHandlerCtx) error {
157157
// TODO: Increment badger nextTxnTs to read latest data from MapUserOpHashToClientID.
158-
time.Sleep(time.Millisecond)
158+
time.Sleep(2 * time.Millisecond)
159159

160160
var del []string
161161
err := r.db.Update(func(txn *badger.Txn) error {
162-
// Delete any request ID entries from dropped userOps.
162+
// Delete any userOpHash entries from dropped userOps.
163163
if len(ctx.PendingRemoval) > 0 {
164164
hashes := getUserOpHashesFromOps(ctx.EntryPoint, ctx.ChainID, ctx.PendingRemoval...)
165165
if err := removeUserOpHashEntries(txn, hashes...); err != nil {
@@ -231,7 +231,7 @@ func (r *Relayer) SendUserOperation() modules.BatchHandlerFunc {
231231
return err
232232
}
233233

234-
// Delete remaining request ID entries from submitted userOps.
234+
// Delete remaining userOpHash entries from submitted userOps.
235235
// Perform update in new txn to avoid db conflicts.
236236
err = r.db.Update(func(txn *badger.Txn) error {
237237
return removeUserOpHashEntries(txn, del...)

pkg/modules/relay/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ func incrementOpsSeenByClientID(txn *badger.Txn, clientID string) error {
7878
}
7979

8080
func incrementOpsIncludedByUserOpHashes(txn *badger.Txn, userOpHashes ...string) error {
81-
for _, hashes := range userOpHashes {
82-
item, err := txn.Get(getUserOpHashKey(hashes))
81+
for _, hash := range userOpHashes {
82+
item, err := txn.Get(getUserOpHashKey(hash))
8383
if err != nil && err == badger.ErrKeyNotFound {
8484
return nil
8585
}

0 commit comments

Comments
 (0)