Skip to content

Commit 6da6559

Browse files
Add instruction for conformance testing against local build (#4910)
* Add instructions for conformance testing against local build with examples * Add instructions to build the Haskell code from formal ledger --------- Co-authored-by: teodanciu <teodora.danciu@tweag.io>
1 parent b1672f1 commit 6da6559

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ from [the Shelley ledger spec](./eras/shelley/formal-spec)).
289289
4. Add a link to the package near the bottom of [flake.nix](./flake.nix),
290290
following the existing examples.
291291

292+
### To build the Haskell code from the Agda ledger spec
293+
294+
See [Build the spec using nix-build](https://github.com/IntersectMBO/formal-ledger-specifications/tree/master?tab=readme-ov-file#build-the-spec-using-nix-build)
295+
and [Contributing](https://github.com/IntersectMBO/formal-ledger-specifications/blob/master/CONTRIBUTING.md)
296+
in the [formal-ledger-specifications repo](https://github.com/IntersectMBO/formal-ledger-specifications).
297+
292298
### To update the referenced Agda ledger spec
293299

294300
To update the version of the Agda spec that the conformance tests are using:
@@ -304,6 +310,41 @@ To update the version of the Agda spec that the conformance tests are using:
304310

305311
If the commit you need in `formal-ledger-specifications` is not on master, open a PR for your branch in the `formal-ledger-specifications` repository. This will create a branch with the updated generated code, which you can then use as described above. You will not be able to merge in `cardano-leder` master a reference to a commit not yet merged in `formal-ledger-specifications`.
306312

313+
### To run conformance testing against a local build of the Agda ledger spec
314+
315+
1. Enter the `nix develop` shell
316+
2. Comment out the `source-repository-package` section in `cabal.project`
317+
3. Add the path to the local build directory (containing the `cardano-ledger-executable-spec.cabal` file, see below for examples) to `packages` in `cabal.project`
318+
4. Execute the tests, e.g., running `cabal test cardano-ledger-conformance`
319+
320+
To change the local build directory, redo step 3 _without leaving_ the `nix develop` shell.
321+
322+
#### Examples
323+
324+
- As an absolute path:
325+
326+
Compiling the `formal-ledger-specifications` to Haskell via:
327+
```shell
328+
nix-build -A ledger.hsSrc
329+
```
330+
returns a path to the nix store, e.g., `/nix/store/9pv3x44dfnwrz0jjrh9mlxa9y143i987-hs-src-0.1`, that can be used as:
331+
```
332+
/nix/store/9pv3x44dfnwrz0jjrh9mlxa9y143i987-hs-src-0.1/haskell/Ledger
333+
```
334+
in the packages section of the `cabal.project` file.
335+
336+
- As a relative path:
337+
338+
Cloning the [formal-ledger-specifications repo](https://github.com/IntersectMBO/formal-ledger-specifications) on a `MAlonzo` branch as a sibling folder, e.g., `spec`, of `cardano-leder`:
339+
```shell
340+
git clone -b MAlonzo-code git@github.com:IntersectMBO/formal-ledger-specifications.git spec
341+
```
342+
and using:
343+
```
344+
../spec/generated/
345+
```
346+
in the `cabal.project` file.
347+
307348
### Additional documentation
308349

309350
You can find additional documentation on the nix infrastructure used in this

0 commit comments

Comments
 (0)