diff --git a/ethtxmanager/ethtxmanager.go b/ethtxmanager/ethtxmanager.go index 79f9262962..ae640bab7c 100644 --- a/ethtxmanager/ethtxmanager.go +++ b/ethtxmanager/ethtxmanager.go @@ -184,9 +184,10 @@ func (c *Client) buildResult(ctx context.Context, mTx monitoredTx) (MonitoredTxR } result := MonitoredTxResult{ - ID: mTx.id, - Status: mTx.status, - Txs: txs, + ID: mTx.id, + Status: mTx.status, + BlockNumber: mTx.blockNumber, + Txs: txs, } return result, nil diff --git a/ethtxmanager/monitoredtx.go b/ethtxmanager/monitoredtx.go index 716030763b..b0c4182b95 100644 --- a/ethtxmanager/monitoredtx.go +++ b/ethtxmanager/monitoredtx.go @@ -182,9 +182,10 @@ func (mTx *monitoredTx) blockNumberU64Ptr() *uint64 { // MonitoredTxResult represents the result of a execution of a monitored tx type MonitoredTxResult struct { - ID string - Status MonitoredTxStatus - Txs map[common.Hash]TxResult + ID string + Status MonitoredTxStatus + BlockNumber *big.Int + Txs map[common.Hash]TxResult } // TxResult represents the result of a execution of a ethereum transaction in the block chain diff --git a/sequencesender/sequencesender.go b/sequencesender/sequencesender.go index 81b2c68fc6..80a467eafd 100644 --- a/sequencesender/sequencesender.go +++ b/sequencesender/sequencesender.go @@ -12,7 +12,6 @@ import ( "github.com/0xPolygonHermez/zkevm-node/event" "github.com/0xPolygonHermez/zkevm-node/log" "github.com/0xPolygonHermez/zkevm-node/state" - "github.com/ethereum/go-ethereum/common" ethTypes "github.com/ethereum/go-ethereum/core/types" "github.com/jackc/pgx/v4" ) @@ -97,25 +96,13 @@ func (s *SequenceSender) tryToSendSequence(ctx context.Context) { s.ethTxManager.ProcessPendingMonitoredTxs(ctx, ethTxManagerOwner, func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) { if result.Status == ethtxmanager.MonitoredTxStatusConfirmed { if len(result.Txs) > 0 { - var txL1BlockNumber uint64 - var txHash common.Hash - receiptFound := false - for _, tx := range result.Txs { - if tx.Receipt != nil { - txL1BlockNumber = tx.Receipt.BlockNumber.Uint64() - txHash = tx.Tx.Hash() - receiptFound = true - break - } - } - - if !receiptFound { - s.halt(ctx, fmt.Errorf("monitored tx %s for sequence [%d-%d] is confirmed but doesn't have a receipt", result.ID, s.lastSequenceInitialBatch, s.lastSequenceEndBatch)) + if result.BlockNumber == nil { + s.halt(ctx, fmt.Errorf("monitored tx %s for sequence [%d-%d] is confirmed but doesn't have L1 block number where tx was mined", result.ID, s.lastSequenceInitialBatch, s.lastSequenceEndBatch)) } // wait L1 confirmation blocks - log.Infof("waiting %d L1 block confirmations for sequence [%d-%d], L1 block: %d, tx: %s", - s.cfg.SequenceL1BlockConfirmations, s.lastSequenceInitialBatch, s.lastSequenceEndBatch, txL1BlockNumber, txHash) + log.Infof("waiting %d L1 block confirmations for sequence [%d-%d], L1 block: %d", + s.cfg.SequenceL1BlockConfirmations, s.lastSequenceInitialBatch, s.lastSequenceEndBatch, result.BlockNumber) for { lastL1BlockHeader, err := s.etherman.GetLatestBlockHeader(ctx) if err != nil { @@ -123,7 +110,7 @@ func (s *SequenceSender) tryToSendSequence(ctx context.Context) { } else { lastL1BlockNumber := lastL1BlockHeader.Number.Uint64() - if lastL1BlockNumber >= txL1BlockNumber+s.cfg.SequenceL1BlockConfirmations { + if lastL1BlockNumber >= result.BlockNumber.Uint64()+s.cfg.SequenceL1BlockConfirmations { log.Infof("continuing, last L1 block: %d", lastL1BlockNumber) break } diff --git a/state/forkid.go b/state/forkid.go index bfd78c6c91..ed035a53e1 100644 --- a/state/forkid.go +++ b/state/forkid.go @@ -19,10 +19,6 @@ const ( FORKID_ELDERBERRY = 8 // FORKID_9 is the fork id 9 FORKID_9 = 9 - // FORKID_10 is the fork id 10 - FORKID_10 = 10 - // FORKID_11 is the fork id 11 - FORKID_11 = 11 ) // ForkIDInterval is a fork id interval diff --git a/synchronizer/actions/forksids.go b/synchronizer/actions/forksids.go index e379dcb136..1383ef98c5 100644 --- a/synchronizer/actions/forksids.go +++ b/synchronizer/actions/forksids.go @@ -14,10 +14,6 @@ const ( ForkIDElderberry = ForkIdType(8) //nolint:gomnd // ForkID9 is the forkId for 9 ForkID9 = ForkIdType(9) //nolint:gomnd - // ForkID10 is the forkId for 10 (support more counters) - ForkID10 = ForkIdType(10) //nolint:gomnd - // ForkID11 is the forkId for 11 (support even more counters) - ForkID11 = ForkIdType(11) //nolint:gomnd ) var ( @@ -26,7 +22,7 @@ var ( ForksIdAll = []ForkIdType{WildcardForkId} // ForksIdOnlyElderberry support only elderberry forkId - ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9, ForkID10, ForkID11} + ForksIdOnlyElderberry = []ForkIdType{ForkIDElderberry, ForkID9} // ForksIdOnlyEtrog support only etrog forkId ForksIdOnlyEtrog = []ForkIdType{ForkIDEtrog}