Skip to content

Commit

Permalink
rpcdaemon: fix in debug_getRawHeader/debug_getRawBlock in case of hea…
Browse files Browse the repository at this point in the history
…der/block not found (#2618)
  • Loading branch information
lupin012 authored Dec 23, 2024
1 parent b0ce84b commit 15e8dc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rpc-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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 v1.28.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
git -c advice.detachedHead=false clone --depth 1 --branch v1.29.0 https://github.com/erigontech/rpc-tests ${{runner.workspace}}/rpc-tests
cd ${{runner.workspace}}/rpc-tests
pip3 install -r requirements.txt --break-system-packages
Expand Down
8 changes: 4 additions & 4 deletions silkworm/rpc/commands/debug_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ Task<void> DebugRpcApi::handle_debug_get_raw_block(const nlohmann::json& request
reply = make_json_content(request, silkworm::to_hex(encoded_block, true));
} catch (const std::invalid_argument& iv) {
SILK_ERROR << "exception: " << iv.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInvalidParams, iv.what());
reply = make_json_error(request, kServerError, iv.what());
} catch (const std::exception& e) {
SILK_ERROR << "exception: " << e.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInternalError, e.what());
Expand Down Expand Up @@ -740,14 +740,14 @@ Task<void> DebugRpcApi::handle_debug_get_raw_header(const nlohmann::json& reques
const auto block_hash = co_await chain_storage->read_canonical_header_hash(block_num);
const auto header = co_await chain_storage->read_header(block_num, block_hash->bytes);
if (!header) {
throw std::invalid_argument("header " + std::to_string(block_num) + " not found");
throw std::invalid_argument("header not found");
}
Bytes encoded_header;
rlp::encode(encoded_header, *header);
reply = make_json_content(request, silkworm::to_hex(encoded_header, true));
} catch (const std::invalid_argument& iv) {
SILK_ERROR << "exception: " << iv.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInvalidParams, iv.what());
reply = make_json_error(request, kServerError, iv.what());
} catch (const std::exception& e) {
SILK_ERROR << "exception: " << e.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInternalError, e.what());
Expand Down Expand Up @@ -783,7 +783,7 @@ Task<void> DebugRpcApi::handle_debug_get_raw_transaction(const nlohmann::json& r
reply = make_json_content(request, silkworm::to_hex(rlp, true));
} catch (const std::invalid_argument& iv) {
SILK_WARN << "invalid_argument: " << iv.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInvalidParams, iv.what());
reply = make_json_error(request, kServerError, iv.what());
} catch (const std::exception& e) {
SILK_ERROR << "exception: " << e.what() << " processing request: " << request.dump();
reply = make_json_error(request, kInternalError, e.what());
Expand Down

0 comments on commit 15e8dc9

Please sign in to comment.