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

Minor fixups from internal audit #4697

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 8 additions & 5 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,15 @@ validateTotalCollateral pp txBody utxoCollateral =
bal = collAdaBalance txBody utxoCollateral
fromAlonzoValidation = first (fmap injectFailure)

-- | This validation produces the same failure as in Alonzo, but is slightly
-- different then the corresponding one in Alonzo, since it is possible to add
-- non-ada collateral, but only if the same amount of the same multi-asset is
-- present in the collateral return output.
-- | This validation produces the same failure as in Alonzo, but is slightly different
-- then the corresponding one in Alonzo, due to addition of the collateral return output:
--
-- > isAdaOnly balance
-- 1. Collateral amount can be specified exactly, thus protecting user against unnecessary
-- loss.
--
-- 2. Collateral inputs can contain multi-assets, as long all of them are returned to the
-- `collateralReturnTxBodyL`. This design decision was also intentional, in order to
-- simplify utxo selection for collateral.
validateCollateralContainsNonADA ::
forall era.
BabbageEraTxBody era =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ returnProposalDeposits removedProposals oldUMap =
(RewDepUView um)
, unclaimed
)
| otherwise = (um, Map.insertWith (<>) (gasId gas) (gasDeposit gas) unclaimed)
| otherwise = (um, Map.insert (gasId gas) (gasDeposit gas) unclaimed)
addReward c rd =
-- Deposits have been validated at this point
rd {rdReward = rdReward rd <> compactCoinOrError c}
Expand Down
5 changes: 3 additions & 2 deletions libs/cardano-ledger-core/src/Cardano/Ledger/CertState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,16 @@ deriving newtype instance Era era => ToJSON (CommitteeState era)
instance Era era => ToCBOR (CommitteeState era) where
toCBOR = toEraCBOR @era

-- | The state that tracks the voting entities (DReps and Constitutional Committee members)
-- | The state that tracks the voting entities (DReps and Constitutional Committee
-- members). In the formal ledger specification this type is called @GState@
data VState era = VState
{ vsDReps ::
!( Map
(Credential 'DRepRole (EraCrypto era))
(DRepState (EraCrypto era))
)
, vsCommitteeState :: !(CommitteeState era)
, vsNumDormantEpochs :: EpochNo
, vsNumDormantEpochs :: !EpochNo
-- ^ Number of contiguous epochs in which there are exactly zero
-- active governance proposals to vote on. It is incremented in every
-- EPOCH rule if the number of active governance proposals to vote on
Expand Down