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

Simplify registrar benchmarks #566

Merged
merged 10 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 58 additions & 57 deletions pallets/registrar/src/benchmark_blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,54 +33,53 @@ pub struct BenchmarkBlob {
}

const ENCODED_BLOB: &[u8] = &[
0, 9, 177, 241, 214, 77, 65, 110, 230, 156, 74, 146, 155, 254, 39, 188, 91, 117, 252, 8, 90,
167, 163, 117, 158, 193, 82, 40, 92, 159, 126, 167, 127, 117, 168, 49, 35, 21, 117, 102, 82,
252, 221, 89, 243, 5, 169, 208, 200, 206, 28, 124, 211, 224, 185, 242, 66, 250, 47, 27, 200,
31, 48, 141, 6, 0, 118, 30, 162, 34, 163, 78, 91, 130, 87, 18, 148, 219, 145, 6, 214, 15, 236,
131, 51, 167, 137, 239, 95, 207, 21, 167, 140, 167, 87, 106, 104, 155, 189, 123, 155, 7, 173,
16, 8, 252, 54, 108, 185, 113, 139, 218, 215, 254, 68, 37, 173, 30, 51, 245, 163, 205, 241,
202, 134, 131, 97, 41, 182, 15, 144, 103, 146, 229, 52, 207, 5, 82, 255, 36, 219, 55, 41, 38,
112, 208, 127, 150, 239, 131, 227, 6, 154, 95, 28, 205, 66, 32, 209, 89, 69, 228, 28, 176, 0,
0, 32, 0, 0, 0, 16, 0, 8, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0,
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 47, 140, 97, 41, 216, 22, 207, 81, 195, 116, 188, 127,
8, 195, 230, 62, 209, 86, 207, 120, 174, 251, 74, 101, 80, 217, 123, 135, 153, 121, 119, 238,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 63, 32, 6, 222, 61, 138, 84, 210, 126,
68, 169, 213, 206, 24, 150, 24, 242, 45, 180, 180, 157, 149, 50, 13, 144, 33, 153, 76, 133, 15,
37, 184, 227, 133, 236, 219, 232, 203, 100, 143, 101, 214, 239, 232, 53, 250, 27, 50, 253, 149,
140, 97, 244, 92, 63, 91, 253, 137, 187, 12, 221, 174, 199, 161, 103, 210, 57, 1, 63, 56, 15,
186, 152, 104, 158, 190, 209, 19, 135, 53, 224, 231, 165, 167, 144, 171, 205, 113, 11, 48, 189,
46, 171, 3, 82, 221, 204, 38, 65, 122, 161, 148, 180, 222, 242, 92, 253, 166, 239, 58, 0, 0, 0,
0, 69, 171, 129, 240, 74, 150, 152, 45, 218, 197, 226, 11, 83, 38, 121, 204, 15, 12, 197, 115,
153, 57, 69, 212, 166, 142, 68, 212, 239, 160, 6, 119, 200, 95, 12, 230, 120, 121, 157, 62,
255, 2, 66, 83, 185, 14, 132, 146, 124, 198, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 1, 128, 11, 0, 128, 21, 69, 87, 39, 80,
189, 63, 244, 210, 244, 71, 86, 224, 172, 98, 5, 171, 30, 40, 194, 211, 222, 117, 47, 81, 150,
51, 191, 236, 129, 237, 184, 128, 223, 91, 79, 3, 86, 79, 50, 130, 149, 40, 193, 33, 8, 158,
35, 82, 137, 134, 195, 10, 60, 248, 193, 39, 236, 182, 225, 143, 110, 206, 62, 80, 128, 77,
174, 114, 63, 107, 0, 39, 241, 147, 41, 150, 41, 130, 189, 148, 216, 5, 24, 47, 167, 29, 117,
8, 120, 210, 51, 35, 145, 27, 94, 189, 250, 169, 1, 159, 12, 182, 243, 110, 2, 122, 187, 32,
145, 207, 181, 17, 10, 181, 8, 127, 137, 0, 104, 95, 6, 21, 91, 60, 217, 168, 201, 229, 233,
162, 63, 213, 220, 19, 165, 237, 32, 0, 0, 0, 0, 0, 0, 0, 0, 104, 95, 8, 49, 108, 191, 143,
160, 218, 130, 42, 32, 172, 28, 85, 191, 27, 227, 32, 0, 0, 0, 0, 0, 0, 0, 0, 128, 254, 108,
203, 37, 75, 132, 240, 210, 32, 46, 181, 5, 189, 223, 159, 84, 203, 158, 189, 15, 178, 113,
144, 114, 233, 46, 229, 124, 29, 161, 216, 9, 190, 247, 74, 173, 54, 61, 117, 185, 65, 198,
150, 80, 9, 116, 166, 1, 185, 33, 23, 38, 14, 102, 24, 248, 23, 224, 15, 137, 66, 208, 101,
122, 20, 176, 0, 0, 32, 0, 0, 0, 16, 0, 8, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 5, 0, 0, 0, 5, 0,
0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 63, 32, 6, 222, 61, 138, 84, 210,
126, 68, 169, 213, 206, 24, 150, 24, 242, 45, 180, 180, 157, 149, 50, 13, 144, 33, 153, 76,
133, 15, 37, 184, 227, 133, 236, 219, 232, 203, 100, 143, 101, 214, 239, 232, 53, 250, 27, 50,
253, 149, 140, 97, 244, 92, 63, 91, 253, 137, 187, 12, 221, 174, 199, 161, 103, 210, 200, 95,
12, 230, 120, 121, 157, 62, 255, 2, 66, 83, 185, 14, 132, 146, 124, 198, 128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 1, 128, 3, 0,
128, 21, 69, 87, 39, 80, 189, 63, 244, 210, 244, 71, 86, 224, 172, 98, 5, 171, 30, 40, 194,
211, 222, 117, 47, 81, 150, 51, 191, 236, 129, 237, 184, 128, 223, 91, 79, 3, 86, 79, 50, 130,
149, 40, 193, 33, 8, 158, 35, 82, 137, 134, 195, 10, 60, 248, 193, 39, 236, 182, 225, 143, 110,
206, 62, 80, 169, 1, 159, 12, 182, 243, 110, 2, 122, 187, 32, 145, 207, 181, 17, 10, 181, 8,
127, 137, 0, 104, 95, 6, 21, 91, 60, 217, 168, 201, 229, 233, 162, 63, 213, 220, 19, 165, 237,
32, 0, 0, 0, 0, 0, 0, 0, 0, 104, 95, 8, 49, 108, 191, 143, 160, 218, 130, 42, 32, 172, 28, 85,
191, 27, 227, 32, 0, 0, 0, 0, 0, 0, 0, 0, 128, 254, 108, 203, 37, 75, 132, 240, 210, 32, 46,
181, 5, 189, 223, 159, 84, 203, 158, 189, 15, 178, 113, 144, 114, 233, 46, 229, 124, 29, 161,
216, 9,
0, 55, 133, 53, 79, 12, 10, 168, 38, 54, 66, 50, 252, 54, 227, 253, 113, 215, 29, 209, 8, 221,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has changed because previously I used let account = ALICE; below, but that doesn't work because of an invalid signature error when running:

cargo test -p pallet-registrar --features=runtime-benchmarks

I didn't notice before because this command is not being run in CI

20, 197, 153, 62, 101, 188, 113, 113, 151, 107, 29, 114, 40, 177, 193, 51, 191, 107, 186, 141,
9, 224, 71, 191, 174, 137, 181, 55, 170, 28, 245, 103, 136, 244, 27, 22, 81, 153, 116, 217,
254, 14, 0, 0, 118, 30, 162, 34, 163, 78, 91, 130, 87, 18, 148, 219, 145, 6, 214, 15, 236, 131,
51, 167, 137, 239, 95, 207, 21, 167, 140, 167, 87, 106, 104, 155, 189, 123, 155, 7, 173, 16, 8,
252, 54, 108, 185, 113, 139, 218, 215, 254, 68, 37, 173, 30, 51, 245, 163, 205, 241, 202, 134,
131, 97, 41, 182, 15, 144, 103, 146, 229, 52, 207, 5, 82, 255, 36, 219, 55, 41, 38, 112, 208,
127, 150, 239, 131, 227, 6, 154, 95, 28, 205, 66, 32, 209, 89, 69, 228, 28, 176, 0, 0, 32, 0,
0, 0, 16, 0, 8, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 47, 140, 97, 41, 216, 22, 207, 81, 195, 116, 188, 127, 8, 195,
230, 62, 209, 86, 207, 120, 174, 251, 74, 101, 80, 217, 123, 135, 153, 121, 119, 238, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 63, 32, 6, 222, 61, 138, 84, 210, 126, 68, 169,
213, 206, 24, 150, 24, 242, 45, 180, 180, 157, 149, 50, 13, 144, 33, 153, 76, 133, 15, 37, 184,
227, 133, 236, 219, 232, 203, 100, 143, 101, 214, 239, 232, 53, 250, 27, 50, 253, 149, 140, 97,
244, 92, 63, 91, 253, 137, 187, 12, 221, 174, 199, 161, 103, 210, 57, 1, 63, 56, 15, 186, 152,
104, 158, 190, 209, 19, 135, 53, 224, 231, 165, 167, 144, 171, 205, 113, 11, 48, 189, 46, 171,
3, 82, 221, 204, 38, 65, 122, 161, 148, 180, 222, 242, 92, 253, 166, 239, 58, 0, 0, 0, 0, 69,
171, 129, 240, 74, 150, 152, 45, 218, 197, 226, 11, 83, 38, 121, 204, 15, 12, 197, 115, 153,
57, 69, 212, 166, 142, 68, 212, 239, 160, 6, 119, 200, 95, 12, 230, 120, 121, 157, 62, 255, 2,
66, 83, 185, 14, 132, 146, 124, 198, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 153, 1, 128, 11, 0, 128, 21, 69, 87, 39, 80, 189, 63,
244, 210, 244, 71, 86, 224, 172, 98, 5, 171, 30, 40, 194, 211, 222, 117, 47, 81, 150, 51, 191,
236, 129, 237, 184, 128, 223, 91, 79, 3, 86, 79, 50, 130, 149, 40, 193, 33, 8, 158, 35, 82,
137, 134, 195, 10, 60, 248, 193, 39, 236, 182, 225, 143, 110, 206, 62, 80, 128, 77, 174, 114,
63, 107, 0, 39, 241, 147, 41, 150, 41, 130, 189, 148, 216, 5, 24, 47, 167, 29, 117, 8, 120,
210, 51, 35, 145, 27, 94, 189, 250, 169, 1, 159, 12, 182, 243, 110, 2, 122, 187, 32, 145, 207,
181, 17, 10, 181, 8, 127, 137, 0, 104, 95, 6, 21, 91, 60, 217, 168, 201, 229, 233, 162, 63,
213, 220, 19, 165, 237, 32, 0, 0, 0, 0, 0, 0, 0, 0, 104, 95, 8, 49, 108, 191, 143, 160, 218,
130, 42, 32, 172, 28, 85, 191, 27, 227, 32, 0, 0, 0, 0, 0, 0, 0, 0, 128, 254, 108, 203, 37, 75,
132, 240, 210, 32, 46, 181, 5, 189, 223, 159, 84, 203, 158, 189, 15, 178, 113, 144, 114, 233,
46, 229, 124, 29, 161, 216, 9, 190, 247, 74, 173, 54, 61, 117, 185, 65, 198, 150, 80, 9, 116,
166, 1, 185, 33, 23, 38, 14, 102, 24, 248, 23, 224, 15, 137, 66, 208, 101, 122, 20, 176, 0, 0,
32, 0, 0, 0, 16, 0, 8, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 5, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, 6,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 63, 32, 6, 222, 61, 138, 84, 210, 126, 68, 169, 213,
206, 24, 150, 24, 242, 45, 180, 180, 157, 149, 50, 13, 144, 33, 153, 76, 133, 15, 37, 184, 227,
133, 236, 219, 232, 203, 100, 143, 101, 214, 239, 232, 53, 250, 27, 50, 253, 149, 140, 97, 244,
92, 63, 91, 253, 137, 187, 12, 221, 174, 199, 161, 103, 210, 200, 95, 12, 230, 120, 121, 157,
62, 255, 2, 66, 83, 185, 14, 132, 146, 124, 198, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 1, 128, 3, 0, 128, 21, 69, 87, 39,
80, 189, 63, 244, 210, 244, 71, 86, 224, 172, 98, 5, 171, 30, 40, 194, 211, 222, 117, 47, 81,
150, 51, 191, 236, 129, 237, 184, 128, 223, 91, 79, 3, 86, 79, 50, 130, 149, 40, 193, 33, 8,
158, 35, 82, 137, 134, 195, 10, 60, 248, 193, 39, 236, 182, 225, 143, 110, 206, 62, 80, 169, 1,
159, 12, 182, 243, 110, 2, 122, 187, 32, 145, 207, 181, 17, 10, 181, 8, 127, 137, 0, 104, 95,
6, 21, 91, 60, 217, 168, 201, 229, 233, 162, 63, 213, 220, 19, 165, 237, 32, 0, 0, 0, 0, 0, 0,
0, 0, 104, 95, 8, 49, 108, 191, 143, 160, 218, 130, 42, 32, 172, 28, 85, 191, 27, 227, 32, 0,
0, 0, 0, 0, 0, 0, 0, 128, 254, 108, 203, 37, 75, 132, 240, 210, 32, 46, 181, 5, 189, 223, 159,
84, 203, 158, 189, 15, 178, 113, 144, 114, 233, 46, 229, 124, 29, 161, 216, 9,
];

