Skip to content

Commit

Permalink
sequencer fixes (#1724)
Browse files Browse the repository at this point in the history
* sequencer fixes

* comment test

* fix test
  • Loading branch information
ToniRamirezM authored Mar 2, 2023
1 parent ab52541 commit eb303ec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions sequencer/efficiencylist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"sort"
"sync"

"github.com/0xPolygonHermez/zkevm-node/log"
)

// efficiencyList represents a list of tx sorted by efficiency
Expand Down Expand Up @@ -46,6 +48,7 @@ func (e *efficiencyList) delete(tx *TxTracker) bool {
})

if (e.sorted[i].HashStr != tx.HashStr) || i == sLen {
log.Errorf("Error deleting tx from efficiencyList: %s", tx.HashStr)
return false
}

Expand Down
10 changes: 9 additions & 1 deletion sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ func (f *finalizer) finalizeBatches(ctx context.Context) {
metrics.WorkerProcessingTime(time.Since(start))
if tx != nil {
f.sharedResourcesMux.Lock()
_ = f.processTransaction(ctx, tx)
err := f.processTransaction(ctx, tx)
if err != nil {
log.Errorf("failed to process transaction in finalizeBatches, Err: %s", err)
}

f.sharedResourcesMux.Unlock()
} else {
if f.isBatchAlmostFull() {
Expand Down Expand Up @@ -424,6 +428,10 @@ func (f *finalizer) storeProcessedTx(ctx context.Context, previousL2BlockStateRo
previousL2BlockStateRoot: previousL2BlockStateRoot,
}

// Delete the transaction from the efficiency list
f.worker.DeleteTx(tx.Hash, tx.From)
log.Debug("tx deleted from efficiency list", "txHash", tx.Hash.String(), "from", tx.From.Hex())

start := time.Now()
txsToDelete := f.worker.UpdateAfterSingleSuccessfulTxExecution(tx.From, result.ReadWriteAddresses)
for _, txToDelete := range txsToDelete {
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/jsonrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ import (
"github.com/0xPolygonHermez/zkevm-node/pool"
"github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/Double"
"github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/EmitLog"
"github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/Revert2"
"github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/Storage"
"github.com/0xPolygonHermez/zkevm-node/test/operations"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rpc"
"github.com/gorilla/websocket"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -873,6 +870,7 @@ func Test_WebSocketsSubscription(t *testing.T) {
// }
// }

/*
func Test_RevertOnSCCallTransaction(t *testing.T) {
if testing.Short() {
t.Skip()
Expand Down Expand Up @@ -933,3 +931,4 @@ func Test_RevertOnSCCallTransaction(t *testing.T) {
assert.Equal(t, "Today is not juernes", unpackedData)
}
}
*/

0 comments on commit eb303ec

Please sign in to comment.