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

jsonrpc: allow parse object at tx status requests #9648

Merged
merged 1 commit into from
Oct 12, 2023

Conversation

telezhnaya
Copy link
Contributor

@telezhnaya telezhnaya commented Oct 5, 2023

Adding the possibility to pass object as params for tx status methods:

{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "EXPERIMENTAL_tx_status", // could be "tx"
  "params": {
    "tx_hash": "6zgh2u9DqHHiXzdy9ouTP7oGky2T4nugqzqt9wJZwNFm",
    "sender_account_id": "sender.testnet"
  }
}

This is just a nice improvement, it looks cleaner.
But I specifically need this as a prep step for #6837
Having json params will allow me to add new request parameter easier.

I thought about adding passing object to send tx methods as well, but the user has to pack it by borsh to be able to sign it.
So, deserialising SignedTransaction by serde makes no sense, I dropped this functionality.
Serialisation can still be useful to be able to dump tx to json so that humans may read it.

@telezhnaya telezhnaya marked this pull request as ready for review October 5, 2023 22:26
@telezhnaya telezhnaya requested a review from a team as a code owner October 5, 2023 22:26
@telezhnaya telezhnaya requested a review from wacban October 5, 2023 22:26
@telezhnaya telezhnaya changed the title rpc: allow parse object at tx status request jsonrpc: allow parse object at tx status request Oct 6, 2023
Copy link
Contributor

@wacban wacban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall and big thanks for adding more tests
I'm a bit worried about renaming fields. Can you clarify if it is safe?

chain/jsonrpc-primitives/src/types/transactions.rs Outdated Show resolved Hide resolved
chain/jsonrpc/src/api/mod.rs Outdated Show resolved Hide resolved
chain/jsonrpc/src/api/transactions.rs Outdated Show resolved Hide resolved
chain/jsonrpc/src/api/transactions.rs Outdated Show resolved Hide resolved
chain/jsonrpc/src/api/transactions.rs Outdated Show resolved Hide resolved
github-merge-queue bot pushed a commit that referenced this pull request Oct 9, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
@telezhnaya
Copy link
Contributor Author

I decided to cover some of things in separate PR #9653

@telezhnaya telezhnaya changed the title jsonrpc: allow parse object at tx status request jsonrpc: allow parse object at tx requests Oct 9, 2023
@telezhnaya
Copy link
Contributor Author

@wacban could you please have a look again?
With the tests merged, we are sure I'm not breaking old tests with these changes.

I've also updated the description to be more clear what I'm trying to achieve here.

Copy link
Contributor

@wacban wacban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

chain/jsonrpc/src/lib.rs Show resolved Hide resolved
nikurt pushed a commit that referenced this pull request Oct 10, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 11, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
@telezhnaya telezhnaya changed the title jsonrpc: allow parse object at tx requests jsonrpc: allow parse object at tx status requests Oct 11, 2023
@telezhnaya
Copy link
Contributor Author

telezhnaya commented Oct 11, 2023

@wacban could you please have a look on the last commit?

After the discussion with @frol, @firatNEAR and the team, we all came up with the idea that deserialising SignedTransaction by serde makes no sense, because the user has to pack the tx by borsh to be able to sign it.
Please leave the comment that you are still OK with the proposed changes

nikurt pushed a commit that referenced this pull request Oct 11, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
@telezhnaya telezhnaya added this pull request to the merge queue Oct 12, 2023
Merged via the queue into near:master with commit 22b7a36 Oct 12, 2023
9 checks passed
@telezhnaya telezhnaya deleted the rpc_tx_tests branch October 12, 2023 13:47
nikurt pushed a commit that referenced this pull request Oct 16, 2023
Adding the possibility to pass object as params for tx status methods:
```
{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "EXPERIMENTAL_tx_status", // could be "tx"
  "params": {
    "tx_hash": "6zgh2u9DqHHiXzdy9ouTP7oGky2T4nugqzqt9wJZwNFm",
    "sender_account_id": "sender.testnet"
  }
}
```

This is just a nice improvement, it looks cleaner.
But I specifically need this as a prep step for
#6837
Having json params will allow me to add new request parameter easier.

I thought about adding passing object to send tx methods as well, but
the user has to pack it by borsh to be able to sign it.
So, deserialising SignedTransaction by serde makes no sense, I dropped
this functionality.
Serialisation can still be useful to be able to dump tx to json so that
humans may read it.
nikurt pushed a commit that referenced this pull request Oct 16, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 18, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 19, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 19, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 19, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 23, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 23, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 24, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
nikurt pushed a commit that referenced this pull request Oct 24, 2023
I mixed up adding tests and introducing new functionality here
#9648
Please have a look just at tests separately
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants