-
Notifications
You must be signed in to change notification settings - Fork 635
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
refactor(jsonrpc): Refactor broadcast_tx jsonrpc handler to add structured errors #4180
refactor(jsonrpc): Refactor broadcast_tx jsonrpc handler to add structured errors #4180
Conversation
04a553d
to
c7c6766
Compare
We have methods:
I assume they were created for Wallet needs (#2525). Currently @frol and I suggest returning an error in case tx was routed as well because from an end-user perspective it was unable to check if tx is valid because it was routed and the user needs to check tx to ensure it is valid. Any objections if we throw an error there? Another suggestion to return the same structure for /cc @bowenwang1996 |
Sounds good to me |
7a4eacb
to
7a6ceed
Compare
…for error messages (to watch for backward compatibility after refactor) (#4200) I've refactored transaction related methods on JSON-RPC in this PR #4180 Here I've added tests to check that error messages are the same, so we can ensure that refactor is backward compatible. We need to merge this PR before #4180
7a6ceed
to
7bd09bc
Compare
9b8e174
to
f003ac4
Compare
f003ac4
to
aba2a29
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.
- I have minor suggestions in the comments
- I want to ask you to add notable changes to the
chain/jsonrpc/CHANGELOG
…jsonrpc to avoid near_network dependency in jsonrpc-primitives
… same result on check_tx and send_tx_sync
…orresponding tests pass
…ServerError from jsonrpc to jsonrpc-primitives, fix dependencies
35bd7af
to
9d080c2
Compare
…tured errors (#4180) * Refactor broadcast_tx jsonrpc handler to add structurred errors * Remove wip comments * Refactor tx_status_common, move impl From<NetworkClientResponses> to jsonrpc to avoid near_network dependency in jsonrpc-primitives * Return error in case of NetworkClientResponses::RequestRouted, return same result on check_tx and send_tx_sync * Make backward compatible error messages to refactored methods. Make corresponding tests pass * Move backward compatibility to jsonrpc-primitives from jsonrpc, move ServerError from jsonrpc to jsonrpc-primitives, fix dependencies * Address review suggestions * Address review suggestions. Update jsonrpc changelog, bump version * Address review suggestions
This PR introduces structured errors to JSON RPC methods which deals with transaction broadcasting:
broadcast_tx_async
broadcast_tx_commit
EXPERIMENTAL_broadcast_tx_sync
EXPERIMENTAL_check_tx
EXPERIMENTAL_tx_status
tx