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

fix(stdlib): Workaround for Field comparison error in EdDSA signature verification #1372

Merged
merged 1 commit into from
May 18, 2023

Conversation

ax0
Copy link
Contributor

@ax0 ax0 commented May 18, 2023

Related issue(s)

Related to #1313

Description

This PR resolves an error that occurs when generating a proof involving EdDSA signature verification: Calling eddsa_poseidon_verify leads to an error on the following example:

use dep::std::eddsa::eddsa_poseidon_verify;

fn main(data: [Field; 6])
{
	assert(eddsa_poseidon_verify(data[0], data[1], data[2], data[3], data[4], data[5]));
}

#[test]
fn test_main()
{
	let data = [0x1f3581c1eb058355ad574689b0bf37ab4e02433492eac1fbcd9fe5ce9272099e,0x0f72436cb679e0fa77342a92342d271bdd869ac14ce1f13a2afcccc5b6f75714,0x03ec6779f0250bb9852b3bc71cfb3dbb21420294fe8ce16ac6469049171b987e, 0x0b317e5deb2cbbc171f7c70ee5f6634563bb3a23f67d001ed9750380bbaf60cf,0x1cad3257ef27851ebd24587ff64230f3be41dfac3e8170878116190527448373,0x1d7ecd14bf6ec1bf60b655ef74e99bc874c76d179b1adc9a81bb55dd4bbacf46];
    

	main(data);
}

nargo test passes, but nargo prove with the following Prover.toml fails with the error not implemented: Field comparison is not implemented yet, try to cast arguments to integer type:

data = ["0x1f3581c1eb058355ad574689b0bf37ab4e02433492eac1fbcd9fe5ce9272099e","0x0f72436cb679e0fa77342a92342d271bdd869ac14ce1f13a2afcccc5b6f75714","0x03ec6779f0250bb9852b3bc71cfb3dbb21420294fe8ce16ac6469049171b987e", "0x0b317e5deb2cbbc171f7c70ee5f6634563bb3a23f67d001ed9750380bbaf60cf","0x1cad3257ef27851ebd24587ff64230f3be41dfac3e8170878116190527448373","0x1d7ecd14bf6ec1bf60b655ef74e99bc874c76d179b1adc9a81bb55dd4bbacf46"]

The problem lies in lt_bytes32, where the compiler is not treating the elements of the byte arrays x_bytes and y_bytes as bytes. This PR adds type casts to force this, which eliminates the above error.

Summary of changes

Added u8 type casts.

Dependency additions / changes

Test additions / changes

Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt with default settings.
  • I have linked this PR to the issue(s) that it resolves.
  • I have reviewed the changes on GitHub, line by line.
  • I have ensured all changes are covered in the description.

Documentation needs

  • This PR requires documentation updates when merged.

Additional context

@Savio-Sou Savio-Sou requested review from kevaundray and guipublic May 18, 2023 14:45
@kevaundray kevaundray added this pull request to the merge queue May 18, 2023
Merged via the queue into noir-lang:master with commit e790c9f May 18, 2023
TomAFrench added a commit that referenced this pull request May 23, 2023
* phated/acvm-0.12.0:
  fix compilation issue
  switch to published acvm and backend
  feat(nargo): Consume CommonReferenceString functions & manage caching (#1348)
  fix(stdlib): Workaround for Field comparison error in EdDSA signature verification (#1372)
  feat!: remove concept of noir fallbacks for foreign functions (#1371)
  feat(ssa refactor): mem2reg opt pass (#1363)
  feat(stdlib): EdDSA sig verification (#1313)
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