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

chore: move acir docs to code declaration #5040

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

michaeljklein
Copy link
Contributor

Description

Problem*

Resolves a few minor inaccuracies in the ACIR docs and moves their primary location to Rust.

Summary*

ACIR docs get stale quickly when detached from code/tests. This PR moves them to the code for now; we expect to move them back once ACIR is more stable.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

…rom the readme are already removed and some are missing)
@michaeljklein michaeljklein marked this pull request as ready for review May 16, 2024 20:30
Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

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

nit, can do a proper review later.

acvm-repo/acir/src/circuit/opcodes.rs Outdated Show resolved Hide resolved
@vezenovm
Copy link
Contributor

Can give this a proper look tomorrow

michaeljklein and others added 2 commits May 16, 2024 20:54
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
@vezenovm
Copy link
Contributor

Can give this a proper look tomorrow

Apologies for the delay will look today

/// Calculates the SHA256 hash of the inputs.

/// Computes SHA256 of the inputs
/// - inputs are a byte array, i.e a vector of (FieldElement, 8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// - inputs are a byte array, i.e a vector of (FieldElement, 8)
/// - inputs are a byte array, i.e a vector of (witness, 8)

Any reason we decided to say FieldElement rather than witness here? Same for other places where we say FieldElement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, this was copy/pasted to match existing examples

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you link to where from?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah from the original docs

acvm-repo/acir/src/circuit/black_box_functions.rs Outdated Show resolved Hide resolved
acvm-repo/acir/src/circuit/black_box_functions.rs Outdated Show resolved Hide resolved
/// uses 0 as domain separator.
///
/// In Barretenberg, PedersenHash is doing the same as PedersenCommitment,
/// except that it prepends the inputs with their length.
Copy link
Contributor

Choose a reason for hiding this comment

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

You could state how a commitment is expected to be additively homomorphic above in the PedersenCommitment comments. Then here you can say this is also how a pedersen hash differs

/// scalars (FieldElement, N) a vector of low and high limbs of input
/// scalars `[s1_low, s1_high, s2_low, s2_high, ...]`. (FieldElement, N)
/// For Barretenberg, they must both be less than 128 bits.
/// - output: (FieldElement, N) a vector of x and y coordinates of output
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we just return a tuple of two witnesses here representing x and y

Copy link
Contributor

@vezenovm vezenovm May 21, 2024

Choose a reason for hiding this comment

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

An MSM multiplies the points and scalars and sums the results

acvm-repo/acir/src/circuit/black_box_functions.rs Outdated Show resolved Hide resolved
acvm-repo/acir/src/circuit/black_box_functions.rs Outdated Show resolved Hide resolved
Comment on lines +52 to +53
/// field of the main one, and vice-versa. The curves used by the proving
/// system are dependent on the proving system (and/or its configuration).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// field of the main one, and vice-versa. The curves used by the proving
/// system are dependent on the proving system (and/or its configuration).
/// field of the main one, and vice-versa.

This feels slightly redundant no? Especially as we already state "Calls to "gadgets" which rely on backends implementing support" above

acvm-repo/acir/src/circuit/opcodes.rs Outdated Show resolved Hide resolved
/// ACIR arrays all have a known fixed length (given in the MemoryInit
/// opcode below)
///
/// - predicate: an arithmetic expression that disable the opcode when it is null.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// - predicate: an arithmetic expression that disable the opcode when it is null.
/// - predicate: an arithmetic expression that disables execution of the opcode

Wdym when it is null?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say "evaluates to zero" rather than "is null"

Copy link
Member

Choose a reason for hiding this comment

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

Also "it" is a bit ambiguous here as it can be read as the predicate or the opcode.

michaeljklein and others added 7 commits May 21, 2024 14:57
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
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.

None yet

3 participants