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

Interactive verifier #379

Merged
merged 59 commits into from
Dec 5, 2023
Merged

Interactive verifier #379

merged 59 commits into from
Dec 5, 2023

Conversation

th4s
Copy link
Member

@th4s th4s commented Oct 27, 2023

This PR implements functionality for an interactive verifier, who works without using commitments.

  • Improve code organization in prover and verifier crates
  • Decouple substring proving from commitments
  • Introduce proofs based on garbled circuit labels
  • Modify tlsn-core and introduce new types for the new verify flow
  • Add verify flow to tlsn-prover and tlsn-verifier

I still need to add some tests and currently debugging an error, but opened it for early feedback.

@th4s th4s marked this pull request as ready for review October 31, 2023 12:31
@th4s th4s requested review from sinui0 and themighty1 October 31, 2023 12:31
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

Cool 🔥

I didn't review at a high resolution, will share this feedback first then circle back

tlsn/tlsn-core/Cargo.toml Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/msg.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/proof/mod.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/proof/session.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/http/mod.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/error.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/session/data.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/proof/substring/label.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/Cargo.toml Outdated Show resolved Hide resolved
@th4s th4s changed the base branch from dev to v0.1.0-alpha.3 October 31, 2023 23:40
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

Almost there. I do think it would be beneficial to create a TranscriptRanges type which I think covers most of the functionality that you're trying to add in the substring/transcript module.

tlsn/tlsn-core/src/proof/substring/transcript.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/state.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/session/data.rs Outdated Show resolved Hide resolved
tlsn/tlsn-core/src/proof/mod.rs Outdated Show resolved Hide resolved
@th4s th4s force-pushed the interactive-verifier branch from 23cedd3 to 0df63b7 Compare November 7, 2023 12:52
@th4s th4s changed the base branch from v0.1.0-alpha.3 to feature/stream-cipher-zk November 8, 2023 11:53
@th4s th4s requested a review from sinui0 November 8, 2023 11:53
Base automatically changed from feature/stream-cipher-zk to dev November 18, 2023 08:50
@th4s th4s force-pushed the interactive-verifier branch from 1608645 to 955ec80 Compare November 19, 2023 11:09
@sinui0
Copy link
Member

sinui0 commented Nov 19, 2023

should be able to rebase on dev now

@th4s
Copy link
Member Author

th4s commented Nov 20, 2023

it is already.

@th4s th4s force-pushed the interactive-verifier branch from 0a300d7 to 7d4a727 Compare November 20, 2023 08:03
@sinui0 sinui0 changed the base branch from dev to v0.1.0-alpha.3 December 1, 2023 02:40
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

Couple small things, otherwise lgtm

tlsn/tlsn-prover/src/tls/prove.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/error.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/prove.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/prove.rs Outdated Show resolved Hide resolved
tlsn/tlsn-prover/src/tls/prove.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/error.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Outdated Show resolved Hide resolved
tlsn/tlsn-verifier/src/tls/verify.rs Show resolved Hide resolved
@th4s th4s merged commit 08e74bc into v0.1.0-alpha.3 Dec 5, 2023
@th4s th4s deleted the interactive-verifier branch December 5, 2023 16:32
themighty1 added a commit to themighty1/tlsn that referenced this pull request Jan 4, 2024
* Added necessary state and state transitions

* Move Prover future into its own module

* Put phase-specific prover code into its own modules

* Make `ProverFuture` public again

* Added `Into` from `Closed` to `Verify` for `Prover` state transition

* Added first part of finalize method for `Prover<Verify>`

* Rename `SessionData` to `NotarizedSessionData` and introduce
`SessionData` for interactive verifier flow

* Added first sketches for HttpProver and Prover with Verifier state

* Introduced wrapper `ServerInfo`

`ServerInfo` is generated by `SessionData` and is the non-notarization
version of `SessionProof`

* Crate `ServerInfo` from `SessionData` in Prover<Verify> flow

* Introduced another module for direct substring proofs.

* WIP: Added dirty first version of prover flow...

* Move `RangeCollector` and restore substring module

* Tidy up tlsn-core and finish first version of prover flow for dealing
with a verifier

* Refactored verifier

* Added `Verify` state for `Verifier`

* WIP: Added first draft for verify flow...

* Added more parts of verifier flow

* Adapt tests to new api changes

* Add some logging and improve code here and there

* Added `ProofBuilder` trait and started implementing it for `SubstringsProofBuilder`

* WIP: Tinkering with lifetimes...

* Resolved lifetime issues

* Refactor module `proof` to support another implementor of `SubstringProofBuilder`

* WIP: Adding `LabelProofBuilder`...

* Streamlined api

