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

M2 updates and milestone report #16

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@
--reload=cem-script.cabal --command="cabal repl test-suite:cem-sdk-test" -W -T ":main"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
devnet/db
haddocks
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@ 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

## Running tests

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/
```

After that run: `cabal test`.

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

## 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
16 changes: 14 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,21 @@ 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 2023-12-24T05:49:51Z
, cardano-haskell-packages 2023-12-24T05:54:15Z

source-repository-package
type: git
location: https://github.com/geniusyield/plutus-simple-model
tag: 0cb63af903a835c73aec662092eb67d228bba9b0
--sha256: sha256-H56EyRFNdDvLDo9FVeGZyQZ92itQPG39TkMVyEC/xqM=
subdir:
cardano-simple
psm

tests: true

allow-newer:
cardano-ledger-shelley-ma:base

packages: .
96 changes: 86 additions & 10 deletions cem-script.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ synopsis: Cardano DApp SDK
homepage: https://github.com/cem-script
author: MLabs
maintainer: [email protected]
data-files: README.md
data-files:
data/alonzo-params.json
README.md

-- @todo #3 Reproduce `cabal repl` and HLS build on another (@adamczykm) computer
tested-with: GHC ==9.6.3
Expand All @@ -21,10 +23,12 @@ common common-lang
-- Options from MLabs styleguide

ghc-options:
-Wall -Wcompat -Wincomplete-record-updates
-Wincomplete-uni-patterns -Wredundant-constraints
-Wmissing-export-lists -Wmissing-deriving-strategies
-Wno-redundant-constraints

-- -Wall
-- -Wcompat -Wincomplete-record-updates
-- -Wincomplete-uni-patterns -Wredundant-constraints
-- -Wmissing-export-lists -Wmissing-deriving-strategies
-- -Wno-redundant-constraints

if !flag(dev)
ghc-options: -Werror
Expand Down Expand Up @@ -60,6 +64,7 @@ common common-lang
MultiParamTypeClasses
NamedFieldPuns
NoImplicitPrelude
NoPolyKinds
NumericUnderscores
OverloadedStrings
PatternSynonyms
Expand All @@ -76,6 +81,7 @@ common common-lang
TypeOperators
TypeSynonymInstances
UndecidableInstances
ViewPatterns

if flag(dev)
default-extensions: PartialTypeSignatures
Expand All @@ -85,12 +91,15 @@ common common-lang
common common-onchain
import: common-lang
build-depends:
, plutus-core
, plutus-ledger-api
, plutus-tx
, plutus-tx-plugin
, template-haskell >=2.20
, th-abstraction >=0.6.0.0

if flag(dev)
ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors
-- if flag(dev)
-- ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors

-- Options for Plutus Tx compilations
-- (some are enabled additionaly in individual modules)
Expand All @@ -99,24 +108,91 @@ common common-onchain
-fplugin-opt PlutusTx.Plugin:target-version=1.0.0 -fobject-code
-fno-ignore-interface-pragmas -fno-omit-interface-pragmas
-fno-specialize -fno-unbox-small-strict-fields
-fno-unbox-strict-fields
-fno-unbox-strict-fields -fno-full-laziness -fno-spec-constr
-fno-strictness -fno-unbox-small-strict-fields

common common-offchain
import: common-lang
build-depends:
, aeson
, bytestring
, cardano-api
, cardano-crypto-class
, cardano-ledger-alonzo
, cardano-ledger-babbage
, cardano-ledger-core
, cardano-ledger-shelley
, containers
, filepath
, ouroboros-consensus-cardano
, ouroboros-network-protocols
, pretty-show
, retry
, text
, time
, unix

-- , cardano-cli
common common-executable
import: common-offchain
ghc-options: -threaded -rtsopts

library cem-sdk
import: common-onchain
library data-spine
import: common-lang
hs-source-dirs: src-lib/data-spine
build-depends:
, singletons
, template-haskell

exposed-modules: Data.Spine

library cardano-extras
import:
common-offchain,
common-onchain

hs-source-dirs: src-lib/cardano-extras
build-depends: template-haskell
exposed-modules:
Cardano.Extras
Plutus.Extras

library
import:
common-onchain,
common-offchain

hs-source-dirs: src/
exposed-modules:
Cardano.CEM
Cardano.CEM.Examples.Auction
Cardano.CEM.Examples.Compilation
Cardano.CEM.Examples.Voting
Cardano.CEM.Monads
Cardano.CEM.Monads.CLB
Cardano.CEM.Monads.L1
Cardano.CEM.OnChain
Cardano.CEM.Stages

-- Cardano.CEM.Examples.Escrow
build-depends:
, cem-script:{cardano-extras, data-spine}
, dependent-map
, singletons-th

test-suite cem-sdk-test
import:
common-onchain,
common-offchain,

type: exitcode-stdio-1.0
build-depends:
, cem-script:{cem-script, cardano-extras, data-spine}
, dependent-map
, hspec
, QuickCheck
, quickcheck-dynamic
, random

hs-source-dirs: test/
main-is: Main.hs
Binary file added devnet/byron-delegate.key
Binary file not shown.
8 changes: 8 additions & 0 deletions devnet/byron-delegation.cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ "omega": 0
, "issuerPk":
"NclXQiNNEpaaLdSxP3VFeOPIfSuFqBcNtmv8/7fftBKtgW1Aig7UqHJ/czsywkWFFVmBYPRnGjXspUl3wEMvuQ=="
, "delegatePk":
"24ejRK+kCDs1g4f3PcodFEUFVgNFWtfmuoEtVQf8/Ii2j2ruXHebJmZZPrwtAdbJYwDiSEvsHr95+BAF1ifGsA=="
, "cert":
"498c72e35ef30cd4657b48bfcc0a84a555a67981e3b6104a0d1708ab84510367d81e1ba3f47619565b1ee1098e31dcb8eb648d8030e061b568de113fdf3d6a09"
}
80 changes: 80 additions & 0 deletions devnet/cardano-node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"Protocol": "Cardano",

"ByronGenesisFile": "genesis-byron.json",
"ShelleyGenesisFile": "genesis-shelley.json",
"AlonzoGenesisFile": "genesis-alonzo.json",
"ConwayGenesisFile": "genesis-conway.json",

"ApplicationName": "cardano-sl",
"ApplicationVersion": 1,
"MaxKnownMajorProtocolVersion": 2,
"LastKnownBlockVersion-Alt": 0,
"LastKnownBlockVersion-Major": 6,
"LastKnownBlockVersion-Minor": 0,

"TestShelleyHardForkAtEpoch": 0,
"TestAllegraHardForkAtEpoch": 0,
"TestMaryHardForkAtEpoch": 0,
"TestAlonzoHardForkAtEpoch": 0,
"TestBabbageHardForkAtEpoch": 0,

"RequiresNetworkMagic": "RequiresNoMagic",

"minSeverity": "Info",
"defaultBackends": ["KatipBK"],
"defaultScribes": [[ "StdoutSK", "stdout" ]],
"setupBackends": ["KatipBK"],
"setupScribes": [
{
"scFormat": "ScJson",
"scKind": "StdoutSK",
"scName": "stdout",
"scRotation": null
}
],

"TurnOnLogMetrics": true,
"TurnOnLogging": true,

"TracingVerbosity": "NormalVerbosity",
"TraceBlockFetchClient": false,
"TraceBlockFetchDecisions": false,
"TraceBlockFetchProtocol": false,
"TraceBlockFetchProtocolSerialised": false,
"TraceBlockFetchServer": false,
"TraceChainDb": true,
"TraceChainSyncBlockServer": false,
"TraceChainSyncClient": false,
"TraceChainSyncHeaderServer": false,
"TraceChainSyncProtocol": false,
"TraceDNSResolver": false,
"TraceDNSSubscription": false,
"TraceErrorPolicy": false,
"TraceForge": true,
"TraceHandshake": false,
"TraceIpSubscription": false,
"TraceLocalChainSyncProtocol": true,
"TraceLocalErrorPolicy": false,
"TraceLocalHandshake": false,
"TraceLocalTxSubmissionProtocol": true,
"TraceLocalTxSubmissionServer": true,
"TraceMempool": true,
"TraceMux": false,
"TraceTxInbound": false,
"TraceTxOutbound": false,
"TraceTxSubmissionProtocol": false,

"options": {
"mapBackends": {
"cardano.node.metrics": [ "EKGViewBK" ],
"cardano.node.resources": [ "EKGViewBK" ]
},
"mapSubtrace": {
"cardano.node.metrics": { "subtrace": "Neutral" }
}
},

"ExperimentalHardForksEnabled": true,
"ExperimentalProtocolsEnabled": true
}
5 changes: 5 additions & 0 deletions devnet/credentials/alice.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "58204e1eaaad4ed0ab25c802b7dd90fc8e30001c88bb19dd04a0eea592050b80f35d"
}
5 changes: 5 additions & 0 deletions devnet/credentials/alice.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "",
"cborHex": "5820eb94e8236e2099357fa499bfbc415968691573f25ec77435b7949f5fdfaa5da0"
}
5 changes: 5 additions & 0 deletions devnet/credentials/bob.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "5820258cb3f25a69b9a084bc36fed08fd66473ac6cb549ffa6dcb138bacbc74c3fa4"
}
5 changes: 5 additions & 0 deletions devnet/credentials/bob.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "",
"cborHex": "5820fb1e80f6b5c0ef33d1b68215389d0ac836412a99edfac8bb203eb1d782342ab3"
}
5 changes: 5 additions & 0 deletions devnet/credentials/carol.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "5820bdbe4654a6afa701a52ffb1b020df118c82bafe8dc4670b218a3c903fcfbc5ac"
}
5 changes: 5 additions & 0 deletions devnet/credentials/carol.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "Payment Verification Key",
"cborHex": "5820e48471a0e6711b566ae3607582dfa1e79dacfadaa41682673c91cec014907904"
}
5 changes: 5 additions & 0 deletions devnet/credentials/dave.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "58207db5f1648fad2d8582ccfb66b5a5d9e010d42a71307eedb8c65b4517ac52795d"
}
5 changes: 5 additions & 0 deletions devnet/credentials/dave.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "Payment Verification Key",
"cborHex": "5820cacd56e031dbfafbd2bef50d4b9caf9d7692176d306b4cb84178577005ed4e97"
}
5 changes: 5 additions & 0 deletions devnet/credentials/eve.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "58204529a253925e55cb2bfb1fc7c7114e0d7c2b3f5e08011ef54391517d06240bb4"
}
5 changes: 5 additions & 0 deletions devnet/credentials/eve.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "Payment Verification Key",
"cborHex": "5820bbb3a08d51be1a2cc91be884229dc3dc2931e3dba1258949af80d12c26fb6cb0"
}
5 changes: 5 additions & 0 deletions devnet/credentials/faucet.sk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentSigningKeyShelley_ed25519",
"description": "Payment Signing Key",
"cborHex": "5820a5e4238b67ebb1108c52a01ac850bbce82c915d77bad94331892f3edf612883c"
}
5 changes: 5 additions & 0 deletions devnet/credentials/faucet.vk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "PaymentVerificationKeyShelley_ed25519",
"description": "Payment Verification Key",
"cborHex": "5820ce13cd433cdcb3dfb00c04e216956aeb622dcd7f282b03304d9fc9de804723b2"
}
Loading
Loading