diff --git a/silkworm/silkrpc/core/cached_chain_test.cpp b/silkworm/silkrpc/core/cached_chain_test.cpp index e2f77b60..f45bc9eb 100644 --- a/silkworm/silkrpc/core/cached_chain_test.cpp +++ b/silkworm/silkrpc/core/cached_chain_test.cpp @@ -118,6 +118,7 @@ TEST_CASE("read_block_by_number_or_hash") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_number_or_hash(cache, db_reader, bnoh), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -129,6 +130,7 @@ TEST_CASE("read_block_by_number_or_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_number_or_hash(cache, db_reader, bnoh), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -140,6 +142,7 @@ TEST_CASE("read_block_by_number_or_hash") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_number_or_hash(cache, db_reader, bnoh), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -158,6 +161,7 @@ TEST_CASE("silkworm::core::read_block_by_number") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, core::read_block_by_number(cache, db_reader, bn), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -168,6 +172,7 @@ TEST_CASE("silkworm::core::read_block_by_number") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { Bytes key{}; Bytes value{*silkworm::from_hex( @@ -194,6 +199,7 @@ TEST_CASE("silkworm::core::read_block_by_number") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, core::read_block_by_number(cache, db_reader, bn), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -202,6 +208,7 @@ TEST_CASE("silkworm::core::read_block_by_number") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([]() -> boost::asio::awaitable { co_return; })); auto result1 = boost::asio::co_spawn(pool, core::read_block_by_number(cache, db_reader, bn), boost::asio::use_future); const std::shared_ptr bwh1 = result1.get(); @@ -219,6 +226,7 @@ TEST_CASE("silkworm::core::read_block_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { Bytes key{}; Bytes value{*silkworm::from_hex( @@ -241,6 +249,7 @@ TEST_CASE("silkworm::core::read_block_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { Bytes key{}; Bytes value{*silkworm::from_hex( @@ -265,6 +274,7 @@ TEST_CASE("silkworm::core::read_block_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, core::read_block_by_hash(cache, db_reader, bh), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -273,6 +283,7 @@ TEST_CASE("silkworm::core::read_block_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([]() -> boost::asio::awaitable { co_return; })); auto result1 = boost::asio::co_spawn(pool, core::read_block_by_hash(cache, db_reader, bh), boost::asio::use_future); const std::shared_ptr bwh1 = result1.get(); @@ -348,6 +359,7 @@ TEST_CASE("read_block_by_transaction_hash") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_transaction_hash(cache, db_reader, transaction_hash), boost::asio::use_future); const silkworm::BlockWithHash bwh = result.get(); @@ -385,6 +397,7 @@ TEST_CASE("read_transaction_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_transaction_by_hash(cache, db_reader, transaction_hash), boost::asio::use_future); CHECK(result.get() == std::nullopt); @@ -396,6 +409,7 @@ TEST_CASE("read_transaction_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNotEmptyBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { Bytes key{}; Bytes value{*silkworm::from_hex( diff --git a/silkworm/silkrpc/core/evm_trace_test.cpp b/silkworm/silkrpc/core/evm_trace_test.cpp index 5b5cf3c6..ac153c0f 100644 --- a/silkworm/silkrpc/core/evm_trace_test.cpp +++ b/silkworm/silkrpc/core/evm_trace_test.cpp @@ -3841,6 +3841,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue3; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); // TransactionDatabase::walk: TABLE BlockTransaction static Bytes kBlockTransactionKey1{*silkworm::from_hex("0000000005c62e66")}; @@ -5334,6 +5335,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue2; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); BlockCache block_cache; std::shared_ptr mock_cursor = std::make_shared(); @@ -5418,6 +5420,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue2; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); BlockCache block_cache; std::shared_ptr mock_cursor = std::make_shared(); @@ -5476,6 +5479,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue2; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); BlockCache block_cache; std::shared_ptr mock_cursor = std::make_shared(); @@ -5591,6 +5595,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue2; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); BlockCache block_cache; std::shared_ptr mock_cursor = std::make_shared(); @@ -5675,6 +5680,7 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_filter") { .WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockBodyValue2; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillRepeatedly(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); BlockCache block_cache; std::shared_ptr mock_cursor = std::make_shared(); diff --git a/silkworm/silkrpc/core/rawdb/chain_test.cpp b/silkworm/silkrpc/core/rawdb/chain_test.cpp index ada4f739..3cda1e64 100644 --- a/silkworm/silkrpc/core/rawdb/chain_test.cpp +++ b/silkworm/silkrpc/core/rawdb/chain_test.cpp @@ -346,6 +346,7 @@ TEST_CASE("read_block_by_hash") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_hash(db_reader, block_hash), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -420,6 +421,7 @@ TEST_CASE("read_block_by_number") { EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBlockHash; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block_by_number(db_reader, block_number), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -493,6 +495,7 @@ TEST_CASE("read_block") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return silkworm::Bytes{}; })); + //EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); auto result = boost::asio::co_spawn(pool, read_block(db_reader, block_hash, block_number), boost::asio::use_future); #ifdef SILKWORM_SANITIZE // Avoid comparison against exception message: it triggers a TSAN data race seemingly related to libstdc++ string implementation CHECK_THROWS_AS(result.get(), std::runtime_error); @@ -506,6 +509,7 @@ TEST_CASE("read_block") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return silkworm::Bytes{0x00, 0x01}; })); + //EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); auto result = boost::asio::co_spawn(pool, read_block(db_reader, block_hash, block_number), boost::asio::use_future); CHECK_THROWS_AS(result.get(), std::runtime_error); } @@ -515,6 +519,7 @@ TEST_CASE("read_block") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return *silkworm::from_hex("c68369000003c0"); })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block(db_reader, block_hash, block_number), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -526,6 +531,7 @@ TEST_CASE("read_block") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return; })); auto result = boost::asio::co_spawn(pool, read_block(db_reader, block_hash, block_number), boost::asio::use_future); const std::shared_ptr bwh = result.get(); @@ -681,6 +687,7 @@ TEST_CASE("read_body") { const auto block_hash{0x439816753229fc0736bf86a5048de4bc9fcdede8c91dadf88c828c76b2281dff_bytes32}; const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return silkworm::Bytes{}; })); + //EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); auto result = boost::asio::co_spawn(pool, read_body(db_reader, block_hash, block_number), boost::asio::use_future); #ifdef SILKWORM_SANITIZE // Avoid comparison against exception message: it triggers a TSAN data race seemingly related to libstdc++ string implementation CHECK_THROWS_AS(result.get(), std::runtime_error); @@ -1008,6 +1015,7 @@ TEST_CASE("read_receipts") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { silkworm::Bytes key{}; silkworm::Bytes value{*silkworm::from_hex( @@ -1038,6 +1046,7 @@ TEST_CASE("read_receipts") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { silkworm::Bytes key{}; silkworm::Bytes value{*silkworm::from_hex( @@ -1097,7 +1106,7 @@ TEST_CASE("read_receipts") { EXPECT_CALL(db_reader, get_one(db::table::kHeaderNumbersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kNumber; })); EXPECT_CALL(db_reader, get_one(db::table::kHeadersName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kHeader; })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); - + EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); EXPECT_CALL(db_reader, walk(db::table::kBlockTransactionsName, _, _, _)).WillOnce(Invoke([](Unused, Unused, Unused, Walker w) -> boost::asio::awaitable { silkworm::Bytes key1{}; silkworm::Bytes value1{*silkworm::from_hex( @@ -1418,6 +1427,7 @@ TEST_CASE("read_cumulative_transaction_count") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return *silkworm::from_hex("9816753229fc0736bf86a5048de4bc9fcdede8c91dadf88c828c76b2281dff"); })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return kBody; })); + //EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); auto result = boost::asio::co_spawn(pool, read_cumulative_transaction_count(db_reader, block_number), boost::asio::use_future); CHECK(result.get() == 6939740); } @@ -1442,6 +1452,7 @@ TEST_CASE("read_cumulative_transaction_count") { const uint64_t block_number{4'000'000}; EXPECT_CALL(db_reader, get_one(db::table::kCanonicalHashesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return *silkworm::from_hex("9816753229fc0736bf86a5048de4bc9fcdede8c91dadf88c828c76b2281dff"); })); EXPECT_CALL(db_reader, get_one(db::table::kBlockBodiesName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return silkworm::Bytes{0x00, 0x01}; })); + //EXPECT_CALL(db_reader, get_one(db::table::kExtraBlockDataName, _)).WillOnce(InvokeWithoutArgs([]() -> boost::asio::awaitable { co_return Bytes{}; })); auto result = boost::asio::co_spawn(pool, read_cumulative_transaction_count(db_reader, block_number), boost::asio::use_future); CHECK_THROWS_AS(result.get(), std::runtime_error); }