Skip to content

Commit 8032923

Browse files
turuslankamilsa
andauthored
fix injector compiler error (#269)
Signed-off-by: turuslan <[email protected]> Co-authored-by: kamilsa <[email protected]>
1 parent 9a077cf commit 8032923

5 files changed

Lines changed: 69 additions & 70 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
MacOS:
13-
runs-on: macos-14
13+
runs-on: macos-15
1414
steps:
1515
- uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6
1616
- name: venv
@@ -31,8 +31,7 @@ jobs:
3131
CTEST_OUTPUT_ON_FAILURE: 1
3232
run: cmake --build build --target test
3333
Linux-gcc:
34-
runs-on: ubuntu-latest
35-
container: qdrvm/kagome-dev@sha256:2d70246c32418a3dd45c246d3f5c2dd99bdafde145b903271849affe476c4cfc
34+
runs-on: ubuntu-24.04
3635
steps:
3736
- uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6
3837
- name: venv

include/libp2p/injector/host_injector.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ namespace libp2p::injector {
3030
makeNetworkInjector<InjectorConfig>(),
3131

3232
// repositories
33-
di::bind<peer::PeerRepository>.template to<peer::PeerRepositoryImpl>(),
34-
di::bind<peer::AddressRepository>.template to<peer::InmemAddressRepository>(),
35-
di::bind<peer::KeyRepository>.template to<peer::InmemKeyRepository>(),
36-
di::bind<peer::ProtocolRepository>.template to<peer::InmemProtocolRepository>(),
33+
di::bind<peer::PeerRepository>.to<peer::PeerRepositoryImpl>(),
34+
di::bind<peer::AddressRepository>.to<peer::InmemAddressRepository>(),
35+
di::bind<peer::KeyRepository>.to<peer::InmemKeyRepository>(),
36+
di::bind<peer::ProtocolRepository>.to<peer::InmemProtocolRepository>(),
3737

38-
di::bind<Libp2pClientVersion>.template to(Libp2pClientVersion{"cpp-libp2p"}),
38+
di::bind<Libp2pClientVersion>.to(Libp2pClientVersion{"cpp-libp2p"}),
3939

40-
di::bind<Host>.template to<host::BasicHost>(),
40+
di::bind<Host>.to<host::BasicHost>(),
4141

4242
// user-defined overrides...
4343
std::forward<decltype(args)>(args)...

include/libp2p/injector/kademlia_injector.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace libp2p::injector {
7070
typename C = std::decay_t<T>,
7171
typename = std::enable_if<std::is_same_v<C, protocol::kademlia::Config>>>
7272
inline auto useKademliaConfig(T &&c) {
73-
return boost::di::bind<C>().template to(
73+
return boost::di::bind<C>().to(
7474
[c = std::forward<C>(c)](const auto &injector) mutable -> const C & {
7575
static C instance = std::move(c);
7676
return instance;
@@ -85,15 +85,15 @@ namespace libp2p::injector {
8585
return di::make_injector<InjectorConfig>(
8686
// clang-format off
8787

88-
di::bind<protocol::kademlia::Config>.template to<protocol::kademlia::Config>(),
89-
di::bind<protocol::kademlia::ContentRoutingTable>.template to<protocol::kademlia::ContentRoutingTableImpl>(),
90-
di::bind<protocol::kademlia::PeerRoutingTable>.template to<protocol::kademlia::PeerRoutingTableImpl>(),
91-
di::bind<protocol::kademlia::StorageBackend>.template to<protocol::kademlia::StorageBackendDefault>(),
92-
di::bind<protocol::kademlia::Storage>.template to<protocol::kademlia::StorageImpl>(),
93-
di::bind<protocol::kademlia::Validator>.template to<protocol::kademlia::ValidatorDefault>(),
88+
di::bind<protocol::kademlia::Config>.to<protocol::kademlia::Config>(),
89+
di::bind<protocol::kademlia::ContentRoutingTable>.to<protocol::kademlia::ContentRoutingTableImpl>(),
90+
di::bind<protocol::kademlia::PeerRoutingTable>.to<protocol::kademlia::PeerRoutingTableImpl>(),
91+
di::bind<protocol::kademlia::StorageBackend>.to<protocol::kademlia::StorageBackendDefault>(),
92+
di::bind<protocol::kademlia::Storage>.to<protocol::kademlia::StorageImpl>(),
93+
di::bind<protocol::kademlia::Validator>.to<protocol::kademlia::ValidatorDefault>(),
9494

95-
di::bind<protocol::kademlia::MessageObserver>.template to<protocol::kademlia::KademliaImpl>(),
96-
di::bind<protocol::kademlia::Kademlia>.template to<protocol::kademlia::KademliaImpl>(),
95+
di::bind<protocol::kademlia::MessageObserver>.to<protocol::kademlia::KademliaImpl>(),
96+
di::bind<protocol::kademlia::Kademlia>.to<protocol::kademlia::KademliaImpl>(),
9797

9898
// user-defined overrides...
9999
std::forward<decltype(args)>(args)...

include/libp2p/injector/network_injector.hpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace libp2p::injector {
149149
* @endcode
150150
*/
151151
inline auto useKeyPair(crypto::KeyPair key_pair) {
152-
return boost::di::bind<crypto::KeyPair>().template to(
152+
return boost::di::bind<crypto::KeyPair>().to(
153153
std::move(key_pair))[boost::di::override];
154154
}
155155

@@ -168,7 +168,7 @@ namespace libp2p::injector {
168168
cert_res.error());
169169
}
170170
}
171-
return boost::di::bind<layer::WssCertificate>.template to(
171+
return boost::di::bind<layer::WssCertificate>.to(
172172
std::move(cert))[boost::di::override];
173173
}
174174

@@ -199,7 +199,7 @@ namespace libp2p::injector {
199199
*/
200200
template <typename C>
201201
inline auto useConfig(C &&c) {
202-
return boost::di::bind<std::decay<C>>().template to(
202+
return boost::di::bind<std::decay<C>>().to(
203203
std::forward<C>(c))[boost::di::override];
204204
}
205205

@@ -221,7 +221,7 @@ namespace libp2p::injector {
221221
template <typename... AdaptorImpl>
222222
inline auto useLayerAdaptors() {
223223
return boost::di::bind<layer::LayerAdaptor *[]>() // NOLINT
224-
.template to<AdaptorImpl...>()[boost::di::override];
224+
.to<AdaptorImpl...>()[boost::di::override];
225225
}
226226

227227
/**
@@ -242,7 +242,7 @@ namespace libp2p::injector {
242242
template <typename... SecImpl>
243243
inline auto useSecurityAdaptors() {
244244
return boost::di::bind<security::SecurityAdaptor *[]>() // NOLINT
245-
.template to<SecImpl...>()[boost::di::override];
245+
.to<SecImpl...>()[boost::di::override];
246246
}
247247

248248
/**
@@ -255,7 +255,7 @@ namespace libp2p::injector {
255255
template <typename... MuxerImpl>
256256
inline auto useMuxerAdaptors() {
257257
return boost::di::bind<muxer::MuxerAdaptor *[]>() // NOLINT
258-
.template to<MuxerImpl...>()[boost::di::override];
258+
.to<MuxerImpl...>()[boost::di::override];
259259
}
260260

261261
/**
@@ -268,7 +268,7 @@ namespace libp2p::injector {
268268
template <typename... TransportImpl>
269269
inline auto useTransportAdaptors() {
270270
return boost::di::bind<transport::TransportAdaptor *[]>() // NOLINT
271-
.template to<TransportImpl...>()[boost::di::override];
271+
.to<TransportImpl...>()[boost::di::override];
272272
}
273273

274274
/**
@@ -305,47 +305,47 @@ namespace libp2p::injector {
305305

306306
// clang-format off
307307
return di::make_injector<InjectorConfig>(
308-
di::bind<crypto::random::RandomGenerator>.template to<crypto::random::BoostRandomGenerator>(),
308+
di::bind<crypto::random::RandomGenerator>.to<crypto::random::BoostRandomGenerator>(),
309309

310-
di::bind<crypto::KeyPair>().template to(std::move(keypair)),
311-
di::bind<crypto::random::CSPRNG>().template to(std::move(csprng)),
312-
di::bind<crypto::ed25519::Ed25519Provider>().template to(std::move(ed25519_provider)),
313-
di::bind<crypto::rsa::RsaProvider>().template to(std::move(rsa_provider)),
314-
di::bind<crypto::ecdsa::EcdsaProvider>().template to(std::move(ecdsa_provider)),
315-
di::bind<crypto::secp256k1::Secp256k1Provider>().template to(std::move(secp256k1_provider)),
316-
di::bind<crypto::aes::AesCtr>().template to<crypto::aes::AesCtrImpl>(),
317-
di::bind<crypto::hmac::HmacProvider>().template to<crypto::hmac::HmacProviderImpl>(),
318-
di::bind<crypto::CryptoProvider>().template to<crypto::CryptoProviderImpl>(),
319-
di::bind<crypto::marshaller::KeyMarshaller>().template to<crypto::marshaller::KeyMarshallerImpl>(),
320-
di::bind<peer::IdentityManager>().template to<peer::IdentityManagerImpl>(),
321-
di::bind<crypto::validator::KeyValidator>().template to<crypto::validator::KeyValidatorImpl>(),
322-
di::bind<security::plaintext::ExchangeMessageMarshaller>().template to<security::plaintext::ExchangeMessageMarshallerImpl>(),
323-
di::bind<security::secio::ProposeMessageMarshaller>().template to<security::secio::ProposeMessageMarshallerImpl>(),
324-
di::bind<security::secio::ExchangeMessageMarshaller>().template to<security::secio::ExchangeMessageMarshallerImpl>(),
325-
di::bind<layer::WsConnectionConfig>.template to(layer::WsConnectionConfig{}),
326-
di::bind<layer::WssCertificate>.template to(layer::WssCertificate{}),
310+
di::bind<crypto::KeyPair>().to(std::move(keypair)),
311+
di::bind<crypto::random::CSPRNG>().to(std::move(csprng)),
312+
di::bind<crypto::ed25519::Ed25519Provider>().to(std::move(ed25519_provider)),
313+
di::bind<crypto::rsa::RsaProvider>().to(std::move(rsa_provider)),
314+
di::bind<crypto::ecdsa::EcdsaProvider>().to(std::move(ecdsa_provider)),
315+
di::bind<crypto::secp256k1::Secp256k1Provider>().to(std::move(secp256k1_provider)),
316+
di::bind<crypto::aes::AesCtr>().to<crypto::aes::AesCtrImpl>(),
317+
di::bind<crypto::hmac::HmacProvider>().to<crypto::hmac::HmacProviderImpl>(),
318+
di::bind<crypto::CryptoProvider>().to<crypto::CryptoProviderImpl>(),
319+
di::bind<crypto::marshaller::KeyMarshaller>().to<crypto::marshaller::KeyMarshallerImpl>(),
320+
di::bind<peer::IdentityManager>().to<peer::IdentityManagerImpl>(),
321+
di::bind<crypto::validator::KeyValidator>().to<crypto::validator::KeyValidatorImpl>(),
322+
di::bind<security::plaintext::ExchangeMessageMarshaller>().to<security::plaintext::ExchangeMessageMarshallerImpl>(),
323+
di::bind<security::secio::ProposeMessageMarshaller>().to<security::secio::ProposeMessageMarshallerImpl>(),
324+
di::bind<security::secio::ExchangeMessageMarshaller>().to<security::secio::ExchangeMessageMarshallerImpl>(),
325+
di::bind<layer::WsConnectionConfig>.to(layer::WsConnectionConfig{}),
326+
di::bind<layer::WssCertificate>.to(layer::WssCertificate{}),
327327

328-
di::bind<basic::Scheduler::Config>.template to(basic::Scheduler::Config{}),
329-
di::bind<basic::SchedulerBackend>().template to<basic::AsioSchedulerBackend>(),
330-
di::bind<basic::Scheduler>().template to<basic::SchedulerImpl>(),
328+
di::bind<basic::Scheduler::Config>.to(basic::Scheduler::Config{}),
329+
di::bind<basic::SchedulerBackend>().to<basic::AsioSchedulerBackend>(),
330+
di::bind<basic::Scheduler>().to<basic::SchedulerImpl>(),
331331

332332
// internal
333-
di::bind<network::DnsaddrResolver>().template to <network::DnsaddrResolverImpl>(),
334-
di::bind<network::Router>().template to<network::RouterImpl>(),
335-
di::bind<network::ConnectionManager>().template to<network::ConnectionManagerImpl>(),
336-
di::bind<network::ListenerManager>().template to<network::ListenerManagerImpl>(),
337-
di::bind<network::Dialer>().template to<network::DialerImpl>(),
338-
di::bind<network::Network>().template to<network::NetworkImpl>(),
339-
di::bind<network::TransportManager>().template to<network::TransportManagerImpl>(),
340-
di::bind<transport::Upgrader>().template to<transport::UpgraderImpl>(),
341-
di::bind<protocol_muxer::ProtocolMuxer>().template to<protocol_muxer::multiselect::Multiselect>(),
333+
di::bind<network::DnsaddrResolver>().to <network::DnsaddrResolverImpl>(),
334+
di::bind<network::Router>().to<network::RouterImpl>(),
335+
di::bind<network::ConnectionManager>().to<network::ConnectionManagerImpl>(),
336+
di::bind<network::ListenerManager>().to<network::ListenerManagerImpl>(),
337+
di::bind<network::Dialer>().to<network::DialerImpl>(),
338+
di::bind<network::Network>().to<network::NetworkImpl>(),
339+
di::bind<network::TransportManager>().to<network::TransportManagerImpl>(),
340+
di::bind<transport::Upgrader>().to<transport::UpgraderImpl>(),
341+
di::bind<protocol_muxer::ProtocolMuxer>().to<protocol_muxer::multiselect::Multiselect>(),
342342

343343
// default adaptors
344-
di::bind<muxer::MuxedConnectionConfig>.template to(muxer::MuxedConnectionConfig{}),
345-
di::bind<layer::LayerAdaptor *[]>().template to<layer::WsAdaptor, layer::WssAdaptor>(), // NOLINT
346-
di::bind<security::SecurityAdaptor *[]>().template to<security::Plaintext, security::Secio, security::Noise, security::TlsAdaptor>(), // NOLINT
347-
di::bind<muxer::MuxerAdaptor *[]>().template to<muxer::Yamux, muxer::Mplex>(), // NOLINT
348-
di::bind<transport::TransportAdaptor *[]>().template to<transport::TcpTransport, transport::QuicTransport>(), // NOLINT
344+
di::bind<muxer::MuxedConnectionConfig>.to(muxer::MuxedConnectionConfig{}),
345+
di::bind<layer::LayerAdaptor *[]>().to<layer::WsAdaptor, layer::WssAdaptor>(), // NOLINT
346+
di::bind<security::SecurityAdaptor *[]>().to<security::Plaintext, security::Secio, security::Noise, security::TlsAdaptor>(), // NOLINT
347+
di::bind<muxer::MuxerAdaptor *[]>().to<muxer::Yamux, muxer::Mplex>(), // NOLINT
348+
di::bind<transport::TransportAdaptor *[]>().to<transport::TcpTransport, transport::QuicTransport>(), // NOLINT
349349

350350
// user-defined overrides...
351351
std::forward<decltype(args)>(args)...

test/libp2p/muxer/muxers_and_streams_test.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -523,70 +523,70 @@ TEST(StreamsRegression, YamuxStreamsGetNotifiedAboutEOF) {
523523
testStreamsGetNotifiedAboutEOF(
524524
false,
525525
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
526-
.template to<libp2p::muxer::Yamux>()[boost::di::override]);
526+
.to<libp2p::muxer::Yamux>()[boost::di::override]);
527527
}
528528

529529
TEST(StreamsRegression, YamuxStreamsGetNotifiedAboutEOFJumboMsg) {
530530
testStreamsGetNotifiedAboutEOF(
531531
true,
532532
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
533-
.template to<libp2p::muxer::Yamux>()[boost::di::override]);
533+
.to<libp2p::muxer::Yamux>()[boost::di::override]);
534534
}
535535

536536
TEST(StreamsRegression, MplexStreamsGetNotifiedAboutEOF) {
537537
testStreamsGetNotifiedAboutEOF(
538538
false,
539539
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
540-
.template to<libp2p::muxer::Mplex>()[boost::di::override]);
540+
.to<libp2p::muxer::Mplex>()[boost::di::override]);
541541
}
542542

543543
TEST(StreamsRegression, OutboundMplexConnectionAcceptsStreams) {
544544
testOutboundConnectionAcceptsStreams(
545545
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
546-
.template to<libp2p::muxer::Mplex>()[boost::di::override]);
546+
.to<libp2p::muxer::Mplex>()[boost::di::override]);
547547
}
548548

549549
TEST(StreamsRegression, OutboundYamuxConnectionAcceptsStreams) {
550550
testOutboundConnectionAcceptsStreams(
551551
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
552-
.template to<libp2p::muxer::Yamux>()[boost::di::override]);
552+
.to<libp2p::muxer::Yamux>()[boost::di::override]);
553553
}
554554

555555
TEST(StreamsRegression, OutboundYamuxTLSConnectionAcceptsStreams) {
556556
testOutboundConnectionAcceptsStreams(
557557
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
558-
.template to<libp2p::muxer::Yamux>()[boost::di::override],
558+
.to<libp2p::muxer::Yamux>()[boost::di::override],
559559
libp2p::injector::useSecurityAdaptors<libp2p::security::TlsAdaptor>());
560560
}
561561

562562
TEST(StreamsRegression, YamuxTLSStreamsGetNotifiedAboutEOF) {
563563
testStreamsGetNotifiedAboutEOF(
564564
false,
565565
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
566-
.template to<libp2p::muxer::Yamux>()[boost::di::override],
566+
.to<libp2p::muxer::Yamux>()[boost::di::override],
567567
libp2p::injector::useSecurityAdaptors<libp2p::security::TlsAdaptor>());
568568
}
569569

570570
TEST(StreamsRegression, OutboundYamuxNoiseConnectionAcceptsStreams) {
571571
testOutboundConnectionAcceptsStreams(
572572
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
573-
.template to<libp2p::muxer::Yamux>()[boost::di::override],
573+
.to<libp2p::muxer::Yamux>()[boost::di::override],
574574
libp2p::injector::useSecurityAdaptors<libp2p::security::Noise>());
575575
}
576576

577577
TEST(StreamsRegression, YamuxNoiseStreamsGetNotifiedAboutEOF) {
578578
testStreamsGetNotifiedAboutEOF(
579579
false,
580580
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
581-
.template to<libp2p::muxer::Yamux>()[boost::di::override],
581+
.to<libp2p::muxer::Yamux>()[boost::di::override],
582582
libp2p::injector::useSecurityAdaptors<libp2p::security::Noise>());
583583
}
584584

585585
TEST(StreamsRegression, YamuxNoiseStreamsGetNotifiedAboutEOFJumboMsg) {
586586
testStreamsGetNotifiedAboutEOF(
587587
true,
588588
boost::di::bind<libp2p::muxer::MuxerAdaptor *[]>()
589-
.template to<libp2p::muxer::Yamux>()[boost::di::override],
589+
.to<libp2p::muxer::Yamux>()[boost::di::override],
590590
libp2p::injector::useSecurityAdaptors<libp2p::security::Noise>());
591591
}
592592

0 commit comments

Comments
 (0)