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

Lock down token transfer to AssetHub only #1047

Closed
wants to merge 7 commits into from

Conversation

alistair-singh
Copy link
Contributor

@alistair-singh alistair-singh commented Dec 11, 2023

Resolves: SNO-771
Polkadot-Sdk: Snowfork/polkadot-sdk#62

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

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

Comparison is base (3b3e9c2) 81.31% compared to head (b6fafe4) 81.34%.
Report is 1 commits behind head on main.

Files Patch % Lines
parachain/primitives/router/src/outbound/mod.rs 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1047      +/-   ##
==========================================
+ Coverage   81.31%   81.34%   +0.02%     
==========================================
  Files          54       54              
  Lines        2243     2246       +3     
  Branches       71       71              
==========================================
+ Hits         1824     1827       +3     
  Misses        402      402              
  Partials       17       17              
Flag Coverage Δ
rust 81.49% <88.88%> (+0.02%) ⬆️

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.

@@ -111,6 +130,12 @@ where
command: Command::AgentExecute { agent_id, command: agent_execute_command },
};

// filter out message
if !ExportFilter::contains(&local_sub, &outbound_message) {
Copy link
Contributor

@yrong yrong Dec 12, 2023

Choose a reason for hiding this comment

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

Notice that ExportFilter is declared as EverythingBut<NonAssetHubTokenTransfers> in runtime, so could it be simplified as NonAssetHubTokenTransfers and remove the not operation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was also a bit unsure on which way to go with this, so I looked at other "Filter" constraints in the Polkadot codebase to see what is the standard way, and it seems that if the filter returns true, the call should be allowed. This allows you to use the traits Everything to allow all, and Nothing to block all.

Examples:

Copy link
Contributor

@yrong yrong Dec 12, 2023

Choose a reason for hiding this comment

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

IMHO the filters above are more of a whitelist whereas we're blocking a blacklist item here? So will it make more sense to rename it as ExportInterceptor and make the simplification?

Copy link
Contributor

Choose a reason for hiding this comment

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

What does local_sub mean? Local subscription?

@alistair-singh alistair-singh marked this pull request as ready for review December 12, 2023 07:53
@@ -111,6 +130,12 @@ where
command: Command::AgentExecute { agent_id, command: agent_execute_command },
};

// filter out message
if !ExportFilter::contains(&local_sub, &outbound_message) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What does local_sub mean? Local subscription?

@alistair-singh alistair-singh force-pushed the alistair/lock-down-token-transfer branch from fa311d4 to 42499fe Compare December 16, 2023 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants