-
Notifications
You must be signed in to change notification settings - Fork 300
Limit Call size to 200 bytes #598
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
Changes from all commits
07d5b93
d388f59
819f313
6f5da03
36248a0
ca45617
f981733
4613a9a
1832f55
951cb9b
4e1d4ef
e555cd6
33bc599
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,7 +207,7 @@ fn fast_track_scheduled_dispatch_work() { | |
let pallets_origin = schedule_origin.caller().clone(); | ||
assert_ok!(Authority::fast_track_scheduled_dispatch( | ||
Origin::root(), | ||
pallets_origin, | ||
Box::new(pallets_origin), | ||
0, | ||
DispatchTime::At(4), | ||
)); | ||
|
@@ -234,7 +234,7 @@ fn fast_track_scheduled_dispatch_work() { | |
|
||
assert_ok!(Authority::fast_track_scheduled_dispatch( | ||
Origin::root(), | ||
frame_system::RawOrigin::Root.into(), | ||
Box::new(frame_system::RawOrigin::Root.into()), | ||
1, | ||
DispatchTime::At(4), | ||
)); | ||
|
@@ -284,7 +284,7 @@ fn delay_scheduled_dispatch_work() { | |
let pallets_origin = schedule_origin.caller().clone(); | ||
assert_ok!(Authority::delay_scheduled_dispatch( | ||
Origin::root(), | ||
pallets_origin, | ||
Box::new(pallets_origin), | ||
0, | ||
4, | ||
)); | ||
|
@@ -311,7 +311,7 @@ fn delay_scheduled_dispatch_work() { | |
|
||
assert_ok!(Authority::delay_scheduled_dispatch( | ||
Origin::root(), | ||
frame_system::RawOrigin::Root.into(), | ||
Box::new(frame_system::RawOrigin::Root.into()), | ||
1, | ||
4, | ||
)); | ||
|
@@ -358,7 +358,11 @@ fn cancel_scheduled_dispatch_work() { | |
}; | ||
|
||
let pallets_origin = schedule_origin.caller().clone(); | ||
assert_ok!(Authority::cancel_scheduled_dispatch(Origin::root(), pallets_origin, 0)); | ||
assert_ok!(Authority::cancel_scheduled_dispatch( | ||
Origin::root(), | ||
Box::new(pallets_origin), | ||
0 | ||
)); | ||
System::assert_last_event(mock::Event::Authority(Event::Cancelled( | ||
OriginCaller::Authority(DelayedOrigin { | ||
delay: 1, | ||
|
@@ -381,7 +385,7 @@ fn cancel_scheduled_dispatch_work() { | |
|
||
assert_ok!(Authority::cancel_scheduled_dispatch( | ||
Origin::root(), | ||
frame_system::RawOrigin::Root.into(), | ||
Box::new(frame_system::RawOrigin::Root.into()), | ||
1 | ||
)); | ||
System::assert_last_event(mock::Event::Authority(Event::Cancelled( | ||
|
@@ -390,3 +394,13 @@ fn cancel_scheduled_dispatch_work() { | |
))); | ||
}); | ||
} | ||
|
||
#[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", | ||
); | ||
Comment on lines
+397
to
+405
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This tests passes, yet in karura runtime the Call size for Edit: Nvm, I think I figured it out it probably is because karura sets something different in the runtime than the mock 👍 |
||
} |
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 forAuthority
from 608 bytes to 24 bytes in karura. Not entirely sure why but numbers don't lie