cardano-ledger icon indicating copy to clipboard operation
cardano-ledger copied to clipboard

Added a hash field to MemoBytes

Open Soupstraw opened this issue 2 years ago • 2 comments

This PR adds a hash of the byte string to the MemoBytes data structure. This will make it easier to spot if the byte string representations of two MemoBytes values are different by calling show on MemoBytes.

I also changed the type signature of MemoBytes t to MemoBytes t era and made all the necessary changes in other files. Some other type signatures also had to be changed as a consequence:

  • Mem t -> Mem t era
  • Timelock crypto -> Timelock era
  • MultiSig crypto -> MultiSig era

The MemoBytes constructor and destructor are now behind a bidirectional pattern Memo. Since we have to calculate the hash based on the current era and crypto, the pattern has a constraint Era era, which had to be added to a lot of function signatures across the codebase.

closes #2882

Soupstraw avatar Aug 02 '22 16:08 Soupstraw

@Soupstraw looks like you are hitting this bug as well. Can't quite pinpoint where exactly is the problem, but the tests indicate that it is in the Data type.

lehins avatar Aug 06 '22 23:08 lehins

@lehins It turned out to be a bug in my implementation of FromCBOR for the data wrapper for Plutus.Data 😅

Soupstraw avatar Aug 09 '22 14:08 Soupstraw