-
Notifications
You must be signed in to change notification settings - Fork 217
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
Support extraCollateral in updateSealedTx #2941
Conversation
Discovered in the property test of the following commit. The resolvedCollateral would always be empty.
Will be needed for the balancing endpoint.
@@ -1206,8 +1206,7 @@ fromAlonzoTxBodyAndAux bod mad = | |||
, fee = | |||
Just $ fromShelleyCoin fee | |||
, resolvedCollateral = | |||
-- TODO: (ADP-957) | |||
[] | |||
map ((,W.Coin 0) . fromShelleyTxIn) (toList collateral) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess these W.Coin 0
are remainders from jormungandr? 🤷♂️
@@ -435,6 +435,9 @@ mkDelegationCertificates da accXPub = | |||
-- `updateSealedTx`. See `updateSealedTx` for more details. | |||
data ExtraTxBodyContent = ExtraTxBodyContent | |||
{ extraInputs :: [TxIn] | |||
, extraCollateral :: [TxIn] | |||
-- ^ Only used in the Alonzo era and later. Will be silently ignored in | |||
-- previous eras. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about error
ing, but decided to ignore instead.
I don't think returning Left
here is a good idea, as passing collateral to a Shelley tx would be a programmer and not user error.
ShelleyBasedEraAlonzo -> body | ||
{ Alonzo.outputs = Alonzo.outputs body | ||
<> StrictSeq.fromList (Cardano.toShelleyTxOut era <$> extraOutputs') | ||
, Alonzo.inputs = Alonzo.inputs body | ||
<> Set.fromList (Cardano.toShelleyTxIn <$> extraInputs') | ||
, Alonzo.collateral = Alonzo.collateral body | ||
<> Set.fromList (Cardano.toShelleyTxIn <$> extraCollateral') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
outs = Set.fromList . view #outputs . _decodeSealedTx | ||
fee = view #fee . _decodeSealedTx | ||
|
||
isAlonzo (cardanoTx -> InAnyCardanoEra Cardano.AlonzoEra _) = True | ||
isAlonzo (cardanoTx -> InAnyCardanoEra _ _) = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like ViewPatterns more and more:-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
bors r+ |
Build succeeded: |
extraCollateral
inupdateSealedTx
fromAlonzoTxBodyAndAux
Comments
Issue Number
ADP-1140