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

Change ProverServer::compress to work with Receipt #1726

Merged
merged 9 commits into from
Apr 27, 2024
Merged

Conversation

SchmErik
Copy link
Contributor

This change re-implements the compress function. We want the ability for a user to generate any kind of receipt using the Prover and ProverServer. In other words, we want to be able to translate composite receipts to succinct receipts, and succinct receipts into compact receipts to move up through the various receipt stages like so:

Composite -> Succinct -> Compact

In a previous PR, I've added a ReceiptKind field with in ProverOpts so that ProverImpl::prove_session can generate any kind of receipt specified by ProverOpts. In this PR, I changed the semantics of the Compress function to mean "for a given ProverOpts and Receipt, compress the receipt to the desired receipt kind". The following table illustrates the semantics of the new compress functionality:

InnerReceipt ReceiptFormat Result
Fake any no-op
Composite Composite no-op
Composite Succinct Composite -> Succinct
Composite Compact Composite -> Succinct -> Compact
Succinct Composite Error
Succinct Succinct no-op
Succinct Compact Succinct -> Compact
Compact Composite Error
Compact Succinct Error
Compact Compact no-op

In order to implement this, I realized that the existing compress function took a composite receipt and compressed it to a succinct receipt. I've renamed this to composite_to_succinct and created a similar succinct_to_compact function so that I can use the compress function to move up the various receipt types like so:

composite_to_succinct
          |   succinct_to_compact
          |           |
          V           V
Composite -> Succinct -> Compact
    ^                      ^
    |______________________|
          compress

This change re-implements the compress function. We want the ability for
a user to generate any kind of receipt using the Prover and ProverServer.
In other words, we want to be able to translate composite receipts to
succinct receipts, and succinct receipts into compact receipts to move
up through the various receipt stages like so:
```
Composite -> Succinct -> Compact
```
In a previous PR, I've added a `ReceiptKind` field with in `ProverOpts`
so that `ProverImpl::prove_session` can generate any kind of receipt
specified by `ProverOpts`. In this PR, I changed the semantics of the
Compress function to mean "for a given ProverOpts and Receipt, compress
the receipt to the desired receipt kind". The following table illustrates
the semantics of the new compress functionality:

| InnerReceipt | ReceiptFormat | Result                           |
|--------------|---------------|----------------------------------|
| Fake         | any           | no-op                            |
| Composite    | Composite     | no-op                            |
| Composite    | Succinct      | Composite -> Succinct            |
| Composite    | Compact       | Composite -> Succinct -> Compact |
| Succinct     | Composite     | Error                            |
| Succinct     | Succinct      | no-op                            |
| Succinct     | Compact       | Succinct -> Compact              |
| Compact      | Composite     | Error                            |
| Compact      | Succinct      | Error                            |
| Compact      | Compact       | no-op                            |

In order to implement this, I realized that the existing compress
function took a composite receipt and compressed it to a succinct
receipt. I've renamed this to `composite_to_succinct` and created a
similar `succinct_to_compact` function so that I can use the compress
function to move up the various receipt types like so:
```
composite_to_succinct
          |   succinct_to_compact
          |           |
          V           V
Composite -> Succinct -> Compact
    ^                      ^
    |______________________|
          compress
```
Copy link

vercel bot commented Apr 25, 2024

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

Name Status Preview Updated (UTC)
docs-website ✅ Ready (Inspect) Visit Preview Apr 27, 2024 11:00am
reports-and-benchmarks ✅ Ready (Inspect) Visit Preview Apr 27, 2024 11:00am

@SchmErik
Copy link
Contributor Author

@flaub this is the final change involving moving the stark2snark to the prover/provers server/proverImpl

@flaub
Copy link
Member

flaub commented Apr 25, 2024

I feel like this is missing a bunch of tests that basically covers the table above.

@SchmErik
Copy link
Contributor Author

@flaub tests have been written

@flaub flaub enabled auto-merge (squash) April 27, 2024 10:58
@flaub flaub merged commit 6190936 into main Apr 27, 2024
37 of 39 checks passed
@flaub flaub deleted the erik/change-compact branch April 27, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants