Skip to content

Commit

Permalink
Merge pull request #91 from geniusyield/update-maestro-sdk
Browse files Browse the repository at this point in the history
feat: remove usage of deprecated Maestro endpoints
  • Loading branch information
4TT1L4 authored Aug 30, 2024
2 parents ad6be7d + 697ec24 commit a84887a
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 139 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/geniusyield/haskell-base-image:9.2.8
FROM ghcr.io/geniusyield/haskell-base-image:9.6.5

# ==================================[ BUILD ]========================================
WORKDIR /MM
Expand Down
207 changes: 84 additions & 123 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ repository cardano-haskell-packages
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

-- repeating the index-state for hackage to work around hackage.nix parsing limitation
index-state: 2023-06-06T00:00:00Z
index-state: 2024-03-19T15:29:53Z

index-state:
, hackage.haskell.org 2023-06-06T00:00:00Z
, cardano-haskell-packages 2023-06-05T06:39:32Z
, hackage.haskell.org 2024-03-19T15:29:53Z
, cardano-haskell-packages 2024-03-15T17:07:52Z

packages: .
packages: geniusyield-annset
Expand All @@ -24,127 +24,113 @@ packages: geniusyield-market-maker
-- TODO: Default value should be @direct@ in upcoming 3.10 version of cabal, omit this line then.
test-show-details: direct

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

-- 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/geniusyield/dex-contracts-api
tag: d1212bba3112e3057543a159303f0bdec294feca
--sha256: sha256-fgFz50aaEr1uZQTBO1C1Y+G08SQmoZjs0ajqh5pWFzg=
tag: 5d21453d7b99491b5e40ddcdb500685bcd00f862
--sha256: sha256-s8xPPW4zbcYdJvZsxZfBAOCvaheSqI01k1SUhMRrXTA=
subdir:
geniusyield-dex-api
geniusyield-onchain/geniusyield-common

source-repository-package
type: git
location: https://github.com/maestro-org/haskell-sdk
tag: 609515b3f8861efaa17adf4e599aa1b845775a6d
--sha256: sha256-8se+xlIB1BDEuKGwjaldmW5G4LpCujD1ABgBaY0cY6Y=

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

source-repository-package
type: git
location: https://github.com/geniusyield/ply
tag: c301d9514982abce1b4497237ba8231cf3ca058d
--sha256: sha256-f3hhzeOpva64FfF4HZc3uoPcWbhEJN20b0RrEKfXBxc=
tag: b13674633771f572a5eedfb47276c0ac3993ab85
--sha256: sha256-a63OdFAbo0sWOXxceI2bW/ZMrS8wo1t7aPFrfXvVhvE=
subdir: ply-core

source-repository-package
type: git
location: https://github.com/geniusyield/atlas
tag: 105ff78b32935ae5c18c53ccf4fb8462b8c1ca03
--sha256: sha256-Ee/UIoJ8OYBxgdnSv61hN8DH7CrIOPn4DjqOBxFL3Js=
tag: 97f3ca97bda997533d17274689daa69c5fdcbcd6
--sha256: sha256-NKUrxa3f6tlywWNWwdw5bWQ974ziOG9MXmY9GNZTdu8=

-------- Begin contents from @atlas@'s @cabal.project@ file. --------

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

-- 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/geniusyield/plutus-simple-model
tag: 0cb63af903a835c73aec662092eb67d228bba9b0
--sha256: sha256-H56EyRFNdDvLDo9FVeGZyQZ92itQPG39TkMVyEC/xqM=
subdir:
cardano-simple
psm
location: https://github.com/maestro-org/haskell-sdk
tag: v1.7.2
--sha256: sha256-nXnelHH4a+V0nguP8oUDlyEz/fLQ/i1fs/flyZTmvAc=

-- This should be present for in hackage index state >= 18th of september, 23. Remove it when we update to it.
source-repository-package
type: git
location: https://github.com/blockfrost/blockfrost-haskell
tag: 206e1a0f62e2a7cc08d05db8d62cef8dc2fbd98e
--sha256: sha256-R6BP3hwrOBmlRabA3prUuOGkYzETmQIM+K+Oh+fczEY=
subdir:
blockfrost-api
blockfrost-client-core
blockfrost-client
location: https://github.com/mlabs-haskell/clb
tag: 18e781b5b53adc1aa1d8c057c1b606b536a80350
--sha256: sha256-PDmrXYTBHPcY0x+JnF21uupLMBwURLSiNMqNmwwapkc=

constraints:
, cardano-api ^>= 8.38.0.0

-- 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=
tag: v2024-03-27
--sha256: sha256-rxMPopa3nxQaM0yOxUCq5oj3+XSL68jkuuFVhj/SY+w=
subdir:
lib/address-derivation-discovery
lib/balance-tx/
lib/coin-selection/
lib/crypto-primitives/
lib/delta-store/
lib/delta-table
lib/delta-types/
lib/iohk-monitoring-extra
lib/launcher/
lib/network-layer/
lib/numeric/
lib/primitive/
lib/read
lib/secrets
lib/std-gen-seed/
lib/test-utils/
lib/text-class/
lib/wai-middleware-logging/
lib/wallet/
lib/wallet-benchmarks/
lib/wallet/

-- 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
------ Begin contents from @cardano-wallet@'s @cabal.project@ file. --------

-- TODO: ADP-1713
source-repository-package
type: git
location: https://github.com/paolino/openapi3
tag: f22c31611c295637a3e72b341cd1c56d1d87b993
--sha256: 10l7wlaz9rcr3fysi1vwg7qqa826bb7nidkpx9jy1q7ja7ddw47i
--------------------------------------------------------------------------------

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

