Skip to content

Commit

Permalink
Add arbitraryUnRegTxCert for Imptests.
Browse files Browse the repository at this point in the history
This chooses between `UnRegTxCert` and `UnRegDepositTxCert`.
  • Loading branch information
aniketd committed Jan 10, 2025
1 parent 5e1ed75 commit 77d9def
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* Deprecate `Conway` type synonym
* Remove crypto parametrization from `ConwayEra`

### testlib

* Add `arbitraryUnRegTxCert` to choose between `UnRegTxCert` and `UnRegDepositTxCert` in Imp tests.

## 1.18.0.0

* Remove `SlotNo` from `CertEnv` and `CertsEnv`
Expand Down
15 changes: 15 additions & 0 deletions eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/ImpTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module Test.Cardano.Ledger.Conway.ImpTest (
submitYesVote_,
submitFailingVote,
trySubmitVote,
arbitraryUnRegTxCert,
registerDRep,
unRegisterDRep,
updateDRep,
Expand Down Expand Up @@ -390,6 +391,20 @@ unRegisterDRep drep = do
& bodyTxL . certsTxBodyL
.~ SSeq.singleton (UnRegDRepTxCert drep refund)

arbitraryUnRegTxCert ::
forall era.
( ShelleyEraImp era
, ConwayEraTxCert era
) =>
Credential 'Staking ->
ImpTestM era (TxCert era)
arbitraryUnRegTxCert stakingCredential = do
keyDeposit <- getsNES (nesEsL . curPParamsEpochStateL . ppKeyDepositL)
elements
[ UnRegTxCert stakingCredential
, UnRegDepositTxCert stakingCredential keyDeposit
]

-- | Submit a transaction that updates a given DRep
updateDRep ::
forall era.
Expand Down

0 comments on commit 77d9def

Please sign in to comment.