diff --git a/sequencer/finalizer.go b/sequencer/finalizer.go index 2b603e1026..438782e7b9 100644 --- a/sequencer/finalizer.go +++ b/sequencer/finalizer.go @@ -449,7 +449,6 @@ func (f *finalizer) handleTransactionError(ctx context.Context, result *state.Pr } }() } else if (executor.IsInvalidNonceError(errorCode) || executor.IsInvalidBalanceError(errorCode)) && !tx.IsClaim { - log.Errorf("intrinsic error, moving tx with Hash: %s to NOT READY, err: %s", tx.Hash, txResponse.RomError) var ( nonce *uint64 balance *big.Int @@ -459,6 +458,7 @@ func (f *finalizer) handleTransactionError(ctx context.Context, result *state.Pr balance = addressInfo.Balance } start := time.Now() + log.Errorf("intrinsic error, moving tx with Hash: %s to NOT READY nonce(%d) balance(%s) cost(%s), err: %s", tx.Hash, nonce, balance.String(), tx.Cost.String(), txResponse.RomError) txsToDelete := f.worker.MoveTxToNotReady(tx.Hash, tx.From, nonce, balance) for _, txToDelete := range txsToDelete { err := f.dbManager.UpdateTxStatus(ctx, txToDelete.Hash, pool.TxStatusFailed, false) diff --git a/sequencer/finalizer_test.go b/sequencer/finalizer_test.go index 27a093c888..e581345c0d 100644 --- a/sequencer/finalizer_test.go +++ b/sequencer/finalizer_test.go @@ -224,7 +224,7 @@ func TestFinalizer_handleTransactionError(t *testing.T) { // arrange f = setupFinalizer(true) nonce := uint64(0) - tx := &TxTracker{Hash: oldHash, From: sender} + tx := &TxTracker{Hash: oldHash, From: sender, Cost: big.NewInt(0)} testCases := []struct { name string error pb.RomError diff --git a/sequencer/worker.go b/sequencer/worker.go index 0235926cc0..e720655936 100644 --- a/sequencer/worker.go +++ b/sequencer/worker.go @@ -78,20 +78,20 @@ func (w *Worker) AddTxTracker(ctx context.Context, tx *TxTracker) { w.workerMutex.Lock() w.pool[tx.FromStr] = addr - log.Infof("AddTx new addrQueue created for addr(%s)", tx.FromStr) + log.Infof("AddTx new addrQueue created for addr(%s) nonce(%d) balance(%s)", tx.FromStr, nonce.Uint64(), balance.String()) } // Add the txTracker to Addr and get the newReadyTx and prevReadyTx - log.Infof("AddTx new tx(%s) to addrQueue(%s)", tx.Hash.String(), tx.FromStr) + log.Infof("AddTx new tx(%s) nonce(%d) cost(%s) to addrQueue(%s)", tx.Hash.String(), tx.Nonce, tx.FromStr, tx.Cost.String()) newReadyTx, prevReadyTx := addr.addTx(tx) // Update the EfficiencyList (if needed) if prevReadyTx != nil { - log.Infof("AddTx prevReadyTx(%s) deleted from EfficiencyList", prevReadyTx.Hash.String()) + log.Infof("AddTx prevReadyTx(%s) nonce(%d) cost(%s) deleted from EfficiencyList", prevReadyTx.Hash.String(), prevReadyTx.Nonce, prevReadyTx.Cost.String()) w.efficiencyList.delete(prevReadyTx) } if newReadyTx != nil { - log.Infof("AddTx newReadyTx(%s) added to EfficiencyList", newReadyTx.Hash.String()) + log.Infof("AddTx newReadyTx(%s) nonce(%d) cost(%s) added to EfficiencyList", newReadyTx.Hash.String(), newReadyTx.Nonce, newReadyTx.Cost.String()) w.efficiencyList.add(newReadyTx) } } @@ -105,11 +105,11 @@ func (w *Worker) applyAddressUpdate(from common.Address, fromNonce *uint64, from // Update the EfficiencyList (if needed) if prevReadyTx != nil { - log.Infof("applyAddressUpdate prevReadyTx(%s) deleted from EfficiencyList", prevReadyTx.Hash.String()) + log.Infof("applyAddressUpdate prevReadyTx(%s) nonce(%d) cost(%s) deleted from EfficiencyList", prevReadyTx.Hash.String(), prevReadyTx.Nonce, prevReadyTx.Cost.String()) w.efficiencyList.delete(prevReadyTx) } if newReadyTx != nil { - log.Infof("applyAddressUpdate newReadyTx(%s) added to EfficiencyList", newReadyTx.Hash.String()) + log.Infof("applyAddressUpdate newReadyTx(%s) nonce(%d) cost(%s) added to EfficiencyList", newReadyTx.Hash.String(), newReadyTx.Nonce, newReadyTx.Cost.String()) w.efficiencyList.add(newReadyTx) } @@ -148,6 +148,7 @@ func (w *Worker) UpdateAfterSingleSuccessfulTxExecution(from common.Address, tou func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, actualBalance *big.Int) []*TxTracker { w.workerMutex.Lock() defer w.workerMutex.Unlock() + log.Infof("MoveTxToNotReady tx(%s) from(%s) actualNonce(%d) actualBalance(%s)", txHash.String(), from.String(), actualNonce, actualBalance.String()) addrQueue, found := w.pool[from.String()] if found { @@ -157,7 +158,7 @@ func (w *Worker) MoveTxToNotReady(txHash common.Hash, from common.Address, actua if addrQueue.readyTx != nil { readyHashStr = addrQueue.readyTx.HashStr } - log.Errorf("MoveTxToNotReady txHash(s) is not the readyTx(%s)", txHash.String(), readyHashStr) + log.Errorf("MoveTxToNotReady txHash(%s) is not the readyTx(%s)", txHash.String(), readyHashStr) // TODO: how to manage this? } } @@ -187,6 +188,15 @@ func (w *Worker) DeleteTx(txHash common.Hash, addr common.Address) { func (w *Worker) UpdateTx(txHash common.Hash, addr common.Address, counters state.ZKCounters) { w.workerMutex.Lock() defer w.workerMutex.Unlock() + log.Infof("UpdateTx tx(%s) addr(%s)", txHash.String(), addr.String()) + log.Debugf("UpdateTx counters.CumulativeGasUsed: %s", counters.CumulativeGasUsed) + log.Debugf("UpdateTx counters.UsedKeccakHashes: %s", counters.UsedKeccakHashes) + log.Debugf("UpdateTx counters.UsedPoseidonHashes: %s", counters.UsedPoseidonHashes) + log.Debugf("UpdateTx counters.UsedPoseidonPaddings: %s", counters.UsedPoseidonPaddings) + log.Debugf("UpdateTx counters.UsedMemAligns: %s", counters.UsedMemAligns) + log.Debugf("UpdateTx counters.UsedArithmetics: %s", counters.UsedArithmetics) + log.Debugf("UpdateTx counters.UsedBinaries: %s", counters.UsedBinaries) + log.Debugf("UpdateTx counters.UsedSteps: %s", counters.UsedSteps) addrQueue, found := w.pool[addr.String()] @@ -195,11 +205,11 @@ func (w *Worker) UpdateTx(txHash common.Hash, addr common.Address, counters stat // Resort the newReadyTx in efficiencyList if prevReadyTx != nil { - log.Infof("UpdateTx prevReadyTx(%s) deleted from EfficiencyList", prevReadyTx.Hash.String()) + log.Infof("UpdateTx prevReadyTx(%s) nonce(%d) cost(%s) deleted from EfficiencyList", prevReadyTx.Hash.String(), prevReadyTx.Nonce, prevReadyTx.Cost.String()) w.efficiencyList.delete(prevReadyTx) } if newReadyTx != nil { - log.Infof("UpdateTx newReadyTx(%s) added to EfficiencyList", newReadyTx.Hash.String()) + log.Infof("UpdateTx newReadyTx(%s) nonce(%d) cost(%s) added to EfficiencyList", newReadyTx.Hash.String(), newReadyTx.Nonce, newReadyTx.Cost.String()) w.efficiencyList.add(newReadyTx) } } else {