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

feat: yul lagrange basis evaluation #442

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

JayWhite2357
Copy link
Contributor

Rationale for this change

In order to port the verifier to Solidity, we need to write some code in Yul.

What changes are included in this PR?

Simplified the existing Rust lagrange basis evaluation.
Added a YUL port.
Added some tooling around YUL code.

Are these changes tested?

Yes

@JayWhite2357 JayWhite2357 force-pushed the feat/yul-lagrange-basis-evaluation branch from abc1139 to 1ecc3c1 Compare December 17, 2024 20:41
pure
returns (uint256 result0)
{
// solhint-disable-next-line no-inline-assembly
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps you want to add this to your solhint: "no-inline-assembly": "off", to avoid repeatedly using // solhint-disable-next-line rule

assembly {
// IMPORT-YUL ../base/LagrangeBasisEvaluation.sol:compute_truncated_lagrange_basis_sum
// solhint-disable-next-line no-empty-blocks
function compute_truncated_lagrange_basis_sum(length, point, num_vars, modulus) -> result {}
Copy link
Contributor

Choose a reason for hiding this comment

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

this line isn't needed right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. It's needed for the sake of the linter, so it knows what the function signature is.

@waelsy123
Copy link
Contributor

waelsy123 commented Dec 18, 2024

is there anyway to run target test without blitzer?

% cargo run --bin yul_preprocessor crates/proof-of-sql --no-default-features --features="arrow cpu-perf"
   Compiling blitzar-sys v1.83.0
error: failed to run custom build command for `blitzar-sys v1.83.0`

Caused by:
  process didn't exit successfully: `/Users/wa.sxt/sxt/sxt-proof-of-sql/target/debug/build/blitzar-sys-c9fd1875a1ff06ba/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /Users/wa.sxt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blitzar-sys-1.83.0/build.rs:14:9:
  Unsupported OS. Only Linux is supported.
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace```

@JayWhite2357
Copy link
Contributor Author

is there anyway to run target test without blitzer?

% cargo run --bin yul_preprocessor crates/proof-of-sql --no-default-features --features="arrow cpu-perf"
   Compiling blitzar-sys v1.83.0
error: failed to run custom build command for `blitzar-sys v1.83.0`

Caused by:
  process didn't exit successfully: `/Users/wa.sxt/sxt/sxt-proof-of-sql/target/debug/build/blitzar-sys-c9fd1875a1ff06ba/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at /Users/wa.sxt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/blitzar-sys-1.83.0/build.rs:14:9:
  Unsupported OS. Only Linux is supported.
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace```

Try this:

cargo run --bin yul_preprocessor --no-default-features --features="arrow cpu-perf" -- crates/proof-of-sql 

Copy link
Contributor

@iajoiner iajoiner left a comment

Choose a reason for hiding this comment

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

I verified that the new Rust and Yul implementations do the exact same computation. It will be really great if we can add more docs to the Yul Preprocessor though.

@iajoiner iajoiner force-pushed the feat/yul-lagrange-basis-evaluation branch from 1ecc3c1 to 4414c11 Compare December 18, 2024 14:08
@iajoiner iajoiner enabled auto-merge December 18, 2024 18:31
@iajoiner iajoiner force-pushed the feat/yul-lagrange-basis-evaluation branch from 4414c11 to ce07269 Compare December 18, 2024 18:31
@iajoiner iajoiner merged commit 792aaf3 into main Dec 18, 2024
11 checks passed
Copy link

🎉 This PR is included in version 0.64.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants