Currently Crust Service is generic over Uid trait. This trait is used for service ID and spreads throughout the whole code base. To make Service use simpler we will remove the ID type parameter and use a specific ID structure instead.
Advantages
This will simplify Crust code base a lot. E.g. CrustData is generic over Uid and this requires EventLoopCore<UID> and EventLoop<UID> to be generic which are used in Crust States, so they have to be generic as well, etc. E.g. see BootstrapState
Disadvantages
Routing uses a tuple of (pub_sign_key, pub_encrypt_key) to identify peers. To satisfy Routing needs Crust would need to associate public signing key with public encryption key. So in this case Crust would be holding redundant data - public signing key.
Although, given that data signing could quite common operation in p2p networks, that might not be a big issue. Also, for users that don't need signing keys, we could provide a helper ID constructor, say:
Currently Crust
Service
is generic overUid
trait. This trait is used for service ID and spreads throughout the whole code base. To makeService
use simpler we will remove the ID type parameter and use a specific ID structure instead.Advantages
This will simplify Crust code base a lot. E.g. CrustData is generic over
Uid
and this requiresEventLoopCore<UID>
andEventLoop<UID>
to be generic which are used in CrustState
s, so they have to be generic as well, etc. E.g. see BootstrapStateDisadvantages
Routing uses a tuple of
(pub_sign_key, pub_encrypt_key)
to identify peers. To satisfy Routing needs Crust would need to associate public signing key with public encryption key. So in this case Crust would be holding redundant data - public signing key.Although, given that data signing could quite common operation in p2p networks, that might not be a big issue. Also, for users that don't need signing keys, we could provide a helper ID constructor, say:
Anyway, this is out of the scope of this issue.
API
The new proposed
Service
API with regard to ID management is:Then Crust users would fill the values of
PeerId
and pass it to Crust constructor.