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

HAMT key serialization is not compliant with spec #900

Open
ZenGround0 opened this issue Sep 23, 2022 · 1 comment
Open

HAMT key serialization is not compliant with spec #900

ZenGround0 opened this issue Sep 23, 2022 · 1 comment
Milestone

Comments

@ZenGround0
Copy link

Filecoin HAMTs need to have byte serializing keys to be compliant with the spec and the conforming implementation used by lotus. However the implementation as it stands accepts arbitrary cbor serializable key types.

For existing code ported from specs-actors this hasn't caused issues because actors HAMTs have so far always needed to match bytes created by go HAMTs so they handle this on the caller site by converting ints (for example) into keys that serialize as bytes.

In the new world where we develop state in rust first with rust builtin actors this is a problem. This recently led to an issue with the helix token type having integer keys, causing lotus integration to fail to load the HAMT root.

We should enforce that HAMT key types implement a trait converting them to bytes and then serialize these bytes directly. This way the compiler will prevent this sort of problem from happening again.

@lemmih
Copy link
Contributor

lemmih commented Oct 12, 2022

Looks like this issue should be done together with #958.

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

3 participants