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

Adjust semantics of ConwayWdrlNotDelegatedToDRep #4715

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

* Add `whenBootstrap`

## 1.17.2.0

* Change the state used for `ConwayWdrlNotDelegatedToDRep` predicate failure checking

## 1.17.1.0

* Add `processDelegation`
Expand Down
24 changes: 15 additions & 9 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Ledger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,15 @@ ledgerTransition = do
committee = govState ^. committeeGovStateL
proposals = govState ^. proposalsGovStateL
committeeProposals = proposalsWithPurpose grCommitteeL proposals
certStateAfterCERTS <-
trans @(EraRule "CERTS" era) $
TRC
( CertsEnv tx pp slot currentEpoch committee committeeProposals
, certState
, StrictSeq.fromStrict $ txBody ^. certsTxBodyL
)

-- Starting with version 10, we don't allow withdrawals into RewardAcounts that are KeyHashes and not delegated to Dreps
-- Starting with version 10, we don't allow withdrawals into RewardAcounts that are
-- KeyHashes and not delegated to Dreps.
--
-- We also need to make sure we are using the certState before certificates are applied,
-- because otherwise it would not be possible to unregister a reward account and withdraw
-- all funds from it in the same transaction.
unless (HF.bootstrapPhase (pp ^. ppProtocolVersionL)) $ do
let dUnified = dsUnified $ certDState certStateAfterCERTS
let dUnified = dsUnified $ certDState certState
wdrls = unWithdrawals $ tx ^. bodyTxL . withdrawalsTxBodyL
delegatedAddrs = DRepUView dUnified
wdrlsKeyHashes =
Expand All @@ -437,6 +435,14 @@ ledgerTransition = do
Set.filter (not . (`UMap.member` delegatedAddrs) . KeyHashObj) wdrlsKeyHashes
failOnNonEmpty nonExistentDelegations ConwayWdrlNotDelegatedToDRep

certStateAfterCERTS <-
trans @(EraRule "CERTS" era) $
TRC
( CertsEnv tx pp slot currentEpoch committee committeeProposals
, certState
, StrictSeq.fromStrict $ txBody ^. certsTxBodyL
)

-- Votes and proposals from signal tx
let govSignal =
GovSignal
Expand Down
Loading