-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve
PartialTx
inputs over LSQ (#4630)
- Add `getUTxOByTxIn` local state query - Resolve `PartialTx` inputs over LSQ in `Cardano.Wallet.balanceTx` ### Comments This is part of the fix for the [integration test in the 8.11 branch](https://buildkite.com/cardano-foundation/cardano-wallet/builds/5254#018fee3c-01ad-441e-bb7e-25acd78cb7f3); if we have the UTxO of the reference input containing the script used for minting in constructTx, then `Ledger.getMinFeeTxUtxo pp tx utxo` will correctly account for minFeeRefScriptCoinsPerByte * totalRefScriptSize. Previous step: #4629 Next step: #4631 ### Issue Number ADP-3373
- Loading branch information
Showing
10 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
lib/network-layer/src/Cardano/Wallet/Network/LocalStateQuery/UTxO.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{-# LANGUAGE GADTs #-} | ||
-- | | ||
-- Copyright: © 2024 Cardano Foundation | ||
-- License: Apache-2.0 | ||
-- | ||
-- A local state query that looks up UTxOs based on TxIns. | ||
-- | ||
module Cardano.Wallet.Network.LocalStateQuery.UTxO | ||
( getUTxOByTxIn | ||
) where | ||
|
||
import Prelude | ||
|
||
import Cardano.Ledger.TxIn | ||
( TxIn | ||
) | ||
import Cardano.Ledger.UTxO | ||
( UTxO | ||
) | ||
import Cardano.Wallet.Network.Implementation.Ouroboros | ||
( LSQ (..) | ||
) | ||
import Cardano.Wallet.Network.LocalStateQuery.Extra | ||
( onAnyEra | ||
) | ||
import Data.Set | ||
( Set | ||
) | ||
import Internal.Cardano.Write.Tx | ||
( MaybeInRecentEra (..) | ||
) | ||
import Ouroboros.Consensus.Cardano | ||
( CardanoBlock | ||
) | ||
import Ouroboros.Consensus.Shelley.Eras | ||
( StandardCrypto | ||
) | ||
|
||
import qualified Ouroboros.Consensus.Shelley.Ledger as Shelley | ||
|
||
{----------------------------------------------------------------------------- | ||
Local State Query for GetUTxOByTxIn | ||
------------------------------------------------------------------------------} | ||
-- | ||
type LSQ' m = LSQ (CardanoBlock StandardCrypto) m | ||
|
||
getUTxOByTxIn | ||
:: Set (TxIn StandardCrypto) -> LSQ' m (MaybeInRecentEra UTxO) | ||
getUTxOByTxIn ins = | ||
onAnyEra | ||
(pure InNonRecentEraByron) | ||
(pure InNonRecentEraShelley) | ||
(pure InNonRecentEraAllegra) | ||
(pure InNonRecentEraMary) | ||
(pure InNonRecentEraAlonzo) | ||
(InRecentEraBabbage <$> LSQry (Shelley.GetUTxOByTxIn ins)) | ||
(InRecentEraConway <$> LSQry (Shelley.GetUTxOByTxIn ins)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters