We have different constructions of the Share and Namespace types across celestia repos. We should converge on types and have them standardised across repos.
type Namespace struct {
data []byte
}
type Share struct {
data []byte
}
We have decided to encapsulate the types as this completely prevents users from misusing them (i.e. incorrect length).
Encapsulation also allows us to make changes in the future that don't break users such as caching certain bytes in the struct i.e. namespace in the share struct.
The other option considered was to use type Namespace []byte
Summary
We have different constructions of the Share and Namespace types across celestia repos. We should converge on types and have them standardised across repos.
https://github.com/celestiaorg/celestia-node/blob/762bd93b1b6242bdd5660172d1b32fcade144a8c/share/namespace.go#L34
https://github.com/celestiaorg/go-square/blob/fd78256df076539ef5e13cd271276f058a167d8c/namespace/namespace.go#L8-L11
https://github.com/celestiaorg/celestia-node/blob/762bd93b1b6242bdd5660172d1b32fcade144a8c/share/share.go#L29
https://github.com/celestiaorg/go-square/blob/fd78256df076539ef5e13cd271276f058a167d8c/shares/shares.go#L12-L14
Proposal
Agreed upon types:
We have decided to encapsulate the types as this completely prevents users from misusing them (i.e. incorrect length).
Encapsulation also allows us to make changes in the future that don't break users such as caching certain bytes in the struct i.e. namespace in the share struct.
The other option considered was to use
type Namespace []byte
For Admin Use