These notes describe running conformance tests on the Cardano blockchain ledger---specifically, we test the native Haskell implementation against the Agda-generated Haskell code of the formal specification.
We'll create
fls = a directory where we clone the formal-ledger-specifications repo.
cl = a directory where we clone the cardano-ledger repo.
in our $HOME directory, but the choice of location is arbitrary.
-
Clone the formal-ledger-specifications repository.
In the directory
fls/masterclone the formal-ledger-specifications repository, as follows:cd # enter $HOME directory mkdir -p fls cd fls git clone https://github.com/IntersectMBO/formal-ledger-specifications.git master cd master
We're now in
fls/master, the project root of formal-ledger-specifications, on the master branch. -
Generate Haskell code from the Agda formalization.
In the
fls/masterdirectory, enternix develop --command fls-shake hsUpon completion, this results in
fls/master/dist/hs -
Clone the cardano-ledger repository.
In the directory
cl/masterclone the cardano-ledger repository, as follows:cd # enter $HOME directory mkdir -p cl cd cl git clone https://github.com/IntersectMBO/cardano-ledger.git master cd master
-
Edit the
cabal.projectfile.Comment out the following block:
source-repository-package type: git location: https://github.com/IntersectMBO/formal-ledger-specifications.git subdir: hs -- !WARNING!: -- MAKE SURE THIS POINTS TO A COMMIT IN `*-artifacts` BEFORE MERGE! tag: 61f0683c62adf1efe67f14e11dc0edfe884c348fand place the following at the bottom of the
packages:section:/home/your-user-name/fls/master/dist/hsImportant. Replace
/home/you-user-name/with your actual$HOMEdirectory! -
Enter the default Nix development shell.
cd cd cl/master nix develop -
Run some tests!
For example, to run tests concerning the
CERTSrule,cabal test cardano-ledger-conformance --test-options='--match "CERTS"'