Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DOBEN committed May 24, 2024
1 parent 72eece2 commit 34deed3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion deps/concordium-base
8 changes: 5 additions & 3 deletions src/Concordium/Client/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ data TransactionOpts energyOrMaybe = TransactionOpts
toNonce :: !(Maybe Nonce),
toMaxEnergyAmount :: !energyOrMaybe,
toExpiration :: !(Maybe Text),
toOutFile :: !(Maybe FilePath), -- Optional file name and path to ouptput the signed/partially-signed transaction to instead of submitting the transaction on-chain.
-- | Optional file name and path to output the signed/partially-signed
-- transaction to instead of submitting the transaction on-chain.
toOutFile :: !(Maybe FilePath),
toInteractionOpts :: !InteractionOpts
}
deriving (Show)
Expand Down Expand Up @@ -659,7 +661,7 @@ transactionOptsParserBuilder energyOrMaybeParser =
<*> optional (option auto (long "nonce" <> metavar "NONCE" <> help "Transaction nonce."))
<*> energyOrMaybeParser
<*> optional (strOption (long "expiry" <> metavar "EXPIRY" <> help "Expiration time of a transaction, specified as a relative duration (\"30s\", \"5m\", etc.) or UNIX epoch timestamp."))
<*> optional (strOption (long "outFile" <> metavar "FILE" <> help "An optional file name and path to ouptput the signed/partially-signed transaction to instead of submitting the transaction on-chain."))
<*> optional (strOption (long "out" <> metavar "FILE" <> help "File to output the signed/partially-signed transaction to instead of submitting the transaction on-chain."))
<*> interactionOptsParser

interactionOptsParser :: Parser InteractionOpts
Expand Down Expand Up @@ -734,7 +736,7 @@ transactionSignAndSubmitCmd =
<$> strArgument (metavar "FILE" <> help "File containing the transaction parameters in JSON format.")
<*> interactionOptsParser
)
(progDesc "Create transaction, sign it, and send it to the node.")
(progDesc "Parse a JSON transaction with keys, sign it, and send it to the node.")
)

transactionSubmitCmd :: Mod CommandFields TransactionCmd
Expand Down
8 changes: 6 additions & 2 deletions src/Concordium/Client/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,11 @@ readSignedTransactionFromFile fname = do
logInfo ["Transaction in file: "]
logInfo [[i| #{showPrettyJSON tx}.|]]

-- Check if the transaction is expired.
now <- getCurrentTimeUnix
let expiry = CT.stExpiryTime tx
warnSuspiciousExpiry expiry now

-- TODO: to further decode and display the `message` in contract update or init transactions, we need a schema.

return tx
Expand All @@ -698,7 +703,6 @@ processTransactionCmd action baseCfgDir verbose backend =
logSuccess [printf "transaction '%s' sent to the node" (show hash)]
when (ioTail intOpts) $ do
tailTransaction_ verbose hash
-- logSuccess ["transaction successfully completed"]
TransactionSubmit fname intOpts -> do
-- Read signedTransaction from file
signedTransaction <- readSignedTransactionFromFile fname
Expand Down Expand Up @@ -1660,7 +1664,7 @@ signAndProcessTransaction_ ::
signAndProcessTransaction_ verbose txCfg pl intOpts outFile backend = void $ signAndProcessTransaction verbose txCfg pl intOpts outFile backend

-- | Sign a transaction and process transaction by either send it to the node or write it to a file.
-- If send to the node, optionally tail it (see 'tailTransaction' below).
-- If sent to the node, optionally tail it (see 'tailTransaction' below).
-- If tailed, it returns the TransactionStatusResult of the finalized status,
-- otherwise the return value is @Nothing@.
signAndProcessTransaction ::
Expand Down

0 comments on commit 34deed3

Please sign in to comment.