393 use fee per second from asset metadata in xcm config#410
Conversation
… to blocks, generate weights
…extends-our-current-treasury-pallet-with-buyout-feature
…g' of github.com:pendulum-chain/pendulum into 393-use-fee_per_second-from-asset-metadata-in-xcm-config
ebma
left a comment
There was a problem hiding this comment.
Looks good overall 👍 Few remarks:
- It might be more interesting not to use the same
fee_per_secondvalue for each asset in the test - We should also change the xcm config for Foucoco
- We might want to introduce a default value in case the
fee_per_secondis not available
|
@ebma thanks for pointing out about the xcm config of Foucoco. I didn't consider it. We should keep in mind that any XCM message was allowed before, given the configuration of the barrier |
|
Good question. I doubt that it messes with any of our Foucoco integrations (at the moment just Moonbase Alpha). Should be fine to change it like this. Or what do you think @bogdanS98? |
I think it's fine as long as we have the same XCM config for all runtimes with respect to |
|
That is great to hear @bogdanS98 @ebma. It is nice indeed to have all the same XCM configurations on the chains otherwise testing becomes very difficult. I think I will wait a bit this discussion and then, if you agree with the changes, we can merge. |
ebma
left a comment
There was a problem hiding this comment.
I think it's fine now 👍 not sure if other @pendulum-chain/devs want to review too
ebma
left a comment
There was a problem hiding this comment.
I just commented some minor things about the comments. I think we can improve it a little but it's not important.
Closes #393.
This PR will replace our previous implementation of the
RelativeValueand calculation of the xcm fee by means ofWeightToFee.We will now use the parameter stored in the custom metadata
fee_per_secondin order to obtain the fee, by replacing altogether the previously implemented traderTakeFirstAssetTraderforAssetRegistryTrader. See the definition for the former and the latter.Now, the fee is calculated as is defined in
FixedRateAssetRegistryTraderhere, where:fee = weight/WEIGHT_REF_TIME_PER_SECOND * fee_per_secondAnother important difference is that
AssetRegistryTraderwill attempt to buy from all of the assets exchanged until one is able to do so, whileTakeFirstAssettrader will only attempt the first.Also, if the asset by location is not found in the registry, the trader will error with
TooExpensive, this is why in the incorrect incoming asset test we now look for this error.The
FixedConversionRateProvidertype thatFixedRateAssetRegistryTraderrequires will just attempt to get thefee_per_secondfrom the metadata.Finally, we now require to declare the metadata in our mock chains for integration tests, particularly the
fee_per_secondvalue, so that the message is able to execute. For this, we only care that the correct multilocation of the incoming asset exists in the registry, with the correspondingfee_per_second. For simplicity, this value is the same for each asset.