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

Reverse trie key bit ordering #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

arkpar
Copy link
Contributor

@arkpar arkpar commented Oct 8, 2024

As per changes in GP 0.4.0

@sourabhniyogi
Copy link

Thanks for this -- We are able to pass this.

sourabhniyogi added a commit to jam-duna/jamtestnet that referenced this pull request Oct 18, 2024
Based on w3f/jamtestvectors#14

Also:
* jam-duna: assurances first trace: just 1 epoch
* add note re bootstrap services, adjust codec => bin in README
@vekexasia
Copy link

vekexasia commented Dec 17, 2024

The test files included in this pr are not matching what is written in graypaper.

Leaf with |v|<=32 is encoded wrongly by performing a bitwise or of [1,0] and the length of |v|.

in case |v| is = 1 (for example) its binary repr is 00 00 00 01 . Graypaper says we should use the first 6 which corresponds to 00 00 00 but the tests here do a different thing.
image

vs

 if len(v) <= 32:
        head = 0b10000000 | len(v)
        return bytes([head]) + k[:-1] + v + ((32 - len(v)) * b'\0')

TBH the implementation here makes more sense than taking the first 6 digits considering |v|<=32.

I just wanted to write it down so that we know its currently out of spec (0.5.2) but may become the correct tests in a future GP release.

@arkpar
Copy link
Contributor Author

arkpar commented Dec 18, 2024

@vekexasia Thank you for noticing this. Should be fixed in the spec:
gavofyork/graypaper#168

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

Successfully merging this pull request may close these issues.

3 participants