-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix collateral balancing when building transaction #631
Conversation
8c6b528
to
02f6030
Compare
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.
Great work, I can tell this was annoying to debug. Just one comment regarding the commit message.
@@ -114,6 +116,10 @@ conwayEraOnwardsToShelleyBasedEra :: ConwayEraOnwards era -> ShelleyBasedEra era | |||
conwayEraOnwardsToShelleyBasedEra = \case | |||
ConwayEraOnwardsConway -> ShelleyBasedEraConway | |||
|
|||
conwayEraOnwardsToBabbageEraOnwards :: ConwayEraOnwards era -> BabbageEraOnwards era |
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.
Yikes
, totalCollateral | ||
) | ||
else (TxReturnCollateralNone, TxTotalCollateralNone) | ||
calcReturnAndTotalCollateral w fee pp' TxInsCollateral{} txReturnCollateral txTotalCollateral cAddr totalAvailableCollateral = babbageEraOnwardsConstraints w $ do |
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.
Does this function exist in cardano-ledger
? Or any function that can assist in this calculation? The more we can call from ledger the better.
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.
Something similar is implemented here, but it's a validation, not a calculation, so we can't just reuse it. https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/babbage/impl/src/Cardano/Ledger/Babbage/Rules/Utxo.hs#L307
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.Hedgehog (testProperty) | ||
|
||
-- | Test that the fee is the same when spending minted asset manually or when autobalancing it | ||
prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset :: Property | ||
prop_make_transaction_body_autobalance_return_correct_fee_for_multi_asset = H.propertyOnce $ do | ||
let sbe = ShelleyBasedEraConway | ||
let ceo = ConwayEraOnwardsConway | ||
beo = conwayEraOnwardsToBabbageEraOnwards ceo |
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.
Another good example as to why we have to ditch the Eon
s.
02f6030
to
2bf5f99
Compare
Changelog
Context
This PR fixes:
This PR consist of two commits:
Checklist