From f588da2d46c8bc1ec0f0942b988f11753cb87924 Mon Sep 17 00:00:00 2001 From: pk910 Date: Tue, 7 Jan 2025 22:02:07 +0100 Subject: [PATCH 1/2] fix dequeue block calculation --- indexer/execution/contract_indexer.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/indexer/execution/contract_indexer.go b/indexer/execution/contract_indexer.go index aa9322c7..55f4dd0d 100644 --- a/indexer/execution/contract_indexer.go +++ b/indexer/execution/contract_indexer.go @@ -240,16 +240,9 @@ func (ci *contractIndexer[TxType]) processFinalizedBlocks(finalizedBlockNumber u var txBlockHeader *types.Header requestTxs := []*TxType{} - queueBlock := ci.state.FinalBlock + queueBlock := ci.state.FinalBlock + 1 queueLength := ci.state.FinalQueueLen - // we start crawling from the next block, so we need to decrease the queue length for the current block - if queueLength > ci.options.dequeueRate { - queueLength -= ci.options.dequeueRate - } else { - queueLength = 0 - } - for idx := range logs { log := &logs[idx] From 481894ed03641c5622cea406acabd2dfc35690f8 Mon Sep 17 00:00:00 2001 From: pk910 Date: Tue, 7 Jan 2025 22:34:10 +0100 Subject: [PATCH 2/2] fix order of requests from cahce (order by descending block index) --- services/chainservice_consolidations.go | 2 ++ services/chainservice_withdrawals.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/services/chainservice_consolidations.go b/services/chainservice_consolidations.go index 0024cf50..f3715994 100644 --- a/services/chainservice_consolidations.go +++ b/services/chainservice_consolidations.go @@ -8,6 +8,7 @@ import ( "github.com/ethpandaops/dora/db" "github.com/ethpandaops/dora/dbtypes" "github.com/ethpandaops/dora/indexer/beacon" + "github.com/prysmaticlabs/prysm/v5/container/slice" "github.com/sirupsen/logrus" ) @@ -211,6 +212,7 @@ func (bs *ChainService) GetConsolidationRequestOperationsByFilter(filter *dbtype } consolidationRequests := block.GetDbConsolidationRequests(bs.beaconIndexer) + slice.Reverse(consolidationRequests) // reverse as other datasources are ordered by descending block index too for idx, consolidationRequest := range consolidationRequests { if filter.MinSrcIndex > 0 && (consolidationRequest.SourceIndex == nil || *consolidationRequest.SourceIndex < filter.MinSrcIndex) { continue diff --git a/services/chainservice_withdrawals.go b/services/chainservice_withdrawals.go index 58cd754a..3b1aff43 100644 --- a/services/chainservice_withdrawals.go +++ b/services/chainservice_withdrawals.go @@ -8,6 +8,7 @@ import ( "github.com/ethpandaops/dora/db" "github.com/ethpandaops/dora/dbtypes" "github.com/ethpandaops/dora/indexer/beacon" + "github.com/prysmaticlabs/prysm/v5/container/slice" "github.com/sirupsen/logrus" ) @@ -197,6 +198,7 @@ func (bs *ChainService) GetWithdrawalRequestOperationsByFilter(filter *dbtypes.W } withdrawalRequests := block.GetDbWithdrawalRequests(bs.beaconIndexer) + slice.Reverse(withdrawalRequests) // reverse as other datasources are ordered by descending block index too for idx, withdrawalRequest := range withdrawalRequests { if filter.MinIndex > 0 && (withdrawalRequest.ValidatorIndex == nil || *withdrawalRequest.ValidatorIndex < filter.MinIndex) { continue