Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
uhbif19 committed Feb 6, 2024
1 parent 63220ac commit 22e020f
Show file tree
Hide file tree
Showing 26 changed files with 1,596 additions and 277 deletions.
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 -r
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
12 changes: 12 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ index-state:
, 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: .
40 changes: 38 additions & 2 deletions cem-script.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ common common-onchain
, 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
Expand All @@ -97,16 +99,32 @@ common common-onchain
-- (some are enabled additionaly in individual modules)

ghc-options:
-fplugin-opt PlutusTx.Plugin:target-version=1.0.0 -fobject-code
-fplugin-opt PlutusTx.Plugin:target-version=1.0.0
-fplugin-opt PlutusTx.Plugin:verbosity=2
-fobject-code
-fno-ignore-interface-pragmas -fno-omit-interface-pragmas
-fno-specialize -fno-unbox-small-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
, pretty-show
, retry
, cardano-api
, cardano-cli
, cardano-ledger-core
, cardano-ledger-babbage
, cardano-ledger-alonzo
, cardano-ledger-shelley
, ouroboros-consensus-cardano
, cardano-crypto-class
, containers
, filepath
, text
Expand All @@ -124,9 +142,27 @@ library cem-sdk

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

test-suite cem-sdk-test
import:
common-onchain,
common-offchain,
type: exitcode-stdio-1.0
build-depends:
hspec,
cem-script:cem-sdk,
QuickCheck,
quickcheck-dynamic,
hs-source-dirs: test/
main-is: Main.hs
2 changes: 1 addition & 1 deletion devnet/genesis-byron.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"k": 2160,
"protocolMagic": 42
},
"startTime": 1706549850,
"startTime": 1707213473,
"blockVersionData": {
"scriptVersion": 0,
"slotDuration": "250",
Expand Down
2 changes: 1 addition & 1 deletion devnet/genesis-byron.json.bak
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"k": 2160,
"protocolMagic": 42
},
"startTime": 1706549840,
"startTime": 1707128149,
"blockVersionData": {
"scriptVersion": 0,
"slotDuration": "250",
Expand Down
37 changes: 36 additions & 1 deletion devnet/genesis-conway.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
{
"genDelegs": {}
"genDelegs": {},
"poolVotingThresholds": {
"pvtCommitteeNormal": 0.51,
"pvtCommitteeNoConfidence": 0.51,
"pvtHardForkInitiation": 0.51,
"pvtMotionNoConfidence": 0.51
},
"dRepVotingThresholds": {
"dvtMotionNoConfidence": 0.51,
"dvtCommitteeNormal": 0.51,
"dvtCommitteeNoConfidence": 0.51,
"dvtUpdateToConstitution": 0.51,
"dvtHardForkInitiation": 0.51,
"dvtPPNetworkGroup": 0.51,
"dvtPPEconomicGroup": 0.51,
"dvtPPTechnicalGroup": 0.51,
"dvtPPGovGroup": 0.51,
"dvtTreasuryWithdrawal": 0.51
},
"committeeMinSize": 0,
"committeeMaxTermLength": 200,
"govActionLifetime": 10,
"govActionDeposit": 1000000000,
"dRepDeposit": 2000000,
"dRepActivity": 20,
"constitution": {
"anchor": {
"url": "",
"dataHash": "0000000000000000000000000000000000000000000000000000000000000000"
}
},
"committee": {
"members": {
},
"quorum": 0
}
}
4 changes: 2 additions & 2 deletions devnet/genesis-shelley.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"epochLength": 432000,
"epochLength": 5,
"activeSlotsCoeff": 1.0,
"slotLength": 0.1,
"securityParam": 2160,
Expand Down Expand Up @@ -60,6 +60,6 @@
"074a515f7f32bf31a4f41c7417a8136e8152bfb42f06d71b389a6896": "8a219b698d3b6e034391ae84cee62f1d76b6fbc45ddfe4e31e0d4b60"
}
},
"systemStart": "2024-01-29T17:37:30Z",
"systemStart": "2024-02-06T09:57:53Z",
"updateQuorum": 2
}
4 changes: 2 additions & 2 deletions devnet/genesis-shelley.json.bak
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"epochLength": 432000,
"epochLength": 5,
"activeSlotsCoeff": 1.0,
"slotLength": 0.1,
"securityParam": 2160,
Expand Down Expand Up @@ -60,6 +60,6 @@
"074a515f7f32bf31a4f41c7417a8136e8152bfb42f06d71b389a6896": "8a219b698d3b6e034391ae84cee62f1d76b6fbc45ddfe4e31e0d4b60"
}
},
"systemStart": "2024-01-29T17:37:20Z",
"systemStart": "2024-02-05T10:15:49Z",
"updateQuorum": 2
}
20 changes: 20 additions & 0 deletions docker-compose.devnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
cardano-node-devnet:
image: ghcr.io/input-output-hk/cardano-node:8.7.3
volumes:
- ./devnet:/devnet
environment:
- CARDANO_BLOCK_PRODUCER=true
- CARDANO_SOCKET_PATH=/devnet/node.socket # used by cardano-node
- CARDANO_NODE_SOCKET_PATH=/devnet/node.socket # used by cardano-cli
command:
[ "run"
, "--config", "/devnet/cardano-node.json"
, "--topology", "/devnet/topology.json"
, "--database-path", "/devnet/db"
, "--shelley-kes-key", "/devnet/kes.skey"
, "--shelley-vrf-key", "/devnet/vrf.skey"
, "--shelley-operational-certificate", "/devnet/opcert.cert"
, "--byron-delegation-certificate", "/devnet/byron-delegation.cert"
, "--byron-signing-key", "/devnet/byron-delegate.key"
]
5 changes: 3 additions & 2 deletions docs/goals_and_soa.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ are covering our high-level goals.

1. DApp logic as whole (synced-by-construction)
2. Code is free from common security weaknesses by construction (secure-by-construction)
3. Seamplessly emulate and test anything (emulate-anything)
3. Seamlessly emulate and test anything (emulate-anything)
4. Declarativity close to informal specification and bridging lightweight formal methods (declarative-spec)
5. Generally production ready (production-ready)

Expand All @@ -40,7 +40,7 @@ are covering our high-level goals.
## Reference apps

Those are list of open-source DApps,
what we use to demonstrate problems in folloging:
what we use to demonstrate problems in folloving:

* Audited production DApps
* Agora
Expand Down Expand Up @@ -167,6 +167,7 @@ real blockchain behaviour may lead to flacky test behaviour.
Our script stages abstraction cover all those kind of problems.

* @todo #3: document problems with slots
* https://github.com/mlabs-haskell/hydra-auction/issues/236
* @todo #3: bug example


Expand Down
4 changes: 4 additions & 0 deletions prepare-devnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TARGETDIR=devnet
sed -i.bak "s/\"startTime\": [0-9]*/\"startTime\": $(date +%s)/" "$TARGETDIR/genesis-byron.json" && \
sed -i.bak "s/\"systemStart\": \".*\"/\"systemStart\": \"$(date -u +%FT%TZ)\"/" "$TARGETDIR/genesis-shelley.json"
sudo chown -R $USER:$USER ./devnet/
Loading

0 comments on commit 22e020f

Please sign in to comment.