Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

AllowTopLevelPaidExecutionFrom changed behavior #6770

Closed
girazoki opened this issue Feb 23, 2023 · 2 comments · Fixed by #6787
Closed

AllowTopLevelPaidExecutionFrom changed behavior #6770

girazoki opened this issue Feb 23, 2023 · 2 comments · Fixed by #6787
Labels
T6-XCM This PR/Issue is related to XCM.

Comments

@girazoki
Copy link
Contributor

AllowTopLevelPaidExecutionFrom changed behavior after xcmV3 merge. Before if the message contained a BuyExecution(Limited(bought_weight)) and bought_weight was greater than the weighed_weight weighed by the receiving chain, the weight inside BuyExecution was overriden:

match i {
	BuyExecution { weight_limit: Limited(ref mut weight), .. } if *weight >= max_weight => {
		*weight = max_weight;
		Ok(())
	},
	BuyExecution { ref mut weight_limit, .. } if weight_limit == &Unlimited => {
		*weight_limit = Limited(max_weight);
		Ok(())
	},
	_ => Err(()),
}

Now this is no longer the case. The same barrier now has the following check now:

match i {
	BuyExecution { weight_limit: Limited(ref mut weight), .. }
		if weight.all_gte(max_weight) =>
	{
		*weight = weight.max(max_weight);
		Ok(())
	},
	BuyExecution { ref mut weight_limit, .. } if weight_limit == &Unlimited => {
		*weight_limit = Limited(max_weight);
		Ok(())
	},
	_ => Err(()),
}

Which checks that the bought_weight is greater or equal than the weighed_weight. But if it is the case, the weight is overriden by the max of both. Which by definition of the check made before, it will always be bought_weight.

@bkchr
Copy link
Member

bkchr commented Feb 23, 2023

CC @KiChjang

@KiChjang KiChjang added the T6-XCM This PR/Issue is related to XCM. label Feb 25, 2023
@KiChjang
Copy link
Contributor

Ack, the check there used to be any_gte, but later got changed to all_gte instead. Will fix soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants