Skip to content

Conversation

iamalwaysuncomfortable
Copy link
Member

Motivation

Note: originally created by @vicsn but merged into a branch on this repo to enable it to run properly.

Similar to: ProvableHQ/snarkOS#3814

Introduces a github action to allow automated testing on snarkVM updates:

  • Pushes to a update-snarkvm-staging branch if a new snarkVM staging branch rev was found
  • Opens a PR if it wasn't opened yet

Test Plan

You can try it out by pushing this as a branch to ProvableHQ/SDK:ci/snarkvm-update

I don't have write permissions to the SDK repo so I can't push there or add reviewers, so doing a manual tag: @iamalwaysuncomfortable

Signed-off-by: Mike Turner <[email protected]>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a GitHub Actions workflow to automatically update snarkVM dependencies when new commits are available on the staging branch. The workflow runs hourly to check for updates and creates pull requests when changes are detected.

  • Automated hourly checks for new snarkVM staging commits
  • Updates multiple snarkVM dependencies in the wasm directory using cargo commands
  • Creates pull requests automatically when updates are found

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +88 to +93
git commit --no-verify -m "Update snarkVM to latest staging commit ${{ steps.snarkvm-commit.outputs.latest_commit }}

Previous commit: ${{ steps.snarkvm-commit.outputs.current_commit }}
Latest commit: ${{ steps.snarkvm-commit.outputs.latest_commit }}

This update was performed automatically by the snarkVM update workflow."
Copy link
Preview

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

The commit message references current_commit on line 90, but this output variable is never set in the snarkvm-commit step. Only latest_commit is defined on line 42. This will result in an empty value being displayed in the commit message.

Copilot uses AI. Check for mistakes.

title: 'Update snarkVM to latest staging commit',
head: 'update-snarkvm-staging',
base: 'staging',
body: 'This PR updates the snarkVM dependency to track the latest staging commit.\n\nLatest commit: ${{ steps.snarkvm-commit.outputs.latest_commit }}\nPrevious commit: ${{ steps.snarkvm-commit.outputs.current_commit }}\n\nThis PR was created automatically by the snarkVM update workflow.'
Copy link
Preview

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

The PR body references current_commit which is not defined in the snarkvm-commit step outputs. This will result in an empty value being displayed in the pull request description.

Copilot uses AI. Check for mistakes.

if: always()
run: |
echo "## Workflow Summary (staging)" >> $GITHUB_STEP_SUMMARY
echo "- Current snarkVM commit: ${{ steps.snarkvm-commit.outputs.current_commit }}" >> $GITHUB_STEP_SUMMARY
Copy link
Preview

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

The summary step references current_commit output which doesn't exist. Only latest_commit and update_needed are set as outputs in the snarkvm-commit step.

Suggested change
echo "- Current snarkVM commit: ${{ steps.snarkvm-commit.outputs.current_commit }}" >> $GITHUB_STEP_SUMMARY

Copilot uses AI. Check for mistakes.

Comment on lines +42 to +44
core.setOutput('latest_commit', latestCommit);
core.setOutput('update_needed', 'true');

Copy link
Preview

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

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

The update_needed output is hardcoded to 'true', which means the workflow will always attempt to update regardless of whether there are actual changes. Consider implementing logic to compare the current commit with the latest commit to determine if an update is actually needed.

Suggested change
core.setOutput('latest_commit', latestCommit);
core.setOutput('update_needed', 'true');
// Read the currently used snarkVM commit hash from Cargo.lock
const fs = require('fs');
let currentCommit = null;
try {
const lockFile = fs.readFileSync('Cargo.lock', 'utf8');
const match = lockFile.match(/name = "snarkVM"[^\n]*\n(?:[^\n]*\n)*?source = "git\+https:\/\/github\.com\/ProvableHQ\/snarkVM\.git\?rev=([a-f0-9]+)"/);
if (match && match[1]) {
currentCommit = match[1];
}
} catch (e) {
console.log('Could not read current snarkVM commit from Cargo.lock:', e);
}
console.log('Current snarkVM commit in Cargo.lock:', currentCommit);
core.setOutput('latest_commit', latestCommit);
if (currentCommit && currentCommit === latestCommit) {
core.setOutput('update_needed', 'false');
} else {
core.setOutput('update_needed', 'true');
}

Copilot uses AI. Check for mistakes.

@iamalwaysuncomfortable
Copy link
Member Author

@vicsn we'll test this out over the next few days.

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