Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on cardano-prelude #2992

Merged
merged 3 commits into from
Sep 17, 2022
Merged

Conversation

teodanciu
Copy link
Contributor

@teodanciu teodanciu commented Aug 23, 2022

This PR also updates plutus and cardano-base dependencies.

The initial purpose of this was to remove the dependency on cardano-prelude. It turns out a good amount of yak-shaving was necessary to achieve this, in the form of updating plutus and adapting to the API changes. Also a change in nix-shell, without which cabal from within the nix-shell could not resolve plutus dependencies (for nix reasons).

You might need to delete ~/.cabal/store/ghc-8.10.7 in order for cabal to get the new plutus version properly. Before deleting this I was getting errors like this:

 Could not load module 'Plutus.V2.Ledger.Api'
    It is a member of the package 'plutus-ledger-api-1.0.0.0-b674ddb5eb0946c34d87898eef5ad3899a783b9697a81e84375d1682c1e7629f' 
    which is unusable due to missing dependencies:
barbies-2.0.3.1-82eGrD9c7V217T7RY4npks base16-bytestring-1.0.2.0-
  ... (and many others) 

So if this happens to you, you might want to 1) delete this folder 2) brace yourself with patience

resolves #1676

@teodanciu teodanciu force-pushed the td/update-plutus-and-cardano-base branch from e8f1da3 to 9bc84b2 Compare August 23, 2022 10:46
Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. As you did notice we do need to remove some duplication though

@teodanciu
Copy link
Contributor Author

@lehins Thanks for the review and suggestions - I think I have to redo the Plutus update slightly and use better their changes. Concretely, CostModel in our code could use the enum for the param names instead of the text . I will make the change and see which of your suggestions still apply

@teodanciu teodanciu force-pushed the td/update-plutus-and-cardano-base branch from 9bc84b2 to ca54877 Compare September 5, 2022 14:03
@teodanciu teodanciu marked this pull request as draft September 5, 2022 14:03
@teodanciu teodanciu force-pushed the td/update-plutus-and-cardano-base branch 4 times, most recently from 2c9c4d0 to 6413277 Compare September 8, 2022 16:14
@teodanciu teodanciu mentioned this pull request Sep 9, 2022
@teodanciu teodanciu force-pushed the td/update-plutus-and-cardano-base branch 2 times, most recently from d60414d to 516d786 Compare September 9, 2022 01:17
@teodanciu teodanciu changed the base branch from master to td/update-plutus September 9, 2022 01:17
@teodanciu teodanciu changed the title Update plutus and cardano-base Remove dependency on cardano-prelude Sep 13, 2022
@L-as
Copy link

L-as commented Sep 13, 2022

I'm trying to do a similar thing, and I've had to change a lot of .s on Format into %s for some reason. I'm curious why you didn't need the same thing here. Maybe I'm using a formatting that's too new accidentally?

@teodanciu teodanciu force-pushed the td/update-plutus branch 2 times, most recently from 96a42c1 to b581958 Compare September 16, 2022 11:42
so that running cabal from within the shell doesn't have to (which
sometimes fails).

Update plutus version and adjust to API changes

Update cardano-base to a version compatible with plutus

Allow newer version of `hashable`

since plutus brings in version 1.4.1.0 but our dependency Unique is
restricting it to 1.4.

Regenerate PlutusScript using plutus-preprocessor

Fix Plutus protocol version in test

which was wrong, but only started failing with the new plutus version
so that running cabal from within the shell doesn't have to (which
sometimes fails).

Update plutus version and adjust to API changes

Update plutus to latest version

Update cardano-base to a version compatible with plutus

Allow newer version of `hashalble`

since plutus brings in version 1.4.1.0 but our dependency Unique is
restricting it to 1.4.

[WIP] Try and fail to adapt code to newest Plutus

Replace `panic` function from cardano-prelude with `error`

