Skip to content

Commit

Permalink
Merge pull request #209 from ethpandaops/pk910/fix-dequeue-block-calc…
Browse files Browse the repository at this point in the history
…ulation

fix dequeue block calculation
  • Loading branch information
pk910 authored Jan 8, 2025
2 parents 265c43f + 481894e commit 2f6af44
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
9 changes: 1 addition & 8 deletions indexer/execution/contract_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 2 additions & 0 deletions services/chainservice_consolidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions services/chainservice_withdrawals.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f6af44

Please sign in to comment.