Moving pallet-asset-tx-payment from cumulus to substrate (#10127)

* Moving `pallet-asset-tx-payment` from cumulus

* move pallet-asset-tx-payment into transaction payment directory

* cargo +nightly fmt

* Adding `pallet-asset-tx-payment` to node runtime
I had to change the Balance type to u128.
Also harmonised that pallet's version

* Updating cargo.lock after merge

* forgot this

* Adding tx-payment signature

* Missed one more

* `transaction-payment` replaced in`SignedExtension`
by `asset-tx-payment` and not added

* Fixing benches

* add test to verify that we don't charge on post-dispatch if we didn't on pre-dispatch

* add (failing) test for asset tx payment of unsigned extrinsics

* fix test by removing debug_assert

* cargo +nightly fmt

* typo in `Cargo.lock`

* Object defined twice in lock file

* cargo update

* remove todo

* Apply formatting suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Refactoring `post_dispatch` of `asset-tx-payment`
to reuse `post_dispatch` of `transaction-payment` if the fee asset is
native
Removing unneeded imports.

* Removing redundant `TODO`

* Reverting an accidental bump of `impl-serde`
 from `0.3.1` to `0.3.2`

* Revert unneeded changes to `cargo.lock`

* Update frame/transaction-payment/asset-tx-payment/src/payment.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fixing cargo fmt

Reverting changes which broke cargo fmt

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Georges
2021-11-19 09:29:12 +00:00
committed by GitHub
parent 69478639b3
commit 439af98e55
16 changed files with 1346 additions and 11 deletions
+1
View File
@@ -81,6 +81,7 @@ sc-sync-state-rpc = { version = "0.10.0-dev", path = "../../../client/sync-state
frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
frame-system-rpc-runtime-api = { version = "4.0.0-dev", path = "../../../frame/system/rpc/runtime-api" }
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
pallet-asset-tx-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment/asset-tx-payment/" }
pallet-im-online = { version = "4.0.0-dev", default-features = false, path = "../../../frame/im-online" }
# node-specific dependencies
+3 -3
View File
@@ -92,7 +92,7 @@ pub fn create_extrinsic(
)),
frame_system::CheckNonce::<node_runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<node_runtime::Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<node_runtime::Runtime>::from(tip),
pallet_asset_tx_payment::ChargeAssetTxPayment::<node_runtime::Runtime>::from(tip, None),
);
let raw_payload = node_runtime::SignedPayload::from_raw(
@@ -725,7 +725,7 @@ mod tests {
let check_era = frame_system::CheckEra::from(Era::Immortal);
let check_nonce = frame_system::CheckNonce::from(index);
let check_weight = frame_system::CheckWeight::new();
let payment = pallet_transaction_payment::ChargeTransactionPayment::from(0);
let tx_payment = pallet_asset_tx_payment::ChargeAssetTxPayment::from(0, None);
let extra = (
check_spec_version,
check_tx_version,
@@ -733,7 +733,7 @@ mod tests {
check_era,
check_nonce,
check_weight,
payment,
tx_payment,
);
let raw_payload = SignedPayload::from_raw(
function,