-
Notifications
You must be signed in to change notification settings - Fork 689
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
add status field to response in RPC methods tx
, EXPERIMENTAL_tx_status
, broadcast_tx_commit
, broadcast_tx_async
#9556
Conversation
38de644
to
4dca195
Compare
@wacban @jakmeier adding you back :) In the meantime, I'll think about tests. For now, I just roughly fixed the existing ones |
3306d6a
to
3990544
Compare
tx
, EXPERIMENTAL_tx_status
, broadcast_tx_commit
tx
, EXPERIMENTAL_tx_status
, broadcast_tx_commit
, broadcast_tx_async
Eq, | ||
PartialEq, | ||
)] | ||
pub enum TxExecutionStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about the corner cases from a point of view of a user:
- Submit a transaction
- Transaction gets included in a block in a fork
- See that the transaction is included in a block
- Wait for 10s
- See that the transaction is included in a block
- Wait for 10s
- .. repeat forever
Should we help the user in this case?
IIUC, this infinite loop is not possible with the execution of receipts, because the outgoing receipts of the parent block must be included in the child block.
Inclusion of transactions is different, because it is not mandatory.
A counter-argument would be that a transaction may never be included in any block by chunk producers, and we can't possibly verify this condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After we merge this, I'll start working on adding the same struct to the request to all the methods touched in this PR. It should solve this issue at least partially.
Thank you for the review!
I've addressed all the other comments and added the notes to CHANGELOG.md, please have a look again
8243ac6
to
ddb1e43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍 👍
3b7d40b
to
cb1cc58
Compare
add `final_execution_status` field to response in RPC methods: - tx - EXPERIMENTAL_tx_status - broadcast_tx_commit - broadcast_tx_async
…atus`, `broadcast_tx_commit`, `broadcast_tx_async` (#9556) This PR is a part of RPC tx methods redesign https://docs.google.com/document/d/1jGuXzBlMAGQENsUpy5x5Xd7huCLOd8k6tyMOEE41Rro/edit?usp=sharing Addressing point 3 in #9542 and start working on #6837 Changes: - New field `status` appeared in the response of RPC methods `tx`, `EXPERIMENTAL_tx_status`, `broadcast_tx_commit`, `broadcast_tx_async` - Added some comments with the explanations In #6837, Illia suggested to have the structure ```rust enum BroadcastWait { /// Returns right away. None, /// Waits only for inclusion into the block. Inclusion, /// Waits until block with inclusion is finalized. InclusionFinal, /// Waits until all non-refund receipts are executed. Executed, /// Waits until all non-refund receipts are executed and the last of the blocks is final. ExecutedFinal, /// Waits until everything has executed and is final. Final, } ``` I've renamed it to `TxExecutionStatus` and simplified it a little by dropping all refund options: 1. We may add them later without breaking backwards compatibility 2. To support them, we need to have the access to `receipt` (it's the method `get_tx_execution_status`). We have there only `execution_outcome` by default. We created special logic to be able not to retrieve the receipts (it's the only difference between `tx` and `EXPERIMENTAL_tx_status`). I have a feeling (please correct me here if I'm wrong) that retrieving corresponding receipt may slow down the execution that we tried to optimise. BTW, maybe the data from `execution_outcome` is enough (we have there `gas_burnt` and `tokens_burnt`). @jakmeier suggested the condition `outcome.tokens_burnt == 0 && outcome.status == Success`. Unfortunately, we need to work with any status. But maybe the first part (`outcome.tokens_burnt == 0`) is enough to say that it could be only refund receipt. I need more input here.
…, add method `broadcast_tx` (#9644) Fixes #6837 I'll need to update the [docs](/~https://github.com/near/docs) and [jsonrpc_client](/~https://github.com/near/near-jsonrpc-client-rs) (and maybe something else, I haven't already checked) Important updates: 1. We have a new concept for all tx-related methods - `finality`. `finality` in the response is merged to master 2 weeks ago: #9556. `finality` field in the request means "I want at least this level of confidence". So, the stricter the level, the longer the user needs to wait. 2. I decided to use `Final` as a default `finality` value because it gives the strongest guarantee and does not change backward compatibility for any of the methods (though, the waiting time may be increased sometimes to achieve the strictest level of confidence). 3. Methods `tx`, `EXPERIMENTAL_tx_status` have `finality` as an additional optional field. 4. A new method appeared - `broadcast_tx`. It allows to send the tx, it also have the optional field `finality`. 6. `broadcast_tx_async` is equal to `broadcast_tx` with hardcoded `finality None`, I'll mark it as deprecated in the doc 7. `broadcast_tx_commit` is equal to `broadcast_tx` with hardcoded `finality Final`, I'll mark it as deprecated in the doc.
…, add method `broadcast_tx` (#9644) Fixes #6837 I'll need to update the [docs](/~https://github.com/near/docs) and [jsonrpc_client](/~https://github.com/near/near-jsonrpc-client-rs) (and maybe something else, I haven't already checked) Important updates: 1. We have a new concept for all tx-related methods - `finality`. `finality` in the response is merged to master 2 weeks ago: #9556. `finality` field in the request means "I want at least this level of confidence". So, the stricter the level, the longer the user needs to wait. 2. I decided to use `Final` as a default `finality` value because it gives the strongest guarantee and does not change backward compatibility for any of the methods (though, the waiting time may be increased sometimes to achieve the strictest level of confidence). 3. Methods `tx`, `EXPERIMENTAL_tx_status` have `finality` as an additional optional field. 4. A new method appeared - `broadcast_tx`. It allows to send the tx, it also have the optional field `finality`. 6. `broadcast_tx_async` is equal to `broadcast_tx` with hardcoded `finality None`, I'll mark it as deprecated in the doc 7. `broadcast_tx_commit` is equal to `broadcast_tx` with hardcoded `finality Final`, I'll mark it as deprecated in the doc.
This PR is a part of RPC tx methods redesign https://docs.google.com/document/d/1jGuXzBlMAGQENsUpy5x5Xd7huCLOd8k6tyMOEE41Rro/edit?usp=sharing
Addressing point 3 in #9542 and start working on #6837
Changes:
status
appeared in the response of RPC methodstx
,EXPERIMENTAL_tx_status
,broadcast_tx_commit
,broadcast_tx_async
In #6837, Illia suggested to have the structure
I've renamed it to
TxExecutionStatus
and simplified it a little by dropping all refund options:receipt
(it's the methodget_tx_execution_status
). We have there onlyexecution_outcome
by default. We created special logic to be able not to retrieve the receipts (it's the only difference betweentx
andEXPERIMENTAL_tx_status
). I have a feeling (please correct me here if I'm wrong) that retrieving corresponding receipt may slow down the execution that we tried to optimise.BTW, maybe the data from
execution_outcome
is enough (we have theregas_burnt
andtokens_burnt
). @jakmeier suggested the conditionoutcome.tokens_burnt == 0 && outcome.status == Success
. Unfortunately, we need to work with any status. But maybe the first part (outcome.tokens_burnt == 0
) is enough to say that it could be only refund receipt. I need more input here.