Update cardano-base to a version without cardano-prelude

Use HeapWords from cardano-base instead of cardano-prelude

Remove dependency on cardano-prelude from everywhere except byron

Update cardano-base
@lehins lehins force-pushed the td/update-plutus-and-cardano-base branch from 516d786 to eadaf0f Compare September 17, 2022 12:11
@lehins lehins changed the base branch from td/update-plutus to master September 17, 2022 12:13
@lehins
Copy link
Contributor

lehins commented Sep 17, 2022

I'm trying to do a similar thing, and I've had to change a lot of .s on Format into %s for some reason.

@L-as I think you need to use . from Control.Category for it to work

@lehins lehins marked this pull request as ready for review September 17, 2022 12:16
@lehins lehins force-pushed the td/update-plutus-and-cardano-base branch from c58f03f to bec947a Compare September 17, 2022 21:12
@lehins
Copy link
Contributor

lehins commented Sep 17, 2022

This PR brings ledger up to date with latest plutus and cardano-base as well as removes dependency on cardano-prelude. We need to unblock @erikd and others on their effort to update ghc-9.2 Becuase @teodanciu is off on Monday I took it upon myself to address all the review comments and incorporated #3030 into this PR as well. If there is anything else needs to be done for this PR we can tackle it in a subsequent one at a later point.

Copy link
Contributor

@lehins lehins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you for doing all the work @teodanciu If there were any other plans for this PR we can postpone it to a later PR.

@JaredCorduan Once you back, it would be nice if you could take a second look at this PR, even though it will merged. It will be valuable, since you are the most familiar person with the Plutus Cost Models in ledger

@JaredCorduan
Copy link
Contributor

@JaredCorduan Once you back, it would be nice if you could take a second look at this PR, even though it will merged. It will be valuable, since you are the most familiar person with the Plutus Cost Models in ledger

Most definitely, I am very keen to review this one carefully. thanks for the heads up.

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for doing these two items @teodanciu , it looks great! (and you too @lehins for getting it across the line!)

It's going to be wonderful having these changes to the evaluation context (I reviewed it all very carefully).

I made one small followup issue: #3042

@lehins
Copy link
Contributor

lehins commented Sep 17, 2022

Thank you @JaredCorduan

@lehins lehins merged commit 4d85002 into master Sep 17, 2022
@iohk-bors iohk-bors bot deleted the td/update-plutus-and-cardano-base branch September 17, 2022 22:59
angerman pushed a commit that referenced this pull request Nov 10, 2022
Update `plutus` and `cardano-base` dependencies. Remove usage of `cardano-prelude`:

* Update nix shell to prebuild packages and make them available to ghc-pkg so that
  running cabal from within the shell doesn't have to (which sometimes fails).

* Update plutus version and adjust to API changes

* Update cardano-base to a version compatible with plutus and without cardano-prelude

* Allow newer version of `hashable`, since plutus brings in version 1.4.1.0,
  but our dependency Unique is restricting it to 1.4.

* Regenerate `PlutusScript` using `plutus-preprocessor`

* Fix Plutus protocol version in test, which was wrong, but only started
  failing with the new plutus version

* Replace `panic` function from `cardano-prelude` with `error`

* Use HeapWords from cardano-base instead of cardano-prelude

* Remove dependency on `cardano-prelude` from everywhere except byron

Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
angerman pushed a commit that referenced this pull request Nov 10, 2022
Update `plutus` and `cardano-base` dependencies. Remove usage of `cardano-prelude`:

* Update nix shell to prebuild packages and make them available to ghc-pkg so that
  running cabal from within the shell doesn't have to (which sometimes fails).

* Update plutus version and adjust to API changes

* Update cardano-base to a version compatible with plutus and without cardano-prelude

* Allow newer version of `hashable`, since plutus brings in version 1.4.1.0,
  but our dependency Unique is restricting it to 1.4.

