Fix sp-api handling of multiple arguments (#6484)

With the switch to `decode_all_with_depth_limit` we silently broken
support for functions with multiple arguments. The old generated code
tried to decode each parameter separately, which does not play well with
`decode_all`.

This pr adds a test to ensure that this does not happen again and fixes
the bug by decoding everything at once by wrapping it into tuples.
This commit is contained in:
Bastian Köcher
2020-06-23 13:46:16 +02:00
committed by GitHub
parent 63793c8b97
commit 6647a42a67
3 changed files with 35 additions and 11 deletions
@@ -207,3 +207,14 @@ fn record_proof_works() {
&runtime_code,
).expect("Executes block while using the proof backend");
}
#[test]
fn call_runtime_api_with_multiple_arguments() {
let client = TestClientBuilder::new().set_execution_strategy(ExecutionStrategy::Both).build();
let data = vec![1, 2, 4, 5, 6, 7, 8, 8, 10, 12];
let block_id = BlockId::Number(client.chain_info().best_number);
client.runtime_api()
.test_multiple_arguments(&block_id, data.clone(), data.clone(), data.len() as u32)
.unwrap();
}