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

Add command to update registerTokenFee and sendTokenFee #991

Merged
merged 15 commits into from
Nov 9, 2023
Merged

Conversation

yrong
Copy link
Contributor

@yrong yrong commented Nov 3, 2023

Resolves: sno-738
Requires: Snowfork/polkadot-sdk#15

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

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

Comparison is base (3d5658b) 83.36% compared to head (9fe0175) 82.69%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #991      +/-   ##
==========================================
- Coverage   83.36%   82.69%   -0.67%     
==========================================
  Files          51       51              
  Lines        2044     2069      +25     
  Branches       71       72       +1     
==========================================
+ Hits         1704     1711       +7     
- Misses        325      343      +18     
  Partials       15       15              
Flag Coverage Δ
rust 83.09% <0.00%> (-0.79%) ⬇️

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

Files Coverage Δ
contracts/src/Gateway.sol 86.62% <77.77%> (-0.54%) ⬇️
parachain/pallets/control/src/weights.rs 0.00% <0.00%> (ø)
parachain/pallets/control/src/lib.rs 93.51% <0.00%> (-5.51%) ⬇️
parachain/primitives/core/src/outbound.rs 82.75% <0.00%> (-6.14%) ⬇️

☔ 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 November 3, 2023 12:13
Copy link
Collaborator

@vgeddes vgeddes left a comment

Choose a reason for hiding this comment

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

Looks good. Needs a few naming related changes, and then we should be ready to go.

contracts/src/Gateway.sol Outdated Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/primitives/core/src/outbound.rs Outdated Show resolved Hide resolved
parachain/primitives/core/src/outbound.rs Outdated Show resolved Hide resolved
contracts/src/Types.sol Outdated Show resolved Hide resolved
contracts/test/mocks/GatewayUpgradeMock.sol Outdated Show resolved Hide resolved
contracts/src/interfaces/IGateway.sol Outdated Show resolved Hide resolved
contracts/src/interfaces/IGateway.sol Outdated Show resolved Hide resolved

function testSetTokenFees() public {
GatewayMock(address(gateway)).setTokenTransferFeesPublic(
abi.encode(Gateway.SetTokenTransferFeesParams({register: 1, send: 1}))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The default fees are already (1, 1), so this test could pass even if the command failed somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the default are 1(ether) not 1(wei), anyway check fee before and after set and make sure change as expected.
0a2cb16

Comment on lines +444 to +445
register: u128,
send: u128,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets validate these to make sure they are non-zero, and if not, return an InvalidTokenFees error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 430 to 439
/// Sends a message to the Gateway contract to update fees
///
/// Privileged. Can only be called by root.
///
/// Fee required: No
///
/// - `origin`: Must be root
/// - `location`: Location used to resolve the agent
/// - `recipient`: Recipient of funds
/// - `amount`: Amount to transfer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Documentation needs to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@claravanstaden claravanstaden left a comment

Choose a reason for hiding this comment

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

A few minor comments. Looks great! 👍🏻

contracts/test/mocks/GatewayMock.sol Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
parachain/pallets/control/src/lib.rs Outdated Show resolved Hide resolved
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.

Looks good. We should add an integration test for this.

@yrong yrong merged commit 654f242 into main Nov 9, 2023
7 checks passed
@yrong yrong deleted the ron/sno-738 branch November 9, 2023 11:06
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