-
Notifications
You must be signed in to change notification settings - Fork 193
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
refactor!: generalize one eval to arbitrary lengths #381
Conversation
5f8967a
to
33ee01e
Compare
9d87859
to
2eb1d15
Compare
160a15a
to
27218fe
Compare
98b06ed
to
a85b1b5
Compare
5ff0e59
to
35442f3
Compare
56030f1
to
41f7e9b
Compare
5bb0b21
to
e345a91
Compare
@@ -282,6 +298,7 @@ pub(super) fn prove_filter<'a, S: Scalar + 'a>( | |||
n: usize, | |||
m: usize, | |||
) { | |||
builder.push_one_evaluation_length(m); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inside the prove_filter
, but the corresponding consume
is outside the verify_filter
. Functionally it is correct, but we should keep the prove and verify mirrored. Either move them both in, or move them both out.
@@ -82,9 +82,9 @@ pub fn prover_evaluate_sign<'a, S: Scalar>( | |||
builder: &mut FinalRoundBuilder<'a, S>, | |||
alloc: &'a Bump, | |||
expr: &'a [S], | |||
table_length: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should just use expr.len()
.
@@ -178,6 +180,7 @@ impl<CP: CommitmentEvaluationProof> QueryProof<CP> { | |||
|
|||
let proof = Self { | |||
bit_distributions: builder.bit_distributions().to_vec(), | |||
one_evaluation_lengths: builder.one_evaluation_lengths().to_vec(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lengths need to be passed to make_transcript
in order for the proof to be secure.
.chain(self.one_evaluation_lengths.clone().iter()) | ||
.copied() | ||
.collect::<Vec<_>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: there is a lot of clone/copy/collect here. At least some of them can be avoided.
22ef5ff
to
e64a6cc
Compare
e64a6cc
to
87185fd
Compare
636fe8d
to
61ff4b5
Compare
61ff4b5
to
cb8be29
Compare
🎉 This PR is included in version 0.51.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Please be sure to look over the pull request guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md#submit-pr. # Please go through the following checklist - [x] The PR title and commit messages adhere to guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md. In particular `!` is used if and only if at least one breaking change has been introduced. - [x] I have run the ci check script with `source scripts/run_ci_checks.sh`. - The following upstream PRs have been merged: - [x] #381 - [x] #401 - [x] #404 # Rationale for this change This PR replaces #121 and is designed to test whether our `ProofPlan`s are truly composable now. <!-- Why are you proposing this change? If this is already explained clearly in the linked issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. Example: Add `NestedLoopJoinExec`. Closes #345. Since we added `HashJoinExec` in #323 it has been possible to do provable inner joins. However performance is not satisfactory in some cases. Hence we need to fix the problem by implement `NestedLoopJoinExec` and speed up the code for `HashJoinExec`. --> # What changes are included in this PR? - add `SliceExec`. <!-- There is no need to duplicate the description in the ticket here but it is sometimes worth providing a summary of the individual changes in this PR. Example: - Add `NestedLoopJoinExec`. - Speed up `HashJoinExec`. - Route joins to `NestedLoopJoinExec` if the outer input is sufficiently small. --> # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? Example: Yes. --> Yes.
Please be sure to look over the pull request guidelines here: https://github.com/spaceandtimelabs/sxt-proof-of-sql/blob/main/CONTRIBUTING.md#submit-pr.
Please go through the following checklist
!
is used if and only if at least one breaking change has been introduced.source scripts/run_ci_checks.sh
.table_length
toFirstRoundBuilder
#380 has been merged.Rationale for this change
When
ProofPlan
s compose it makes no sense to havetable_length
inVerificationBuilder
. Instead it becomes necessary to record each and every instance of length used for one_eval and pass the info to the verifier.What changes are included in this PR?
VerificationBuilder::table_length
input_length
andoutput_length
to arbitrary lengthssingleton_one_evaluation
toSumcheckMleEvaluations
VerificationBuilder
TableEvaluation
one_eval
as an arg toProofExpr::verifier_evaluate
TableEvaluation
inProofPlan::verifier_evaluate
(Table<'a, S>, Vec<usize>)
inProofPlan::result_evaluate
to return one eval lengthsrange_length
logic fromFirstRoundBuilder
asProofPlan::result_evaluate
already tracks potentially large output lengths in intermediate tablesAre these changes tested?
Yes.