A compiler that translates Declarative smart contracts into Solidity programs.
Build tool: SBT
sbt "run compile benchmarks/[contract_name].dl"
The complete list of benchmark smart contracts are in here.
Other options:
--fuse consolidate updates into one function
--materialize <filename> materialize the set of relations specified in file
--out <directory> output directory
The view materialization file is organized as a csv file, where the names of the materialized relations are separated by comma. See an example. Other examples are located in view-materialization.
- Generate Solidity programs:
sbt "run test"
- Generate Solidity programs with instrumentations for run-time verification:
sbt "run test-instrument"
The generated programs are located at solidity/dsc
and solidity/dsc-instrument
.
Alternatively, one could run it in docker.
First install Docker from here.
- Pull the docker image:
docker pull hxchen/fse22-artifact
- Generate Solidity programs:
docker run hxchen/fse22-artifact sh -c "sbt 'run test'; cat solidity/dsc/*.sol"
- Generate Solidity programs with instrumentations for run-time verification:
docker run hxchen/fse22-artifact sh -c "sbt 'run test-instrument'; cat solidity/dsc-instrument/*.sol"
Examples of declarative smart contrats are located in benchmarks.
- Download z3 source.
- Build z3 and generate Java binding:
cd z3 python scripts/mk_make.py --java cd build make
- Copy files from
z3
todsc
project directory:- copy
com.microsoft.z3.jar
to sub-directory calledunmanaged
. - copy
libz3.dylib
andlibz3java.dylib
to the project directory.
- copy
- Add the following line to
build.sbt
:Compile / unmanagedJars += { baseDirectory.value / "unmanaged" / "com.microsoft.z3.jar" }
- In sbt configuration, set working directory as the project directory, so that Java runtime can locate the two dylib file.