-
Notifications
You must be signed in to change notification settings - Fork 771
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
Ensure outbound XCMs are decodable with limits + add EnsureDecodableXcm
router (for testing purposes)
#4186
Changes from 5 commits
9331a6c
5f53e19
feaf731
5080212
f7e94f4
fd213ca
d08c440
198bef1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,8 @@ pub trait Config: frame_system::Config { | |
fn valid_destination() -> Result<Location, BenchmarkError>; | ||
|
||
/// Worst case scenario for a holding account in this runtime. | ||
/// - `depositable_count` specifies the count of assets we plan to add to the holding on top of | ||
/// those generated by the `worst_case_holding` implementation. | ||
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. 😄 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. @franciscoaguirre :), any other suggestion? |
||
fn worst_case_holding(depositable_count: u32) -> Assets; | ||
} | ||
|
||
|
@@ -64,19 +66,22 @@ pub type AssetTransactorOf<T> = <<T as Config>::XcmConfig as XcmConfig>::AssetTr | |
/// The call type of executor's config. Should eventually resolve to the same overarching call type. | ||
pub type XcmCallOf<T> = <<T as Config>::XcmConfig as XcmConfig>::RuntimeCall; | ||
|
||
pub fn mock_worst_case_holding(depositable_count: u32, max_assets: u32) -> Assets { | ||
pub fn generate_holding_assets(max_assets: u32) -> Assets { | ||
let fungibles_amount: u128 = 100; | ||
let holding_fungibles = max_assets / 2 - depositable_count; | ||
let holding_non_fungibles = holding_fungibles; | ||
let holding_fungibles = max_assets / 2; | ||
let holding_non_fungibles = max_assets - holding_fungibles - 1; // -1 because of adding `Here` asset | ||
// add count of `holding_fungibles` | ||
(0..holding_fungibles) | ||
.map(|i| { | ||
Asset { | ||
id: AssetId(GeneralIndex(i as u128).into()), | ||
fun: Fungible(fungibles_amount * i as u128), | ||
fun: Fungible(fungibles_amount * (i + 1) as u128), // non-zero amount | ||
} | ||
.into() | ||
}) | ||
// add one more `Here` asset | ||
.chain(core::iter::once(Asset { id: AssetId(Here.into()), fun: Fungible(u128::MAX) })) | ||
// add count of `holding_non_fungibles` | ||
.chain((0..holding_non_fungibles).map(|i| Asset { | ||
id: AssetId(GeneralIndex(i as u128).into()), | ||
fun: NonFungible(asset_instance_from(i)), | ||
|
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.
Where do you add the possible required fee?
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.
right bellow -
required fees = expected_assets_in_holding
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.
there was just
executor.set_holding(expected_assets_in_holding
) before, which could possibly remove previouslyexecutor.set_holding(holding.clone()