celestiaorg / go-square

A library for encoding blobs into a 2D square of evenly sized chunks designed for sampling and reconstruction
Apache License 2.0
12 stars 18 forks source link

Make `ShareProof` types available in go-square #55

Open damiannolan opened 3 months ago

damiannolan commented 3 months ago

Summary

From discussions with @nashqueue - the ShareProof types currently maintained in both celestia-app and celestia-core should be made available in go-square. This is to assist in the ibc story for rollups using celestia as a data availability provider.

Referring specifically to the types maintained in the links listed below:

We have been working on a light client for celestia data availability in ibc-go which would ideally consume go-square as a dependency. The implementation in progress currently has copied the both ShareProof and RowProof code in order to unmarshal the proof bytes into these types.

Perhaps celestia could benefit from adding the code in this repo and removing the duplication at both the app and core layers, however this may not be possible due to import cycles etc, I'm unaware if this would be a concern or not.

rootulp commented 3 months ago

Related: https://github.com/celestiaorg/celestia-core/issues/1182

rach-id commented 1 month ago

We can move these definitions to go-square, however, core will also need to depend on it

rach-id commented 1 month ago

Proposal:

Since many types are defined twice or three times between different repos, and type conversion gymnastics are always required. Why not create a separate project, which can reside with a separate go.mod in go-square, to contain all the exported types and types required to be used across multiple repos. I am not inclined towards having all the types in go-square because we have some types in repos that shouldn't depend on it. For example, nmt.Proof: https://github.com/celestiaorg/nmt/blob/3539dc8fbaf43d80a32d07c71d8f165b25b5531c/pb/proof.proto#L7-L22.

If we create that, we can move ShareProof, CommitmentProof, nmt.Proof, RowProof... and that package would be safe to import since it will only depend on protobuf/json (in case some types require specific marshallers). It can be imported from: core, app, node, nmt, celestia-openrpc, etc.

One more thing we could do is move also the tendermint specific types there: header for example, since it's needed in multiple repos like celestia-openrpc. Pros are we will have a single place for types. Cons are diverging more from upstream.