mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
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:
@@ -313,6 +313,9 @@ cfg_if! {
|
||||
fn test_ecdsa_crypto() -> (ecdsa::AppSignature, ecdsa::AppPublic);
|
||||
/// Run various tests against storage.
|
||||
fn test_storage();
|
||||
/// Test that ensures that we can call a function that takes multiple
|
||||
/// arguments.
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -359,6 +362,9 @@ cfg_if! {
|
||||
fn test_ecdsa_crypto() -> (ecdsa::AppSignature, ecdsa::AppPublic);
|
||||
/// Run various tests against storage.
|
||||
fn test_storage();
|
||||
/// Test that ensures that we can call a function that takes multiple
|
||||
/// arguments.
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -641,6 +647,11 @@ cfg_if! {
|
||||
test_read_storage();
|
||||
test_read_child_storage();
|
||||
}
|
||||
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32) {
|
||||
assert_eq!(&data[..], &other[..]);
|
||||
assert_eq!(data.len(), num as usize);
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
@@ -862,6 +873,11 @@ cfg_if! {
|
||||
test_read_storage();
|
||||
test_read_child_storage();
|
||||
}
|
||||
|
||||
fn test_multiple_arguments(data: Vec<u8>, other: Vec<u8>, num: u32) {
|
||||
assert_eq!(&data[..], &other[..]);
|
||||
assert_eq!(data.len(), num as usize);
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user