From 6a0b221d26280d401917173979778358b33e0fb8 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 21 Mar 2024 13:00:28 +0200 Subject: [PATCH 1/4] txWatch: Limit the number of active subscriptions Signed-off-by: Alexandru Vasile --- src/api/transactionWatch_unstable_submitAndWatch.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/transactionWatch_unstable_submitAndWatch.md b/src/api/transactionWatch_unstable_submitAndWatch.md index 91522fb..39d864d 100644 --- a/src/api/transactionWatch_unstable_submitAndWatch.md +++ b/src/api/transactionWatch_unstable_submitAndWatch.md @@ -10,6 +10,9 @@ The string returned by this function is opaque and its meaning can't be interpre Once this function has been called, the server will try to propagate this transaction over the peer-to-peer network and/or include it onto the chain even if `transactionWatch_unstable_unwatch` is called or that the JSON-RPC client disconnects. In other words, it is not possible to cancel submitting a transaction. +The JSON-RPC server must accept at least 4 `transactionWatch_unstable_submitAndWatch` subscriptions per JSON-RPC client. +Trying to open more might lead to a JSON-RPC error when calling `transactionWatch_unstable_submitAndWatch`. + ## Notifications format This function will later generate one or more notifications in the following format: @@ -165,4 +168,5 @@ JSON-RPC servers are allowed to skip sending events as long as it properly keeps ## Possible errors -A JSON-RPC error is generated if the `transaction` parameter has an invalid format, but no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated. +- A JSON-RPC error with error code `-32800` can be generated if the JSON-RPC client has already opened 4 or more `transactionWatch_unstable_submitAndWatch` subscriptions. +- A JSON-RPC error is generated if the `transaction` parameter has an invalid format, but no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated. From 81aa61759ac8dc972dd52004b4c1266ade4a9d71 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 21 Mar 2024 13:03:16 +0200 Subject: [PATCH 2/4] txWatch: Specify rpc error code from jsonrpc.org Signed-off-by: Alexandru Vasile --- src/api/transactionWatch_unstable_submitAndWatch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/transactionWatch_unstable_submitAndWatch.md b/src/api/transactionWatch_unstable_submitAndWatch.md index 39d864d..1cea1af 100644 --- a/src/api/transactionWatch_unstable_submitAndWatch.md +++ b/src/api/transactionWatch_unstable_submitAndWatch.md @@ -169,4 +169,4 @@ JSON-RPC servers are allowed to skip sending events as long as it properly keeps ## Possible errors - A JSON-RPC error with error code `-32800` can be generated if the JSON-RPC client has already opened 4 or more `transactionWatch_unstable_submitAndWatch` subscriptions. -- A JSON-RPC error is generated if the `transaction` parameter has an invalid format, but no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated. +- A JSON-RPC error with error code `-32602` is generated if the `transaction` parameter has an invalid format, but no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated. From 7dab561fd6d007e7fc0193d2cc050324f8c7abec Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 21 Mar 2024 13:05:51 +0200 Subject: [PATCH 3/4] txWatch: Add mention for invalid tx decoded bytes Signed-off-by: Alexandru Vasile --- src/api/transactionWatch_unstable_submitAndWatch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/transactionWatch_unstable_submitAndWatch.md b/src/api/transactionWatch_unstable_submitAndWatch.md index 1cea1af..00419d9 100644 --- a/src/api/transactionWatch_unstable_submitAndWatch.md +++ b/src/api/transactionWatch_unstable_submitAndWatch.md @@ -127,7 +127,7 @@ No more event will be generated about this transaction. The `invalid` event indicates that the runtime has marked the transaction as invalid. -This can happen for a variety of reasons specific to the chain, such as a bad signature, bad nonce, not enough balance for fees, etc. +This can happen for a variety of reasons specific to the chain, such as a bad signature, bad nonce, not enough balance for fees, invalid decoded transaction bytes etc. `error` is a human-readable error message indicating why the transaction is invalid. This string isn't meant to be shown to end users, but is for developers to understand the problem. From 7d3d0a7e94de248c31466db423f0c49ab1e57493 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Thu, 21 Mar 2024 19:08:22 +0200 Subject: [PATCH 4/4] Update src/api/transactionWatch_unstable_submitAndWatch.md Co-authored-by: James Wilson --- src/api/transactionWatch_unstable_submitAndWatch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/transactionWatch_unstable_submitAndWatch.md b/src/api/transactionWatch_unstable_submitAndWatch.md index 00419d9..f0823d3 100644 --- a/src/api/transactionWatch_unstable_submitAndWatch.md +++ b/src/api/transactionWatch_unstable_submitAndWatch.md @@ -169,4 +169,4 @@ JSON-RPC servers are allowed to skip sending events as long as it properly keeps ## Possible errors - A JSON-RPC error with error code `-32800` can be generated if the JSON-RPC client has already opened 4 or more `transactionWatch_unstable_submitAndWatch` subscriptions. -- A JSON-RPC error with error code `-32602` is generated if the `transaction` parameter has an invalid format, but no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated. +- A JSON-RPC error with error code `-32602` is generated if the `transaction` parameter is not a valid hex string. Note that no error is produced if the bytes of the `transaction`, once decoded, are invalid. Instead, an `invalid` notification will be generated.