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

Implement the remaining upgradable families #3714

Merged
merged 12 commits into from
Sep 25, 2023
Merged

Conversation

nc6
Copy link
Contributor

@nc6 nc6 commented Sep 6, 2023

Description

This PR adds the remaining upgrade functions described in #3618

  • Adds upgradeTxBody, upgradeTxWits, and upgradeTx
  • Derive ToExpr in various places throughout the code in order to print the diffs
  • Implements some logic to handle specific cases which may fail:
    • Mary->Alonzo Tx and TxBody may fail due to dropped protocol parameters
    • Mary->Alonzo Tx fails due to the introduction of isValid and not doing translation via deserialisation of the Tx.
    • Alonzo->Babbage Tx and TxBody may fail due to dropped protocol parameters
    • Alonzo transactions with a protocol parameter update to coinsPerUTxOWord will deserialise correctly in Babbage but with an altered meaning. We account for this in the upgrade function. An alternative would be to explicitly fail on any transactions that attempted to update this field, but this would require that the translation logic unpack the transaction, and doesn't seem worth it since these will never occur.

Resolves #3618

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated
  • When applicable, versions are updated in .cabal and CHANGELOG.md files according to the
    versioning process.
  • The version bounds in .cabal files for all affected packages are updated. If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
  • All visible changes are prepended to the latest section of a CHANGELOG.md for the affected packages. New section is never added with the code changes. (See RELEASING.md)
  • Code is formatted with fourmolu (use scripts/fourmolize.sh)
  • Cabal files are formatted (use scripts/cabal-format.sh)
  • hie.yaml has been updated (use scripts/gen-hie.sh)
  • Self-reviewed the diff

@teodanciu
Copy link
Contributor

Rebased, solved merge conflicts and compilation problems caused by changes happening since the PR

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.

Could use a few minor improvements, otherwise this is exactly what I was hoping for.

eras/allegra/impl/CHANGELOG.md Outdated Show resolved Hide resolved
eras/allegra/impl/src/Cardano/Ledger/Allegra/TxBody.hs Outdated Show resolved Hide resolved
eras/alonzo/impl/CHANGELOG.md Outdated Show resolved Hide resolved
eras/conway/impl/CHANGELOG.md Outdated Show resolved Hide resolved
eras/mary/impl/CHANGELOG.md Outdated Show resolved Hide resolved
eras/mary/impl/src/Cardano/Ledger/Mary/TxBody.hs Outdated Show resolved Hide resolved
eras/mary/impl/src/Cardano/Ledger/Mary/TxBody.hs Outdated Show resolved Hide resolved
eras/mary/impl/src/Cardano/Ledger/Mary/TxBody.hs Outdated Show resolved Hide resolved
eras/shelley/impl/CHANGELOG.md Outdated Show resolved Hide resolved
@teodanciu teodanciu force-pushed the nc/upgradable-families branch 2 times, most recently from 6c179a8 to 4244b9e Compare September 22, 2023 07:55
@teodanciu teodanciu force-pushed the nc/upgradable-families branch 3 times, most recently from 4cb2c89 to 466daee Compare September 25, 2023 15:16
nc6 and others added 11 commits September 25, 2023 16:16
- `upgradeTxBody`
- `upgradeTxWits`
- `upgradeTx`

We introduce a few helpers to assist, which follow the same pattern
outside of an era-indexed family:

- `upgradeData`
- `upgradeTxDats`
- `upgradeRedeemers`
Also implement 'Memoized' for 'ShelleyTx', which admits a trivial
instance but was missing it.
This happens if the Mary transaction attempts to pass a protocol
parameter update which updates the min ADA, since this field is not
effectively translatable to Alonzo.
We switch this off in Alonzo, since the translation path does not
directly deserialise, rather pulling together the body and witnesses
data separately.
- We need to avoid comparing the size for 'Sized' fields.
- 'coinsPerUTxOByte' is translated through binary translation naively as
  'coinsPerUTxOWord'. We need to reflect this to preserve transaction
  validity.
- Two other protocol parameters were removed and will cause the
  translation to fail, so must be accounted for in the upgrade.
and use it in Allegra and Mary upgrade
@teodanciu teodanciu force-pushed the nc/upgradable-families branch 3 times, most recently from 99978f2 to 48e400d Compare September 25, 2023 15:22
@teodanciu
Copy link
Contributor

Updated CHANGELOG and adjusted versions: set cardano-ledger-core depedency lower bound to 1.7 for all ears. Merging!

@lehins
Copy link
Contributor

lehins commented Sep 25, 2023

set cardano-ledger-core depedency lower bound to 1.7 for all ears

👂 🦻
🤣 👍

@teodanciu teodanciu merged commit c6a86f5 into master Sep 25, 2023
11 of 12 checks passed
@iohk-bors iohk-bors bot deleted the nc/upgradable-families branch September 25, 2023 17:06
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.

Implement upgradeable type families
3 participants