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

View call RPC is returning byte arrays instead of base64 #3179

Closed
ilblackdragon opened this issue Aug 16, 2020 · 15 comments
Closed

View call RPC is returning byte arrays instead of base64 #3179

ilblackdragon opened this issue Aug 16, 2020 · 15 comments
Assignees
Labels
A-RPC Area: rpc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-public-interfaces Team: issues relevant to the public interfaces team

Comments

@ilblackdragon
Copy link
Member

Steps to reproduce:

  1. Run any view call, for example query call/evm.test.near/view_call_contract
  2. Observe that output has byte array in result.
{"jsonrpc":"2.0","result":{"result":[34,82,101,118,101,114,116,101,100,32,48,56,99,51,55,57,97,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,50,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,50,52,53,53,50,53,50,53,102,52,101,52,102,53,52,53,102,52,51,52,102,52,101,53,52,53,50,52,102,52,99,52,99,52,53,53,50,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,34],"logs":[],"block_height":31287,"block_hash":"GvE1UnAoiTKWZAcD6tNCJGvnmKnTmkz8RnwVJ2Uk1jhu"},"id":280}

Expectation: result is base64 encoded.

@ilblackdragon ilblackdragon added C-bug Category: This is a bug A-RPC Area: rpc labels Aug 16, 2020
@MaksymZavershynskyi
Copy link
Contributor

Assigning to @khorolets , CC-ing @frol

@frol
Copy link
Collaborator

frol commented Aug 17, 2020

We should not break the existing API, so I see two ways to handle this:

  1. Respond with two fields (result and result_base64)
  2. Extend the query API (we have the extended version of query API where we can now easily add new parameters), so user can request the encoding (bytes or base64 string), this way the deprecated API (query call/...) will not be touched in any way.

UPD: I am re-assigning to myself to cast the decision first

@frol frol added C-enhancement Category: An issue proposing an enhancement or a PR with one. and removed C-bug Category: This is a bug labels Aug 17, 2020
@frol frol assigned frol and unassigned khorolets Aug 17, 2020
@alexauroradev
Copy link
Collaborator

Check with Illia whether this is connected with old EVM implementation @artob

@alexauroradev alexauroradev added the A-EVM Area: Native EVM implementation and support label Dec 4, 2020
@alexauroradev alexauroradev assigned artob and unassigned frol Dec 4, 2020
@frol
Copy link
Collaborator

frol commented Dec 4, 2020

@djsatok How exactly is this related to EVM? This is JSON RPC representation, and we cannot really change it in a backward-compatible way, so the only option is to return both old bytes array and a new base64 representation. We will also need to update the logs field for Events support to be also old (utf-8 strings) and new (base64-encoded strings allowing binary logs) style

@artob artob assigned frol and unassigned artob Dec 7, 2020
@artob artob added T-public-interfaces Team: issues relevant to the public interfaces team and removed A-EVM Area: Native EVM implementation and support labels Dec 7, 2020
@artob
Copy link
Contributor

artob commented Dec 7, 2020

@frol OK, understood, and assigning this back to you.

@ilblackdragon
Copy link
Member Author

ilblackdragon commented Dec 7, 2020 via email

@frol
Copy link
Collaborator

frol commented Dec 8, 2020

@ilblackdragon can you elaborate more on the EVM use case? Do we need a v2 endpoint with base64 encoding instead? Should it be completely different? Should it be something that is not JSON in the first place?

@ilblackdragon
Copy link
Member Author

ilblackdragon commented Dec 9, 2020 via email

@frol
Copy link
Collaborator

frol commented Dec 9, 2020

@ilblackdragon I meant that if the RPC response in JSON bytes encoding is too big, we may as well consider having the RPC responses in non-JSON format in the first place (instead of using base64 inside JSON RPC response).

@ilblackdragon
Copy link
Member Author

ilblackdragon commented Dec 10, 2020 via email

@stale
Copy link

stale bot commented Jul 1, 2021

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months.
It will be closed in 7 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the S-stale label Jul 1, 2021
@bowenwang1996
Copy link
Collaborator

@frol what is the status of this issue?

@stale
Copy link

stale bot commented Sep 29, 2021

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months.
It will be closed in 7 days if no further activity occurs.
Thank you for your contributions.

@stale stale bot added the S-stale label Sep 29, 2021
@bowenwang1996
Copy link
Collaborator

@frol ?

@stale stale bot removed the S-stale label Sep 30, 2021
@frol
Copy link
Collaborator

frol commented Sep 30, 2021

We cannot handle it in a backward-compatible way and it is not important implementation detail if you deal with it through some near-api-* library

@frol frol closed this as completed Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-RPC Area: rpc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-public-interfaces Team: issues relevant to the public interfaces team
Projects
None yet
Development

No branches or pull requests

7 participants