Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

GeniusYield Atlas Fork (not for merging) #112

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
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
191 changes: 188 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,11 +1,196 @@
repository cardano-haskell-packages
url: https://input-output-hk.github.io/cardano-haskell-packages
secure: True
root-keys:
3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

-- repeating the index-state for hackage to work around hackage.nix parsing limitation
index-state: 2023-06-06T00:00:00Z

index-state:
, hackage.haskell.org 2023-06-06T00:00:00Z
, cardano-haskell-packages 2023-06-05T06:39:32Z

packages:
./psm
./cardano-simple

-- TODO: Default value should be @direct@ in upcoming 3.10 version of cabal, omit this line then.
test-show-details: direct

-- Using 0.7.1.0, which is already on hackage; but bumping the index state will break everything.
source-repository-package
type: git
location: https://github.com/blockfrost/blockfrost-haskell
tag: v0.7.1.0
--sha256: sha256-hCT0yp3dnNTm7PRDXqrW9zYyUtALMqQNMxS7IZsNoe4=
subdir:
blockfrost-api
blockfrost-client
blockfrost-client-core

allow-newer:
, cardano-wallet:blockfrost-api
, cardano-wallet:blockfrost-client
, cardano-wallet:blockfrost-client-core

-- TODO: This is fixed for in their later version, omit this when we update to it.
package strict-containers
ghc-options: -Wwarn=noncanonical-monad-instances

source-repository-package
type: git
location: https://github.com/maestro-org/haskell-sdk
tag: deb1e133cd7de989e9e85c2b44e9361f52e93776
--sha256: sha256-k4OoAAUFdYkKDSTDeM2dwC/DrJrPotiz0EIeU0xccXY=

-- Unfortunately, cardano-node 8.1.2 is constrained with plutus-ledger-api 1.5.0.0 and we would like at least 1.6.0.0.
-- This is done in accordance with changes in https://github.com/input-output-hk/cardano-ledger/pull/3430/files.
constraints:
plutus-ledger-api == 1.6.0.0
, plutus-core == 1.6.0.0

allow-newer:
, cardano-ledger-alonzo:plutus-ledger-api
, cardano-ledger-alonzo:plutus-core
, cardano-ledger-alonzo-test:plutus-ledger-api
, cardano-ledger-alonzo-test:plutus-ledger-api-testlib
, cardano-ledger-babbage:plutus-ledger-api
, cardano-ledger-conway:plutus-ledger-api
, cardano-ledger-binary:plutus-ledger-api
, cardano-api:plutus-ledger-api
, cardano-api:plutus-ledger-api-testlib
, cardano-api:prettyprinter-configurable


-- Everything below is essentially copied from cardano-wallet's cabal.project.
-------- Begin contents from @cardano-wallet@'s @cabal.project@ file. --------

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-wallet
tag: v2023-07-18
--sha256: sha256-ijflgIw+1FpLoxM4Rksf4MJvNqnEPAv3gNWE8zMuefU=
subdir:
lib/balance-tx/
lib/coin-selection/
lib/delta-store/
lib/delta-table
lib/delta-types/
lib/launcher/
lib/numeric/
lib/primitive/
lib/test-utils/
lib/text-class/
lib/wai-middleware-logging/
lib/wallet/
lib/wallet-benchmarks/

-- Using RDRAND instead of /dev/urandom as an entropy source for key
-- generation is dubious. Set the flag so we use /dev/urandom by default.
package cryptonite
flags: -support_rdrand

-- Using a fork until our patches can be merged upstream

-- TODO: ADP-1713
source-repository-package
type: git
location: https://github.com/biocad/servant-openapi3
tag: 4165b837d3a71debd1059c3735460075840000b5
--sha256: 1dngrr353kjhmwhn0b289jzqz5rf32llwcv79zcyq15ldpqpbib9