* Improved decoding flow

* Include lengths in `LabelProof`

* Improved structure of `LabelProof` and finished `verify`

* Added integration test for verify flow

* Add tests for `LabelProof`

* Improve test for `LabelProof::verify`

* Make tlsn compile without `tlsn-formats`

* Restore `tlsn-formats` from `dev` and temporarily remove from workspace

* Add first batch of feedback

* Add further feedback

* Separated decoding from finalization

* Add warning comment to `Verifier::receive`

* Remove unnecessary traits

* Adapt test

* Repair notarize integration test

* Add `decode` call to prover for verify integration test

* Simplified `LabelProof` and renamed to `TranscriptProof`

* Add range check to `reconstruct`

* Roll back changes to `tlsn-prover/src/http`

* Rename `Verify` to `Prove`

* Added more feedback

* Various code improvements

* Remove `SessionData`

* Restore naming of `TlsProof` and `SessionData`

* Improve error handling

* Adapt prove-verify flow to new API

* Finalize VM first

* Fix prover closing connection too early

* Add correct server certificate and assert correct redactions

* Fix imports after rebase

* Fix api test in `tlsn-core`

* Add feedback

* Fix linting in integration test

Co-authored-by: th4s <th4s@metavoid.xyz>
th4s added a commit that referenced this pull request Jan 9, 2024
* Added necessary state and state transitions

* Move Prover future into its own module

* Put phase-specific prover code into its own modules

* Make `ProverFuture` public again

* Added `Into` from `Closed` to `Verify` for `Prover` state transition

* Added first part of finalize method for `Prover<Verify>`

* Rename `SessionData` to `NotarizedSessionData` and introduce
`SessionData` for interactive verifier flow

* Added first sketches for HttpProver and Prover with Verifier state

* Introduced wrapper `ServerInfo`

`ServerInfo` is generated by `SessionData` and is the non-notarization
version of `SessionProof`

* Crate `ServerInfo` from `SessionData` in Prover<Verify> flow

* Introduced another module for direct substring proofs.

* WIP: Added dirty first version of prover flow...

* Move `RangeCollector` and restore substring module

* Tidy up tlsn-core and finish first version of prover flow for dealing
with a verifier

* Refactored verifier

* Added `Verify` state for `Verifier`

* WIP: Added first draft for verify flow...

* Added more parts of verifier flow

* Adapt tests to new api changes

* Add some logging and improve code here and there

* Added `ProofBuilder` trait and started implementing it for `SubstringsProofBuilder`

* WIP: Tinkering with lifetimes...

* Resolved lifetime issues

* Refactor module `proof` to support another implementor of `SubstringProofBuilder`

* WIP: Adding `LabelProofBuilder`...

* Streamlined api

* Improved decoding flow

* Include lengths in `LabelProof`

* Improved structure of `LabelProof` and finished `verify`

* Added integration test for verify flow

* Add tests for `LabelProof`

* Improve test for `LabelProof::verify`

* Make tlsn compile without `tlsn-formats`

* Restore `tlsn-formats` from `dev` and temporarily remove from workspace

* Add first batch of feedback

* Add further feedback

* Separated decoding from finalization

* Add warning comment to `Verifier::receive`

* Remove unnecessary traits

* Adapt test

* Repair notarize integration test

* Add `decode` call to prover for verify integration test

* Simplified `LabelProof` and renamed to `TranscriptProof`

* Add range check to `reconstruct`

* Roll back changes to `tlsn-prover/src/http`

* Rename `Verify` to `Prove`

* Added more feedback

* Various code improvements

* Remove `SessionData`

* Restore naming of `TlsProof` and `SessionData`

* Improve error handling

* Adapt prove-verify flow to new API

* Finalize VM first

* Fix prover closing connection too early

* Add correct server certificate and assert correct redactions

* Fix imports after rebase

* Fix api test in `tlsn-core`

* Add feedback

* Fix linting in integration test
th4s added a commit that referenced this pull request Jan 10, 2024
* Added necessary state and state transitions

* Move Prover future into its own module

* Put phase-specific prover code into its own modules

* Make `ProverFuture` public again

* Added `Into` from `Closed` to `Verify` for `Prover` state transition

* Added first part of finalize method for `Prover<Verify>`

* Rename `SessionData` to `NotarizedSessionData` and introduce
`SessionData` for interactive verifier flow

* Added first sketches for HttpProver and Prover with Verifier state

* Introduced wrapper `ServerInfo`

`ServerInfo` is generated by `SessionData` and is the non-notarization
version of `SessionProof`

* Crate `ServerInfo` from `SessionData` in Prover<Verify> flow

