Skip to content

Commit

Permalink
correct byron unit test
Browse files Browse the repository at this point in the history
adjust restore byron
  • Loading branch information
paweljakubas committed May 25, 2020
1 parent 2c87b04 commit 1ced010
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/byron/bench/Restore.hs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ bench_restoration
, WalletKey k
, NFData s
, Show s
, MaxSizeOf Address n k
, MaxSizeOf Address n ByronKey
, PersistState s
, PersistPrivateKey (k 'RootK)
, NetworkDiscriminantVal n
Expand Down
11 changes: 7 additions & 4 deletions lib/byron/test/unit/Cardano/Wallet/Byron/TransactionSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ prop_rebalanceChangeOutputs sel onDangling = do
propSizeEstimation
:: forall n k.
( WalletKey k
, MaxSizeOf Address n k
, MaxSizeOf Address n ByronKey
)
=> ProtocolMagic
-> Gen CoinSelection
Expand All @@ -334,13 +334,16 @@ propSizeEstimation pm genSel genChngAddrs =
cbor = fromCoinSelection sel chngAddrs
size = fromIntegral $ BS.length $ CBOR.toStrictByteString cbor

-- As we have
-- maxSizeOf Icarus w/ Mainnet = 43
-- maxSizeOf Random w/ Mainnet = 76
-- We always go for the higher bound for change address payload's size,
-- so, we may end up with up to 12 extra bytes per change address in our
-- so, we may end up with up to 33 extra bytes per change address in our
-- estimation.
-- For Icarus addresses, we can be as good as 4 bytes per change address
-- because there's no variance due to the derivation path encoded as
-- attributes (this only happens on random addresses).
margin = 12 * fromIntegral (length $ change sel)
margin = 33 * fromIntegral (length $ change sel)
realSizeSup = Quantity (size + margin)
realSizeInf = Quantity size
in
Expand Down Expand Up @@ -510,7 +513,7 @@ xprv seed =
goldenTestSignedTx
:: forall (n :: NetworkDiscriminant) k.
( k ~ IcarusKey
, MaxSizeOf Address n k
, MaxSizeOf Address n ByronKey
, PaymentAddress n k
)
=> Proxy n
Expand Down

0 comments on commit 1ced010

Please sign in to comment.