Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state of the world for this ADL #17

Open
mvdan opened this issue May 11, 2021 · 0 comments
Open

state of the world for this ADL #17

mvdan opened this issue May 11, 2021 · 0 comments

Comments

@mvdan
Copy link
Contributor

mvdan commented May 11, 2021

The following is done:

  • Creating new HAMTs with arbitrary parameters, or filecoin actors v3 parameters: Prototype, Builder, etc.
  • Thanks to the above, we can decode existing HAMT blocks too.
  • Using a HAMT in a read-only way, including following links.

The following are the major TODOs. The code has a few more inline TODOs, but they're mostly minor.

  1. A good way to modify an existing HAMT.

Right now, the best way would be to set up a new builder, copy all previous key-values we want to keep, and add new key-values. This is inefficient, especially with large maps.

A better way, as discussed with @mikeal some time ago, would be to batch a series of map changes (sets, deletes, etc) and produce a single new HAMT node with those changes. For example, if 10 operations all require re-balancing the same bucket, we'd do all of those steps in memory and only produce a new IPLD node (and possibly new encoded blocks and CIDs) at the very end, reducing churn and cost.

Note that ipld-prime nodes are immutable by design. Once you have an ipld.Node value, it can't be modified in-place. So a "modify" API would take a HAMT node value and return a new one, even if a large portion of the tree is unmodified and reused as-is.

  1. The Reify API; e.g. going from a data model HAMT node to the ADL node, assuming the same shape.

  2. More practical testing against Filecoin HAMTs, as they are by far the HAMTs that we deal with the most.

Right now we just have one test, TestFilecoinBasic. More should be added to test more edge cases, and we should also try swapping out go-hamt-ipld for go-ipld-adl-hamt in one or two projects using Filecoin HAMTs directly. Ideally one of the projects that would benefit from ipld-prime the most, such as needing selectors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant