geniusyield / atlas

Application backend for Plutus smart contracts on Cardano
https://atlas-app.io
Apache License 2.0
67 stars 18 forks source link

HandshakeError #270

Closed Fiftyw3bs closed 11 months ago

Fiftyw3bs commented 11 months ago

Describe the bug My project compiles successfully, but wouldn't run due to the following error:

HandshakeError (Refused NodeToClientV_13 "version data mismatch: NodeToClientVersionData {networkMagic = NetworkMagic {unNetworkMagic = 2}, query = False} /= NodeToClientVersionData {networkMagic = NetworkMagic {unNetworkMagic = 1}, query = False}")

To Reproduce Steps to reproduce the behavior: cabal.project file:


repository cardano-haskell-packages
  url: https://input-output-hk.github.io/cardano-haskell-packages
  secure: True
  root-keys:
    3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
    443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
    a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
    bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
    c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
    d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

-- Must repeat the hackage index state to work around haskell.nix parsing limitation.
index-state: 2022-09-26T22:25:36Z

index-state:
  , hackage.haskell.org      2022-09-26T22:25:36Z
  , cardano-haskell-packages 2022-10-25T17:33:07Z

packages: .

tests: True

package ply-core
  flags: -new-ledger-namespace

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

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

test-show-details: direct

-- ---------------------------------------------------------
-- Main repositories:
-- * cardano-node
-- * cardano-wallet

source-repository-package
    type: git
    location: https://github.com/input-output-hk/cardano-node
    tag: 1.35.4
    --sha256: 1j01m2cp2vdcl26zx9xmipr551v3b2rz9kfn9ik8byfwj1z7652r
    subdir:
      cardano-api
      cardano-git-rev
      cardano-cli
      cardano-node
      cardano-node-chairman
      trace-dispatcher
      trace-resources
      trace-forward

source-repository-package
  type: git
  location: https://github.com/input-output-hk/cardano-wallet
  tag: v2022-12-14
  --sha256: sha256-lz3bi711qORionkcfduC+AXGP6Ii+uWiVHRmRZmvfb8=
  subdir:
    lib/balance-tx
    lib/coin-selection
    lib/dbvar
    lib/launcher
    lib/numeric
    lib/primitive
    lib/strict-non-empty-containers
    lib/test-utils
    lib/text-class
    lib/wai-middleware-logging
    lib/wallet

source-repository-package
  type: git
  location: https://github.com/mlabs-haskell/ply
  tag: 0.2.1
  --sha256: sha256-dL+zGbtFQFTsFNAjzYgEKcbJkIP8If74sNCixBJWjp0=
  subdir: ply-core

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

source-repository-package
  type: git
  location: https://github.com/geniusyield/atlas
  -- tag: 09458858099572bfd00fa9f3c582a68f3d62d9b5
  tag: v0.2.0
  -- tag: 28f7d4775a80f17464a131ad07d8f9494fdd6922
  -- tag: ac9c271fc45df5dded4de60af963b54902aebff0
  --sha256: sha256-yXfc+DZaQ3o6E2t+7O097BXtNJoQh+RsuqRb8pAZtfI=

-- Using an in house fork as upstream lacks desired capabilities and uses incompatible dependencies.
source-repository-package
  type: git
  location: https://github.com/geniusyield/plutus-simple-model
  tag: 760fd3d7084a2efdb2510804caaf43b27cf5b288
  -- tag: d710c4c5400ff7072fe89c337c1cdd0128dc5d99
  --sha256: sha256-dpTAGN4qg1Fu1LjPIJiyEXlLxcHEC/a4sj1zjEvG/Js=

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

-- Everything below is essentially copied from cardano-wallet's cabal.project.

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

source-repository-package
  type: git
  location: https://github.com/paolino/openapi3
  tag: 340d86fe44b96004918d62638262ddaad6da3161
  --sha256: 0b0fzj5vrnfrc8qikabxhsnp4p8lrjpssblbh2rb7aji5hzzfli9

source-repository-package
    type: git
    location: https://github.com/input-output-hk/cardano-addresses
    tag: 5094fb9d304ed69adedc99513634a00cbf850fca
    --sha256: 1zhi8kvr2yhn50dm3dwwb1jlm5yl0y6c6hg39cs6abbxqmsj5jlv
    subdir:
      command-line
      core

source-repository-package
    type: git
    location: https://github.com/input-output-hk/bech32
    tag: ab61914443e5f53624d3b2995767761b3f68e576
    --sha256: 0isqh5s6rdhmqa3jhvc32zb3kvzy149hmzddx1ld9f9jhls4f3wg
    subdir:
      bech32
      bech32-th

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/ekg-forward
  tag: 297cd9db5074339a2fb2e5ae7d0780debb670c63
  --sha256: 1zcwry3y5rmd9lgxy89wsb3k4kpffqji35dc7ghzbz603y1gy24g

source-repository-package
    type: git
    location: https://github.com/input-output-hk/cardano-crypto
    tag: f73079303f663e028288f9f4a9e08bcca39a923e
    --sha256: 1n87i15x54s0cjkh3nsxs4r1x016cdw1fypwmr68936n3xxsjn6q

source-repository-package
  type: git
  location: https://github.com/input-output-hk/io-sim
  tag: 57e888b1894829056cb00b7b5785fdf6a74c3271
  --sha256: 1kv8lwmrw1c0g03jy3i3fgk3c8d47ihjcslg295djqj442y95y2f
  subdir:
    io-classes
    io-sim
    strict-stm

source-repository-package
  type: git
  location: https://github.com/input-output-hk/plutus-apps
  tag: v1.2.0
  subdir:
    plutus-ledger
    plutus-script-utils
    freer-extras
    plutus-contract
    plutus-tx-constraints
    plutus-chain-index-core
    cardano-node-emulator

source-repository-package
    type: git
    location: https://github.com/Quviq/quickcheck-contractmodel
    tag: cc43f13f98c704e0d53dbdef6a98367918f8c5c1
    subdir:
      contractmodel

source-repository-package
    type: git
    location: https://github.com/input-output-hk/quickcheck-dynamic
    tag: 3.0.2
    subdir:
      quickcheck-dynamic

-- This is needed because we rely on an unreleased branch of
-- cardano-ledger-alonzo. The feature we need
-- (evaluateTransactionExecutionUnitsWithLogs) in only included from
-- cardano-ledger-alonzo version 1.0.0.0
-- See https://github.com/input-output-hk/cardano-ledger/pull/3111
source-repository-package
    type: git
    location: https://github.com/input-output-hk/cardano-ledger
    tag: da3e9ae10cf9ef0b805a046c84745f06643583c2
    subdir:
      eras/alonzo/impl
      eras/alonzo/test-suite
      eras/babbage/impl
      eras/babbage/test-suite
      eras/byron/chain/executable-spec
      eras/byron/crypto
      eras/byron/crypto/test
      eras/byron/ledger/executable-spec
      eras/byron/ledger/impl
      eras/byron/ledger/impl/test
      eras/shelley/impl
      eras/shelley/test-suite
      eras/shelley-ma/impl
      eras/shelley-ma/test-suite
      libs/cardano-ledger-core
      libs/cardano-ledger-pretty
      libs/cardano-protocol-tpraos
      libs/cardano-data
      libs/vector-map
      libs/set-algebra
      libs/small-steps
      libs/small-steps-test
      libs/non-integral

-- -------------------------------------------------------------------------
-- 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:*
  , cardano-sl-x509:ip
  , *:aeson
  , size-based:template-haskell

-- Copied from (copied from cardano-node/cabal.project)
allow-newer:
  *:aeson,
  monoidal-containers:aeson,
  size-based:template-haskell

allow-newer:
  async-timer:unliftio-core

constraints:
    bimap >= 0.4.0
  , either == 5.0.2
  , 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
  , cardano-api == 1.35.4
  , cardano-node == 1.35.4
  , generic-arbitrary == 0.2.2
  , iohk-monitoring >= 0.1.11

  -- Could probably be bumped with minor work in the wallet
  , resource-pool == 0.2.3.2

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

  -- Copied from cardano-node's cabal.project:
  , bimap >= 0.4.0
  , libsystemd-journal >= 1.4.4
  , systemd >= 2.3.0
    -- systemd-2.3.0 requires at least network 3.1.1.0 but it doesn't declare
    -- that dependency
  , network >= 3.1.1.0
  , HSOpenSSL >= 0.11.7.2
  , algebraic-graphs < 0.7
  , protolude < 0.3.1
  , cardano-prelude == 0.1.0.0
  , base-deriving-via == 0.1.0.0
  , cardano-binary  == 1.5.0
  , cardano-binary-test == 1.3.0
  , cardano-crypto-class  == 2.0.0.0.1
  , cardano-crypto-praos  == 2.0.0.0.1
  , cardano-crypto-tests  == 2.0.0.0.1
  , cardano-slotting  == 0.1.0.0
  , measures == 0.1.0.0
  , orphans-deriving-via == 0.1.0.0
  , strict-containers == 0.1.0.0
  , plutus-core == 1.0.0.1
  , plutus-ledger-api == 1.0.0.1
  , plutus-tx == 1.0.0.0
  , plutus-tx-plugin == 1.0.0.0
  , plutus-ledger >= 1.0.0.0
  , prettyprinter-configurable == 0.1.0.0
  , plutus-ghc-stub == 8.6.5
  , word-array == 0.1.0.0
  , word-array == 0.1.0.0
  , easy-file >= 0.2.2

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

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

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

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

sourabhxyz commented 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.

Fiftyw3bs commented 11 months ago

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

sourabhxyz commented 11 months ago

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.

Fiftyw3bs commented 11 months ago

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. --------
Fiftyw3bs commented 11 months ago

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}")?

sourabhxyz commented 11 months ago

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.

Fiftyw3bs commented 11 months ago

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.

sourabhxyz commented 11 months ago

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

Fiftyw3bs commented 11 months ago

Thank you very much @sourabhxyz :)

I've been able to build the project and everything appears to be working fine 👍