Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Jan 24, 2025
1 parent ed017c9 commit 80358d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion execution/gethexec/express_lane_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package gethexec

import (
"bytes"
"context"
"fmt"
"sync"
Expand Down Expand Up @@ -329,7 +330,10 @@ func (es *expressLaneService) sequenceExpressLaneSubmission(
}

// Check if a duplicate submission exists already, and reject if so.
if _, exists := roundInfo.msgAndResultBySequenceNumber[msg.SequenceNumber]; exists {
if prev, exists := roundInfo.msgAndResultBySequenceNumber[msg.SequenceNumber]; exists {
if bytes.Equal(prev.msg.Signature, msg.Signature) {
return nil
}
return timeboost.ErrDuplicateSequenceNumber
}

Expand Down
7 changes: 4 additions & 3 deletions execution/gethexec/express_lane_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,19 @@ func Test_expressLaneService_sequenceExpressLaneSubmission_duplicateNonce(t *tes
stubPublisher := makeStubPublisher(els)
els.transactionPublisher = stubPublisher

msg := buildValidSubmissionWithSeqAndTx(t, 0, 2, types.NewTx(&types.DynamicFeeTx{Data: []byte{1}}))
msg1 := buildValidSubmissionWithSeqAndTx(t, 0, 2, types.NewTx(&types.DynamicFeeTx{Data: []byte{1}}))
msg2 := buildValidSubmissionWithSeqAndTx(t, 0, 2, types.NewTx(&types.DynamicFeeTx{Data: []byte{2}}))
var wg sync.WaitGroup
wg.Add(3) // We expect only of the below two to return with an error here
var err1, err2 error
go func(w *sync.WaitGroup) {
w.Done()
err1 = els.sequenceExpressLaneSubmission(ctx, msg)
err1 = els.sequenceExpressLaneSubmission(ctx, msg1)
wg.Done()
}(&wg)
go func(w *sync.WaitGroup) {
w.Done()
err2 = els.sequenceExpressLaneSubmission(ctx, msg)
err2 = els.sequenceExpressLaneSubmission(ctx, msg2)
wg.Done()
}(&wg)
wg.Wait()
Expand Down

0 comments on commit 80358d7

Please sign in to comment.