Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
7b7b8baa
Commit
7b7b8baa
authored
3 years ago
by
Svyatoslav Nikolsky
Committed by
Bastian Köcher
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
added no_stack_overflow_when_decoding_nested_call_during_dispatch test (#1349)
parent
f95456d4
Branches
gh-readonly-queue/master/pr-2981-b57e53dc139cc398318d42107e915e5883a77734
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bridges/bin/rialto/runtime/src/millau_messages.rs
+65
-0
65 additions, 0 deletions
bridges/bin/rialto/runtime/src/millau_messages.rs
with
65 additions
and
0 deletions
bridges/bin/rialto/runtime/src/millau_messages.rs
+
65
−
0
View file @
7b7b8baa
...
...
@@ -476,4 +476,69 @@ mod tests {
.0
,
);
}
#[test]
#[ignore]
fn
no_stack_overflow_when_decoding_nested_call_during_dispatch
()
{
// this test is normally ignored, because it only makes sense to run it in release mode
let
mut
ext
:
sp_io
::
TestExternalities
=
SystemConfig
::
default
()
.build_storage
::
<
Runtime
>
()
.unwrap
()
.into
();
ext
.execute_with
(||
{
let
bridge
=
MILLAU_CHAIN_ID
;
let
mut
call
:
Call
=
SystemCall
::
set_heap_pages
{
pages
:
64
}
.into
();
for
_i
in
0
..
3000
{
call
=
Call
::
Sudo
(
pallet_sudo
::
Call
::
sudo
{
call
:
Box
::
new
(
call
)
});
}
let
dispatch_weight
=
500
;
let
dispatch_fee
=
<
Runtime
as
pallet_transaction_payment
::
Config
>
::
WeightToFee
::
calc
(
&
dispatch_weight
,
);
assert!
(
dispatch_fee
>
0
);
// create relayer account with minimal balance
let
relayer_account
:
AccountId
=
[
1u8
;
32
]
.into
();
let
initial_amount
=
ExistentialDeposit
::
get
();
let
_
=
<
pallet_balances
::
Pallet
<
Runtime
>
as
Currency
<
AccountId
>>
::
deposit_creating
(
&
relayer_account
,
initial_amount
,
);
// create dispatch account with minimal balance + dispatch fee
let
dispatch_account
=
derive_account_id
::
<
<
Runtime
as
pallet_bridge_dispatch
::
Config
>
::
SourceChainAccountId
,
>
(
bridge
,
SourceAccount
::
Root
);
let
dispatch_account
=
<
Runtime
as
pallet_bridge_dispatch
::
Config
>
::
AccountIdConverter
::
convert
(
dispatch_account
,
);
let
_
=
<
pallet_balances
::
Pallet
<
Runtime
>
as
Currency
<
AccountId
>>
::
deposit_creating
(
&
dispatch_account
,
initial_amount
+
dispatch_fee
,
);
// dispatch message with intention to pay dispatch fee at the target chain
//
// this is where the stack overflow has happened before the fix has been applied
FromMillauMessageDispatch
::
dispatch
(
&
relayer_account
,
DispatchMessage
{
key
:
MessageKey
{
lane_id
:
Default
::
default
(),
nonce
:
0
},
data
:
DispatchMessageData
{
payload
:
Ok
(
FromBridgedChainMessagePayload
::
<
WithMillauMessageBridge
>
{
spec_version
:
VERSION
.spec_version
,
weight
:
dispatch_weight
,
origin
:
CallOrigin
::
SourceRoot
,
dispatch_fee_payment
:
DispatchFeePayment
::
AtTargetChain
,
call
:
FromBridgedChainEncodedMessageCall
::
new
(
call
.encode
()),
}),
fee
:
1
,
},
},
);
});
}
}
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment