Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transactionWatch: Limit the number of active subscriptions and clarify error codes #146

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/api/transactionWatch_unstable_submitAndWatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -124,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.

Expand Down Expand Up @@ -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 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.
lexnv marked this conversation as resolved.
Show resolved Hide resolved