forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 49
Goto-transcoder action #236
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 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c4e10e6
added goto-transcoder flow
rafaelsamenezes a0cde2a
added missing .sh
rafaelsamenezes 20840c3
added goto-transcoder to .gitignore
rafaelsamenezes e573265
run-goto-transcoder.sh now gets the contract as a parameter
rafaelsamenezes 8cd0743
added comment for run-goto-transcoder.sh
rafaelsamenezes a5fce73
added goto-transcoder entry to book
rafaelsamenezes ee45c1c
removed spurious change
rafaelsamenezes a2c7322
added --target-dir to kani output
rafaelsamenezes dc6945c
changed path for contracts
rafaelsamenezes b454135
update
rafaelsamenezes d3c7c0b
Merge branch 'main' into main
rafaelsamenezes 76a619d
added goto-transcoder.md
rafaelsamenezes b9126f2
removed debug step from goto-transcoder.yml
rafaelsamenezes 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,37 @@ | ||
# This workflow executes the supported contracts in goto-transcoder | ||
|
||
name: Run GOTO Transcoder (ESBMC) | ||
on: | ||
workflow_dispatch: | ||
merge_group: | ||
pull_request: | ||
branches: [ main ] | ||
push: | ||
paths: | ||
- 'library/**' | ||
- '.github/workflows/goto-transcoder.yml' | ||
- 'scripts/run-kani.sh' | ||
- 'scripts/run-goto-transcoder.sh' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
verify-rust-std: | ||
name: Verify contracts with goto-transcoder | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Check out the repository | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
# Step 2: Generate contracts programs | ||
- name: Generate contracts | ||
run: ./scripts/run-kani.sh --kani-args --keep-temps --only-codegen | ||
|
||
# Step 3: Run goto-transcoder | ||
- name: Run goto-transcoder | ||
run: ./scripts/run-goto-transcoder.sh checked_unchecked.*.out |
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 |
---|---|---|
|
@@ -46,6 +46,9 @@ package-lock.json | |
## Kani | ||
*.out | ||
|
||
## GOTO-Transcoder | ||
goto-transcoder | ||
|
||
|
||
# Added by cargo | ||
# | ||
|
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
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
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,52 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
############## | ||
# PARAMETERS # | ||
############## | ||
contract_folder=target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps | ||
feliperodri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
supported_regex=$1 | ||
unsupported_regex=neg | ||
|
||
goto_transcoder_git=https://github.com/rafaelsamenezes/goto-transcoder | ||
esbmc_url=https://github.com/esbmc/esbmc/releases/download/nightly-7867f5e5595b9e181cd36eb9155d1905f87ad241/esbmc-linux.zip | ||
|
||
########## | ||
# SCRIPT # | ||
########## | ||
|
||
echo "Checking contracts with goto-transcoder" | ||
|
||
if [ ! -d "goto-transcoder" ]; then | ||
rafaelsamenezes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "goto-transcoder not found. Downloading..." | ||
git clone $goto_transcoder_git | ||
cd goto-transcoder | ||
wget $esbmc_url | ||
unzip esbmc-linux.zip | ||
chmod +x ./linux-release/bin/esbmc | ||
cd .. | ||
fi | ||
|
||
ls $contract_folder | grep "$supported_regex" | grep -v .symtab.out > ./goto-transcoder/_contracts.txt | ||
|
||
cd goto-transcoder | ||
while IFS= read -r line; do | ||
# I expect each line to be similar to 'core-58cefd8dce4133f9__RNvNtNtCs9uKEoH8KKW4_4core3num6verify24checked_unchecked_add_i8.out' | ||
# The entrypoint of the contract would be _RNvNtNtCs9uKEoH8KKW4_4core3num6verify24checked_unchecked_add_i8 | ||
# So we use awk to extract this name. | ||
feliperodri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
contract=`echo "$line" | awk '{match($0, /(_RNv.*).out/, arr); print arr[1]}'` | ||
rafaelsamenezes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "Processing: $contract" | ||
if [[ -z "$contract" ]]; then | ||
continue | ||
fi | ||
if echo "$contract" | grep -q "$unsupported_regex"; then | ||
continue | ||
fi | ||
echo "Running: goto-transcoder $contract $contract_folder/$line $contract.esbmc.goto" | ||
cargo run cbmc2esbmc $contract ../$contract_folder/$line $contract.esbmc.goto | ||
celinval marked this conversation as resolved.
Show resolved
Hide resolved
|
||
./linux-release/bin/esbmc --binary $contract.esbmc.goto | ||
done < "_contracts.txt" | ||
|
||
rm "_contracts.txt" | ||
cd .. |
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.
Uh oh!
There was an error while loading. Please reload this page.