Skip to content

Commit

Permalink
align getModifiedAccountsByHash to getModifiedAccountsByNumber and f… (
Browse files Browse the repository at this point in the history
…#12680)

This PR contains two changes:
- align getModifiedAccountByHash() to getModifiedAccountsByNumber() on
txn calculations
- I assume the txn range is:  fromTxn <= values <= toTxn 
  Therefore the endTxn should be min(next block) - 1
In the sw nextBlock is equal to endBlock (endBlock is increased before)
  • Loading branch information
lupin012 authored Nov 9, 2024
1 parent 54960b0 commit dbdfa43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/scripts/run_rpc_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ disabled_tests=(
debug_traceBlockByNumber/test_10.tar
debug_traceBlockByNumber/test_11.tar
debug_traceBlockByNumber/test_12.tar
# modified expected in case of empty rsp
debug_storageRangeAt/test_11.json
# remove this line after https://github.com/erigontech/rpc-tests/pull/281
parity_getBlockReceipts
parity_listStorageKeys/test_12.json
Expand Down
6 changes: 3 additions & 3 deletions turbo/jsonrpc/debug_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (api *PrivateDebugAPIImpl) GetModifiedAccountsByNumber(ctx context.Context,
if err != nil {
return nil, err
}
return getModifiedAccounts(tx.(kv.TemporalTx), startTxNum, endTxNum)
return getModifiedAccounts(tx.(kv.TemporalTx), startTxNum, endTxNum-1)
}

// getModifiedAccounts returns a list of addresses that were modified in the block range
Expand Down Expand Up @@ -282,11 +282,11 @@ func (api *PrivateDebugAPIImpl) GetModifiedAccountsByHash(ctx context.Context, s
if err != nil {
return nil, err
}
endTxNum, err := txNumsReader.Max(tx, endNum-1)
endTxNum, err := txNumsReader.Min(tx, endNum)
if err != nil {
return nil, err
}
return getModifiedAccounts(tx.(kv.TemporalTx), startTxNum, endTxNum)
return getModifiedAccounts(tx.(kv.TemporalTx), startTxNum, endTxNum-1)
}

func (api *PrivateDebugAPIImpl) AccountAt(ctx context.Context, blockHash common.Hash, txIndex uint64, address common.Address) (*AccountResult, error) {
Expand Down

0 comments on commit dbdfa43

Please sign in to comment.