Skip to content

Commit

Permalink
Deprecate createAndValidateTransactionBody
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Aug 23, 2024
1 parent fe2ae13 commit f858e3e
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cardano-api/gen/Test/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ genValidTxBody sbe =
-- | Partial! This function will throw an error when the generated transaction is invalid.
genTxBody :: HasCallStack => ShelleyBasedEra era -> Gen (TxBody era)
genTxBody era = do
res <- Api.createAndValidateTransactionBody era <$> genTxBodyContent era
res <- Api.createTransactionBody era <$> genTxBodyContent era
case res of
Left err -> error (docToString (prettyError err))
Right txBody -> pure txBody
Expand Down
14 changes: 7 additions & 7 deletions cardano-api/internal/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ estimateBalancedTxBody
let maxLovelaceFee = L.Coin (2 ^ (32 :: Integer) - 1)
txbody1ForFeeEstimateOnly <-
first TxFeeEstimationxBodyError $ -- TODO: impossible to fail now
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent1
{ txFee = TxFeeExplicit sbe maxLovelaceFee
Expand Down Expand Up @@ -330,7 +330,7 @@ estimateBalancedTxBody
-- 3. Return and total collateral
txbody2 <-
first TxFeeEstimationxBodyError $ -- TODO: impossible to fail now
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent1
{ txFee = TxFeeExplicit sbe fee
Expand Down Expand Up @@ -370,7 +370,7 @@ estimateBalancedTxBody
first TxFeeEstimationFinalConstructionError $ -- TODO: impossible to fail now. We need to implement a function
-- that simply creates a transaction body because we have already
-- validated the transaction body earlier within makeTransactionBodyAutoBalance
createAndValidateTransactionBody sbe finalTxBodyContent
createTransactionBody sbe finalTxBodyContent
return
( BalancedTxBody
finalTxBodyContent
Expand Down Expand Up @@ -1045,7 +1045,7 @@ makeTransactionBodyAutoBalance
-- 4. balance the transaction and update tx change output
txbody0 <-
first TxBodyError $
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent
{ txOuts =
Expand Down Expand Up @@ -1105,7 +1105,7 @@ makeTransactionBodyAutoBalance
let (dummyCollRet, dummyTotColl) = maybeDummyTotalCollAndCollReturnOutput sbe txbodycontent changeaddr
txbody1 <-
first TxBodyError $ -- TODO: impossible to fail now
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent1
{ txFee = TxFeeExplicit sbe maxLovelaceFee
Expand Down Expand Up @@ -1150,7 +1150,7 @@ makeTransactionBodyAutoBalance
-- we need to calculate.
txbody2 <-
first TxBodyError $ -- TODO: impossible to fail now
createAndValidateTransactionBody
createTransactionBody
sbe
txbodycontent1
{ txFee = TxFeeExplicit sbe fee
Expand Down Expand Up @@ -1187,7 +1187,7 @@ makeTransactionBodyAutoBalance
first TxBodyError $ -- TODO: impossible to fail now. We need to implement a function
-- that simply creates a transaction body because we have already
-- validated the transaction body earlier within makeTransactionBodyAutoBalance
createAndValidateTransactionBody sbe finalTxBodyContent
createTransactionBody sbe finalTxBodyContent
return
( BalancedTxBody
finalTxBodyContent
Expand Down
6 changes: 2 additions & 4 deletions cardano-api/internal/Cardano/Api/Tx/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ maxShelleyTxInIx = fromIntegral $ maxBound @Word16
maxTxOut :: Quantity
maxTxOut = fromIntegral (maxBound :: Word64)

{-# DEPRECATED createAndValidateTransactionBody "Use createTransactionBody instead" #-}
createAndValidateTransactionBody
:: ()
=> ShelleyBasedEra era
Expand Down Expand Up @@ -2794,10 +2795,7 @@ makeShelleyTransactionBody
convPParamsToScriptIntegrityHash AlonzoEraOnwardsBabbage txProtocolParams redeemers datums languages
let txbody =
( mkCommonTxBody sbe txIns txOuts txFee txWithdrawals txAuxData
& A.collateralInputsTxBodyL azOn
.~ case txInsCollateral of
TxInsCollateralNone -> Set.empty
TxInsCollateral _ txins -> fromList (map toShelleyTxIn txins)
& A.collateralInputsTxBodyL azOn .~ convCollateralTxIns txInsCollateral
& A.referenceInputsTxBodyL bOn .~ convReferenceInputs txInsReference
& A.collateralReturnTxBodyL bOn .~ convReturnCollateral sbe txReturnCollateral
& A.totalCollateralTxBodyL bOn .~ convTotalCollateral txTotalCollateral
Expand Down
1 change: 1 addition & 0 deletions cardano-api/src/Cardano/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ module Cardano.Api

-- ** Transaction bodies
, TxBody (..)
, createTransactionBody
, createAndValidateTransactionBody
, makeByronTransactionBody
, TxBodyContent (..)
Expand Down
172 changes: 172 additions & 0 deletions hls.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
2024-08-23 15:23:49.4320000 [client] INFO Writing client log to file /home/jordan/Repos/Work/intersect-mbo/cardano-api/hls.log
2024-08-23 15:23:49.4340000 [client] INFO Finding haskell-language-server
2024-08-23 15:23:49.4360000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:49.4360000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:49.4420000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose upgrade' in cwd '/home/jordan'
2024-08-23 15:23:50.0120000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.0120000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.0190000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose list -t hls -c installed -r' in cwd '/home/jordan'
2024-08-23 15:23:50.1440000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.1440000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.1510000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose list -t cabal -c installed -r' in cwd '/home/jordan'
2024-08-23 15:23:50.2870000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.2870000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.2920000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose list -t stack -c installed -r' in cwd '/home/jordan'
2024-08-23 15:23:50.4230000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.4230000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.4280000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis hls 2.9.0.1' in cwd '/home/jordan'
2024-08-23 15:23:50.4430000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.4430000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.4500000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis cabal 3.10.3.0' in cwd '/home/jordan'
2024-08-23 15:23:50.4700000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.4700000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.4740000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis stack 2.13.1' in cwd '/home/jordan'
2024-08-23 15:23:50.4920000 [client] INFO Executing 'ghc --numeric-version' in cwd '/home/jordan'
2024-08-23 15:23:50.6070000 [client] INFO Checking for ghcup installation
2024-08-23 15:23:50.6070000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:23:50.6140000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose run --hls 2.9.0.1 --cabal 3.10.3.0 --stack 2.13.1 --install' in cwd '/home/jordan'
2024-08-23 15:23:50.7520000 [client] INFO Working out the project GHC version. This might take a while...
2024-08-23 15:23:50.7530000 [client] INFO Executing 'haskell-language-server-wrapper --project-ghc-version' in cwd '/home/jordan/Repos/Work/intersect-mbo/cardano-api'
2024-08-23 15:24:23.9880000 [client] INFO The GHC version for the project or file: 9.8.2
2024-08-23 15:24:24.3080000 [client] INFO Platform constants: Linux_UnknownLinux, A_64
2024-08-23 15:24:24.3080000 [client] INFO Checking for ghcup installation
2024-08-23 15:24:24.3080000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:24:24.3160000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose list -t hls -c installed -r' in cwd '/home/jordan'
2024-08-23 15:24:24.4120000 [client] INFO Checking for ghcup installation
2024-08-23 15:24:24.4120000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:24:24.4190000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis bindir' in cwd '/home/jordan'
2024-08-23 15:24:24.4380000 [client] INFO Checking for ghcup installation
2024-08-23 15:24:24.4380000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:24:24.4440000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis hls 2.9.0.1' in cwd '/home/jordan'
2024-08-23 15:24:24.4590000 [client] INFO Checking for ghcup installation
2024-08-23 15:24:24.4590000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:24:24.4660000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose whereis ghc 9.8.2' in cwd '/home/jordan'
2024-08-23 15:24:24.4810000 [client] INFO Checking for ghcup installation
2024-08-23 15:24:24.4810000 [client] INFO Trying to find the ghcup executable in: /home/jordan/.ghcup/bin/ghcup
2024-08-23 15:24:24.4890000 [client] INFO Executing '/home/jordan/.ghcup/bin/ghcup --no-verbose run --hls 2.9.0.1 --cabal 3.10.3.0 --stack 2.13.1 --ghc 9.8.2 --install' in cwd '/home/jordan'
2024-08-23 15:24:24.6060000 [client] INFO Activating the language server in working dir: /home/jordan/Repos/Work/intersect-mbo/cardano-api (the workspace folder)
2024-08-23 15:24:24.6060000 [client] INFO run command: /home/jordan/.ghcup/tmp/ghcup-ghc-9.8.2_cabal-3.10.3.0_hls-2.9.0.1_stack-2.13.1/haskell-language-server-wrapper --lsp -l hls.log
2024-08-23 15:24:24.6060000 [client] INFO debug command: /home/jordan/.ghcup/tmp/ghcup-ghc-9.8.2_cabal-3.10.3.0_hls-2.9.0.1_stack-2.13.1/haskell-language-server-wrapper --lsp -l hls.log
2024-08-23 15:24:24.6060000 [client] INFO server cwd: /home/jordan/Repos/Work/intersect-mbo/cardano-api
2024-08-23 15:24:24.6060000 [client] INFO server environment variables:
2024-08-23 15:24:24.6060000 [client] INFO PKG_CONFIG_PATH=/usr/local/opt/cardano/lib/pkgconfig:$PKG_CONFIG_PATH
2024-08-23 15:24:24.6060000 [client] INFO LD_LIBRARY_PATH=/usr/local/opt/cardano/lib:$LD_LIBRARY_PATH
2024-08-23 15:24:24.6060000 [client] INFO PATH=/home/jordan/.ghcup/tmp/ghcup-ghc-9.8.2_cabal-3.10.3.0_hls-2.9.0.1_stack-2.13.1:/home/jordan/.cabal/bin:/home/jordan/.ghcup/bin:/home/jordan/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/home/jordan/.cargo/bin:/home/jordan/.local/bin:/home/jordan/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
2024-08-23 15:24:24.6090000 [client] INFO Starting language server
2024-08-23T15:24:36.348665Z | Info | haskell-language-server version: 2.9.0.1 (GHC: 9.8.2) (PATH: /home/jordan/.ghcup/hls/2.9.0.1/lib/haskell-language-server-2.9.0.1/bin/haskell-language-server-9.8.2)
2024-08-23T15:24:36.351323Z | Info | Directory: /home/jordan/Repos/Work/intersect-mbo/cardano-api
2024-08-23T15:24:36.351564Z | Info | Starting (haskell-language-server) LSP server...
GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsLogLevel = Info, argsLogFile = Just "hls.log", argsLogStderr = True, argsLogClient = False, argsThreads = 0, argsProjectGhcVersion = False}
PluginIds: [ pragmas-suggest
, pragmas-completion
, ghcide-code-actions-bindings
, ghcide-extend-import-action
, retrie
, stylish-haskell
, explicit-fields
, ghcide-code-actions-type-signatures
, ghcide-code-actions-fill-holes
, stan
, hlint
, changeTypeSignature
, ghcide-code-actions-imports-exports
, cabal-fmt
, notes
, ghcide-completions
, eval
, ghcide-type-lenses
, cabal
, overloaded-record-dot
, gadt
, LSPRecorderCallback
, importLens
, floskell
, codeRange
, class
, ormolu
, qualifyImportedNames
, ghcide-hover-and-symbols
, alternateNumberFormat
, rename
, splice
, moduleName
, semanticTokens
, fourmolu
, cabal-gild
, callHierarchy
, ghcide-core
, explicit-fixity
, pragmas-disable ]
2024-08-23T15:24:36.354444Z | Info | Logging heap statistics every 60.00s
2024-08-23T15:24:36.363292Z | Info | Starting LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
PluginIds: [ pragmas-suggest
, pragmas-completion
, ghcide-code-actions-bindings
, ghcide-extend-import-action
, retrie
, stylish-haskell
, explicit-fields
, ghcide-code-actions-type-signatures
, ghcide-code-actions-fill-holes
, stan
, hlint
, changeTypeSignature
, ghcide-code-actions-imports-exports
, cabal-fmt
, notes
, ghcide-completions
, eval
, ghcide-type-lenses
, cabal
, overloaded-record-dot
, gadt
, LSPRecorderCallback
, importLens
, floskell
, codeRange
, class
, ormolu
, qualifyImportedNames
, ghcide-hover-and-symbols
, alternateNumberFormat
, rename
, splice
, moduleName
, semanticTokens
, fourmolu
, cabal-gild
, callHierarchy
, ghcide-core
, explicit-fixity
, pragmas-disable ]
2024-08-23T15:24:36.363982Z | Info | Starting server
2024-08-23T15:24:36.379679Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-6511971617328114305) "file:///home/jordan/Repos/Work/intersect-mbo/cardano-api"], clientSettings = hashed Nothing}
2024-08-23T15:24:36.534247Z | Info | Started LSP server in 0.17s
2024-08-23T15:24:38.001373Z | Info | Cradle path: cardano-api/internal/Cardano/Api/Tx/Body.hs
2024-08-23T15:24:38.001964Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2024-08-23T15:24:38.492981Z | Warning | No plugin handles this "textDocument/semanticTokens/full" request.
2024-08-23T15:24:39.682151Z | Info | Load cabal cradle using single file
2024-08-23T15:24:40.791304Z | Info | cabal --builddir=/home/jordan/.cache/hie-bios/dist-cardano-api-421e1b3c108ffc95d1506cfadac1f678 v2-repl --with-compiler /home/jordan/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/jordan/.cache/hie-bios/ghc-pkg-b88342b269acd611f4601bef43a69dba cardano-api:lib:internal
Environment Variables
HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT76726-0
HIE_BIOS_GHC: /home/jordan/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
HIE_BIOS_GHC_ARGS: -B/home/jordan/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-08-23T15:24:41.928952Z | Warning | No plugin handles this "textDocument/semanticTokens/full" request.
2024-08-23T15:24:47.388913Z | Info | Interface files cache directory: /home/jordan/.cache/ghcide/cardano-api-9.2.0.0-inplace-internal-d709d8174c8add048ec63121cbae6aac9437b6bc
2024-08-23T15:24:47.391993Z | Info | Making new HscEnv. In-place unit ids: [cardano-api-9.2.0.0-inplace-internal]
2024-08-23T15:24:47.596926Z | Info | Cradle path: cardano-api/test/cardano-api-test/Test/Cardano/Api/Typed/TxBody.hs
2024-08-23T15:24:47.598020Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2024-08-23T15:24:49.035163Z | Info | Load cabal cradle using single file
2024-08-23T15:24:50.061120Z | Info | cabal --builddir=/home/jordan/.cache/hie-bios/dist-cardano-api-421e1b3c108ffc95d1506cfadac1f678 v2-repl --with-compiler /home/jordan/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/jordan/.cache/hie-bios/ghc-pkg-b88342b269acd611f4601bef43a69dba cardano-api:test:cardano-api-test
Environment Variables
HIE_BIOS_OUTPUT: /tmp/HIE_BIOS_OUTPUT76726-1
HIE_BIOS_GHC: /home/jordan/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/bin/ghc-9.8.2
HIE_BIOS_GHC_ARGS: -B/home/jordan/.ghcup/ghc/9.8.2/lib/ghc-9.8.2/lib
2024-08-23T15:25:11.446519Z | Info | LSP: received shutdown
2024-08-23T15:25:11.455391Z | Warning | LSP: received message during shutdown: "$/cancelRequest"
2024-08-23T15:25:11.455561Z | Warning | LSP: received message during shutdown: "$/cancelRequest"
2024-08-23T15:25:11.455634Z | Warning | LSP: received message during shutdown: "$/cancelRequest"
2024-08-23T15:25:11.455688Z | Warning | LSP: received message during shutdown: "$/cancelRequest"
2024-08-23T15:25:11.455740Z | Warning | LSP: received message during shutdown: "$/cancelRequest"
2024-08-23T15:25:11.457009Z | Error | Got EOF

0 comments on commit f858e3e

Please sign in to comment.