Skip to content

Commit 0535d6e

Browse files
committed
cardano-testnet | Add gRPC evalTx test
1 parent 82de666 commit 0535d6e

6 files changed

Lines changed: 441 additions & 7 deletions

File tree

cardano-node/src/Cardano/Node/Tracing/Tracers/Rpc.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ instance LogFormatting TraceRpc where
4646
TraceRpcSubmitTxDecodingError _ -> []
4747
TraceRpcSubmitTxValidationError _ -> []
4848
TraceRpcSubmitSpan s -> [spanToObject s]
49+
TraceRpcEvalTxDecodingError _ -> []
50+
TraceRpcEvalTxSpan s -> [spanToObject s]
4951

5052
forHuman = docToText . pretty
5153

@@ -56,6 +58,7 @@ instance LogFormatting TraceRpc where
5658
TraceRpcQuery (TraceRpcQueryReadUtxosSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.ReadUtxos" Nothing]
5759
TraceRpcQuery (TraceRpcQuerySearchUtxosSpan (SpanBegin _)) -> [CounterM "rpc.request.QueryService.SearchUtxos" Nothing]
5860
TraceRpcSubmit (TraceRpcSubmitSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.SubmitTx" Nothing]
61+
TraceRpcSubmit (TraceRpcEvalTxSpan (SpanBegin _)) -> [CounterM "rpc.request.SubmitService.EvalTx" Nothing]
5962
_ -> []
6063

6164
instance MetaTrace TraceRpc where
@@ -76,6 +79,8 @@ instance MetaTrace TraceRpc where
7679
TraceRpcSubmitTxDecodingError _ -> ["TxDecodingError"]
7780
TraceRpcSubmitTxValidationError _ -> ["TxValidationError"]
7881
TraceRpcSubmitSpan _ -> ["SubmitTx", "Span"]
82+
TraceRpcEvalTxDecodingError _ -> ["EvalTxDecodingError"]
83+
TraceRpcEvalTxSpan _ -> ["EvalTx", "Span"]
7984

8085
severityFor (Namespace _ nsInner) _ = case nsInner of
8186
["FatalError"] -> Just Error -- RPC server startup errors
@@ -84,9 +89,11 @@ instance MetaTrace TraceRpc where
8489
["QueryService", "ReadUtxos", "Span"] -> Just Debug
8590
["QueryService", "SearchUtxos", "Span"] -> Just Debug
8691
["SubmitService", "SubmitTx", "Span"] -> Just Debug
92+
["SubmitService", "EvalTx", "Span"] -> Just Debug
8793
["SubmitService", "N2cConnectionError"] -> Just Warning -- this is a more serious error, this shouldn't happen
8894
["SubmitService", "TxDecodingError"] -> Just Debug -- request error
8995
["SubmitService", "TxValidationError"] -> Just Debug -- request error
96+
["SubmitService", "EvalTxDecodingError"] -> Just Debug -- request error
9097
_ -> Nothing
9198

9299
documentFor (Namespace _ nsInner) = case nsInner of
@@ -96,11 +103,13 @@ instance MetaTrace TraceRpc where
96103
["QueryService", "ReadUtxos", "Span"] -> Just "Span for the ReadUtxos UTXORPC method."
97104
["QueryService", "SearchUtxos", "Span"] -> Just "Span for the SearchUtxos UTXORPC method."
98105
["SubmitService", "SubmitTx", "Span"] -> Just "Span for the SubmitTx UTXORPC method."
106+
["SubmitService", "EvalTx", "Span"] -> Just "Span for the EvalTx UTXORPC method."
99107
["SubmitService", "N2cConnectionError"] ->
100108
Just
101109
"Node connection error. This should not happen, as this means that there is an issue in cardano-rpc configuration."
102110
["SubmitService", "TxDecodingError"] -> Just "A regular request error, when submitted transaction decoding fails."
103111
["SubmitService", "TxValidationError"] -> Just "A regular request error, when submitted transaction is invalid."
112+
["SubmitService", "EvalTxDecodingError"] -> Just "A regular request error, when evalTx transaction decoding fails."
104113
_ -> Nothing
105114

106115
metricsDocFor (Namespace _ nsInner) = case nsInner of
@@ -112,6 +121,8 @@ instance MetaTrace TraceRpc where
112121
[("rpc.request.QueryService.SearchUtxos", "Span for the SearchUtxos UTXORPC method.")]
113122
["SubmitService", "SubmitTx", "Span"] ->
114123
[("rpc.request.SubmitService.SubmitTx", "Span for the SubmitTx UTXORPC method.")]
124+
["SubmitService", "EvalTx", "Span"] ->
125+
[("rpc.request.SubmitService.EvalTx", "Span for the EvalTx UTXORPC method.")]
115126
_ -> []
116127

117128
allNamespaces =
@@ -122,9 +133,11 @@ instance MetaTrace TraceRpc where
122133
, ["QueryService", "ReadUtxos", "Span"]
123134
, ["QueryService", "SearchUtxos", "Span"]
124135
, ["SubmitService", "SubmitTx", "Span"]
136+
, ["SubmitService", "EvalTx", "Span"]
125137
, ["SubmitService", "N2cConnectionError"]
126138
, ["SubmitService", "TxDecodingError"]
127139
, ["SubmitService", "TxValidationError"]
140+
, ["SubmitService", "EvalTxDecodingError"]
128141
]
129142

130143
-- helper functions

cardano-testnet/cardano-testnet.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ test-suite cardano-testnet-test
238238
Cardano.Testnet.Test.Gov.TreasuryDonation
239239
Cardano.Testnet.Test.Gov.TreasuryGrowth
240240
Cardano.Testnet.Test.Gov.TreasuryWithdrawal
241+
Cardano.Testnet.Test.Rpc.Eval
241242
Cardano.Testnet.Test.Rpc.Query
242243
Cardano.Testnet.Test.Rpc.SearchUtxos
243244
Cardano.Testnet.Test.Rpc.Transaction

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Transaction.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import qualified Cardano.Api.Ledger as L
1313

1414
import Cardano.CLI.Type.Common
1515
import Cardano.Crypto.Hash.Class (hashToStringAsHex)
16-
import qualified Cardano.Ledger.Core as L
1716
import Cardano.Testnet
1817

1918
import Prelude

0 commit comments

Comments
 (0)