pub fn benchmark_blob() -> BenchmarkBlob {
Expand All @@ -93,7 +92,7 @@ mod tests {
use {
super::*,
crate::{
mock::{get_ed25519_pairs, new_test_ext, run_to_block, ParaRegistrar, ALICE},
mock::{get_ed25519_pairs, new_test_ext, run_to_block, ParaRegistrar},
ParaInfo, REGISTRAR_PARAS_INDEX,
},
cumulus_test_relay_sproof_builder::RelayStateSproofBuilder,
Expand Down Expand Up @@ -125,15 +124,9 @@ mod tests {
sproof.additional_key_values = vec![(key, para_info.encode())];
let (relay_parent_storage_root, proof) = sproof.into_state_root_and_proof();

let account = ALICE;
let relay_storage_root = relay_parent_storage_root;
let signature_msg =
ParaRegistrar::relay_signature_msg(para_id, &account, relay_storage_root);
let signature_account_u64: cumulus_primitives_core::relay_chain::Signature =
pairs[0].sign(&signature_msg).into();

// Account generated by
// Accounts generated by
// create_funded_user::<T>("caller", 0, T::DepositAmount::get());
// AccountId32 is used when benchmarking the runtime, u64 account is used in benchmark tests
let account32 = AccountId32::decode(
&mut [
92u8, 119, 3, 63, 206, 138, 144, 69, 130, 74, 102, 144, 187, 249, 156, 109,
Expand All @@ -142,6 +135,14 @@ mod tests {
.as_slice(),
)
.unwrap();
let account_u64 =
u64::decode(&mut [92, 119, 3, 63, 206, 138, 144, 69].as_slice()).unwrap();
let relay_storage_root = relay_parent_storage_root;
let signature_msg =
ParaRegistrar::relay_signature_msg(para_id, &account_u64, relay_storage_root);
let signature_account_u64: cumulus_primitives_core::relay_chain::Signature =
pairs[0].sign(&signature_msg).into();

let signature_msg = (para_id, &account32, relay_storage_root).encode();
let signature_account_32_bytes: cumulus_primitives_core::relay_chain::Signature =
pairs[0].sign(&signature_msg).into();
Expand Down
Loading
Loading