Skip to content

Commit

Permalink
[rpc-test] erigon_getBalanceChangesInBlock upper bound (#12642)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Nov 8, 2024
1 parent 9e4ba4c commit 26c9140
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/scripts/run_rpc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ disabled_tests=(
# remove this line after https://github.com/erigontech/rpc-tests/pull/282
eth_getBlockByHash/test_10.json
eth_getBlockByNumber/test_12.json
# Erigon bugs: https://github.com/erigontech/erigon/pull/12609
# Erigon bugs
debug_accountRange
debug_storageRangeAt
# need update rpc-test - because Erigon is correct (@AskAlexSharov will do after https://github.com/erigontech/erigon/pull/12634)
# remove this line after https://github.com/erigontech/rpc-tests/pull/273
debug_getModifiedAccountsByHash
Expand Down Expand Up @@ -51,7 +50,6 @@ disabled_tests=(
engine_exchangeCapabilities/test_1.json
engine_exchangeTransitionConfigurationV1/test_01.json
engine_getClientVersionV1/test_1.json
erigon_getBalanceChangesInBlock
trace_replayBlockTransactions/test_29.tar
# do these perhaps require Erigon up?
admin_nodeInfo/test_01.json
Expand Down
1 change: 0 additions & 1 deletion erigon-lib/state/history_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ func (hi *HistoryChangesIterFiles) Next() ([]byte, []byte, error) {
if err := hi.advance(); err != nil {
return nil, nil, err
}
fmt.Printf("[dbg] hist.Next: %x\n", hi.kBackup)
return hi.kBackup, hi.vBackup, nil
}

Expand Down
11 changes: 9 additions & 2 deletions turbo/jsonrpc/erigon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,15 @@ func (api *ErigonImpl) GetBalanceChangesInBlock(ctx context.Context, blockNrOrHa
return nil, err
}

minTxNum, _ := txNumsReader.Min(tx, blockNumber)
it, err := tx.(kv.TemporalTx).HistoryRange(kv.AccountsDomain, int(minTxNum), -1, order.Asc, -1)
minTxNum, err := txNumsReader.Min(tx, blockNumber)
if err != nil {
return nil, err
}
maxTxNum, err := txNumsReader.Max(tx, blockNumber)
if err != nil {
return nil, err
}
it, err := tx.(kv.TemporalTx).HistoryRange(kv.AccountsDomain, int(minTxNum), int(maxTxNum+1), order.Asc, -1)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion turbo/jsonrpc/storage_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func storageRangeAt(ttx kv.TemporalTx, contractAddress libcommon.Address, start
return StorageRangeResult{}, err
}
defer r.Close()
for i := 0; i < maxResult && r.HasNext(); i++ {
for len(result.Storage) < maxResult && r.HasNext() {
k, v, err := r.Next()
if err != nil {
return StorageRangeResult{}, err
Expand Down

0 comments on commit 26c9140

Please sign in to comment.