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

Always prove to produce proofs for BatchProofs #1540

Open
wants to merge 10 commits into
base: nightly
Choose a base branch
from

Conversation

kpp
Copy link
Contributor

@kpp kpp commented Nov 29, 2024

Description

We run every seqcom on l1 block in execute mode (no proving but producing fake receipts).
So we have to implement producing fake proof for all batch proofs but with sampling to produce a real proof once a day.

In order to do that there is a new proving mode: prove-with-fakes.

Linked Issues

Testing

I tested locally for:

index e4bb86e5..37228afa 100644
--- a/bin/citrea/tests/bitcoin_e2e/light_client_test.rs
+++ b/bin/citrea/tests/bitcoin_e2e/light_client_test.rs
@@ -45,6 +45,7 @@ impl TestCase for LightClientProvingTest {
     fn batch_prover_config() -> BatchProverConfig {
         BatchProverConfig {
             enable_recovery: false,
+            proof_sampling_number: 999999999usize,
             ..Default::default()
         }
     }
@@ -52,6 +53,7 @@ impl TestCase for LightClientProvingTest {
     fn light_client_prover_config() -> LightClientProverConfig {
         LightClientProverConfig {
             enable_recovery: false,
+            proof_sampling_number: 0,
             ..Default::default()
         }
     }
@@ -453,7 +455,7 @@ impl TestCase for LightClientProvingTestMultipleProofs {
 }

So light client proving for fake batch proofs works.

@kpp kpp changed the title Kpp/always prove batch Always prove to produce proofs for BatchProofs Nov 29, 2024
Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explained in DMs

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I misunderstood

crates/prover-services/src/lib.rs Show resolved Hide resolved
crates/prover-services/src/parallel/mod.rs Outdated Show resolved Hide resolved
crates/prover-services/src/parallel/mod.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 3, 2024

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure light client proofs with work with fake proofs and real proofs? (running in dev mode ofc)

@kpp
Copy link
Contributor Author

kpp commented Dec 4, 2024

Yes. Before we added a new proving mode prove-with-fakes I tested it with:

index e4bb86e5..37228afa 100644
--- a/bin/citrea/tests/bitcoin_e2e/light_client_test.rs
+++ b/bin/citrea/tests/bitcoin_e2e/light_client_test.rs
@@ -45,6 +45,7 @@ impl TestCase for LightClientProvingTest {
     fn batch_prover_config() -> BatchProverConfig {
         BatchProverConfig {
             enable_recovery: false,
+            proof_sampling_number: 999999999usize,
             ..Default::default()
         }
     }
@@ -52,6 +53,7 @@ impl TestCase for LightClientProvingTest {
     fn light_client_prover_config() -> LightClientProverConfig {
         LightClientProverConfig {
             enable_recovery: false,
+            proof_sampling_number: 0,
             ..Default::default()
         }
     }
@@ -453,7 +455,7 @@ impl TestCase for LightClientProvingTestMultipleProofs {
 }

I can't do it now with prover-with-fakes though, because BatchProverConfig is in citrea-e2e repo.

@yaziciahmet
Copy link
Contributor

yaziciahmet commented Dec 5, 2024

I don't quite understand the motivation behind this PR. As far as I observed:

  • if prove specified, we don’t call prove-l1 at all unless random sampling satisfies
  • if prove-with-fakes specified, we always call prove-l1, but we randomly decide in prover-service to generate either fake or real proofs in a per-proof basis

What is the effect of this to fullnodes? How will fullnodes know whether the proof is fake or not when verifying if some of them can be fake and some of them can be real?

How will this be used in conjunction with the RISC0_DEV_MODE env variable?

What does this bring us in general?

@eyusufatik
Copy link
Member

I don't quite understand the motivation behind this PR. As far as I observed:

  • if prove specified, we don’t call prove-l1 at all unless random sampling satisfies
  • if prove-with-fakes specified, we always call prove-l1, but we randomly decide in prover-service to generate either fake or real proofs in a per-proof basis

What is the effect of this to fullnodes? How will fullnodes know whether the proof is fake or not when verifying if some of them can be fake and some of them can be real?

How will this be used in conjunction with the RISC0_DEV_MODE env variable?

What does this bring us in general?

we get to test da consumption and gather logs on testnet without any additional costs.

looks like our testnet zk aproach will be based on this

Comment on lines 266 to 271
ProofGenMode::ProveWithSampling => {
// `make_proof` is called with a probability in this case.
// When it's called, we have to produce a real proof.
vm.run(elf, true)
}
ProofGenMode::ProveWithSamplingWithFakeProofs(proof_sampling_number) => {
Copy link
Contributor

@yaziciahmet yaziciahmet Dec 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only nit I have is that ProveWithSampling is a bit confusing to me, because in the eyes of ProverService it is just Prove, and sampling happens above in the call stack in da_block_handler. So i think we should just call them Prove and ProveWithSampling respectively, so its obvious from the ProofGenMode whether ProverService should do any sampling itself.

I am not going to block the PR for this nit, but would love to see this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what if instead of sampling on per proof basis for ProveWithSamplingWithFakeProofs, we sample per DA block. Meaning, we again decide the sampling on da_block_handler level, but what we decide is to whether proofs in current DA should be run in execute or prove mode. It would simplify the flow quite a bit. Just throwing this out as a thought. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked with Esad, the approach doesn't matter much in this PR. We may open a new issue as a followup

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.

Testnet light client proofs without proving new proof sampling with fake receipts
3 participants