Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
3f7f587e
Unverified
Commit
3f7f587e
authored
Jul 22, 2021
by
thiolliere
Committed by
GitHub
Jul 22, 2021
Browse files
Improve test in bridge (#3507)
* improve test * better doc
parent
cc746652
Pipeline
#148477
passed with stages
in 44 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bridges/modules/dispatch/src/lib.rs
View file @
3f7f587e
...
...
@@ -397,7 +397,7 @@ mod tests {
#![allow(clippy::from_over_into)]
use
super
::
*
;
use
frame_support
::{
parameter_types
,
weights
::
Weight
};
use
frame_support
::{
parameter_types
,
weights
::
Weight
,
dispatch
::
GetDispatchInfo
};
use
frame_system
::{
EventRecord
,
Phase
};
use
sp_core
::
H256
;
use
sp_runtime
::{
...
...
@@ -599,9 +599,11 @@ mod tests {
fn
should_fail_on_weight_mismatch
()
{
new_test_ext
()
.execute_with
(||
{
let
id
=
[
0
;
4
];
let
mut
message
=
prepare_root_message
(
Call
::
System
(
<
frame_system
::
Call
<
TestRuntime
>>
::
remark
(
vec!
[
1
,
2
,
3
])));
let
call
=
Call
::
System
(
<
frame_system
::
Call
<
TestRuntime
>>
::
remark
(
vec!
[
1
,
2
,
3
]));
let
call_weight
=
call
.get_dispatch_info
()
.weight
;
let
mut
message
=
prepare_root_message
(
call
);
message
.weight
=
7
;
assert!
(
call_weight
!=
7
,
"needed for test to actually trigger a weight mismatch"
);
System
::
set_block_number
(
1
);
let
result
=
Dispatch
::
dispatch
(
SOURCE_CHAIN_ID
,
TARGET_CHAIN_ID
,
id
,
Ok
(
message
),
|
_
,
_
|
unreachable!
());
...
...
@@ -615,7 +617,7 @@ mod tests {
event
:
Event
::
Dispatch
(
call_dispatch
::
Event
::
<
TestRuntime
>
::
MessageWeightMismatch
(
SOURCE_CHAIN_ID
,
id
,
1038000
,
call_weight
,
7
,
)),
topics
:
vec!
[],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment