celestiaorg / celestiaorg/rsmt2d
`UnmarshalJSON` is limited to the default Tree
- Dominant language
- Go
- Stars
- 169
- Forks
- 87
- Avg merge
- 8h 9m
- Merged PRs (30d)
- 7
Description
## Problem
When we deserialize the EDS [we hardcode the default tree](https://github.com/celestiaorg/rsmt2d/blob/7a8fd8372e84ed73c2e42821b9bb2d0913d18bd1/extendeddatasquare.go#L40C88-L40C88). This is problematic because computed Row and Col roots of the deserialized eds will be utterly different if another custom tree is used.
## Solutions
1. Have a global tree constructor var/registry that `UnmarshalJSON` would use instead
* Users would then register their trees by name
* The name would be serialized in the json and deserialization would then get the proper tree by the name
* This is exactly what happens with the codec.
2. `UnmarshalEDS` func that accepts the tree.
* This works in theory, but https://github.com/filecoin-project/go-jsonrpc/blob/17a35772b24f59ceee25cc8d8177a2b255a659ac/client.go#L614 blocks it
* If we contribute an option that custom Unmarshall, then we would be able to inject the one for EDS
Contributor guide
Research direction
Start with extendeddatasquare.go and its UnmarshalJSON implementation, then review the linked go-jsonrpc client limitation and the codec behavior mentioned in the issue. Compare the two proposed approaches and confirm that deserializing an EDS built with a custom tree preserves the expected row and column roots; the issue currently leaves the implementation choice open.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100