@@ -291,6 +291,23 @@ runTransactionCmd cmd =
291
291
mUpperBound certs wdrls metadataSchema scriptFiles metadataFiles mPparams
292
292
mUpProp outputOptions -> do
293
293
294
+ -- The user can specify an era prior to the era that the node is currently in.
295
+ -- We cannot use the user specified era to construct a query against a node because it may differ
296
+ -- from the node's era and this will result in the 'QueryEraMismatch' failure.
297
+
298
+ SocketPath sockPath <- firstExceptT ShelleyTxCmdSocketEnvError
299
+ $ newExceptT readEnvSocketPath
300
+
301
+ let localNodeConnInfo = LocalNodeConnectInfo
302
+ { localConsensusModeParams = cModeParams
303
+ , localNodeNetworkId = nid
304
+ , localNodeSocketPath = sockPath
305
+ }
306
+
307
+ AnyCardanoEra nodeEra
308
+ <- firstExceptT (ShelleyTxCmdQueryConvenienceError . AcqFailure )
309
+ . newExceptT $ determineEra cModeParams localNodeConnInfo
310
+
294
311
inputsAndMaybeScriptWits <- readScriptWitnessFiles cEra txins
295
312
certFilesAndMaybeScriptWits <- readScriptWitnessFiles cEra certs
296
313
certsAndMaybeScriptWits <- sequence
@@ -315,6 +332,7 @@ runTransactionCmd cmd =
315
332
mReturnCollateral <- case mReturnColl of
316
333
Just retCol -> Just <$> toTxOutInAnyEra cEra retCol
317
334
Nothing -> return Nothing
335
+
318
336
txOuts <- mapM (toTxOutInAnyEra cEra) txouts
319
337
320
338
-- We need to construct the txBodycontent outside of runTxBuild
@@ -347,18 +365,25 @@ runTransactionCmd cmd =
347
365
let consensusMode = consensusModeOnly cModeParams
348
366
case consensusMode of
349
367
CardanoMode -> do
350
- (utxo , _, eraHistory, systemStart, _)
368
+ (nodeEraUTxO , _, eraHistory, systemStart, _)
351
369
<- firstExceptT ShelleyTxCmdQueryConvenienceError
352
- . newExceptT $ queryStateForBalancedTx cEra nid allTxInputs
370
+ . newExceptT $ queryStateForBalancedTx nodeEra nid allTxInputs
353
371
case toEraInMode cEra CardanoMode of
354
372
Just eInMode -> do
373
+ -- Why do we cast the era? The user can specify an era prior to the era that the node is currently in.
374
+ -- We cannot use the user specified era to construct a query against a node because it may differ
375
+ -- from the node's era and this will result in the 'QueryEraMismatch' failure.
376
+ txEraUtxo <- case first ShelleyTxCmdTxEraCastErr (eraCast cEra nodeEraUTxO) of
377
+ Right txEraUtxo -> return txEraUtxo
378
+ Left e -> left e
379
+
355
380
scriptExecUnitsMap <- firstExceptT ShelleyTxCmdTxExecUnitsErr $ hoistEither
356
381
$ evaluateTransactionExecutionUnits
357
382
eInMode systemStart eraHistory
358
- pparams utxo balancedTxBody
383
+ pparams txEraUtxo balancedTxBody
359
384
scriptCostOutput <- firstExceptT ShelleyTxCmdPlutusScriptCostErr $ hoistEither
360
385
$ renderScriptCosts
361
- utxo
386
+ txEraUtxo
362
387
executionUnitPrices
363
388
(collectTxBodyScriptWitnesses txBodycontent)
364
389
scriptExecUnitsMap
0 commit comments