-
Notifications
You must be signed in to change notification settings - Fork 11
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
Automatic generating of proof / public parameters JSONs #53
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9b68041
added CI scrypt for generating pk and compression-snark from Nova rep…
asambler 862e5ee
Changed CI e2e configuration to work with NOVA_URL and NOVA_COMMIT pa…
artem-bakuta 0bb97f8
Changed Script name. Return back from generating test in runtime
artem-bakuta 1cef728
Changed Script name. Return back from generating test in runtime
artem-bakuta 20fe182
Changed Script and CI config.
artem-bakuta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,12 @@ jobs: | |
with: | ||
submodules: recursive | ||
|
||
- name: Set environment variables for generate_contract_input.py (Nova URL and commit) | ||
id: parse-comment | ||
run: | ||
echo "::set-env name=NOVA_URL::https://github.com/lurk-lab/Nova" | ||
echo "::set-env name=NOVA_COMMIT::ea4f75c225cb29f523780858ec84f1ff51c229bc" | ||
|
||
- name: Checkout PR branch | ||
run: gh pr checkout $PR_NUMBER | ||
env: | ||
|
@@ -55,9 +61,13 @@ jobs: | |
echo "CONTRACT_ADDRESS=$(forge script script/Deployment.s.sol:NovaVerifierDeployer --fork-url $ANVIL_URL --private-key $ANVIL_PRIVATE_KEY --broadcast --non-interactive | sed -n 's/.*Contract Address: //p' | tail -1)" >> $GITHUB_OUTPUT | ||
id: deployment | ||
|
||
- name: Generate proof and public parameters from commit hash | ||
run: | | ||
python ci_pasta_keys_verifier_script.py $NOVA_URL $NOVA_COMMIT | ||
storojs72 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Load proof and public parameters | ||
run: | | ||
python loader.py pp-verifier-key.json pp-compressed-snark.json ${{steps.deployment.outputs.CONTRACT_ADDRESS}} $ANVIL_URL $ANVIL_PRIVATE_KEY | ||
python loader.py vk.json compressed-snark.json ${{steps.deployment.outputs.CONTRACT_ADDRESS}} $ANVIL_URL $ANVIL_PRIVATE_KEY | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would leave this change for the next PR, when we remove hardcoded |
||
|
||
- name: Check proof verification status | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import subprocess | ||
import sys | ||
import os | ||
import re | ||
|
||
file_path = 'rust-reference-info.txt' | ||
|
||
def parse_variables_from_file(file_path): | ||
variables = {} | ||
with open(file_path, 'r') as file: | ||
content = file.read() | ||
# Define regex patterns for matching variables | ||
nova_url_pattern = r'\$NOVA_URL\s*=\s*\"(.+?)\"' | ||
nova_commit_pattern = r'\$NOVA_COMMIT\s*=\s*\"(.+?)\"' | ||
|
||
# Match variables using regular expressions | ||
nova_url_match = re.search(nova_url_pattern, content) | ||
nova_commit_match = re.search(nova_commit_pattern, content) | ||
|
||
# Extract matched variables | ||
if nova_url_match: | ||
variables['NOVA_URL'] = nova_url_match.group(1) | ||
if nova_commit_match: | ||
variables['NOVA_COMMIT'] = nova_commit_match.group(1) | ||
|
||
return variables | ||
|
||
# python generate_contract_input.py https://github.com/artem-bakuta/Nova.git 3838031868ca3f2783c01299546849860bfd36d2 | ||
if __name__ == "__main__": | ||
nova_repo_arg = "" | ||
nova_commit_arg = "" | ||
|
||
if len(sys.argv) > 1: | ||
nova_repo_arg = sys.argv[1] | ||
nova_commit_arg = sys.argv[2] | ||
|
||
# Configurations | ||
parsed_variables = parse_variables_from_file(file_path) | ||
nova_repo_url = nova_repo_arg if nova_repo_arg else parsed_variables['NOVA_URL'] | ||
nova_commit_hash = nova_commit_arg if nova_commit_arg else parsed_variables['NOVA_COMMIT'] | ||
print("Pulling project from: " + nova_repo_url + " " + nova_commit_hash) | ||
target_directory = "verify_cache" | ||
nova_directory = "nova" | ||
|
||
if os.path.exists(target_directory): | ||
subprocess.run(['rm', '-rf', target_directory], check=True) | ||
os.mkdir(target_directory) | ||
os.mkdir(target_directory + "/" + nova_directory) | ||
os.chdir(target_directory) | ||
os.system(f"git clone {nova_repo_url} {nova_directory}") | ||
os.chdir(nova_directory) | ||
os.system(f"git checkout {nova_commit_hash}") | ||
|
||
# Build the Nova project | ||
os.system(f"cargo test solidity_compatibility_e2e_pasta --release -- --ignored") | ||
print("Copy generated keys from Nova...") | ||
os.system(f"cp vk.json compressed-snark.json ../../.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# generate_contract_input.py script params | ||
|
||
# NOVA_URL variable | ||
$NOVA_URL = "https://github.com/lurk-lab/Nova.git" | ||
|
||
# NOVA_COMMIT variable | ||
$NOVA_COMMIT = "d5f5fb5e557b99cb111f2d5693aa34fe30722750" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@samuelburnham , as we discussed - it would be nice to make specifying
NOVA_URL
andNOVA_COMMIT
via!
test
comment. In case if they are specified in comment, it is necessary to take them instead of extracting fromrust-reference-info.txt
. As you are able to carefully test this behaviour it is better to have a separate PR from you