Skip to content

Conversation

@apopiak
Copy link
Contributor

@apopiak apopiak commented May 3, 2022

Description

The weight trader uses pallet-transaction-multi-payment to determine whether the payment asset has a local price (and can be used for fee payment).
It then uses WeightToFee in combination with that price to calculate the fee to charge for the weight.
The trader tracks assets used for payment and uses them naively (i.e. one by one) to refund weight.

Related

closes #373

based on galacticcouncil/warehouse#48

Motivation and Context

Basilisk currently does not charge for XCM execution which makes it open for exploitation.

How Has This Been Tested?

Checklist:

  • I have updated the documentation if necessary.
  • I have added tests to cover my changes, regression test if fixing an issue.
  • This is a breaking change.

@github-actions
Copy link

github-actions bot commented May 3, 2022

Crate versions that have been updated:

  • runtime-integration-tests: v0.3.1 -> v0.3.2
  • basilisk-runtime: v53.0.0 -> v54.0.0
  • testing-basilisk-runtime: v53.0.0 -> v54.0.0

Runtime version has been increased.

@apopiak
Copy link
Contributor Author

apopiak commented May 6, 2022

Todos / Open issues

  • This should be in the warehouse so it can be used by the HydraDx runtime.
    • move PriceOracle trait
    • move MultiCurrencyTrader
  • Should this be using the regular WeightToFee from the runtime or something that makes for cheaper execution (@lumir-mrkva 's suggestion)?
  • bump spec_version

@apopiak
Copy link
Contributor Author

apopiak commented Jun 13, 2022

Should this be using the regular WeightToFee from the runtime or something that makes for cheaper execution (@lumir-mrkva 's suggestion)?

It will use regular WeightToFee for now. We can optimize fees later if it's necessary.

@apopiak apopiak marked this pull request as ready for review June 13, 2022 13:52
@apopiak apopiak changed the title feat: XCM Weight Trader feat!: XCM Weight Trader Jun 14, 2022
@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

Merging #443 (7eac58a) into master (e4491ab) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #443   +/-   ##
=======================================
  Coverage   83.44%   83.44%           
=======================================
  Files          24       24           
  Lines        2935     2935           
=======================================
  Hits         2449     2449           
  Misses        486      486           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e4491ab...7eac58a. Read the comment docs.

@mrq1911
Copy link
Member

mrq1911 commented Jun 14, 2022

Task linked: CU-2kpe1ch Implement Weight Trader

@apopiak
Copy link
Contributor Author

apopiak commented Jun 14, 2022

requires #493 (and includes its changes)

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.

XCM: Implement Weight Trader

4 participants