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

[ADP-3350] Add Read.ChainPoint #4539

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

HeinrichApfelmus
Copy link
Contributor

This pull request adds a data type ChainPoint to the Cardano.Wallet.Read hierarchy.

In order to add this type, we also need to

  • Add functions related to hashing. The Cardano.Crypto.Hash.Class provides a very thoughtful API, we re-export it.
  • Add a type RawHeaderHash that is an era-independent string of bytes representing a HeaderHash.

Comments

  • This ChainPoint type is meant to be consistent with the other types in the Cardano.Wallet.Read hierarchy, which are in turn meant to be consistent with the ledger specification.
  • The ledger specification stipulates that SlotNo ~ Natural. We stick to this type.
  • The goal is to eventually remove the old primitive types.

Issue Number

ADP-3350

Copy link
Collaborator

@paolino paolino left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -46,15 +51,24 @@ import Cardano.Wallet.Read.Eras.KnownEras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Hash
( Blake2b_256
Copy link
Contributor

Choose a reason for hiding this comment

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

this one could be exported from cryptography-primitive lib

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(See the other comment.)

Comment on lines +35 to +36
( Blake2b_224
, Blake2b_256
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I sympathize, but the problem is that Cardano.Crypto.Hash.Blake2b does not re-export from cryptonite — rather, it defines a distinct type Blake2b_256 here:

https://github.com/IntersectMBO/cardano-base/blob/4e1d652343b48d3f02f05601e059b87965504e13/cardano-crypto-class/src/Cardano/Crypto/Hash/Blake2b.hs#L24

We will have to unify / merge in re-export the APIs at some point. At the moment, I think that the high-level API design of the cardano-crypto-classes is superior to cryptonite, but it covers only those algorithms and use cases that are needed by Cardano.

Copy link
Contributor

@paweljakubas paweljakubas left a comment

Choose a reason for hiding this comment

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

👍

@HeinrichApfelmus HeinrichApfelmus added this pull request to the merge queue Apr 16, 2024
Merged via the queue into master with commit 9f71904 Apr 16, 2024
3 checks passed
@HeinrichApfelmus HeinrichApfelmus deleted the HeinrichApfelmus/ADP-3350/chainpoint branch April 16, 2024 11:50
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.

3 participants