-
Notifications
You must be signed in to change notification settings - Fork 298
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
Limit Call size to 200 bytes #598
Limit Call size to 200 bytes #598
Conversation
Codecov Report
@@ Coverage Diff @@
## master #598 +/- ##
==========================================
+ Coverage 75.54% 75.58% +0.04%
==========================================
Files 76 76
Lines 5945 5955 +10
==========================================
+ Hits 4491 4501 +10
Misses 1454 1454
Continue to review full report at Codecov.
|
|
||
#[test] | ||
fn call_size_limit() { | ||
assert!( | ||
core::mem::size_of::<authority::Call::<Runtime>>() <= 200, | ||
"size of Call is more than 200 bytes: some calls have too big arguments, use Box to \ | ||
reduce the size of Call. | ||
If the limit is too strong, maybe consider increasing the limit", | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests passes, yet in karura runtime the Call size for orml_authority
is printed as 608 bytes, this test when printed says call size of 56 bytes. That doesn't really make sense to me
Edit: Nvm, I think I figured it out it probably is because karura sets something different in the runtime than the mock 👍
I could add a integration test that checks every pallet, although there will be a test in Karura/mandala that would catch any large Calls. It seems that the XCM stuff has some enums that allocate (relatively) a lot memory as arguments for the extrinsics so I left tests checking those pallets |
initial_origin: T::PalletsOrigin, | ||
initial_origin: Box<T::PalletsOrigin>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So boxing T::PalletsOrigin
decreases the call size for Authority
from 608 bytes to 24 bytes in karura. Not entirely sure why but numbers don't lie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Yeah it would be helpful to add integration tests. If there're generic typed params in dispatchable calls, call size would likely to be different between mocks and prod runtimes. |
The idea of this PR is to limit call length to 200 bytes for all orml pallets. It mirrors paritytech/substrate#9418
Companion to AcalaNetwork/Acala#1386