* Introduced another module for direct substring proofs.

* WIP: Added dirty first version of prover flow...

* Move `RangeCollector` and restore substring module

* Tidy up tlsn-core and finish first version of prover flow for dealing
with a verifier

* Refactored verifier

* Added `Verify` state for `Verifier`

* WIP: Added first draft for verify flow...

* Added more parts of verifier flow

* Adapt tests to new api changes

* Add some logging and improve code here and there

* Added `ProofBuilder` trait and started implementing it for `SubstringsProofBuilder`

* WIP: Tinkering with lifetimes...

* Resolved lifetime issues

* Refactor module `proof` to support another implementor of `SubstringProofBuilder`

* WIP: Adding `LabelProofBuilder`...

* Streamlined api

* Improved decoding flow

* Include lengths in `LabelProof`

* Improved structure of `LabelProof` and finished `verify`

* Added integration test for verify flow

* Add tests for `LabelProof`

* Improve test for `LabelProof::verify`

* Make tlsn compile without `tlsn-formats`

* Restore `tlsn-formats` from `dev` and temporarily remove from workspace

* Add first batch of feedback

* Add further feedback

* Separated decoding from finalization

* Add warning comment to `Verifier::receive`

* Remove unnecessary traits

* Adapt test

* Repair notarize integration test

* Add `decode` call to prover for verify integration test

* Simplified `LabelProof` and renamed to `TranscriptProof`

* Add range check to `reconstruct`

* Roll back changes to `tlsn-prover/src/http`

* Rename `Verify` to `Prove`

* Added more feedback

* Various code improvements

* Remove `SessionData`

* Restore naming of `TlsProof` and `SessionData`

* Improve error handling

* Adapt prove-verify flow to new API

* Finalize VM first

* Fix prover closing connection too early

* Add correct server certificate and assert correct redactions

* Fix imports after rebase

* Fix api test in `tlsn-core`

* Add feedback

* Fix linting in integration test
themighty1 added a commit that referenced this pull request Jan 10, 2024
* Added necessary state and state transitions

* Move Prover future into its own module

* Put phase-specific prover code into its own modules

* Make `ProverFuture` public again

* Added `Into` from `Closed` to `Verify` for `Prover` state transition

* Added first part of finalize method for `Prover<Verify>`

* Rename `SessionData` to `NotarizedSessionData` and introduce
`SessionData` for interactive verifier flow

* Added first sketches for HttpProver and Prover with Verifier state

* Introduced wrapper `ServerInfo`

`ServerInfo` is generated by `SessionData` and is the non-notarization
version of `SessionProof`

* Crate `ServerInfo` from `SessionData` in Prover<Verify> flow

* Introduced another module for direct substring proofs.

* WIP: Added dirty first version of prover flow...

* Move `RangeCollector` and restore substring module

* Tidy up tlsn-core and finish first version of prover flow for dealing
with a verifier

* Refactored verifier

* Added `Verify` state for `Verifier`

* WIP: Added first draft for verify flow...

* Added more parts of verifier flow

* Adapt tests to new api changes

* Add some logging and improve code here and there

* Added `ProofBuilder` trait and started implementing it for `SubstringsProofBuilder`

* WIP: Tinkering with lifetimes...

* Resolved lifetime issues

* Refactor module `proof` to support another implementor of `SubstringProofBuilder`

* WIP: Adding `LabelProofBuilder`...

* Streamlined api

* Improved decoding flow

* Include lengths in `LabelProof`

* Improved structure of `LabelProof` and finished `verify`

* Added integration test for verify flow

* Add tests for `LabelProof`

* Improve test for `LabelProof::verify`

* Make tlsn compile without `tlsn-formats`

* Restore `tlsn-formats` from `dev` and temporarily remove from workspace

* Add first batch of feedback

* Add further feedback

* Separated decoding from finalization

* Add warning comment to `Verifier::receive`

* Remove unnecessary traits

* Adapt test

* Repair notarize integration test

* Add `decode` call to prover for verify integration test

* Simplified `LabelProof` and renamed to `TranscriptProof`

* Add range check to `reconstruct`

* Roll back changes to `tlsn-prover/src/http`

* Rename `Verify` to `Prove`

* Added more feedback

* Various code improvements

* Remove `SessionData`

* Restore naming of `TlsProof` and `SessionData`

* Improve error handling

* Adapt prove-verify flow to new API

* Finalize VM first

* Fix prover closing connection too early

* Add correct server certificate and assert correct redactions

* Fix imports after rebase

* Fix api test in `tlsn-core`

* Add feedback

* Fix linting in integration test

Co-authored-by: th4s <th4s@metavoid.xyz>
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.

2 participants