-- TODO: ADP-1713
source-repository-package
type: git
location: https://github.com/paolino/openapi3
tag: c30d0de6875d75edd64d1aac2272886528bc492d
--sha256: 0b0fzj5vrnfrc8qikabxhsnp4p8lrjpssblbh2rb7aji5hzzfli9

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-addresses
tag: 6b55f96d57a181f898eb2a50531d3ae4280c549c
--sha256: 0yygam995i3mawk6hfgxb6v918phvqzyipzhjflff0l6zfrldy7f
subdir: command-line
core

package cardano-addresses
ghc-options: -Wno-incomplete-uni-patterns

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-sl-x509
tag: a91add165152fa36f08e95fafe7da24f1dba4690
--sha256: 1ia8vlqghis92cla8qmqa6kh8f3jn29b01fshyk5hmgy5373s684

source-repository-package
type: git
location: https://github.com/input-output-hk/bech32.git
tag: e341e7f83d7b73f10baa87e946818b2c493cc5f5
--sha256: 1d891bpc1q1m1gqj02b4iv3kr4g9w7knlkq43hwbl9dn5k78aydc
subdir: bech32

-- -------------------------------------------------------------------------
-- Constraints tweaking

-- cardano-addresses unit tests bring in some version constraint conflicts.
--
-- 1. hjsonschema and hjsonpointer deps have overly strict bounds.
-- 2. it has strict aeson < 1.5 dep - this will be fixed in the next release.
allow-newer:
*:aeson
hjsonschema:*
, hjsonpointer:*
, *:aeson
, *:hashable
, async-timer:unliftio-core
, ekg:*
, ntp-client:*
, libsystemd-journal:base
, size-based:template-haskell

constraints:
aeson >= 2
, hedgehog >= 1.1
bimap >= 0.4.0
, openapi3 >= 3.2.0
, libsystemd-journal >= 1.4.4
, systemd >= 2.3.0
-- dependency of systemd-2.3.0
, network >= 3.1.1.1
-- choose versions that work with base >= 4.12
, hjsonpointer >= 1.5.0
, hjsonschema >= 1.10.0
, Cabal >= 3.4.0.0
, async-timer >= 0.2.0.0
, unliftio-core >= 0.2.0.1
, generic-arbitrary >= 0.2.2
, iohk-monitoring >= 0.1.11

-- lower versions of katip won't build with the Win32-2.12.0.1
-- which is shipped with the ghc-9.2.8
, katip >= 0.8.7.4

-- Cardano Node dependencies:
, cardano-api ^>=8.2
, cardano-slotting >= 0.1
, ouroboros-network ^>= 0.8.1.0

-- TH Name shadowing warnings need to be addressed when bumping to 2.13.3.5
, persistent == 2.13.3.3

-- Haddock is broken in this release. Waiting for the next release

-- ----------------------------------------------------------------
-- Flags for dependencies

package cardano-config
flags: -systemd
package cardano-node
flags: -systemd

-- -------------------------------------------------------------------------
-------- End contents from @cardano-wallet@'s @cabal.project@ file. --------
25 changes: 17 additions & 8 deletions cardano-simple/cardano-simple.cabal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cabal-version: 3.0
cabal-version: 3.8
name: cardano-simple
version: 0.0.1
synopsis: Lightweight wrapper layer of some Cardano functions
Expand All @@ -12,11 +12,7 @@ maintainer: <[email protected]>
copyright: TODO
category: TODO
build-type: Simple
tested-with: GHC ==9.2.4
extra-source-files:
data/alonzo-params.json
data/protocol-params.json
README.md
tested-with: GHC ==9.2.8

common lang
default-language: GHC2021
Expand Down Expand Up @@ -62,7 +58,14 @@ common lang
-Wall -Wcompat -Wredundant-constraints -Wmissing-export-lists
-Werror -Wincomplete-record-updates -fobject-code
-fno-ignore-interface-pragmas -fno-omit-interface-pragmas
-fobject-code -fno-specialise
-fno-specialise -Wno-partial-type-signatures

-- expose all unfoldings, so plutustx compiler can do its job
ghc-options:
-fexpose-all-unfoldings -fobject-code
-fplugin-opt PlutusTx.Plugin:defer-errors
-- set target plutus-core version
ghc-options: -fplugin-opt PlutusTx.Plugin:target-version=1.0.0

