-
Notifications
You must be signed in to change notification settings - Fork 36
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
IPA Solidity unit-test generator #341
Conversation
25c2f87
to
3a384d7
Compare
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.
It would be great to add this to the code base, but the current setup is quite invasive to the existing source files.
What about the following organization instead?
src/
└── provider/
├── mod.rs # The main module file for `provider`
└── tests/
├── mod.rs # The main module file for test utilities within `provider`
└── ipa_pc.rs # Test file for IPA polynomial commitment solidity tests within `provider`
This isn't meant to replace the current test organization (which is often useful because it can access private fields), but is a complement to the existing one.
src/provider/pedersen.rs
Outdated
@@ -33,7 +33,7 @@ where | |||
// this is a hack; we just assume the size of the element. | |||
// Look for the static assertions in provider macros for a justification | |||
#[abomonate_with(Vec<[u64; 8]>)] | |||
ck: Vec<<E::GE as PrimeCurve>::Affine>, | |||
pub(crate) ck: Vec<<E::GE as PrimeCurve>::Affine>, |
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.
I think pub (in crate::provider)
would suffice.
Cargo.toml
Outdated
handlebars = "5.1.0" | ||
serde_json = "1.0.1" |
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.
Shouldn't this be a dev-dependency
instead?
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.
Back to your queue for the file hierarchy changes requested in #341 (review)
In this case, we will need to make even more fields public ( |
Rust supports |
2bc400d
to
8d7e819
Compare
8d7e819
to
b7f6d5f
Compare
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.
LGTM!
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 PR is a first step to solve verifier's Rust <-> Solidity compatibility problem (#337)
With a help of Handlebars templating engine this PR adds IPA unit-test which dynamically generates exact ipa.t.sol from our Solidity verifier (checked manually by running forge tests in Solidity with Solidity file generated by Rust).
How to run?
In order to create ipa.t.sol directly from Rust (Arecibo) environment I used following commands:
The ignored test
test_solidity_compatibility_ipa
is invoked and its stdout is redirected to the ipa.t.sol file with a little subsequent truncations of irrelevant lines.Sidenote
It is possible to vary number of variables and
test_solidity_compatibility_ipa
can produce correspondent IPA test-vector which is useful for detecting upper-bound gas cost experiments.P.S. As it is mentioned in #337, IPA now is a first building block that supports dynamic IO generation directly from Rust, and we can experiment with CI enforcements using it as an example in order to derive optimal compatibility rules for every stakeholder.
cc @samuelburnham