Skip to content

Commit

Permalink
Rename DelegateeNotRegisteredDELEG to `DelegateeStakePoolNotRegiste…
Browse files Browse the repository at this point in the history
…redDELEG`
  • Loading branch information
lehins committed Oct 2, 2024
1 parent a77ac33 commit 5055afd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* Changed return type of `proposalsShowDebug`
* Added `gen-golden` executable needed for golden tests: #4629
* Add `DelegateeDRepNotRegisteredDELEG` predicate failure
* Rename `DelegateeNotRegisteredDELEG` to `DelegateeStakePoolNotRegisteredDELEG`

### `testlib`

Expand Down
10 changes: 5 additions & 5 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Deleg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ data ConwayDelegPredFailure era
| StakeKeyNotRegisteredDELEG (Credential 'Staking (EraCrypto era))
| StakeKeyHasNonZeroRewardAccountBalanceDELEG Coin
| DelegateeDRepNotRegisteredDELEG (Credential 'DRepRole (EraCrypto era))
| DelegateeNotRegisteredDELEG (KeyHash 'StakePool (EraCrypto era))
| DelegateeStakePoolNotRegisteredDELEG (KeyHash 'StakePool (EraCrypto era))
deriving (Show, Eq, Generic)

type instance EraRuleFailure "DELEG" (ConwayEra c) = ConwayDelegPredFailure (ConwayEra c)
Expand All @@ -131,8 +131,8 @@ instance Era era => EncCBOR (ConwayDelegPredFailure era) where
Sum (StakeKeyHasNonZeroRewardAccountBalanceDELEG @era) 4 !> To mCoin
DelegateeDRepNotRegisteredDELEG delegatee ->
Sum (DelegateeDRepNotRegisteredDELEG @era) 5 !> To delegatee
DelegateeNotRegisteredDELEG delegatee ->
Sum (DelegateeNotRegisteredDELEG @era) 6 !> To delegatee
DelegateeStakePoolNotRegisteredDELEG delegatee ->
Sum (DelegateeStakePoolNotRegisteredDELEG @era) 6 !> To delegatee

instance Era era => DecCBOR (ConwayDelegPredFailure era) where
decCBOR = decode $ Summands "ConwayDelegPredFailure" $ \case
Expand All @@ -141,7 +141,7 @@ instance Era era => DecCBOR (ConwayDelegPredFailure era) where
3 -> SumD StakeKeyNotRegisteredDELEG <! From
4 -> SumD StakeKeyHasNonZeroRewardAccountBalanceDELEG <! From
5 -> SumD DelegateeDRepNotRegisteredDELEG <! From
6 -> SumD DelegateeNotRegisteredDELEG <! From
6 -> SumD DelegateeStakePoolNotRegisteredDELEG <! From
n -> Invalid n

instance
Expand Down Expand Up @@ -218,7 +218,7 @@ conwayDelegTransition = do
pure $ mUMElem >>= umElemToDelegatee
checkStakeDelegateeRegistered =
let checkPoolRegistered targetPool =
targetPool `Map.member` pools ?! DelegateeNotRegisteredDELEG targetPool
targetPool `Map.member` pools ?! DelegateeStakePoolNotRegisteredDELEG targetPool
checkDRepRegistered = \case
DRepAlwaysAbstain -> pure ()
DRepAlwaysNoConfidence -> pure ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ spec = do
& bodyTxL . certsTxBodyL
.~ [DelegTxCert cred (DelegStake poolKh)]
)
[injectFailure $ DelegateeNotRegisteredDELEG poolKh]
[injectFailure $ DelegateeStakePoolNotRegisteredDELEG poolKh]

expectNotDelegatedToPool cred

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ledgerExamplesConway =
ApplyTxError $
pure $
wrapFailed @(ConwayDELEG Conway) @(ConwayLEDGER Conway) $
DelegateeNotRegisteredDELEG @Conway (SLE.mkKeyHash 1)
DelegateeStakePoolNotRegisteredDELEG @Conway (SLE.mkKeyHash 1)
, SLE.sleRewardsCredentials =
Set.fromList
[ Left (Coin 100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ ppConwayDelegPredFailure x = case x of
StakeKeyHasNonZeroRewardAccountBalanceDELEG c ->
ppSexp "StakeKeyHasNonZeroRewardAccountBalanceDELEG" [pcCoin c]
ConwayRules.DelegateeDRepNotRegisteredDELEG cred -> ppSexp "DelegateeDRepNotRegisteredDELEG" [pcCredential cred]
ConwayRules.DelegateeNotRegisteredDELEG kh -> ppSexp "DelegateeNotRegisteredDELEG" [pcKeyHash kh]
ConwayRules.DelegateeStakePoolNotRegisteredDELEG kh -> ppSexp "DelegateeStakePoolNotRegisteredDELEG" [pcKeyHash kh]

instance PrettyA (ConwayDelegPredFailure era) where
prettyA = ppConwayDelegPredFailure
Expand Down

0 comments on commit 5055afd

Please sign in to comment.