swarm icon indicating copy to clipboard operation
swarm copied to clipboard

standardize usage of BzzAddr and enode.IDs

Open acud opened this issue 6 years ago • 0 comments

The way we handle BzzAddr, BzzPeer and enode.IDs is very, very confusing. For a mere mortal, it is mostly unclear when the usage of any of the above is needed, and in which case to use any of them.

To add confusion on top of confusion, the devp2p handlers signature does not have any notion of BzzPeer. Swarm related protocols MUST be wrapped in the bzz.RunProtocol abstraction (this is not documented anywhere) and every protocol must implement two entry points for the protocol handlers - one for production code and one for testing purposes (example being runProtocol methods).

Important note is that the network.NewAddr is creating BzzAddr objects which are only to be used in tests, this is also not documented anywhere!!!. One might assume that this function creates real usable BzzAddr structs but this cannot be farther away from the truth!

acud avatar Jul 29 '19 13:07 acud