Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpcdaemon: fixes on debug_accountRange #2247

Merged
merged 7 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rpc-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions silkworm/rpc/core/account_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Task<DumpAccounts> 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;
Expand Down Expand Up @@ -109,7 +109,7 @@ Task<void> AccountDumper::load_accounts(const std::vector<KeyValue>& 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<evmc::address, DumpAccount>(address, dump_account));
Expand Down
12 changes: 10 additions & 2 deletions silkworm/rpc/core/storage_walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ Task<ethdb::SplittedKeyValue> 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<void> StorageWalker::walk_of_storages(
BlockNum block_number,
const evmc::address& address,
Expand Down Expand Up @@ -121,12 +129,12 @@ Task<void> 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);
Expand Down
2 changes: 2 additions & 0 deletions silkworm/rpc/core/storage_walker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class StorageWalker {
StorageCollector& collector);

private:
int compare_empty_greater(const ByteView& key1, const ByteView& key2);

db::kv::api::Transaction& transaction_;
};

Expand Down
Loading