Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Avoid duplicate evm transact fees, actual_call_weight in dispatch pallet should be zero according to pays_fee: Pays::No #135

Closed
hackfisher opened this issue Jun 16, 2022 · 1 comment · Fixed by #136
Assignees
Labels

Comments

@hackfisher
Copy link
Contributor

Another issue is:

For evm tx, the fee is paid inside EVM executor, not in DispatchResultWithPostInfo of outside extrinsic. So if we dispatch to evm.transact it might pay twice, one still in EVM executor using gas_price and gas_limit, another one in pay_dispatch_fee in bridge-dispatch pallet, see #103

	fn apply_validated_transaction(
		source: H160,
		transaction: Transaction,
	) -> DispatchResultWithPostInfo {
		Self::raw_transact(source, transaction.into()).map(|(_, used_gas)| {
			Ok(PostDispatchInfo {
				actual_weight: Some(T::GasWeightMapping::gas_to_weight(
					used_gas.unique_saturated_into(),
				)),
				pays_fee: Pays::No,
			}
			.into())
		})?
	}

Originally posted by @hackfisher in #100 (comment)

@hackfisher
Copy link
Contributor Author

Solution:

Here, when extract_actual_weight(&result, &dispatch_info);, should not only take weight value, if the pays_fee in result is Pays::No, should return zero.

https://github.com/darwinia-network/darwinia-messages-substrate/blob/main/modules/dispatch/src/lib.rs#L338

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants