Skip to content

Commit 1d0e771

Browse files
committed
Make ZeroTreasuryWithdrawals a permanent check in gov state transation rule
In `conwayGovTransition`, we remove the condition on `hardforkConwayBootstrapPhase` for checking `ZeroTreasuryWithdrawals`. We then replayed the preview, preprod and mainnet public chains with this change which guarentees there were no empty treasury withdrawals pre-Conway era.
1 parent ca9b8c2 commit 1d0e771

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

  • eras/conway/impl
    • src/Cardano/Ledger/Conway/Rules
    • testlib/Test/Cardano/Ledger/Conway/Imp

eras/conway/impl/src/Cardano/Ledger/Conway/Rules/Gov.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,8 @@ conwayGovTransition = do
546546
-- Guardrails script hash check
547547
runTest $ checkGuardrailsScriptHash @era constitutionPolicy proposalPolicy
548548

549-
unless (hardforkConwayBootstrapPhase $ pp ^. ppProtocolVersionL) $
550-
-- The sum of all withdrawals must be positive
551-
F.fold wdrls /= mempty ?! (injectFailure . ZeroTreasuryWithdrawals) pProcGovAction
549+
-- The sum of all withdrawals must be positive
550+
F.fold wdrls /= mempty ?! (injectFailure . ZeroTreasuryWithdrawals) pProcGovAction
552551
UpdateCommittee _mPrevGovActionId membersToRemove membersToAdd _qrm -> do
553552
let conflicting = Set.intersection (Map.keysSet membersToAdd) membersToRemove
554553
in failOnNonEmptySet conflicting (injectFailure . ConflictingCommitteeUpdate)

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Imp/GovSpec.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,28 +1105,31 @@ withdrawalsSpec =
11051105
}
11061106

11071107
it "Fails for empty withdrawals" $ do
1108-
mkTreasuryWithdrawalsGovAction [] >>= expectZeroTreasuryFailurePostBootstrap
1108+
mkTreasuryWithdrawalsGovAction [] >>= expectZeroTreasuryFailure
11091109

11101110
accountAddress1 <- registerAccountAddress
1111-
mkTreasuryWithdrawalsGovAction [(accountAddress1, zero)] >>= expectZeroTreasuryFailurePostBootstrap
1111+
mkTreasuryWithdrawalsGovAction [(accountAddress1, zero)] >>= expectZeroTreasuryFailure
11121112

11131113
accountAddress2 <- registerAccountAddress
11141114
let withdrawals = [(accountAddress1, zero), (accountAddress2, zero)]
11151115

1116-
mkTreasuryWithdrawalsGovAction withdrawals >>= expectZeroTreasuryFailurePostBootstrap
1116+
mkTreasuryWithdrawalsGovAction withdrawals >>= expectZeroTreasuryFailure
11171117

11181118
wdrls <- mkTreasuryWithdrawalsGovAction $ withdrawals ++ [(accountAddress2, Coin 100_000)]
11191119
proposal <- mkProposal wdrls
11201120
submitBootstrapAwareFailingProposal_ proposal $
11211121
FailBootstrap [disallowedProposalFailure proposal]
11221122
where
1123-
expectZeroTreasuryFailurePostBootstrap wdrls = do
1123+
expectZeroTreasuryFailure wdrls = do
11241124
proposal <- mkProposal wdrls
11251125
void $
11261126
submitBootstrapAwareFailingProposal proposal $
11271127
FailBootstrapAndPostBootstrap $
11281128
FailBoth
1129-
{ bootstrapFailures = [disallowedProposalFailure proposal]
1129+
{ bootstrapFailures =
1130+
[ disallowedProposalFailure proposal
1131+
, injectFailure $ ZeroTreasuryWithdrawals wdrls
1132+
]
11301133
, postBootstrapFailures = [injectFailure $ ZeroTreasuryWithdrawals wdrls]
11311134
}
11321135

0 commit comments

Comments
 (0)