common deps
build-depends:
Expand All @@ -75,9 +78,14 @@ common deps
, cardano-binary
, cardano-crypto
, cardano-crypto-class
, cardano-ledger-api
, cardano-ledger-allegra
, cardano-ledger-binary
, cardano-ledger-mary
, cardano-ledger-alonzo
, cardano-ledger-babbage
, cardano-ledger-core
, cardano-ledger-core:testlib
, cardano-ledger-shelley
, cardano-ledger-shelley-ma
, cardano-slotting
Expand All @@ -90,10 +98,11 @@ common deps
, flat
, hashable
, http-api-data
, lens
, memory
, mtl
, plutarch
, plutus-core
, plutus-core:plutus-ir
, plutus-ledger-api
, plutus-tx
, prettyprinter
Expand Down
21 changes: 11 additions & 10 deletions cardano-simple/src/Cardano/Simple/Cardano/Alonzo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ module Cardano.Simple.Cardano.Alonzo (

import Prelude

import Control.Lens ((^.))
import Cardano.Ledger.Alonzo (AlonzoEra)
import Cardano.Ledger.Alonzo.PParams qualified as C
import Cardano.Ledger.Alonzo.Tx qualified as C
import Cardano.Ledger.Alonzo.TxBody qualified as C
import Cardano.Ledger.Alonzo.TxWitness qualified as C
import Cardano.Ledger.Alonzo.TxWits qualified as C
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.CompactAddress qualified as C
import Cardano.Ledger.Address qualified as C
import Cardano.Ledger.Compactible qualified as C
import Cardano.Ledger.Core qualified as C
import Cardano.Ledger.Crypto (StandardCrypto)
import Cardano.Ledger.Hashes qualified as C
import qualified Cardano.Ledger.Mary.Value as C
import Cardano.Ledger.SafeHash
import Cardano.Ledger.SafeHash qualified as C (hashAnnotated)
import Cardano.Ledger.Shelley.API.Types qualified as C (
Expand Down Expand Up @@ -102,7 +103,7 @@ instance IsCardanoTx Era where
Just cval -> Right cval
Nothing -> Left "Fail to create compact value"

toAlonzoTx :: Network -> C.AlonzoPParams Era -> P.Extra -> Plutus.Tx -> Either ToCardanoError (C.AlonzoTx Era)
toAlonzoTx :: Network -> C.PParams Era -> P.Extra -> Plutus.Tx -> Either ToCardanoError (C.AlonzoTx Era)
toAlonzoTx network params extra tx = do
body <- toBody
wits <- toWits (C.hashAnnotated body) extra tx
Expand All @@ -117,15 +118,15 @@ toAlonzoTx network params extra tx = do
txcerts <-
getDCerts
network
(C._poolDeposit params)
(C._minPoolCost params)
(params ^. C.ppPoolDepositL)
(params ^. C.ppMinPoolCostL)
extra
txwdrls <- getWdrl network extra
let txfee = getFee tx
txvldt = getInterval tx
txUpdates = C.SNothing
reqSignerHashes = getSignatories tx
mint <- getMint tx
(C.MaryValue _ mint) <- getMint tx
let scriptIntegrityHash = C.SNothing
adHash = C.SNothing
txnetworkid = C.SJust network
Expand Down Expand Up @@ -154,14 +155,14 @@ toWits ::
SafeHash StandardCrypto C.EraIndependentTxBody ->
P.Extra ->
Plutus.Tx ->
Either ToCardanoError (C.TxWitness Era)
Either ToCardanoError (C.AlonzoTxWits Era)
toWits txBodyHash extra tx = do
let bootstrapWits = mempty
datumWits <- toDatumWitness tx
let redeemerWits = toRedeemerWitness extra tx
scriptWits <- toScriptWitness extra tx
pure $
C.TxWitness
C.AlonzoTxWits
(toKeyWitness txBodyHash tx)
bootstrapWits
scriptWits
Expand Down
Loading