Skip to content

Commit

Permalink
runtimes: fix call_size() test (paritytech#1245)
Browse files Browse the repository at this point in the history
Signed-off-by: acatangiu <adrian@parity.io>
  • Loading branch information
acatangiu authored and serban300 committed Apr 8, 2024
1 parent ed84048 commit 440035f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,15 @@ mod tests {

#[test]
fn call_size() {
const BRIDGES_PALLETS_MAX_CALL_SIZE: usize = 200;
assert!(
core::mem::size_of::<pallet_bridge_grandpa::Call<Runtime>>() <=
BRIDGES_PALLETS_MAX_CALL_SIZE
);
assert!(
core::mem::size_of::<pallet_bridge_messages::Call<Runtime>>() <=
BRIDGES_PALLETS_MAX_CALL_SIZE
);
const MAX_CALL_SIZE: usize = 230; // value from polkadot-runtime tests
assert!(core::mem::size_of::<Call>() <= MAX_CALL_SIZE);
}
Expand Down
19 changes: 14 additions & 5 deletions bridges/bin/rialto/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,10 +1229,19 @@ mod tests {

#[test]
fn call_size() {
const DOT_MAX_CALL_SZ: usize = 230;
assert!(core::mem::size_of::<pallet_bridge_grandpa::Call<Runtime>>() <= DOT_MAX_CALL_SZ);
// FIXME: get this down to 230. https://github.com/paritytech/grandpa-bridge-gadget/issues/359
const BEEFY_MAX_CALL_SZ: usize = 232;
assert!(core::mem::size_of::<pallet_bridge_messages::Call<Runtime>>() <= BEEFY_MAX_CALL_SZ);
const BRIDGES_PALLETS_MAX_CALL_SIZE: usize = 200;
assert!(
core::mem::size_of::<pallet_bridge_grandpa::Call<Runtime>>() <=
BRIDGES_PALLETS_MAX_CALL_SIZE
);
assert!(
core::mem::size_of::<pallet_bridge_messages::Call<Runtime>>() <=
BRIDGES_PALLETS_MAX_CALL_SIZE
);
// Largest inner Call is `pallet_session::Call` with a size of 224 bytes. This size is a
// result of large `SessionKeys` struct.
// Total size of Rialto runtime Call is 232.
const MAX_CALL_SIZE: usize = 232;
assert!(core::mem::size_of::<Call>() <= MAX_CALL_SIZE);
}
}

0 comments on commit 440035f

Please sign in to comment.