qdrvm / kagome

Kagome - C++20 implementation of Polkadot Host
https://kagome.readthedocs.io
Apache License 2.0
158 stars 33 forks source link

Utils library for KAGOME and Libp2p #1813

Closed kamilsa closed 2 months ago

kamilsa commented 1 year ago

During internal team discussion it was decided that we need to create a separate library for common utils that are used among KAGOME, Libp2p and possible scale-codec libraries. In future we may easily extend this library, to more easily use it in our projects

Such library can include the following components:

Upgraded outcome::result

It is recognized by the team, that the way current outcome::result is used limits the ability to properly identify the source of error. Currently, it stores std::error_code inside, while internal error type could be extended to keep information such as:

Optional refence

Currently we manually define std::optional<std::reference_wrapper> in many places in the code. It makes sense to define an optional_reference type that would replace std::optional<std::reference_wrapper>

Buffer, BufferView, Blob

Hex utils

Literals

Literals from common/literals testutil/literals

turuslan commented 4 months ago