Closed gianfra-t closed 9 months ago
@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 AllowUnpaidExecutionFrom<Everything>
. Do you think this could break any integration we have right now? For example, with moonbase alpha.
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?
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 Barrier
, Trader
and AssetTransactor
. This PR gets all these configurations on the same page and I can't think of any reserved transfer scenario that would be different in Foucoco than in the other runtimes.
Closes #393.
This PR will replace our previous implementation of the
RelativeValue
and calculation of the xcm fee by means ofWeightToFee
.We will now use the parameter stored in the custom metadata
fee_per_second
in order to obtain the fee, by replacing altogether the previously implemented traderTakeFirstAssetTrader
forAssetRegistryTrader
. See the definition for the former and the latter.Now, the fee is calculated as is defined in
FixedRateAssetRegistryTrader
here, where:fee = weight/WEIGHT_REF_TIME_PER_SECOND * fee_per_second
Another important difference is that
AssetRegistryTrader
will attempt to buy from all of the assets exchanged until one is able to do so, whileTakeFirstAsset
trader 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
FixedConversionRateProvider
type thatFixedRateAssetRegistryTrader
requires will just attempt to get thefee_per_second
from the metadata.Finally, we now require to declare the metadata in our mock chains for integration tests, particularly the
fee_per_second
value, 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.