From 39eb580c30fdb35fc5e5a0eb741ef0106ff1284a Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 19 Jan 2023 12:48:33 +0000 Subject: [PATCH] tests: Ensure correct signing of extrinsics larger than 256 bytes Signed-off-by: Alexandru Vasile --- testing/integration-tests/src/client/mod.rs | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/testing/integration-tests/src/client/mod.rs b/testing/integration-tests/src/client/mod.rs index 666bbad952..ebe6b1181a 100644 --- a/testing/integration-tests/src/client/mod.rs +++ b/testing/integration-tests/src/client/mod.rs @@ -234,6 +234,33 @@ async fn dry_run_fails() { } } +#[tokio::test] +async fn submit_large_extrinsic() { + let ctx = test_context().await; + let api = ctx.client(); + + let alice = pair_signer(AccountKeyring::Alice.pair()); + + // 2 MiB blob of data. + let bytes: Vec = (0..2 * 1024 * 1024).map(|i: u32| i as u8).collect(); + // The preimage pallet allows storing and managing large byte-blobs. + let tx = node_runtime::tx().preimage().note_preimage(bytes); + + let signed_extrinsic = api + .tx() + .create_signed(&tx, &alice, Default::default()) + .await + .unwrap(); + + signed_extrinsic + .submit_and_watch() + .await + .unwrap() + .wait_for_finalized_success() + .await + .unwrap(); +} + #[tokio::test] async fn unsigned_extrinsic_is_same_shape_as_polkadotjs() { let ctx = test_context().await;