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

Failing put test #108

Closed
wants to merge 1 commit into from
Closed

Failing put test #108

wants to merge 1 commit into from

Conversation

Frando
Copy link
Member

@Frando Frando commented Apr 7, 2020

I was looking into coupling hypercore-protocol-rs to hypercore today a bit.

However, I was unable to put any data into a cloned hypercore. It seems the put method either has a bug or I did not understand how to use it correctly.

This PR has a failing test. I added some comments on where I arrived at. @yoshuawuyts is my usage of the put method correct? Do you have some ideas why the results are wrong, or is this just unchartered territory and I'd have to investigate myself?

@Frando Frando changed the title Add failing put test Failing put test Apr 7, 2020
@yoshuawuyts
Copy link
Contributor

@Frando ooph; I don't remember how to use put correctly. I do remember it was really tricky to get it to work, so wouldn't be surprised if there was a bug present.

eprintln!("Proof: {:#?}", fmt_proof(&a_proof));

// When putting with data right away (line after next) without putting
// with data = None first, I get errors about "missing tree roots needed for verify".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Frando

i tried to figure out why it doesnt work unless you put None first
i reimplemented your failing test with js version of hypercore like this:
https://gist.github.com/khodzha/36eb72671a087e5e3ae2e0e8b03d55f8

and noticed that for the first hi node:

  • proof in js has 2 nodes with indices [2, 5]
  • proof in rust has 3 nodes, indices [0, 2, 5]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, this happens because of let a_proof = a.proof(i, true).unwrap();
without true proof has 2 nodes and is inserted without problem (although with wrong data 😬 )

btw if i do proof(i, {hash: true}) in js hypercore it will err with Error: Missing tree roots needed for verify too

@Frando Frando mentioned this pull request May 4, 2020
2 tasks
@Frando
Copy link
Member Author

Frando commented May 4, 2020

Great finds @khodzha. Closing this in favor of #110 and #111.

@Frando Frando closed this May 4, 2020
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.

None yet

3 participants