diff --git a/core/network/adapters/protobuf_block_request.hpp b/core/network/adapters/protobuf_block_request.hpp index e7cff08514..608409ce3d 100644 --- a/core/network/adapters/protobuf_block_request.hpp +++ b/core/network/adapters/protobuf_block_request.hpp @@ -41,11 +41,6 @@ namespace kagome::network { msg.set_number(&n, sizeof(n)); }); - // Note: request.to is not used in substrate - if (t.to.has_value()) { - msg.set_to_block(t.to->toString()); - } - msg.set_direction(static_cast<::api::v1::Direction>(t.direction)); if (t.max.has_value()) { @@ -89,12 +84,6 @@ namespace kagome::network { return AdaptersError::UNEXPECTED_VARIANT; } - if (not msg.to_block().empty()) { - OUTCOME_TRY(to_block, - primitives::BlockHash::fromString(msg.to_block())); - out.to.emplace(to_block); - } - if (msg.max_blocks() > 0) { out.max.emplace(msg.max_blocks()); } diff --git a/core/network/impl/protocols/sync_protocol_impl.cpp b/core/network/impl/protocols/sync_protocol_impl.cpp index 713c42a100..f4cc045bd7 100644 --- a/core/network/impl/protocols/sync_protocol_impl.cpp +++ b/core/network/impl/protocols/sync_protocol_impl.cpp @@ -240,10 +240,6 @@ namespace kagome::network { logmsg += fmt::format(", from {}", from); }); - if (block_request.to.has_value()) { - logmsg += fmt::format(" to {}", block_request.to.value()); - } - logmsg += block_request.direction == Direction::ASCENDING ? " anc" : " desc"; @@ -435,10 +431,6 @@ namespace kagome::network { logmsg += fmt::format(" from {}", from); }); - if (block_request.to.has_value()) { - logmsg += fmt::format(" to {}", block_request.to.value()); - } - logmsg += block_request.direction == Direction::ASCENDING ? " anc" : " desc"; diff --git a/core/network/impl/synchronizer_impl.cpp b/core/network/impl/synchronizer_impl.cpp index 5229f40789..94195f3da0 100644 --- a/core/network/impl/synchronizer_impl.cpp +++ b/core/network/impl/synchronizer_impl.cpp @@ -418,7 +418,6 @@ namespace kagome::network { network::BlocksRequest request{network::BlockAttribute::HEADER, hint, - std::nullopt, network::Direction::ASCENDING, 1}; @@ -592,7 +591,6 @@ namespace kagome::network { network::BlocksRequest request{attributesForSync(sync_method_), from.hash, - std::nullopt, network::Direction::ASCENDING, std::nullopt}; @@ -825,7 +823,6 @@ namespace kagome::network { BlocksRequest request{ BlockAttribute::HEADER | BlockAttribute::JUSTIFICATION, target_block.hash, - std::nullopt, Direction::ASCENDING, limit}; diff --git a/core/network/protobuf/api.v1.proto b/core/network/protobuf/api.v1.proto index b51137d1d5..203b157470 100644 --- a/core/network/protobuf/api.v1.proto +++ b/core/network/protobuf/api.v1.proto @@ -23,8 +23,6 @@ message BlockRequest { // Start with given block number. bytes number = 3; } - // End at this block. An implementation defined maximum is used when unspecified. - bytes to_block = 4; // optional // Sequence direction. Direction direction = 5; // Maximum number of blocks to return. An implementation defined maximum is used when unspecified. diff --git a/core/network/types/blocks_request.hpp b/core/network/types/blocks_request.hpp index b2893c73a3..236ffa5b81 100644 --- a/core/network/types/blocks_request.hpp +++ b/core/network/types/blocks_request.hpp @@ -25,9 +25,6 @@ namespace kagome::network { BlockAttributes fields{}; /// start from this block primitives::BlockId from{}; - /// end at this block; an implementation defined maximum is used when - /// unspecified - std::optional to{}; /// sequence direction Direction direction{}; /// maximum number of blocks to return; an implementation defined maximum is @@ -58,11 +55,6 @@ struct std::hash { boost::hash_combine( result, std::hash()(blocks_request.from)); - boost::hash_combine( - result, - std::hash>()( - blocks_request.to)); - boost::hash_combine( result, std::hash()(blocks_request.direction)); diff --git a/test/core/network/sync_protocol_observer_test.cpp b/test/core/network/sync_protocol_observer_test.cpp index 2e784939cd..7de886fc28 100644 --- a/test/core/network/sync_protocol_observer_test.cpp +++ b/test/core/network/sync_protocol_observer_test.cpp @@ -71,7 +71,6 @@ TEST_F(SynchronizerTest, ProcessRequest) { // GIVEN BlocksRequest received_request{BlocksRequest::kBasicAttributes, block3_hash_, - std::nullopt, Direction::ASCENDING, std::nullopt}; diff --git a/test/core/network/types/protobuf_block_request_test.cpp b/test/core/network/types/protobuf_block_request_test.cpp index 5ac9e9fb75..59bb8823f2 100644 --- a/test/core/network/types/protobuf_block_request_test.cpp +++ b/test/core/network/types/protobuf_block_request_test.cpp @@ -29,12 +29,6 @@ struct ProtobufBlockRequestAdapterTest : public ::testing::Test { BlockHash::fromHex("11111403ba5b6a3f3bd0b0604ce439a78244" "c7d43b127ec35cd8325602dd47fd")); request.from = hash_from; - - EXPECT_OUTCOME_TRUE( - hash_to, - BlockHash::fromHex("22221403ba5b6a3f3bd0b0604ce439a78244" - "c7d43b127ec35cd8325602dd47fd")); - request.to = hash_to; } BlocksRequest request; @@ -58,5 +52,4 @@ TEST_F(ProtobufBlockRequestAdapterTest, Serialization) { ASSERT_EQ(r2.max, request.max); ASSERT_EQ(r2.fields, request.fields); ASSERT_EQ(r2.from, request.from); - ASSERT_EQ(r2.to, request.to); }