Plutonomicon / cardano-transaction-lib

A Purescript library for building smart contract transactions on Cardano

Home Page:https://plutonomicon.github.io/cardano-transaction-lib/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`privatePaymentKeyToFile` and `privatePaymentKeyFromFile` do not compose to identity

Renegatto opened this issue · comments

Bug report

Description

Given the example

Contract.Wallet.KeyFile.privatePaymentKeyToFile path key
key' <- Contract.Wallet.KeyFile.privatePaymentKeyFromFile path

Expected behavior

key is equal to key'.

Actual behavior

key is different from key'.

Details

privatePaymentKeyFromTextEnvelope

privatePaymentKeyFromTextEnvelope . decodeTextEnvelope gives the same result as privatePaymentKeyFromFile.

Stable state

privatePaymentKeyFromFile drops half (?) of a CBOR on the first read and does not do it any more.
So in this code:

let
  f key = do
     Contract.Wallet.KeyFile.privatePaymentKeyToFile "temp" key
     Contract.Wallet.KeyFile.privatePaymentKeyFromFile "temp"
key0 <- f key
key1 <- f key0
key2 <- f key1
...

key0 /= key1
but
key1 = key2 = key3 ... keyn

Revision

4e3a69c