argumentcomputer / zk-light-clients

A collection of ZK light client libraries for various blockchains. (contact: @tchataigner)
33 stars 4 forks source link

Fishy serialization in `bytes()` #213

Closed huitseeker closed 2 weeks ago

huitseeker commented 2 months ago

https://github.com/argumentcomputer/zk-light-clients/blob/b20bfa84016031d4846fbe9019ece8a11ed0f80e/fixture-generator/src/bin/main.rs#L76-L87

pr.plonk_vkey_hash[..4] is such that pr.plonk_vkey_hash is a [u8; 32], so why serialize only the first 4 bytes?

huitseeker commented 2 months ago

Answering my own question with this: https://github.com/argumentcomputer/sphinx-contracts/blob/cb4520c63ff695d6a16fa2ad56001882ebf13591/contracts/src/SphinxVerifier.sol#L50

tchataigner commented 2 weeks ago

For information if anyone is wondering:

The proof’s prefix is actually a first 4 bytes of the plain VK that corresponds to a plonk circuit used in the sphinx/sp1. So the verifier rejects any proof generated by sphinx that has a different plonk circuit (this is the case when some precompile is added or removed for example).

Closing this issue