Skip to content

Commit

Permalink
Merge pull request #595 from IntersectMBO/jordan/allow-multiple-witne…
Browse files Browse the repository at this point in the history
…ssses

Modify TxCertificates allow multiple script witnesses for a single stake credential
  • Loading branch information
Jimbo4350 authored Jul 26, 2024
2 parents 65cbae3 + ed927b3 commit aee2131
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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

0 comments on commit aee2131

Please sign in to comment.