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

[feat] Add script that extends program arguments with Utreexo state and inclusion proofs #220

Conversation

Jeanmichel7
Copy link
Collaborator

@Jeanmichel7 Jeanmichel7 commented Sep 25, 2024

Execute script

cd packages/client && scarb run utreexo [block start] [block end] #default 0 200
  • Generates block sequences in the .client_cache file
  • Generates Utreexo on these blocks
  • Generates data in client/tests/utreexo
  • Test 10'000blocks

Hash outpoint from Cairo corelib

cd packages/consensus && scarb cairo-test -f test_poseidon1
//ref oupoint hash : 0x1E8BBC31DA001E7EBACAEBC83DF1FD241040B9525ADEECEADBBC7045C6D1876

Hash outpoint from Python script

cd packages/client/ && scarb run utreexo
// Output point hash: 0x1E8BBC31DA001E7EBACAEBC83DF1FD241040B9525ADEECEADBBC7045C6D1876

The hash appears to be correctly created, added to the Utreexo, and then deleted from the Utreexo in block 170.

Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
raito ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 26, 2024 5:21pm

@Jeanmichel7 Jeanmichel7 changed the title [feat] Integrate new sources of data into generate_data.py [feat] Add script that extends program arguments with Utreexo state and inclusion proofs Sep 25, 2024
@Jeanmichel7 Jeanmichel7 marked this pull request as ready for review September 25, 2024 01:08
@m-kus
Copy link
Collaborator

m-kus commented Sep 25, 2024

Yeah, there's no reference to compare unfortunately, but the point here mostly is to test that our Cairo accumulator behaves as expected.

What is the exact issue with cached field?

@Jeanmichel7
Copy link
Collaborator Author

Yeah, there's no reference to compare unfortunately, but the point here mostly is to test that our Cairo accumulator behaves as expected.

What is the exact issue with cached field?

When I hash the outpoint to delete, the cache is not the same as when I added it, so booom.

example:
utxo spends block 170 tx f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16
input.outpoint.hash = false

block9 (original)
input.cache = true

I don't really understand why we have values set to true when retrieving data from the RPC, is that normal?

@m-kus
Copy link
Collaborator

m-kus commented Sep 25, 2024

output.cached is a hint, it's not part of the PRC response.
I'm not sure I get it, probably you meant that input.outpoint.data.cached (block 170) != output.cached (block 9)?
If so, then there's an error in the script.
Cached flag is set to true only if the output is spent within the same block.

@Jeanmichel7
Copy link
Collaborator Author

output.cached is a hint, it's not part of the PRC response. I'm not sure I get it, probably you meant that input.outpoint.data.cached (block 170) != output.cached (block 9)? If so, then there's an error in the script. Cached flag is set to true only if the output is spent within the same block.

Yes, that's right, sorry I wrote nonsense.
I use generate_data.py to generate my sequence of blocks, it defines if it's cached or not
I'm not supposed to modify the cache right?

Maybe an error in generate_data or I missed something

@m-kus
Copy link
Collaborator

m-kus commented Sep 25, 2024

Basically, if you see an output with cached=true you don't need to add/remove it to/from the accumulator.

@Jeanmichel7
Copy link
Collaborator Author

Jeanmichel7 commented Sep 26, 2024

Basically, if you see an output with cached=true you don't need to add/remove it to/from the accumulator.

I think the problem came from the generate_data.py script l284
utxo_set = {} was defined before looping through all the blocks, so it defined the cached according to the first block traversed and not from the same block.

@Jeanmichel7 Jeanmichel7 marked this pull request as ready for review September 26, 2024 17:26
@m-kus m-kus merged commit 46da45e into keep-starknet-strange:main Sep 27, 2024
7 checks passed
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.

[feat] Add script that extends program arguments with Utreexo state and inclusion proofs
2 participants