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

Modify TxCertificates allow multiple script witnesses for a single stake credential #595

Merged
merged 1 commit into from
Jul 26, 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
6 changes: 3 additions & 3 deletions cardano-api/internal/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ estimateTransactionKeyWitnessCount
_ -> 0
+ case txCertificates of
TxCertificates _ _ (BuildTxWith witnesses) ->
length [() | KeyWitness{} <- Map.elems witnesses]
length [() | (_, KeyWitness{}) <- witnesses]
_ -> 0
+ case txUpdateProposal of
TxUpdateProposal _ (UpdateProposal updatePerGenesisKey _) ->
Expand Down Expand Up @@ -1517,10 +1517,10 @@ substituteExecutionUnits
(ix, cert) <- zip [0 ..] certs
, stakecred <- maybeToList (selectStakeCredentialWitness cert)
, ScriptWitness ctx witness <-
maybeToList (Map.lookup stakecred witnesses)
maybeToList (List.lookup stakecred witnesses)
, let witness' = substituteExecUnits (ScriptWitnessIndexCertificate ix) witness
]
in TxCertificates supported certs . BuildTxWith . Map.fromList
in TxCertificates supported certs . BuildTxWith
<$> traverse
( \(sCred, eScriptWitness) ->
case eScriptWitness of
Expand Down
5 changes: 3 additions & 2 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,8 @@ data TxCertificates build era where
TxCertificates
:: ShelleyBasedEra era
-> [Certificate era]
-> BuildTxWith build (Map StakeCredential (Witness WitCtxStake era))
-> BuildTxWith build [(StakeCredential, Witness WitCtxStake era)]
-- ^ There can be more than one script witness per stake credential
-> TxCertificates build era

deriving instance Eq (TxCertificates build era)
Expand Down Expand Up @@ -3157,7 +3158,7 @@ collectTxBodyScriptWitnesses
(ix, cert) <- zip [0 ..] certs
, ScriptWitness _ witness <- maybeToList $ do
stakecred <- selectStakeCredentialWitness cert
Map.lookup stakecred witnesses
List.lookup stakecred witnesses
]

scriptWitnessesMinting
Expand Down
Loading