Skip to content

Commit

Permalink
Merge branch 'master' into uhbif19/update-soa-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
euonymos authored Dec 19, 2024
2 parents 1c1cc0d + 1984e82 commit a380ba7
Show file tree
Hide file tree
Showing 79 changed files with 5,491 additions and 75 deletions.
8 changes: 0 additions & 8 deletions .0pdd.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/nix-community/nix-direnv A fast, persistent use_nix/use_flake implementation for direnv:
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
# https://github.com/input-output-hk/devx Slightly opinionated shared GitHub Action for Cardano-Haskell projects
use flake "github:input-output-hk/devx?rev=6ee20d669c3a3823c5add1e1528818ccff1eb2b9#ghc96-iog"
2 changes: 2 additions & 0 deletions .ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:set -Wunused-binds -Wunused-imports -Worphans
:set -isrc -itest
1 change: 1 addition & 0 deletions .ghcid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--command="cabal repl test-suite:cem-sdk-test" -W -T ":main"
72 changes: 72 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Haskell-CI
on:
# Reusing caches requires building in `main` branch
- push
# Does not seem to work
- merge_group

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup DevX
uses: input-output-hk/actions/devx@latest
with:
platform: 'x86_64-linux'
compiler-nix-name: 'ghc96'
minimal: false
iog: true
- name: Check Nix env
shell: devx {0}
run: |
echo 'Running in DevX'
ghc --version
cabal --version
- name: Use cabal cache
id: cache-cabal
uses: actions/cache/restore@v3
with:
path: |
~/.cabal-devx
dist-newstyle
key: ${{ runner.os }}-ghc964-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-ghc964-
- name: Cabal setup
shell: devx {0}
run: |
cabal configure -f-dev
cabal update
- name: Install and run linters
shell: devx {0}
run: |
cabal install --overwrite-policy=always cabal-fmt
cabal install --overwrite-policy=always fourmolu
/home/runner/.cabal-devx/bin/cabal-fmt --check cem-script.cabal
/home/runner/.cabal-devx/bin/fourmolu --mode check .
- name: Cabal build and test
shell: devx {0}
run: |
cabal build
cabal test
- name: Build haddock
if: ${{ vars.GITHUB_REF_NAME == 'master' }}
shell: devx {0}
run: |
cabal haddock-project --hackage --internal
- name: Save cabal cache
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cabal-devx
dist-newstyle
key: ${{ runner.os }}-ghc964-${{ hashFiles('**/*.cabal', '**/cabal.project', '**/cabal.project.freeze') }}
- name: Save cabal cache (generic key)
uses: actions/cache/save@v3
if: always()
with:
path: |
~/.cabal-devx
dist-newstyle
key: ${{ runner.os }}-ghc964-
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ cabal.project.local~
.HTF/
.ghc.environment.*
.vscode
haddocks
.direnv/
# Functions changed by runing local testnet
devnet/db
devnet/genesis-*.json
12 changes: 10 additions & 2 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
- group: {name: generalise, enabled: true}
- functions:
- {name: undefined, within: []}
# Do not prohibit using more monomorphic functions
- ignore: {name: Use pure}
- ignore: {name: Use fmap}
- ignore: {name: Use traverse_}
- ignore: {name: "Use <>"}
# Do not enforce less explicit expressions
# and util functions consisting of single line of code
- ignore: {name: Use isNothing}
- ignore: {name: Use print}
- ignore: {name: Use null}
- ignore: {name: Use notElem}
- ignore: {name: Use unless}
- ignore: {name: Use fmap}
- ignore: {name: Use traverse_}
- ignore: {name: "Use asks"}
- ignore: {name: "Eta reduce"}
- ignore: {name: Use concatMap}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"cSpell.words": [
"Fracada",
"POCRE",
"Serialised"
],
"haskell.manageHLS": "PATH"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 MLabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 42 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
[![PDD status](https://www.0pdd.com/svg?name=mlabs-haskell/cem-script)](https://www.0pdd.com/p?name=mlabs-haskell/cem-script)

# CEM SDK

* @todo #3 Take decision if to change project name to CEM SDK
* @todo #3 Found out if we can make PDD bot descriptions and mentions less noisy

## Project pitch

Define and reuse Cardano DApp logic via annotated CEM-machines, resulting in free implementations for:
Expand All @@ -15,6 +10,48 @@ Define and reuse Cardano DApp logic via annotated CEM-machines, resulting in fre
* Automatically testing invariants
* Human-readable specs

## Building

Building is performed with cabal.
Building requires `libblst` and `libsodium` installed.

Arch Linux has `libblst` in AUR, nix are exemplified by IOHK,
and manual installation is described here:
https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/getting-started/install.md#installing-blst

Make sure to `cabal update` before building.

The project uses `github:input-output-hk/devx` to make the development shell. See `.envrc` for details.

## Running tests

Tests are runned in emulated environment by default.

Just run: `cabal test`.

For development and fast response once could consider `ghcid`.

## Starting local devnet

Tests depend on localdevnet, which is runned in Docker.
To start it do:

```bash
./prepare-devnet.sh
docker-compose -f docker-compose.devnet.yaml up
sudo chown -R $USER:$USER ./devnet/
```

## Devnet stalling bug

Sometimes devnet stalls, due to some bug, in that case one should restart it,
and wipe directory `./devnet/db`. To look for stalling one could check:
`CARDANO_NODE_SOCKET_PATH=./devnet/node.socket cardano-cli query tip --testnet-magic 42`. For properly working devnet slots should change
and sync be marked as 100%.

On this bug:
https://forum.cardano.org/t/restarting-custom-private-networks-cardano-node-forge35/116921

## Project status

Project is in early development stage and is funded by
Expand Down
24 changes: 22 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,29 @@ repository cardano-haskell-packages
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

index-state:
, hackage.haskell.org 2023-11-03T12:09:05Z
, cardano-haskell-packages 2023-11-03T12:09:05Z
, hackage.haskell.org 2024-06-12T10:15:00Z
, cardano-haskell-packages 2024-06-12T11:52:25Z

tests: true

source-repository-package
type: git
location: https://github.com/mlabs-haskell/clb
tag: d5b0e7ce07258482d53704ce19383013b1fa6610
--sha256: 6+Os/mQDzBOU+TkTD+n/T1MFcI+Mn0/tcBMJhLRfqyA=

-- FIXME: Cannot use new commit, because it requires `plutus-ledger-api==1.29`
source-repository-package
type: git
location: https://github.com/Plutonomicon/plutarch-plutus
tag: fcdd2209433d8b8979e820dc4fa9aad5f202216d
--sha256: 6+Os/mQDzBOU+TkTD+n/T1MFcI+Mn0/tcBMJhLRfqyA=
subdir:
.
plutarch-ledger-api
plutarch-extra

packages: .

package cardano-crypto-praos
flags: -external-libsodium-vrf
Loading

0 comments on commit a380ba7

Please sign in to comment.