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

Rename To/FromCBOR -> Enc/DecCBOR #3303

Merged
merged 3 commits into from
Feb 16, 2023
Merged

Conversation

lehins
Copy link
Collaborator

@lehins lehins commented Feb 15, 2023

Description

  • Rename ToCBOR -> EncCBOR and FromCBOR -> DecCBOR

  • Rename FromSharedCBOR -> DecShareCBOR and all the related functions:

    • fromSharedCBOR -> decShareCBOR
    • fromSharedPlusCBOR -> decSharePlusCBOR
    • fromSharedLensCBOR -> decShareLensCBOR
    • fromSharedPlusLensCBOR -> decSharePlusLensCBOR
    • fromNotSharedCBOR -> decNoShareCBOR
    • fromShareCBORfunctor -> decShareMonadCBOR

This PR disambiguates between versioned CBOR implemented cardano-ledger-binary and regular plain CBOR interface implemented by cardano-binary. This is necessary for two major reasons:

  1. Both APIs will be used within ledger
  2. By renaming versioned To/FromCBOR to Enc/DecCBOR instead of the plain from cardano-binary we reduce breakage downstream, since it is mostly ledger codebase that is concerned with versioning by the protocol version.

This PR was fully generated by running sed and doing git mv on two files. In other words there are no changes that were done manually. This fact should simplify the review process. That also means that the changelog entries will follow in a subsequent PR

Checklist

  • Commit sequence broadly makes sense
  • Commits have useful messages
  • New tests are added if needed and existing tests are updated
  • Any changes are noted in the changelog
  • Code is formatted with fourmolu (which can be run with scripts/fourmolize.sh)
  • Cabal files are formatted (which can be done with scripts/cabal-format.sh)
  • Self-reviewed the diff

@lehins lehins marked this pull request as draft February 15, 2023 16:36
@lehins lehins force-pushed the lehins/rename-tofrom-encdec-cbor branch from 5e4fc6d to 9d0fef0 Compare February 15, 2023 18:39
@lehins lehins marked this pull request as ready for review February 15, 2023 21:16
@lehins lehins requested a review from JaredCorduan February 15, 2023 22:08
This is necessary to disambiguate from classes from `cardano-binary`,
since they will have to sometimes be used in conjunction with each other

Command that was used to do the renaming:
```
git ls-files -- "*.hs" -- "*.cabal" | xargs sed -i \
  's/FromCBOR/DecCBOR/g; s/fromCBOR/decCBOR/g; s/ToCBOR/EncCBOR/g; s/toCBOR/encCBOR/g'
```
* `fromSharedCBOR` -> `decShareCBOR`
* `fromSharedPlusCBOR` -> `decSharePlusCBOR`
* `fromSharedLensCBOR` -> `decShareLensCBOR`
* `fromSharedPlusLensCBOR` -> `decSharePlusLensCBOR`
* `fromNotSharedCBOR` -> `decNoShareCBOR`
* `fromShareCBORfunctor` -> `decShareMonadCBOR`

This rename is needed for consistency with the `FromCBOR` -> `DecCBOR`
in the previous two commits.

Command used during renaming:

```
git ls-files -- "*.hs" | xargs sed -i \
  's/FromSharedCBOR/DecShareCBOR/g; s/fromSharedCBOR/decShareCBOR/g; s/fromSharedPlusCBOR/decSharePlusCBOR/g; s/fromSharedLensCBOR/decShareLensCBOR/g; s/fromSharedPlusLensCBOR/decSharePlusLensCBOR/g; s/fromNotSharedCBOR/decNoShareCBOR/g; s/fromShareCBORfunctor/decShareMonadCBOR/g;'
```
@lehins lehins force-pushed the lehins/rename-tofrom-encdec-cbor branch from 193db12 to 637b3ec Compare February 16, 2023 00:18
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.

LGTM

@lehins lehins changed the title Rename To/FromCBOR -> EncDecCBOR Rename To/FromCBOR -> Enc/DecCBOR Feb 16, 2023
@lehins lehins merged commit 49a8472 into master Feb 16, 2023
@iohk-bors iohk-bors bot deleted the lehins/rename-tofrom-encdec-cbor branch February 16, 2023 11:07
@lehins lehins restored the lehins/rename-tofrom-encdec-cbor branch February 16, 2023 11:09
@lehins lehins deleted the lehins/rename-tofrom-encdec-cbor branch February 16, 2023 11:10
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.

2 participants