diff --git a/.github/workflows/rpc-integration-tests.yml b/.github/workflows/rpc-integration-tests.yml index b32893bf06..25aba3b035 100644 --- a/.github/workflows/rpc-integration-tests.yml +++ b/.github/workflows/rpc-integration-tests.yml @@ -27,7 +27,7 @@ jobs: - name: Checkout RPC Tests Repository & Install Requirements run: | rm -rf ${{runner.workspace}}/rpc-tests - git -c advice.detachedHead=false clone --depth 1 --branch v0.37.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests + git -c advice.detachedHead=false clone --depth 1 --branch v0.38.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests cd ${{runner.workspace}}/rpc-tests pip3 install -r requirements.txt diff --git a/silkworm/rpc/core/account_dumper.cpp b/silkworm/rpc/core/account_dumper.cpp index c8b4f199f7..e04e342805 100644 --- a/silkworm/rpc/core/account_dumper.cpp +++ b/silkworm/rpc/core/account_dumper.cpp @@ -81,7 +81,7 @@ Task AccountDumper::dump_accounts( co_await load_accounts(collected_data, dump_accounts, exclude_code); if (!exclude_storage) { - co_await load_storage(block_number, dump_accounts); + co_await load_storage(block_number + 1, dump_accounts); } co_return dump_accounts; @@ -109,7 +109,7 @@ Task AccountDumper::load_accounts(const std::vector& collected_d } } if (!exclude_code) { - auto code = co_await state_reader.read_code(account->code_hash); + auto code = co_await state_reader.read_code(dump_account.code_hash); dump_account.code.swap(code); } dump_accounts.accounts.insert(std::pair(address, dump_account)); diff --git a/silkworm/rpc/core/storage_walker.cpp b/silkworm/rpc/core/storage_walker.cpp index 393be27ea9..c368040125 100644 --- a/silkworm/rpc/core/storage_walker.cpp +++ b/silkworm/rpc/core/storage_walker.cpp @@ -79,6 +79,14 @@ Task next(ethdb::SplitCursor& cursor, BlockNum number, co_return skv; } +int StorageWalker::compare_empty_greater(const ByteView& key1, const ByteView& key2) { + if (key1.empty() && !key2.empty()) + return 1; + else if (!key1.empty() && key2.empty()) + return -1; + return key1.compare(key2); +} + Task StorageWalker::walk_of_storages( BlockNum block_number, const evmc::address& address, @@ -121,12 +129,12 @@ Task StorageWalker::walk_of_storages( if (ps_skv.key1.empty() && sh_skv.key1.empty()) { break; } - auto cmp = ps_skv.key1.compare(sh_skv.key1); + auto cmp = compare_empty_greater(ps_skv.key1, sh_skv.key1); if (cmp == 0) { if (ps_skv.key2.empty() && h_loc.empty()) { break; } - cmp = ps_skv.key2.compare(h_loc); + cmp = compare_empty_greater(ps_skv.key2, h_loc); } if (cmp < 0) { const auto ps_address = bytes_to_address(ps_skv.key1); diff --git a/silkworm/rpc/core/storage_walker.hpp b/silkworm/rpc/core/storage_walker.hpp index b053a934c7..b976d83f0d 100644 --- a/silkworm/rpc/core/storage_walker.hpp +++ b/silkworm/rpc/core/storage_walker.hpp @@ -60,6 +60,8 @@ class StorageWalker { StorageCollector& collector); private: + int compare_empty_greater(const ByteView& key1, const ByteView& key2); + db::kv::api::Transaction& transaction_; };