Skip to content
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

Disable system calls from xcm & Refactoring emulated tests #1115

Merged
merged 36 commits into from
Jan 29, 2024

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Jan 16, 2024

  • Disable the agent/channel operation from xcm(not in the scope of the next launch)
  • Refactoring emulated tests with inbound fixtures
  • More tests and checks

Requires: Snowfork/polkadot-sdk#108

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (ec4df8e) 49.74% compared to head (69d632a) 50.05%.
Report is 1 commits behind head on main.

❗ Current head 69d632a differs from pull request most recent head 77b79b7. Consider uploading reports for the commit 77b79b7 to get more accurate results

Files Patch % Lines
...xtures/src/register_token_with_insufficient_fee.rs 0.00% 3 Missing ⚠️
...inbound-queue/fixtures/src/send_token_to_penpal.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1115      +/-   ##
==========================================
+ Coverage   49.74%   50.05%   +0.31%     
==========================================
  Files          61       63       +2     
  Lines        3701     3736      +35     
  Branches       72       72              
==========================================
+ Hits         1841     1870      +29     
- Misses       1843     1849       +6     
  Partials       17       17              
Flag Coverage Δ
rust 46.43% <57.14%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yrong yrong marked this pull request as ready for review January 17, 2024 12:19
Copy link
Contributor

@alistair-singh alistair-singh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -360,6 +358,17 @@ pub mod pallet {
})?;
Ok(())
}

pub fn refund_relayer(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we have now have this pattern in the emulated tests where we call these three functions in order:

  • refund_relayer
  • do_convert
  • send_xcm

However this is problematic as internal implementation details are now leaking into the tests. It makes the tests more brittle, and less useful. The tests should treat submit as a black box.

I would rather refactor the submit extrinsic, so that it calls the following function, where verification is optional.

fn process_message(message: &Message, verify: bool) -> DispatchResult

And then the simulated tests can call process_message(msg, false)

Copy link
Contributor Author

@yrong yrong Jan 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice @claravanstaden is making InboundQueueFixture auto-generated in #1119, then I would prefer to reuse it for the emulated test here. So there is no need to add the process_message(msg, false) function and just test the original submit function with the verification included.

The problem is that InboundQueueTest is for benchmark only and we want to use it also in unit/emulated tests. We did make #1013 for that purpose though closed it for some other high-priority PRs.

So maybe it's time to reopen it. Meanwhile In #1119 we also take it into consideration when generating InboundQueueFixture.

@vgeddes @claravanstaden WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a comment here: #1119 I would also like to use https://github.com/Snowfork/snowbridge/tree/main/parachain/pallets/ethereum-client/tests/fixtures in the runtime tests. Maybe worthwhile to split test fixtures out to a new crate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, ok, this all makes sense - lets split the fixture out into a separate crate - something like pallets/inbound-queue/fixtures.

Copy link
Contributor Author

@yrong yrong Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #1125

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok now that we have the fixtures, its no longer necessary to have this refactor_relayer function. @yrong can you revert it?

Also helps reduce the amount of code which needs to be re-audited.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert in 4f9f56e

@yrong yrong mentioned this pull request Jan 21, 2024
9 tasks
@yrong yrong marked this pull request as draft January 22, 2024 04:54
@yrong yrong changed the base branch from main to ron/refactoring-inbound-fixture January 25, 2024 01:15
@yrong yrong changed the title More integration tests Disable create agent/channel by xcm & more integration tests Jan 25, 2024
@yrong yrong changed the title Disable create agent/channel by xcm & more integration tests Disable system calls from xcm & more integration tests Jan 25, 2024
@yrong yrong requested a review from vgeddes January 25, 2024 09:10
@yrong yrong marked this pull request as ready for review January 25, 2024 09:10
Base automatically changed from ron/refactoring-inbound-fixture to main January 26, 2024 02:15
@yrong yrong changed the title Disable system calls from xcm & more integration tests Disable system calls from xcm & Refactoring emulated tests Jan 26, 2024
@yrong yrong merged commit 3c4fe56 into main Jan 29, 2024
2 checks passed
@yrong yrong deleted the ron/more-integration-tests branch January 29, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants