-
Notifications
You must be signed in to change notification settings - Fork 9
payy inclusion #87
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
base: main
Are you sure you want to change the base?
payy inclusion #87
Conversation
|
working to mock this & ensure easy performance wins are included for the patch here: https://github.com/nuke-web3/sp1-poseidon2-testing Would appreciate a look & collab on tweaks on that repo (& upstream) that we can include here |
nuke-web3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to wrap my head around how Payy sequencers and/or provers will retrieve data from this proof being posted to a settlement layer (Polygon in this case) and had a few notes:
| pub struct PayyInclusionToDataRootProofOutput { | ||
| pub data_root: [u8; 32], | ||
| // The Payy hash of the leaves, a bn254 scalar field element represented as [u8; 32]. | ||
| pub payy_commitment: [u8; 32], | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, we will post this data to Polygon, so we have a agg_agg proof committed to, not all leaves (total 24 Poseidon2 hashes). correct? And the data root is connected in merkle proof for a recent blobstream DataRootTupleRoot right?
So ultimately if I wanted to sync up a Payy node with any update posted to DA, I would need to:
- Find the Celestia block with
data_root. - Search all blobs within that block until I find one with 24 leaf hashes together become the
payy_commitment. (Possible to filter on Payy's known namespace{s})
I think blobstream needs a block height so we could connect root->height from what is on Polygon on a related contract. If not, AFAIK there is no direct API to get blobs from Celestia from only a data root. Some indexing for data roots -> block height is needed. If we can't get what we need from Polygon, maybe we should commit the height too so extra infra isn't required.
Could be that we assume it's not a big deal to search a Celestia block for reconstructing known payy_commitments. If not, committing more metadata in the proof output so you can directly call blob.Get to retrieve the specific data you need would be helpful. At least blob commitment if assume the namespace is public common knowledge so unneeded, and we have block height from some other cheap method.
| // the ~8 UTXO hashes for a Payy block, bn254 scalar field elements represented as [u8; 32]. | ||
| pub hashes: Vec<[u8; 32]>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think now we need this to be 24 exactly, perhaps known & enforced at compile time, unsure if it will ever be different.
| // the ~8 UTXO hashes for a Payy block, bn254 scalar field elements represented as [u8; 32]. | |
| pub hashes: Vec<[u8; 32]>, | |
| // the ~8 UTXO hashes for a Payy block, bn254 scalar field elements represented as [u8; 32]. | |
| pub hashes: [[u8; 32]; 24], |
3 user proofs on UTXOs (that include 4 hashes) -> 2 UTXO_agg -> 1 agg_agg proof.
From https://excalidraw.com/#json=qq9tvy6-Z3i4LRw0aVPbN,8u_rJ0LFt9P9Rk-YDqb5GA
program-payy-inclusion/src/main.rs
Outdated
|
|
||
| println!("cycle-tracker-start: create blob"); | ||
| let blob = | ||
| Blob::new(input.namespace_id, input.data, AppVersion::V3).expect("Failed creating blob"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Blob::new(input.namespace_id, input.data, AppVersion::V3).expect("Failed creating blob"); | |
| Blob::new(input.namespace_id, input.data, AppVersion::V4).expect("Failed creating blob"); |
need to test against latest node versions.
program-payy-inclusion/src/main.rs
Outdated
| .expect("Failed verifying proof"); | ||
| println!("cycle-tracker-end: verify proof"); | ||
|
|
||
| let computed_payy_commitment: [u8; 32] = compute_payy_commitment(&input.hashes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guess this is unimplimented!() at this time and needs to be connected to work in https://github.com/polybase/zk-rollup/pull/1709 IIUC.
| env_logger = "0.11" | ||
| log = "0.4" | ||
| base64 = "0.22" | ||
| sp1-bn254-poseidon = {git = "https://github.com/S1nus/sp1-poseidon2-bn254-scalar"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably we should publish this on crates & version it before merging this PR? 🤷 at least tag a version?
nuke-web3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overview
Payy commitment (poseidon2 on bn254 scalars) equivalence proofs