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

Allow querying accounts touched within the block #2128

Closed
MaksymZavershynskyi opened this issue Feb 13, 2020 · 3 comments · Fixed by #2253
Closed

Allow querying accounts touched within the block #2128

MaksymZavershynskyi opened this issue Feb 13, 2020 · 3 comments · Fixed by #2253
Assignees
Labels
A-RPC Area: rpc P-critical Priority: critical

Comments

@MaksymZavershynskyi
Copy link
Contributor

We should extend RPC API to query all accounts that were touched within the given block.

@frol
Copy link
Collaborator

frol commented Feb 18, 2020

The implementation is already there, account_id that is specified is used as a prefix, so passing an empty account_id works as one requested in this issue. This is definitely unexpected, so I will work on the design a little bit more, and make this feature clear especially since it is not really expected to receive info about changes to vlad, vlad111 and vlad222 accounts when you specify vlad as account_id and expect only the exact match to be filtered.

@frol
Copy link
Collaborator

frol commented Mar 6, 2020

I was under a wrong impression previously. Well, it was a bug turning as a feature. I will need to implement a new RPC endpoint exposing a list of account IDs touched in a block.

Draft API:

$ http post http://localhost:3030 jsonrpc=2.0 id=dontcare \
    method=EXPERIMENTAL_changes_list_accounts \
    'params:={"block_id": "DYHRzRbxUR1ANPdCQcgQE9g5zyYQoDZ1k8BJEQ3hDSgW"}'
$ http post http://localhost:3030 jsonrpc=2.0 id=dontcare \
    method=EXPERIMENTAL_changes_list_accounts \
    'params:={"block_id": 100500}'
$ http post http://localhost:3030 jsonrpc=2.0 id=dontcare \
    method=EXPERIMENTAL_changes_list_accounts \
    'params:={"finality": "latest"}'

NOTE: The endpoint naming needs some bikeshedding.

The response:

{
    "block_hash": "DYHRzRbxUR1ANPdCQcgQE9g5zyYQoDZ1k8BJEQ3hDSgW",
    "changes": [
        {
            "account_id": "frol.near",
            "type": "data_changes",
        },
        {
            "account_id": "frol.near",
            "type": "account_changes",
        },
        {
            "account_id": "user.near",
            "type": "access_key_changes",
        },
    ]
}

frol added a commit that referenced this issue Mar 17, 2020
)

Extended RPC API to query all accounts that were touched within the given block. #2128 

## Test plan

Extended the `pytest/tests/sanity/rpc_state_changes.py` test-suite.
@frol
Copy link
Collaborator

frol commented Mar 17, 2020

The follow-up documentation request is near/docs#267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-RPC Area: rpc P-critical Priority: critical
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants