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

Empty params are always replaced with empty list #314

Open
hoffmannjan opened this issue Jun 30, 2022 · 1 comment
Open

Empty params are always replaced with empty list #314

hoffmannjan opened this issue Jun 30, 2022 · 1 comment

Comments

@hoffmannjan
Copy link

hoffmannjan commented Jun 30, 2022

Library replaces missing params argument with [] empty list.

To Reproduce

return await this.client
      .request({
        method: 'chain_get_state_root_hash',
      })

end in a JSON RPC request that looks like this:

{
  "jsonrpc": "2.0",
  "method": "chain_get_state_root_hash",
  "params": [],
  "id": 8466830112817644860
}

I also tried doing

return await this.client
      .request({
        method: 'chain_get_state_root_hash',
        params: null
      })

but the effect is the same.

Expected behavior
IMO if I don't add params to the request it shouldn't be auto-added to the request.
Our RPC server is very strict and it interpretes [] as wrong parameter.
I was looking for definition how it should be implemented correctly in JSON-RPC specification but it wasn't super clear.

@zcstarr
Copy link
Member

zcstarr commented Sep 12, 2022

@hoffmannjan thx for the issue. And good catch! We should be able to throw out params and not have it specified, let me think about what the solution for this should be

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

No branches or pull requests

2 participants