Closed Fiftyw3bs closed 11 months ago
Please use cabal.project
file of Atlas https://github.com/geniusyield/atlas/blob/main/cabal.project, you would need to add atlas as an external dependency like done in this project which uses Atlas https://github.com/geniusyield/dex-contracts-api/blob/c5734e3b9706edeae37dd40bd81273fd71debc56/cabal.project#L31-L35.
@sourabhxyz Thanks for the prompt response, as usual :)
I've replaced my cabal.project file with the one you suggested, but got issue with dependency:
Warning: Requested index-state 2023-06-06T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2023-06-05T23:38:20Z).
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: shipshift-0.2.0.0 (user goal)
[__1] trying: plutus-ledger-1.2.0.0 (dependency of shipshift)
[__2] next goal: cardano-crypto-class (dependency of plutus-ledger)
[__2] rejecting: cardano-crypto-class-2.1.2.0 (conflict: plutus-ledger =>
cardano-crypto-class^>=2.0.0.0.1)
[__2] skipping: cardano-crypto-class-2.1.1.0, cardano-crypto-class-2.1.0.2,
cardano-crypto-class-2.1.0.1, cardano-crypto-class-2.1.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '^>=2.0.0.0.1' from 'plutus-ledger')
[__2] trying: cardano-crypto-class-2.0.0.1
[__3] next goal: cardano-api (dependency of shipshift)
[__3] rejecting: cardano-api-8.2.0.0 (conflict: cardano-crypto-class==2.0.0.1,
cardano-api => cardano-crypto-class>=2.1.1)
[__3] skipping: cardano-api-8.1.1.1, cardano-api-8.1.1.0, cardano-api-8.1.0.1,
cardano-api-8.0.0 (has the same characteristics that caused the previous
version to fail: excludes 'cardano-crypto-class' version 2.0.0.1)
[__3] rejecting: cardano-api-1.35.4, cardano-api-1.35.3 (constraint from
project config /workspaces/shipshift/code/cabal.project requires ^>=8.2)
[__3] fail (backjumping, conflict set: cardano-api, cardano-crypto-class,
shipshift)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-crypto-class, cardano-api,
plutus-ledger, shipshift
At first, I couldn't build the project using GHC version 8.10.7
and had to upgrade it to 9.2.8
. With 8.10.7
, I got the following error:
rejecting: atlas-cardano-0.3.0 (conflict: requires GHC2021 which is not supported)
Your earlier shared cabal.project file https://github.com/geniusyield/atlas/issues/270#issue-2059020287 is having constraint on cardano-crypto-class
which I think you are still persisting in your new cabal.project file but the latest cabal.project file of Atlas have no such constraint.
Thanks for the response...
I've actually only copied and pasted what you suggested and made no additional modification:
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: ./shipshift
-- 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/maestro-org/haskell-sdk
tag: 37fc9d4297e7a8e2fda51f9396bc69232b2ba5f9
--sha256: sha256-X2fDXSfILfRvRoV25KaDRxKfhzbJyn8m3n9VbEcODNs=
-- 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/plutus-simple-model
tag: 0cb63af903a835c73aec662092eb67d228bba9b0
--sha256: sha256-H56EyRFNdDvLDo9FVeGZyQZ92itQPG39TkMVyEC/xqM=
subdir:
cardano-simple
psm
source-repository-package
type: git
location: https://github.com/geniusyield/atlas
tag: 44b235ac4f4337dd2b2488b4f79f33a987f2be72
--sha256: sha256-EL7o0yYJIC8KvH0kZ9J0n+h/+w4GI4hCz39QyDA7Udg=
-- 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
-- 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: f22c31611c295637a3e72b341cd1c56d1d87b993
--sha256: 10l7wlaz9rcr3fysi1vwg7qqa826bb7nidkpx9jy1q7ja7ddw47i
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:
hjsonschema:*
, hjsonpointer:*
, *:aeson
, *:hashable
, async-timer:unliftio-core
, ekg:*
, ntp-client:*
, libsystemd-journal:base
, size-based:template-haskell
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
package cardano-config
flags: -systemd
package cardano-node
flags: -systemd
-- -------------------------------------------------------------------------
-------- End contents from @cardano-wallet@'s @cabal.project@ file. --------
Btw, is there any explanation for the error message:
HandshakeError (Refused NodeToClientV_13 "version data mismatch: NodeToClientVersionData {networkMagic = NetworkMagic {unNetworkMagic = 2}, query = False} /= NodeToClientVersionData {networkMagic = NetworkMagic {unNetworkMagic = 1}, query = False}")
?
To me it suggests that your node configuration isn't set up properly. Note that latest version of Atlas is tested with node 8.1.2. I see that the current environemnt files available on https://book.world.dev.cardano.org/environments.html have been updated but you can get the old ones (which are compatible with 8.1.2) by finding an appropriate commit here.
Regarding compilation issue, it would require investigation from my side but we have couple of projects open-sourced which uses Atlas, such as https://github.com/geniusyield/dex-contracts-api/, https://github.com/geniusyield/smart-order-router which you can use to investigate your issue. Have also updated atlas-examples
repository (https://github.com/geniusyield/atlas-examples/tree/atlas-0.3-update) so that it compiles but I need to improve that codebase so that it benefits from latest Atlas features, this along with updating docs is what I plan to finish once I am back from my vacation.
I'v come to realize that the issue with the compilation may be as result of the fact that atlas
from version v0.3.0
upwards is not compatible with plutus-apps
v1.2.0
, hence the dependency issue.
I tried building the project with the minimal dependencies used here. It compiled up until it encounters usage of functions defined in plutus-ledger
, and gave the following error:
onchain/Colony/OnChain/Compiled.hs:45:1: error:
Could not find module ‘Ledger.Typed.Scripts’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
45 | import qualified Ledger.Typed.Scripts as Scripts
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onchain/Colony/OnChain/Compiled.hs:51:1: error:
Could not find module ‘Plutus.Script.Utils.V2.Scripts’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
51 | import qualified Plutus.Script.Utils.V2.Scripts as PSU.V2
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
onchain/Colony/OnChain/Compiled.hs:52:1: error:
Could not find module ‘Plutus.Script.Utils.Typed’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
52 | import Plutus.Script.Utils.Typed as PSU
But when I dared to add plutus-ledger
and plutus-script-utils
as below:
, cardano-api
, plutus-core
, plutus-ledger-api
, plutus-tx
, plutus-ledger >=1.2.0
, plutus-script-utils >=1.2.0
, aeson
, bytestring
, serialise
it gave it the usual dependency error message:
Warning: Requested index-state 2023-06-06T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2023-06-05T23:38:20Z).
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: atlas-cardano-0.3.0 (user goal)
[__1] trying: cardano-ledger-byron-1.0.0.0 (dependency of atlas-cardano)
[__2] trying: cardano-api-8.2.0.0 (dependency of atlas-cardano)
[__3] trying: shipshift-0.2.0.0 (user goal)
[__4] next goal: plutus-ledger (dependency of shipshift)
[__4] rejecting: plutus-ledger-1.2.0.0 (conflict:
cardano-ledger-byron==1.0.0.0, plutus-ledger => cardano-ledger-byron==0.1.0.0)
[__4] fail (backjumping, conflict set: cardano-ledger-byron, plutus-ledger,
shipshift)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: atlas-cardano, cardano-api,
cardano-ledger-byron, shipshift, plutus-ledger
Try running with --minimize-conflict-set to improve the error message.
And from the error message, one can see that atlas
depends on cardano-ledger-byron-1.0.0.0
while plutus-ledger
depends on cardano-ledger-byron==0.1.0.0
.
I'll try starting the node with the old parameters and see if it resolves the HandshakeError
.
Thanks.
@Fiftyw3bs
I'v come to realize that the issue with the compilation may be as result of the fact that atlas from version v0.3.0 upwards is not compatible with plutus-apps v1.2.0, hence the dependency issue.
Yup, please do not depend upon plutus-apps
as it is notoriously outdated. Atlas has quiet a few examples on how to work with scripts (parameterized or not) such as https://github.com/geniusyield/atlas/blob/main/src-plutustx/GeniusYield/OnChain/TestToken/Compiled.hs & https://github.com/geniusyield/atlas/blob/main/src-plutustx/GeniusYield/OnChain/Examples/ReadOracle/Compiled.hs. You can grep in repository to see how off-chain code is built for these scripts.
Note that please use the following GHC options: https://github.com/geniusyield/atlas/blob/8e84b45b397767d5b0f338be586173adca101c09/atlas-cardano.cabal#L46-L58, in particular PlutusTx.Plugin:target-version=1.0.0
is important to set correct target version.
Thank you very much @sourabhxyz :)
I've been able to build the project and everything appears to be working fine 👍
Describe the bug My project compiles successfully, but wouldn't run due to the following error:
To Reproduce Steps to reproduce the behavior:
cabal.project
file:Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Station (please complete the following information):