diff --git a/.github/workflows/run_integration_tests.sh b/.github/workflows/run_integration_tests.sh index e6cacced5d..106cae4c03 100755 --- a/.github/workflows/run_integration_tests.sh +++ b/.github/workflows/run_integration_tests.sh @@ -10,7 +10,6 @@ set +e # Disable exit on error cd "$1" || exit 1 rm -rf ./mainnet/results/ -# eth_getBlockReceipts/test_07.json new blobFields # debug_accountRange: new algo using TKV # debug_storageRangeAt: new algo using TKV # debug_traceCall/test_02.json: requested is_latest fix to support ethbackend @@ -55,7 +54,6 @@ debug_traceTransaction/test_96.json,\ engine_,\ erigon_getBalanceChangesInBlock,\ erigon_getLatestLogs,\ -eth_getBlockReceipts/test_07.json,\ eth_getLogs,\ ots_getTransactionBySenderAndNonce/test_04.json,\ ots_getTransactionBySenderAndNonce/test_07.json,\ diff --git a/silkworm/rpc/core/receipts.cpp b/silkworm/rpc/core/receipts.cpp index 6b93d5249f..744fc101c5 100644 --- a/silkworm/rpc/core/receipts.cpp +++ b/silkworm/rpc/core/receipts.cpp @@ -47,6 +47,7 @@ Task get_receipts(db::kv::api::Transaction& tx, const silkworm::BlockW } auto& receipts = *raw_receipts; + auto& header = block_with_hash.block.header; // Add derived fields to the receipts auto& transactions = block_with_hash.block.transactions; @@ -64,6 +65,13 @@ Task get_receipts(db::kv::api::Transaction& tx, const silkworm::BlockW receipts[i].block_hash = block_hash; receipts[i].block_number = block_number; + if (!transactions[i].blob_versioned_hashes.empty()) { + receipts[i].blob_gas_used = kGasPerBlob * transactions[i].blob_versioned_hashes.size(); + if (header.excess_blob_gas) { + receipts[i].blob_gas_price = header.blob_gas_price(); + } + } + // When tx receiver is not set, create a contract with address depending on tx sender and its nonce if (!transactions[i].to.has_value()) { receipts[i].contract_address = create_address(*transactions[i].sender(), transactions[i].nonce); diff --git a/silkworm/rpc/core/receipts.hpp b/silkworm/rpc/core/receipts.hpp index 6343ad934c..e1aef6901d 100644 --- a/silkworm/rpc/core/receipts.hpp +++ b/silkworm/rpc/core/receipts.hpp @@ -26,6 +26,8 @@ namespace silkworm::rpc::core { +static constexpr int kGasPerBlob = 0x20000; + Task get_receipts(db::kv::api::Transaction& tx, const silkworm::BlockWithHash& block_with_hash, const db::chain::ChainStorage& chain_storage, WorkerPool& workers); Task> read_receipts(db::kv::api::Transaction& tx, BlockNum block_number); diff --git a/silkworm/rpc/json/receipt.cpp b/silkworm/rpc/json/receipt.cpp index 4c4fecb1c9..9ee099e341 100644 --- a/silkworm/rpc/json/receipt.cpp +++ b/silkworm/rpc/json/receipt.cpp @@ -47,6 +47,13 @@ void to_json(nlohmann::json& json, const Receipt& receipt) { json["logs"] = receipt.logs; json["logsBloom"] = "0x" + silkworm::to_hex(full_view(receipt.bloom)); json["status"] = to_quantity(receipt.success ? 1 : 0); + + if (receipt.blob_gas_used) { + json["blobGasUsed"] = to_quantity(*(receipt.blob_gas_used)); + } + if (receipt.blob_gas_price) { + json["blobGasPrice"] = to_quantity(*(receipt.blob_gas_price)); + } } void from_json(const nlohmann::json& json, Receipt& receipt) { diff --git a/silkworm/rpc/types/receipt.hpp b/silkworm/rpc/types/receipt.hpp index 64a2ce1c16..5e78d27265 100644 --- a/silkworm/rpc/types/receipt.hpp +++ b/silkworm/rpc/types/receipt.hpp @@ -46,6 +46,8 @@ struct Receipt { std::optional to; std::optional type{std::nullopt}; // EIP-2718 intx::uint256 effective_gas_price{0}; + std::optional blob_gas_used{std::nullopt}; // EIP-4844 + std::optional> blob_gas_price{std::nullopt}; // EIP-4844 }; std::ostream& operator<<(std::ostream& out, const Receipt& r);