forked from solana-program/token
-
Notifications
You must be signed in to change notification settings - Fork 0
first draft of a workflow to run a selection of proofs #31
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b132af8
first draft of a workflow to run a selection of proofs
jberthold 03ad9af
split proofs string into matrix
jberthold 92e1de0
DEBUG hijack publish-js workflow for testing
jberthold 8d006b1
DEBUG stable_mir_json from nix
jberthold 149d4fc
DEBUG add inputs for proof runner for testing
jberthold 1a19d3f
DEBUG test nix-shell-action before prime time
jberthold 4e56ac6
DEBUG newer version of nix, better names
jberthold 35d54f9
DEBUG decrement nix version
jberthold bf1078f
DEBUG try other nix magic
jberthold db6fdd1
DEBUG try other nix magic again
jberthold 56e5f22
DEBUG fix matrix split (needs step id)
jberthold 16feb35
DEBUG fix matrix again, activate real proof step
jberthold 2df3f80
DEBUG fix container name variable (RUNNER_NAME is taken?)
jberthold 85a5a1e
DEBUG use container default user, run a sleep command
jberthold f869ea7
DEBUG allow container user to write into artefacts dir
jberthold 5f9106d
DEBUG stray quote
jberthold cb5b19d
DEBUG run proof properly and store artefacts
jberthold a771230
Adjust proof runner workflow after debugging
jberthold 1ece7df
restore previous workflow file
jberthold a76272c
un-capitalise input parameter description
jberthold 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 hidden or 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,140 @@ | ||
name: RV Run Proofs | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
proofs: | ||
description: Start symbols for proofs to run | ||
required: true | ||
type: string | ||
default: "['test_ptoken_domain_data', 'this_will_fail']" | ||
kmir: | ||
description: KMIR to work with (must exist as a docker image tag, optional) | ||
required: false | ||
type: string | ||
default: p-token-f8c403f # hard-wired now, retrieve from submodule later | ||
smir: | ||
description: Stable MIR JSON to work with (commit hash, optional) | ||
required: false | ||
type: string | ||
default: # empty = master | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
compile: | ||
name: "Compile P-Token to SMIR JSON" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Git Checkout" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Provide nightly Rust" # https://github.com/rust-lang/rustup/issues/3409 | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: nightly-2024-11-29 # Hardcoded version for stable-mir-json. TODO can we use nix? | ||
|
||
- name: "Provide Nix" | ||
uses: cachix/install-nix-action@v30 | ||
|
||
- name: "Set up nix shell" | ||
uses: rrbutani/use-nix-shell-action@v1 | ||
with: | ||
flakes: github:runtimeverification/stable-mir-json/${{ inputs.smir }} | ||
|
||
- name: "Build with stable_mir_json" | ||
run: | | ||
cd p-token | ||
RUSTC=stable_mir_json cargo build --features runtime-verification | ||
|
||
- name: "Store SMIR JSON files" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: p-token.smir | ||
path: ./target/debug/deps/*.smir.json | ||
if-no-files-found: error | ||
retention-days: 1 # only important during workflow run | ||
|
||
prepare_matrix: | ||
name: "Prepare proof matrix" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
proofs: ${{ steps.split.outputs.matrix }} | ||
steps: | ||
- name: "Create Proof Array" | ||
id: split | ||
run: | | ||
echo "proofs = '${{ inputs.proofs }}'" | ||
echo "matrix=${{ inputs.proofs }}" >> $GITHUB_OUTPUT | ||
|
||
run_proof: | ||
name: "Link SMIR and Run Proofs" | ||
needs: | ||
- compile | ||
- prepare_matrix | ||
runs-on: ubuntu-latest | ||
# container: | ||
# image: runtimeverificationinc/kmir:${{ inputs.kmir }} | ||
strategy: | ||
matrix: | ||
proof: ${{ fromJSON(needs.prepare_matrix.outputs.proofs) }} | ||
env: | ||
KMIR_CONTAINER_NAME: "kmir-${{ github.sha }}" | ||
steps: | ||
- name: debug matrix and docker image | ||
run: | | ||
echo "This is proof ${{ matrix.proof }}" | ||
echo "Running with $KMIR_CONTAINER_NAME, docker image runtimeverificationinc/kmir:${{ inputs.kmir }}" | ||
|
||
- name: "Set up Docker Host" | ||
run: | | ||
mkdir -p $PWD/artefacts | ||
chmod a+rwx $PWD/artefacts | ||
docker run --rm --detach \ | ||
-v $PWD:/workdir --workdir /workdir \ | ||
--name "${KMIR_CONTAINER_NAME}" \ | ||
runtimeverificationinc/kmir:${{ inputs.kmir }} \ | ||
sleep 3600 | ||
sleep 10 | ||
|
||
- name: "Get SMIR Files" | ||
uses: actions/download-artifact@v5 | ||
with: | ||
name: p-token.smir | ||
path: artefacts/ | ||
|
||
- name: "Link SMIR Files" | ||
run: | | ||
docker exec --workdir /workdir/artefacts/ "${KMIR_CONTAINER_NAME}" \ | ||
bash -c 'kmir link -o p-token.smir.json *.smir.json' | ||
|
||
- name: "Run Proof ${{ matrix.proof }} and store resulting tree" | ||
run: | | ||
timeout 3600 \ | ||
docker exec --workdir /workdir "${KMIR_CONTAINER_NAME}" \ | ||
kmir prove-rs --smir artefacts/p-token.smir.json \ | ||
--start-symbol 'pinocchio_token_program::entrypoint::${{ matrix.proof }}' \ | ||
--verbose \ | ||
--max-iterations 100 \ | ||
--proof-dir artefacts/proof | ||
docker exec --workdir /workdir "${KMIR_CONTAINER_NAME}" \ | ||
kmir show --full-printer --proof-dir artefacts/proof \ | ||
'p-token.smir.pinocchio_token_program::entrypoint::${{ matrix.proof }}' \ | ||
> artefacts/proof/${{ matrix.proof }}-full.txt | ||
|
||
- name: "Save proof tree and smir" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: $artefacts-{{ matrix.proof }} | ||
path: | | ||
artefacts/p-token.smir.json | ||
artefacts/proof/*-full.txt | ||
|
||
- name: "Shut down docker image" | ||
if: always() | ||
run: | | ||
docker stop ${KMIR_CONTAINER_NAME} | ||
sleep 5 | ||
docker rm -f ${KMIR_CONTAINER_NAME} |
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.
What's the purpose of these
sleep
commands?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.
The
sleep 3600
is what the started container executes in the background. The further steps in the job usedocker exec
to execute a command in the running container.sleep 10
is a technicality, waiting for the container to be properly set up because its start-up script (entrypoint) adjusts file ownerships, which may take a few seconds.