* Regenerate `PlutusScript` using `plutus-preprocessor`

* Fix Plutus protocol version in test, which was wrong, but only started
  failing with the new plutus version

* Replace `panic` function from `cardano-prelude` with `error`

* Use HeapWords from cardano-base instead of cardano-prelude

* Remove dependency on `cardano-prelude` from everywhere except byron

Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
angerman pushed a commit that referenced this pull request Nov 10, 2022
Update `plutus` and `cardano-base` dependencies. Remove usage of `cardano-prelude`:

* Update nix shell to prebuild packages and make them available to ghc-pkg so that
  running cabal from within the shell doesn't have to (which sometimes fails).

* Update plutus version and adjust to API changes

* Update cardano-base to a version compatible with plutus and without cardano-prelude

* Allow newer version of `hashable`, since plutus brings in version 1.4.1.0,
  but our dependency Unique is restricting it to 1.4.

* Regenerate `PlutusScript` using `plutus-preprocessor`

* Fix Plutus protocol version in test, which was wrong, but only started
  failing with the new plutus version

* Replace `panic` function from `cardano-prelude` with `error`

* Use HeapWords from cardano-base instead of cardano-prelude

* Remove dependency on `cardano-prelude` from everywhere except byron

Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
angerman pushed a commit that referenced this pull request Nov 11, 2022
Update `plutus` and `cardano-base` dependencies. Remove usage of `cardano-prelude`:

* Update nix shell to prebuild packages and make them available to ghc-pkg so that
  running cabal from within the shell doesn't have to (which sometimes fails).

* Update plutus version and adjust to API changes

* Update cardano-base to a version compatible with plutus and without cardano-prelude

* Allow newer version of `hashable`, since plutus brings in version 1.4.1.0,
  but our dependency Unique is restricting it to 1.4.

* Regenerate `PlutusScript` using `plutus-preprocessor`

* Fix Plutus protocol version in test, which was wrong, but only started
  failing with the new plutus version

* Replace `panic` function from `cardano-prelude` with `error`

* Use HeapWords from cardano-base instead of cardano-prelude

* Remove dependency on `cardano-prelude` from everywhere except byron

Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
Soupstraw added a commit that referenced this pull request Nov 14, 2022
* Remove dependency on cardano-prelude (#2992)

Update `plutus` and `cardano-base` dependencies. Remove usage of `cardano-prelude`:

* Update nix shell to prebuild packages and make them available to ghc-pkg so that
  running cabal from within the shell doesn't have to (which sometimes fails).

* Update plutus version and adjust to API changes

* Update cardano-base to a version compatible with plutus and without cardano-prelude

* Allow newer version of `hashable`, since plutus brings in version 1.4.1.0,
  but our dependency Unique is restricting it to 1.4.

* Regenerate `PlutusScript` using `plutus-preprocessor`

* Fix Plutus protocol version in test, which was wrong, but only started
  failing with the new plutus version

* Replace `panic` function from `cardano-prelude` with `error`

* Use HeapWords from cardano-base instead of cardano-prelude

* Remove dependency on `cardano-prelude` from everywhere except byron

Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>

* Fix plutus-preprocessor

* Allow newer base (9.2)

* Add 9.2 to workflows

* 9.2 mechanical changes

* cabal.project cleanup

* Bump minor version

This adds 9.2 compatibility

1.1.1 -> 1.1.2
1.4.1 -> 1.4.2

* Fix errors due to newer dependencies.

Also need to bump the protocol version, otherwise
the test-suite will fail.

* Also bump cabal version in shell.nix

Co-authored-by: teodanciu <teodora.danciu@tweag.io>
Co-authored-by: Alexey Kuleshevich <alexey.kuleshevich@iohk.io>
Co-authored-by: Michael Peyton Jones <michael.peyton-jones@iohk.io>
Co-authored-by: Joosep Jääger <joosep.jaager@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of cardano-prelude
4 participants