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

Update inbound queue benchmarks. #902

Merged
merged 6 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
24 changes: 12 additions & 12 deletions parachain/pallets/inbound-queue/src/benchmarking/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ pub struct InboundQueueTest {
pub fn make_create_message() -> InboundQueueTest {
InboundQueueTest{
execution_header: CompactExecutionHeader{
parent_hash: hex!("04a7f6ab8282203562c62f38b0ab41d32aaebe2c7ea687702b463148a6429e04").into(),
block_number: 55,
state_root: hex!("894d968712976d613519f973a317cb0781c7b039c89f27ea2b7ca193f7befdb3").into(),
receipts_root: hex!("cf0d1c1ba57d1e0edfb59786c7e30c2b7e12bd54612b00cd21c4eaeecedf44fb").into(),
parent_hash: hex!("de4afc4d33a83815cde0a6dd95c8e52d9e01231d67d5b5a387ec70994a96108f").into(),
block_number: 61,
state_root: hex!("7bfc6d7a49869863d621989dad7fa26c610470e65473a7e5cab87af67fc6976c").into(),
receipts_root: hex!("a2686fe1aa2f66ada774373ced7952f3591a7830b9161eec5d16149747253779").into(),
},
message: Message {
data: hex!("f9011c94ee9170abfbf9421ad6dd07f6bdec9d89f2b581e0f863a01b11dcf133cc240f682dab2d3a8e4cd35c5da8c9cf99adac4336f8512584c5ada000000000000000000000000000000000000000000000000000000000000003e8a00000000000000000000000000000000000000000000000000000000000000001b8a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004b000f000000000000000100d184c103f7acc340847eee82a0b909e3358bc28d440edffa1352b13227e8ee646f3ea37456dec701345772617070656420457468657210574554481235003511000000000000000000000000000000000000000000").to_vec(),
data: hex!("f8fb94eda338e4dc46038493b885327842fd3e301cab39f842a0d56f1b8dfd3ba41f19c499ceec5f9546f61befa5f10398a75d7dba53a219fecea000000000000000000000000000000000000000000000000000000000000003e8b8a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000034000f000000000000000057a2d4ff0c3866d96556884bf09fecdd7ccd530c87d1f7fdfee7f651fabc8bfcb6e086c278b77a7d3500000000000000000000000000").to_vec(),
proof: Proof {
block_hash: hex!("05aaa60b0f27cce9e71909508527264b77ee14da7b5bf915fcc4e32715333213").into(),
block_hash: hex!("565f5dc872af9351abd1ba4974753169a98f028ef2c2ef3bb6d4eea4c6519eac").into(),
tx_index: 0,
data: (vec![
hex!("cf0d1c1ba57d1e0edfb59786c7e30c2b7e12bd54612b00cd21c4eaeecedf44fb").to_vec(),
hex!("d21fc4f68ab05bc4dcb23c67008e92c4d466437cdd6ed7aad0c008944c185510").to_vec(),
hex!("b9890f91ca0d77aa2a4adfaf9b9e40c94cac9e638b6d9797923865872944b646").to_vec(),
hex!("a2686fe1aa2f66ada774373ced7952f3591a7830b9161eec5d16149747253779").to_vec(),
hex!("77cc88c126ea5be62d3caea280da54cd051a05dadc03e4ecf69621da86ff9e12").to_vec(),
hex!("61ced6f6c7533351a0e60916ee60bbe4f7c49efae74bb898d06b1ae975b38c51").to_vec(),
], vec![
hex!("f90131a0b601337b3aa10a671caa724eba641e759399979856141d3aea6b6b4ac59b889ba00c7d5dd48be9060221a02fb8fa213860b4c50d47046c8fa65ffaba5737d569e0a094601b62a1086cd9c9cb71a7ebff9e718f3217fd6e837efe4246733c0a196f63a06a4b0dd0aefc37b3c77828c8f07d1b7a2455ceb5dbfd3c77d7d6aeeddc2f7e8ca0d6e8e23142cdd8ec219e1f5d8b56aa18e456702b195deeaa210327284d42ade4a08a313d4c87023005d1ab631bbfe3f5de1e405d0e66d0bef3e033f1e5711b5521a0bf09a5d9a48b10ade82b8d6a5362a15921c8b5228a3487479b467db97411d82fa0f95cccae2a7c572ef3c566503e30bac2b2feb2d2f26eebf6d870dcf7f8cf59cea0d21fc4f68ab05bc4dcb23c67008e92c4d466437cdd6ed7aad0c008944c1855108080808080808080").to_vec(),
hex!("f851a0b9890f91ca0d77aa2a4adfaf9b9e40c94cac9e638b6d9797923865872944b646a060a634b9280e3a23fb63375e7bbdd9ab07fd379ab6a67e2312bbc112195fa358808080808080808080808080808080").to_vec(),
hex!("f9030820b9030402f90300018301d6e2b9010000000000000800000000000020040008000000000000000000000000400000008000000000000000000000000000000000000000000000000000000000042010000000001000000000000000000000000000000000040000000000000000000000000000000000000000000000008000000000000000002000000000000000000000000200000000000000200000000000100000000040000001000200008000000000000200000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000f901f5f87a942ffa5ecdbe006d30397c7636d3e015eee251369ff842a0c965575a00553e094ca7c5d14f02e107c258dda06867cbf9e0e69f80e71bbcc1a000000000000000000000000000000000000000000000000000000000000003e8a000000000000000000000000000000000000000000000000000000000000003e8f9011c94ee9170abfbf9421ad6dd07f6bdec9d89f2b581e0f863a01b11dcf133cc240f682dab2d3a8e4cd35c5da8c9cf99adac4336f8512584c5ada000000000000000000000000000000000000000000000000000000000000003e8a00000000000000000000000000000000000000000000000000000000000000001b8a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004b000f000000000000000100d184c103f7acc340847eee82a0b909e3358bc28d440edffa1352b13227e8ee646f3ea37456dec701345772617070656420457468657210574554481235003511000000000000000000000000000000000000000000f858948cf6147918a5cbb672703f879f385036f8793a24e1a01449abf21e49fd025f33495e77f7b1461caefdd3d4bb646424a3f445c4576a5ba0000000000000000000000000440edffa1352b13227e8ee646f3ea37456dec701").to_vec(),
hex!("f90131a0697ffa69627df903e12004769f4a763d81cc2d947fa75e47996112144c7d07d1a0a755881c8727579c18865b63c20117773ddb5579acdb3ed493557bb6aa5a1117a0ba0c4975a96270e63526f20073d129931e4b1dfc4dbd477a92c7d587afaad6a1a0e2c388369c489466c7c03d0a9f3cb294c8fc659015a395f7dc7b1b28eaf18ef4a027fcb43431cd39b449624b39ceb0017fce919e14e2ca77c28f8ab981b01aa637a05f3c3aac495f2fbc982da582c8e62ac05adb1e0552a1b9e81be96028094cbcc4a0a3f115af7400065f142ec8edea4f2000a4bcf6394869df85ecb9d27d75e344daa0b5f12f70fc3e4078273e59aba72683905d11e1c4b1a68858a6e53d3c50f65b93a077cc88c126ea5be62d3caea280da54cd051a05dadc03e4ecf69621da86ff9e128080808080808080").to_vec(),
hex!("f851a061ced6f6c7533351a0e60916ee60bbe4f7c49efae74bb898d06b1ae975b38c51a0f0baa5ff24cde5e3bcc6e5394b30e10e97cca31d002d68769883293d0ebbd569808080808080808080808080808080").to_vec(),
hex!("f9026a20b9026602f902620183013defb9010000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000400000000000000000000000000000000000000000000000000000000000000000000000020200000000000000000000000000000000000040000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010000000000000000000000000014f90157f85894eda338e4dc46038493b885327842fd3e301cab39e1a0f78bb28d4b1d7da699e5c0bc2be29c2b04b5aab6aacf6298fe5304f9db9c6d7ea000000000000000000000000087d1f7fdfee7f651fabc8bfcb6e086c278b77a7df8fb94eda338e4dc46038493b885327842fd3e301cab39f842a0d56f1b8dfd3ba41f19c499ceec5f9546f61befa5f10398a75d7dba53a219fecea000000000000000000000000000000000000000000000000000000000000003e8b8a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000034000f000000000000000057a2d4ff0c3866d96556884bf09fecdd7ccd530c87d1f7fdfee7f651fabc8bfcb6e086c278b77a7d3500000000000000000000000000").to_vec(),
]),
},
},
Expand Down
22 changes: 19 additions & 3 deletions parachain/pallets/inbound-queue/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ mod benchmarks {
use super::*;
use crate::benchmarking::fixtures::make_create_message;
use hex_literal::hex;
use sp_runtime::print;

const GATEWAY_ADDRESS: [u8; 20] = hex!["ee9170abfbf9421ad6dd07f6bdec9d89f2b581e0"];
const GATEWAY_ADDRESS: [u8; 20] = hex!["eda338e4dc46038493b885327842fd3e301cab39"];

#[benchmark]
fn submit() -> Result<(), BenchmarkError> {
Expand All @@ -32,11 +33,26 @@ mod benchmarks {
let dest_para: ParaId = 1000u32.into();
let sovereign_account = dest_para.into_account_truncating();

let minimum_balance = T::Token::minimum_balance();
let minimum_balance_u32: u32 = minimum_balance.try_into()
.unwrap_or_else(|_| panic!("unable to cast minimum balance to u32"));

// Make sure the sovereign balance is enough. This is a funny number, because
// in some cases the minimum balance is really high, in other cases very low.
// e.g. on bridgehub the minium balance is 33333, on test it is 1. So this equation makes
// it is at least twice the minimum balance (so as to satisfy the minimum balance
// requirement, and then some (in case the minimum balance is very low, even lower
// than the relayer reward fee).
let sovereign_balance = (minimum_balance_u32 * 2) + 5000;

// So that the receiving account exists
let _ = T::Token::mint_into(&caller, T::Token::minimum_balance().into());
let _ = T::Token::mint_into(&caller, minimum_balance.into());
// Fund the sovereign account (parachain sovereign account) so it can transfer a reward
// fee to the caller account
let _ = T::Token::mint_into(&sovereign_account, 10000u32.into());
let _ = T::Token::mint_into(&sovereign_account, sovereign_balance.into());

println!("Balance sovereign acc: {:?}", T::Token::total_balance(&sovereign_account));
println!("Balance caller: {:?}", T::Token::total_balance(&caller));

#[block]
{
Expand Down
Loading