-- Normally cabal won't apply ghc-options which we specify to build packages
-- to their "regular" dependencies.
-- However, the dependencies declared using the `source-repository-package`
-- pragma are an exception to this rule.
-- This is why we need to manually control options that are applied to the
-- `cardano-addresses` package by declaring them explicitly here.
--
-- Cardano Addresses CLI uses an outdated version of the `optparse-applicative`
-- library. This causes a deprecation warning to be emitted when building.
-- We don't want to promote this warning to an error level as it break the
-- release build and cardano-addresses codebase is not under our control.
package cardano-addresses-cli
ghc-options:
-Wwarn=deprecations

package cardano-addresses
ghc-options: -Wno-incomplete-uni-patterns
ghc-options:
-Wwarn=incomplete-uni-patterns
-- END Cardano Addresses Dependency
--------------------------------------------------------------------------------

source-repository-package
type: git
Expand All @@ -154,13 +140,13 @@ source-repository-package

source-repository-package
type: git
location: https://github.com/input-output-hk/bech32.git
tag: e341e7f83d7b73f10baa87e946818b2c493cc5f5
--sha256: 1d891bpc1q1m1gqj02b4iv3kr4g9w7knlkq43hwbl9dn5k78aydc
subdir: bech32
location: https://github.com/cardano-foundation/cardano-wallet-client.git
tag: 353412ca621dc28af53e4a19795338b19bab1b7b
--sha256: 04q58c82wy6x9nkwqbvcxbv6s61fx08h5kf62sb511aqp08id4bb
subdir: generated

-- -------------------------------------------------------------------------
-- Constraints tweaking
--------------------------------------------------------------------------------
-- BEGIN Constraints tweaking section

-- cardano-addresses unit tests bring in some version constraint conflicts.
--
Expand All @@ -175,56 +161,31 @@ allow-newer:
, ekg:*
, ntp-client:*
, libsystemd-journal:base
, size-based:template-haskell
, cardano-addresses-cli:mtl
, servant-openapi3:*

constraints:
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
-- END Constraints tweaking section
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- Flags for dependencies without an S-R-P pragma should be kept in this section
-- (conversely, flags for the S-R-P dependencies should be kept within the
-- same section where an S-R-P pragma is located,
-- for them to be managed together)

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

package cardano-config
flags: -systemd

package cardano-node
flags: -systemd

-- -------------------------------------------------------------------------

-------- End contents from @cardano-wallet@'s @cabal.project@ file. --------

constraints:
-- We need turtle > 1.6 to support GHC 9.6. But that version now allows
-- some broken situations: https://github.com/Gabriella439/turtle/pull/446#issuecomment-1637628373
-- We are forced into an old version of ansi-wl-pprint because of inline-c (dep of inline-r), which
-- doesn't support the new one.
-- So for now we just force old versions of optparse-applicative and ansi-wl-pprint.
-- This is fine for CHaP, since we don't publish plutus-metatheory and the flag for inline-r
-- is off by default.
optparse-applicative < 0.18
, ansi-wl-pprint < 1.0
-------- End contents from @atlas@'s @cabal.project@ file. --------
4 changes: 4 additions & 0 deletions geniusyield-market-maker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for geniusyield-market-maker

## 0.7.0 -- 2024-08-30

* Updated Atlas & Maestro SDK version to not make use Maestro's recently deprecated protocol parameters & era summaries endpoint.

## 0.6.1 -- 2024-07-04

* Bug fix to resolve the behavior of `buildGetQuota` where it would result in an arithmetic underflow for TapTools provider when precision of commodity token is greater than that of ADA.
Expand Down
3 changes: 2 additions & 1 deletion geniusyield-market-maker/geniusyield-market-maker.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.4
name: geniusyield-market-maker
version: 0.6.1
version: 0.7.0
build-type: Simple
extra-doc-files: CHANGELOG.md
synopsis:
Expand Down Expand Up @@ -195,6 +195,7 @@ test-suite pproviders-status-sequence
, geniusyield-market-maker:{datasource-providers, orderbook-annset, geniusyield-market-maker-lib}
, geniusyield-orderbot-framework:common
, ghc-typelits-knownnat
, katip
, maestro-sdk
, servant-client-core
, tasty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ import Servant.Client (ClientEnv)
-- Configuration
-------------------------------------------------------------------------------

-- TODO: https://github.com/geniusyield/market-maker/issues/86.
deriving newtype instance (ToJSON a) => ToJSON (Confidential a)

-- | PriceConfigV1 is deprecated
data PriceConfigV1 = PriceConfigV1
{ pcApiKey !(Confidential Text),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module GeniusYield.Test.MarketMaker.Utils where

import Data.List (isInfixOf, findIndex)
import Control.Concurrent.MVar
import Control.Monad.State (StateT)
import Data.List (findIndex, isInfixOf)
import GeniusYield.MarketMaker.Constants (logNS)
import GeniusYield.Types

Expand Down Expand Up @@ -104,13 +104,13 @@ arePredicatesOrdered ps xs = case midxs of
Nothing -> (False, 0)
Just idxs -> (isOrdered idxs, last idxs)
where
midxs = sequenceA $ flip findIndex xs <$> ps
midxs = traverse (`findIndex` xs) ps

areEventsOrdered :: [[a -> Bool]] -> [a] -> Bool
areEventsOrdered [] _ = True
areEventsOrdered (ps:pss) xs =
let (b, i) = arePredicatesOrdered ps xs
in if b then areEventsOrdered pss (drop (i + 1) xs) else False
in (b && areEventsOrdered pss (drop (i + 1) xs))

isPPStatus :: [Maybe Double] -> LogData -> Bool
isPPStatus mbps ld = case ld of
Expand Down
Loading

0 comments on commit a84887a

Please sign in to comment.