Skip to content

Commit

Permalink
companion: for call usage paritytech/substrate#9418 (#3522)
Browse files Browse the repository at this point in the history
* add test for call size

* fix box arg

* fix xcm variant length + increase limit a bit

* fix para sudo wrapper call length

* reorganize

* fmt

* fix tests

* update Substrate

Co-authored-by: parity-processbot <>
  • Loading branch information
gui1117 authored Aug 7, 2021
1 parent 555c08c commit 140d1cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions relay/kusama/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,13 @@ fn era_payout_should_give_sensible_results() {
assert_eq!(era_payout(75, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (10, 0));
assert_eq!(era_payout(80, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (6, 4));
}

#[test]
fn call_size() {
assert!(
core::mem::size_of::<Call>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to reduce \
the size of Call.
If the limit is too strong, maybe consider increase the limit to 300.",
);
}
15 changes: 15 additions & 0 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1683,3 +1683,18 @@ mod test_fees {
assert!(active > target_voters, "we need to reevaluate the weight of the election system");
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn call_size() {
assert!(
core::mem::size_of::<Call>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to \
reduce the size of Call.
If the limit is too strong, maybe consider increase the limit",
);
}
}

0 comments on commit 140d1cb

Please sign in to comment.