chainwayxyz / citrea

Citrea, Bitcoin's First ZK Rollup 🍊🍋
https://citrea.xyz
GNU General Public License v3.0
129 stars 28 forks source link

Assert proof outputs #1345

Closed eyusufatik closed 3 weeks ago

eyusufatik commented 1 month ago

On full nodes we verify the ZK proofs on DA, however, some of the outputs has to be checked against known data as these are trusted inputs to the ZK circuit.

These are:

eyusufatik commented 3 weeks ago

Remove validity condition

Figure out if prev batch hash is asserted in stf to be equal to the first soft confirmation run

figure out if initial state root passed is actually the one used in verifying merkle proofs (it's passed as hint)

remove final state root from input

yaziciahmet commented 3 weeks ago
  1. 1446

  2. Yes, it is asserted:
    assert_eq!(
    soft_confirmations[index_soft_confirmation].prev_hash(),
    previous_batch_hash,
    "Soft confirmation previous hash must match the hash of the block before"
    );
  3. 1449

  4. 1449

eyusufatik commented 3 weeks ago

Yes, it is asserted: assert_eq!( soft_confirmations[index_soft_confirmation].prev_hash(), previous_batch_hash, "Soft confirmation previous hash must match the hash of the block before" );

if so, cant we use the prev hash from soft confirmation instead of giving it as an input :D

eyusufatik commented 3 weeks ago
yaziciahmet commented 3 weeks ago

We already verify sequencer pubkeys in fullnodes:

        let batch_proof_output = Vm::extract_output::<
            <Da as DaService>::Spec,
            BatchProofCircuitOutputV2<<Da as DaService>::Spec, StateRoot>,
        >(&proof)
        .expect("Proof should be deserializable");
        if batch_proof_output.sequencer_da_public_key != self.sequencer_da_pub_key
            || batch_proof_output.sequencer_public_key != self.sequencer_pub_key
        {
            return Err(anyhow!(
                "Proof verification: Sequencer public key or sequencer da public key mismatch. Skipping proof."
            ).into());
        }