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

Drop W.Coin, W.UTxO, W.TxOut usage in BalanceSpec #4940

Conversation

Anviking
Copy link
Member

@Anviking Anviking commented Jan 13, 2025

Drop a significant part of the usage of W.Coin, W.TxOut, W.UTxO in BalanceSpec, as part
of the effort to eventually consistently only use ledger types.

Depends on #4762

@Anviking Anviking self-assigned this Jan 13, 2025
@Anviking Anviking force-pushed the anviking/BalanceSpec-fewer-wallet-deps branch from 25dfa64 to 95fb19f Compare January 13, 2025 13:02
lovelaceF (Coin l)
| l < 0 = "-" <> pretty (W.Coin.unsafeFromIntegral (-l))
| otherwise = pretty (W.Coin.unsafeFromIntegral l)
lovelaceF (Coin c) = fixedF @Double 6 (fromIntegral c / 1e6)
Copy link
Member Author

Choose a reason for hiding this comment

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

From the W.Coin implementation

address :: IsRecentEra era => TxOut era -> W.Address
address = Convert.toWallet . view addrTxOutL
address :: TxOut era -> Address
address = view addrTxOutL
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -875,14 +871,14 @@ spec_balanceTx era = describe "balanceTx" $ do
horizon = SlotNo 20
beyondHorizon = SlotNo 21

wallet = mkTestWallet (utxo [W.Coin 5_000_000])
wallet = mkTestWallet (utxo [Coin 5_000_000])
Copy link
Contributor

Choose a reason for hiding this comment

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

why not lovelace here?

Copy link
Contributor

Choose a reason for hiding this comment

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

aha, Coin is not Value ...

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.

lgtm 👍

@abailly abailly merged commit 153ba89 into anviking/ADP-3413/balanceTx-unit-conway Jan 20, 2025
30 checks passed
@abailly abailly deleted the anviking/BalanceSpec-fewer-wallet-deps branch January 20, 2025 20:12
@Anviking
Copy link
Member Author

@abailly for the record I was intentionally waiting with merging this until the base branch was merged 😅

@abailly
Copy link
Collaborator

abailly commented Jan 21, 2025

My bad @Anviking ! I saw it was Ready for marging and did not read the comments and realised it was based on another branch. I will try to avoid inflicting my help next time

@Anviking Anviking restored the anviking/BalanceSpec-fewer-wallet-deps branch January 21, 2025 14:28
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