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

Remove testing methods from Honk + clean up #177

Merged
merged 2 commits into from
Feb 23, 2023
Merged

Conversation

adr1anh
Copy link
Contributor

@adr1anh adr1anh commented Feb 23, 2023

Description

  • Unify the interfaces for relations and rework tests to not use _testing methods anymore.
  • Remove #pragma GCC and fixed errors.
  • Fix Univariate operator interfaces to be const correct, and return references when required ref.

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • There are no circuit changes, OR specifications in /markdown/specs have been updated.
  • There are no circuit changes, OR a cryptographer has been assigned for review.
  • I've updated any terraform that needs updating (e.g. environment variables) for deployment.
  • The branch has been rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.
  • New functions, classes, etc. have been documented according to the doxygen comment format. Classes and structs must have @brief describing the intended functionality.
  • If existing code has been modified, such documentation has been added or updated.

@adr1anh adr1anh self-assigned this Feb 23, 2023
@adr1anh adr1anh marked this pull request as ready for review February 23, 2023 12:37
Copy link
Collaborator

@ledwards2225 ledwards2225 left a comment

Choose a reason for hiding this comment

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

Overall looks excellent - lots of great cleanup. Just a few minor questions and comments in the spirit of nit picking :)

// get the transposition.
// Ex: polynomial_spans[3][i] returns the i-th coefficient of the third polynomial
// in the list below
std::array<std::span<const fr>, num_polynomials> univariate_array;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any particular reason why we're calling these univariates? I suppose the relations are a bit representation agnostic but for sumcheck at large we think of them as multivariates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accidentally copied the previous name without thinking. Will rename it to something better!

@@ -19,11 +18,12 @@ template <class FF> class SumcheckRelation : public testing::Test {
public:
template <size_t t> using Univariate = Univariate<FF, t>;
template <size_t t> using UnivariateView = UnivariateView<FF, t>;
static constexpr size_t FULL_RELATION_LENGH = 5;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely understand if you don't want to do this in this PR but just some thoughts: This FULL_RELATION_LENGH is necessarily tied to the actual full relation length so the hard coding is kind of brittle and has tripped me up on a few occasions. It would be nice to compute this programmatically instead then updatecompute_mock_extended_edges to create appropriately sized mock univariates. (We could do this by either directly generating the full sized univariate or just defining length 2 univariates then extending them appropriately).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed that this would be nice. I think that we can get this done as part of Arijit's PR since he introduced a lot more functionality to the way the test is performed. Left a more detailed TODO for now

@@ -309,4 +295,67 @@ template <class Fr, size_t view_length> class UnivariateView {
return os;
}
};

Copy link
Collaborator

Choose a reason for hiding this comment

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

These methods don't seem to be used anywhere. You see some use for them in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main use case is to convert an array of Univariate into UnivariateView. The main use case would be to let Sumcheck decide the required degree of the relation evaluation, rather than hardcoding it inside the relation. The _aux version could also be used to create an array of only the polynomials required by the relation, and it could help us implement the optimization where we extend each edge only up to the maximum degree that is required over all relations (for example, L_LAST only needs degree 3).

I'll save this comment as the context might help.

EXPECT_EQ(std::get<1>(results), GrandProductComputationUnivariate(0));
EXPECT_EQ(std::get<2>(results), GrandProductInitializationUnivariate(0));
// // Compute an array containing all the evaluations at a given row i
std::array<fr, num_polynomials> transposed;
Copy link
Collaborator

@ledwards2225 ledwards2225 Feb 23, 2023

Choose a reason for hiding this comment

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

Isn't this operation that you created transposed_univariate_array_at for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem was that that function only worked over Univariate since it doesn't have the operator[] defined. I moved it to the test it was being used it. In retrospect it may have been a bit too generic and the following loop is simple enough.

@adr1anh adr1anh merged commit 3375caf into master Feb 23, 2023
@adr1anh adr1anh deleted the ah/sc_remove_testing branch February 23, 2023 17:27
@adr1anh
Copy link
Contributor Author

adr1anh commented Feb 24, 2023

Fixes #182 btw

ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 22, 2023
ludamad pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Jul 24, 2023
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