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

Fix Warning Expected subscription, but received an id response instead #626

Closed
haerdib opened this issue Jul 24, 2023 · 3 comments · Fixed by #662
Closed

Fix Warning Expected subscription, but received an id response instead #626

haerdib opened this issue Jul 24, 2023 · 3 comments · Fixed by #662
Assignees
Labels
F2-bug Something isn't working

Comments

@haerdib
Copy link
Contributor

haerdib commented Jul 24, 2023

See comment: #620 (comment):

Example hangs if an error should be returned.

Steps to reproduce:
run integritee-node 1.0.36 (polkadot-0.9.42 deps)

wget https://github.com/integritee-network/integritee-node/releases/download/1.0.36/integritee-node-dev
chmod +x integritee-node-dev
./integritee-node-dev --dev 

run substrate api client example:

git checkout polkadot-v0.9.42
export RUST_LOG=warn
cargo run -p ac-examples --example transfer_with_ws_client

Just logs the warning and keeps on waiting for a response.

[2023-07-24T13:25:21Z DEBUG substrate_api_client::rpc::tungstenite_client::client] got on_subscription_msg {"jsonrpc":"2.0","error":{"code":1002,"message":"Verification Error: Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\n\tCould not decode `Call`, variant doesn't exist\n","data":"RuntimeApi(\"Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\\n\\tCould not decode `Call`, variant doesn't exist\\n\")"},"id":"1"}
[2023-07-24T13:25:21Z WARN  substrate_api_client::rpc::tungstenite_client::client] Expected subscription, but received an id response instead: Object {"error": Object {"code": Number(1002), "data": String("RuntimeApi(\"Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\\n\\tCould not decode `Call`, variant doesn't exist\\n\")"), "message": String("Verification Error: Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\n\tCould not decode `Call`, variant doesn't exist\n")}, "id": String("1"), "jsonrpc": String("2.0")}

To be looked into: Is this a problem of ws-client/ tungstenite client only, but also jsonrpsee?

@haerdib
Copy link
Contributor Author

haerdib commented Jul 24, 2023

Update: Jsonrpsee does not hang:
Tested with cargo run -p ac-examples --example event_error_details:

[+] Composed extrinsic: UncheckedExtrinsic(Some((MultiAddress::Id(d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d (5GrwvaEF...)), GenericSignedExtra { era: Era::Immortal, nonce: 0, tip: AssetTip { tip: 0, asset: None } })), ([10, 0], MultiAddress::Id(8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48 (5FHneW46...)), 1000000000000000))
[+] Transaction got included into the TxPool.
[+] Couldn't execute the extrinsic due to RpcClient(Client(Call(Custom(ErrorObject { code: ServerError(1002), message: "Verification Error: Runtime error: Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\n\tCould not decode `Call`, variant doesn't exist\n", data: Some(RawValue("RuntimeApi(\"Execution failed: Runtime panicked: Bad input data provided to validate_transaction: Could not decode `RuntimeCall::System.0`:\\n\\tCould not decode `Call`, variant doesn't exist\\n\")")) }))))

It is therefore an issue of ws-client and tungstenite rpc-client

@haerdib
Copy link
Contributor Author

haerdib commented Jul 24, 2023

Update: A warning is also produced if everything runs through okay (see #620 (comment)).

[2023-07-24T13:20:33Z INFO  substrate_api_client::rpc::ws_client] got on_subscription_msg {"jsonrpc":"2.0","result":"DaTgmIttoXLra0b1","id":"1"}
[2023-07-24T13:20:33Z WARN  substrate_api_client::rpc::ws_client] Expected subscription, but received an id response instead: Object {"id": String("1"), "jsonrpc": String("2.0"), "result": String("DaTgmIttoXLra0b1")}
[2023-07-24T13:20:33Z DEBUG ws::handler] Handler received: 
    <FRAME>
    final: true
    reserved: false false false
    opcode: TEXT
    length: 115
    payload length: 113
    payload: 0x7b226a736f6e727063223a22322e30222c226d6574686f64223a22617574686f725f65787472696e736963557064617465222c22706172616d73223a7b22737562736372697074696f6e223a22446154676d4974746f584c7261306231222c22726573756c74223a227265616479227d7d
                
[2023-07-24T13:20:33Z INFO  substrate_api_client::rpc::ws_client] got on_subscription_msg {"jsonrpc":"2.0","method":"author_extrinsicUpdate","params":{"subscription":"DaTgmIttoXLra0b1","result":"ready"}}

So I suppose the warning is wrong, but one needs to differ between the messages:

  1. If the "result" is a String with the subscription ID, that's fine. No need to issue a warning
  2. If there's not "result" but an "error" instead, that should result in a returned error

@haerdib haerdib changed the title Investigate Warning Expected subscription, but received an id response instead Fix Warning Expected subscription, but received an id response instead Jul 24, 2023
@haerdib haerdib added the F2-bug Something isn't working label Jul 24, 2023
@clangenb
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F2-bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants