Skip to content
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

Remove dependency on abcBridge #1320

Merged
merged 33 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3fd2313
Remove abcBridge from saw-remote-api dependencies
May 21, 2021
153b079
Remove abcBridge as a saw executable dependency
May 21, 2021
cecd30f
Bump aig submodule
May 24, 2021
c3d4119
Un-deprecate functions that `aig` now implements
May 28, 2021
378b10c
Remove dependency of css on abcBridge
May 28, 2021
a1c0a01
Remove several references to abcBridge
May 28, 2021
05206c6
Adapt a test to not use ABC
May 28, 2021
84f08bd
Bump aig submodule
Jun 4, 2021
c69d299
Update ABC-based test to use ABC externally
Jun 4, 2021
a80f830
Fix typo in ci.sh
Jun 4, 2021
83a14b6
Adapt ECDSA proof to use Yices instead of ABC
Jun 4, 2021
a189a2d
Bump aig submodule
Jun 11, 2021
7363709
Use mostly Yices for Salsa20 example
Jun 11, 2021
95997d2
Make `w4_abc_{smtlib2,verilog}` current
Jun 11, 2021
228c6cf
Introduce `w4_abc_aiger`, similar to old `abc`
Jun 14, 2021
ed88d1d
Small cleanups in prover backends
Jun 14, 2021
618ae0d
Bump aig submodule
Jun 14, 2021
e2c0f1a
Correct endianness of AIGER model parsing
Jun 14, 2021
02092f3
Use different provers for some test cases
Jun 14, 2021
bc5379d
Squash warnings
Jun 14, 2021
45c8dab
Add changelog entries for ABC changes
Jun 15, 2021
d7c30af
Bump aig submodule
Jun 16, 2021
fb43090
[CI] Download pre-built abc binary in more cases
Jun 17, 2021
d7f6e40
Improve ability to run abc in CI
Jun 21, 2021
7619310
Copy abc binary into s2n test Docker containers
Jun 21, 2021
99fc521
Make Python tests a little more portable
Jun 21, 2021
e097341
Make low-level remote API tests faster
Jun 21, 2021
3570baa
Simplify CI checkout
Jun 22, 2021
fe83d8f
Check solvers before testing saw-remote-api
Jun 22, 2021
53a5bf6
Work around `abc -h` returning exit code 1
Jun 22, 2021
0b80419
Try avoiding Yices in saw-remote-api tests
Jun 22, 2021
f9f5b1e
Remove one more Yices from saw-remote-api tests
Jun 22, 2021
02b199f
Merge branch 'master' into at-remove-abc
mergify[bot] Jun 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ build() {
cabal v2-update
cabal v2-configure -j --enable-tests
git status --porcelain
pkgs=(saw)
if $IS_WIN; then
echo "flags: -builtin-abc" >> cabal.project.local
echo "constraints: cryptol-saw-core -build-css" >> cabal.project.local
pkgs=(saw)
else
pkgs+=(saw-remote-api)
pkgs=(saw saw-remote-api)
fi
tee -a cabal.project.local > /dev/null < cabal.project.ci
if ! retry cabal v2-build "$@" "${pkgs[@]}"; then
Expand Down Expand Up @@ -163,7 +161,6 @@ build_cryptol() {
bundle_files() {
mkdir -p dist dist/{bin,doc,examples,include,lib}

cp deps/abcBridge/abc-build/copyright.txt dist/ABC_LICENSE
cp LICENSE README.md dist/
$IS_WIN || chmod +x dist/bin/*

Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ jobs:
name: "${{ runner.os }}-bins"
path: dist/bin

- if: runner.os != 'Windows'
uses: actions/download-artifact@v2
with:
path: dist/bin
name: abc-${{ runner.os }}

- uses: actions/setup-python@v2
with:
python-version: '3.9'
Expand All @@ -214,6 +220,12 @@ jobs:
run: |
chmod +x dist/bin/*
export PATH="$PWD/dist/bin:$PATH"
echo "$PWD/dist/bin" >> "$GITHUB_PATH"
abc -h || true
yices --version
yices-smt2 --version
saw --version
saw-remote-api --help
${{ matrix.test }}

cabal-test:
Expand Down Expand Up @@ -256,18 +268,14 @@ jobs:
if: "runner.os != 'Windows'"
run: chmod +x dist/bin/*

- if: |
runner.os != 'Windows' &&
matrix.suite == 'integration_tests'
- if: runner.os != 'Windows'
uses: actions/download-artifact@v2
with:
path: bin
name: abc-${{ runner.os }}

- shell: bash
if: |
runner.os != 'Windows' &&
matrix.suite == 'integration_tests'
if: runner.os != 'Windows'
run: chmod +x bin/*

- uses: actions/download-artifact@v2
Expand Down Expand Up @@ -308,9 +316,8 @@ jobs:
cache: ghcr.io/galoisinc/cache-saw-remote-api
steps:
- uses: actions/checkout@v2
- run: |
git submodule update --init
git -C deps/abcBridge submodule update --init
with:
submodules: true
Copy link
Member

Choose a reason for hiding this comment

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

I think the original intent was to checkout only the abcBridge dependency and not the entire set of submodules, @ldettwy .


- uses: rlespinasse/[email protected]

Expand Down Expand Up @@ -421,6 +428,11 @@ jobs:
name: "saw-Linux-${{ matrix.ghc }}"
path: ./s2nTests/bin

- uses: actions/download-artifact@v2
with:
path: ./s2nTests/bin
name: abc-${{ runner.os }}

- shell: bash
working-directory: s2nTests
run: |
Expand All @@ -439,7 +451,7 @@ jobs:
name: "s2n tests: ${{ matrix.s2n-target }}"
working-directory: s2nTests
run: |
chmod +x bin/saw
chmod +x bin/*
make ${{ matrix.s2n-target }}

# Indicates sufficient CI success for the purposes of mergify merging the pull
Expand Down
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ A new `enable_lax_pointer_ordering` function exists, which relaxes the
restrictions that Crucible imposes on comparisons between pointers from
different allocation blocks.

## Changes

* The linked-in version of ABC (based on the Haskell `abcBridge`
library) has been removed. During the original planning for this
removal, we marked commands based on this library as deprecated. In
the end, we replaced all of them except `cec` with Haskell
implementations, so no other commands have been removed, and the
following commands are now "current" again:

* `abc` (which now is the same as `w4_abc_verilog`)
* `load_aig`
* `save_aig`
* `save_aig_as_cnf`
* `bitblast`
* `write_aiger`
* `write_cnf`

We have also implemented a `w4_abc_aiger` command that writes a `Term`
in AIGER format and invokes ABC on it as an external process. This
should be very similar to the original `abc` command. Note that the
pure Haskell AIGER and CNF generation code has not been heavily tuned
for performance, and could likely be made more efficient. Please file
[issues](https://github.com/galoisinc/saw-script/issues) for
performance regressions you encounter!

# Version 0.8

## New Features
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ build using `build.sh`; see
[Manual Installation](#manual-installation) above. Key automatically
downloaded dependencies include:

* `deps/abcBridge/`: [Haskell bindings for ABC](https://github.com/GaloisInc/abcBridge)
* `deps/crucible/`: [Crucible symbolic execution engine](https://github.com/GaloisInc/crucible)
* `deps/cryptol/`: [Cryptol](https://github.com/GaloisInc/cryptol)

Expand Down Expand Up @@ -129,7 +128,6 @@ systems and Windows systems end up with different package dependencies.
Specifically, we remove lines for the following packages or flags:

```
abcBridge
cryptol-saw-core
regex-posix
saw-remote-api
Expand Down
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
git submodule update --init
(cd deps/abcBridge && git submodule update --init)

function install() {
cp $(find dist-newstyle -type f -name $1 | sort -g | tail -1) bin/
Expand Down
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ packages:
deps/llvm-pretty-bc-parser
deps/jvm-parser
deps/aig
deps/abcBridge
deps/cryptol
deps/what4/what4
deps/crucible/crucible
Expand Down
9 changes: 1 addition & 8 deletions cryptol-saw-core/cryptol-saw-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ Description:
extra-source-files:
saw/Cryptol.sawcore

flag build-css
description: Build the css executable
default: True

library
build-depends:
aig,
Expand Down Expand Up @@ -54,15 +50,12 @@ library
GHC-options: -Wall -Werror

executable css
if !flag(build-css)
buildable: False

other-modules:
Paths_cryptol_saw_core

build-depends:
aig,
array,
abcBridge,
base,
bytestring,
containers,
Expand Down
9 changes: 6 additions & 3 deletions cryptol-saw-core/css/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import qualified Cryptol.TypeCheck.Solver.SMT as SMT
import Cryptol.Utils.PP
import Cryptol.Utils.Logger (quietLogger)

import qualified Data.AIG.CompactGraph as AIG
import qualified Data.AIG.Interface as AIG
import qualified Data.AIG.Operations as AIG

import qualified Verifier.SAW.Cryptol as C
import Verifier.SAW.SharedTerm
import qualified Verifier.SAW.Cryptol.Prelude as C
import Verifier.SAW.CryptolEnv (schemaNoUser, meSolverConfig)


import qualified Data.ABC as ABC
import qualified Verifier.SAW.Simulator.BitBlast as BBSim

import qualified Paths_cryptol_saw_core as Paths
Expand Down Expand Up @@ -120,8 +123,8 @@ processModule menv fout funcName = do

writeAIG :: SharedContext -> FilePath -> Term -> IO ()
writeAIG sc f t = do
BBSim.withBitBlastedTerm ABC.giaNetwork sc mempty t $ \be ls -> do
ABC.writeAiger f (ABC.Network be (ABC.bvToList ls))
BBSim.withBitBlastedTerm AIG.compactProxy sc mempty t $ \be ls -> do
AIG.writeAiger f (AIG.Network be (AIG.bvToList ls))

extractCryptol :: SharedContext -> CM.ModuleEnv -> String -> IO Term
extractCryptol sc modEnv input = do
Expand Down
2 changes: 1 addition & 1 deletion deps/aig
2 changes: 1 addition & 1 deletion doc/tutorial/code/des-cryptol2.saw
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import "DES.cry";
let {{ thm key msg = decrypt key (encrypt key msg) == msg }};
prove_print abc {{ thm }};
prove_print w4_abc_verilog {{ thm }};
8 changes: 4 additions & 4 deletions doc/tutorial/code/des3.saw
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import "DES.cry";

print "proving dec_enc...";
let prop1 = {{ \key msg -> decrypt key (encrypt key msg) == msg }};
dec_enc <- prove_print abc {{prop1}};
dec_enc <- prove_print w4_abc_verilog {{prop1}};

print dec_enc;

print "proving enc_dec...";
let prop2 = {{ \key msg -> encrypt key (decrypt key msg) == msg }};
enc_dec <- prove_print abc {{prop2}};
enc_dec <- prove_print w4_abc_verilog {{prop2}};

print enc_dec;

Expand All @@ -24,7 +24,7 @@ prove_print do {
unfolding ["dec3", "enc3"];
simplify ss;
print_goal;
abc;
w4_abc_verilog;
} {{prop3}};

print "proving enc3_dec3...";
Expand All @@ -34,5 +34,5 @@ prove_print do {
unfolding ["dec3", "enc3"];
simplify ss;
print_goal;
abc;
w4_abc_verilog;
} {{prop4}};
2 changes: 1 addition & 1 deletion doc/tutorial/code/double.saw
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ double_imp <- llvm_extract l "double_imp";
double_ref <- llvm_extract l "double_ref";
let thm = {{ \x -> double_ref x == double_imp x }};

r <- prove abc thm;
r <- prove yices thm;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is anything checking these exercises/tutorials? @benjaminselfridge could we eventually get something like https://github.com/GaloisInc/cryptol/blob/master/cryptol/CheckExercises.hs implemented for this if not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, there's an integration test that pulls them in. That's how I discovered that this would be a lot faster with Yices. :)

print r;

r <- prove yices thm;
Expand Down
Loading