Failing put test#108
Conversation
|
@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". |
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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
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
putmethod correct? Do you have some ideas why the results are wrong, or is this just unchartered territory and I'd have to investigate myself?