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

Commit

Permalink
Disable pallet_asset_tx_payment
Browse files Browse the repository at this point in the history
  • Loading branch information
MRamanenkau committed Oct 13, 2022
1 parent 5dd9424 commit 139f570
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 44 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ pub fn create_extrinsic(
)),
frame_system::CheckNonce::<node_runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<node_runtime::Runtime>::new(),
pallet_asset_tx_payment::ChargeAssetTxPayment::<node_runtime::Runtime>::from(tip, None),
);

let raw_payload = node_runtime::SignedPayload::from_raw(
Expand All @@ -105,7 +104,6 @@ pub fn create_extrinsic(
best_hash,
(),
(),
(),
),
);
let signature = raw_payload.using_encoded(|e| sender.sign(e));
Expand Down Expand Up @@ -725,20 +723,18 @@ 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 tx_payment = pallet_asset_tx_payment::ChargeAssetTxPayment::from(0, None);
let extra = (
check_spec_version,
check_tx_version,
check_genesis,
check_era,
check_nonce,
check_weight,
tx_payment,
);
let raw_payload = SignedPayload::from_raw(
function,
extra,
(spec_version, transaction_version, genesis_hash, genesis_hash, (), (), ()),
(spec_version, transaction_version, genesis_hash, genesis_hash, (), ()),
);
let signature = raw_payload.using_encoded(|payload| signer.sign(payload));
let (function, extra, _) = raw_payload.deconstruct();
Expand Down
8 changes: 3 additions & 5 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "node-runtime"
version = "3.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
edition = "2018"
build = "build.rs"
license = "Apache-2.0"
homepage = "https://substrate.io"
Expand All @@ -20,7 +20,7 @@ codec = { package = "parity-scale-codec", version = "2.2.0", default-features =
] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
static_assertions = "1.1.0"
hex-literal = { version = "0.3.4", optional = true }
hex-literal = { version = "0.3.3", optional = true }
log = { version = "0.4.14", default-features = false }

# primitives
Expand All @@ -41,7 +41,6 @@ sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path =
sp-version = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/version" }
sp-npos-elections = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/npos-elections" }
sp-io = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/io" }
sp-sandbox = { version = "0.10.0-dev", default-features = false, path = "../../../primitives/sandbox" }

# frame dependencies
frame-executive = { version = "4.0.0-dev", default-features = false, path = "../../../frame/executive" }
Expand Down Expand Up @@ -91,7 +90,6 @@ pallet-treasury = { version = "4.0.0-dev", default-features = false, path = "../
pallet-utility = { version = "4.0.0-dev", default-features = false, path = "../../../frame/utility" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" }
pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" }
pallet-asset-tx-payment = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment/asset-tx-payment/" }
pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-storage" }
pallet-uniques = { version = "4.0.0-dev", default-features = false, path = "../../../frame/uniques" }
pallet-vesting = { version = "4.0.0-dev", default-features = false, path = "../../../frame/vesting" }
Expand Down Expand Up @@ -176,7 +174,7 @@ std = [
"pallet-ddc-metrics-offchain-worker/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks",
Expand Down
14 changes: 1 addition & 13 deletions bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@

//! Some configurable implementations as associated type for the substrate runtime.

use crate::{AccountId, Assets, Authorship, Balances, NegativeImbalance, Runtime};
use crate::{AccountId, Authorship, Balances, NegativeImbalance, Runtime};
use frame_support::traits::{
fungibles::{Balanced, CreditOf},
Currency, OnUnbalanced,
};
use pallet_asset_tx_payment::HandleCredit;

pub struct Author;
impl OnUnbalanced<NegativeImbalance> for Author {
Expand All @@ -31,17 +30,6 @@ impl OnUnbalanced<NegativeImbalance> for Author {
}
}

/// A `HandleCredit` implementation that naively transfers the fees to the block author.
/// Will drop and burn the assets in case the transfer fails.
pub struct CreditToBlockAuthor;
impl HandleCredit<AccountId, Assets> for CreditToBlockAuthor {
fn handle_credit(credit: CreditOf<AccountId, Assets>) {
let author = pallet_authorship::Pallet::<Runtime>::author();
// Drop the result which will trigger the `OnDrop` of the imbalance in case of error.
let _ = Assets::resolve(&author, credit);
}
}

#[cfg(test)]
mod multiplier_tests {
use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
Expand Down
23 changes: 6 additions & 17 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub use sp_runtime::BuildStorage;

/// Implementations of some helper traits passed into runtime modules as associated types.
pub mod impls;
use impls::{Author, CreditToBlockAuthor};
use impls::{Author};

/// Constant values used within the runtime.
pub mod constants;
Expand Down Expand Up @@ -437,14 +437,6 @@ impl pallet_transaction_payment::Config for Runtime {
TargetedFeeAdjustment<Self, TargetBlockFullness, AdjustmentVariable, MinimumMultiplier>;
}

impl pallet_asset_tx_payment::Config for Runtime {
type Fungibles = Assets;
type OnChargeAssetTransaction = pallet_asset_tx_payment::FungiblesAdapter<
pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto>,
CreditToBlockAuthor,
>;
}

parameter_types! {
pub const MinimumPeriod: Moment = SLOT_DURATION / 2;
}
Expand Down Expand Up @@ -981,7 +973,6 @@ where
frame_system::CheckEra::<Runtime>::from(era),
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_asset_tx_payment::ChargeAssetTxPayment::<Runtime>::from(tip, None),
);
let raw_payload = SignedPayload::new(call, extra)
.map_err(|e| {
Expand Down Expand Up @@ -1220,7 +1211,6 @@ construct_runtime!(
Indices: pallet_indices,
Balances: pallet_balances,
TransactionPayment: pallet_transaction_payment,
AssetTxPayment: pallet_asset_tx_payment,
ElectionProviderMultiPhase: pallet_election_provider_multi_phase,
Staking: pallet_staking,
Session: pallet_session,
Expand Down Expand Up @@ -1248,11 +1238,11 @@ construct_runtime!(
Bounties: pallet_bounties,
Tips: pallet_tips,
BagsList: pallet_bags_list,
CereDDCModule: pallet_cere_ddc,
ChainBridge: pallet_chainbridge,
Erc721: pallet_erc721,
Erc20: pallet_erc20,
DdcMetricsOffchainWorker: pallet_ddc_metrics_offchain_worker,
CereDDCModule: pallet_cere_ddc::{Pallet, Call, Storage, Event<T>},
ChainBridge: pallet_chainbridge::{Pallet, Call, Storage, Event<T>},
Erc721: pallet_erc721::{Pallet, Call, Storage, Event<T>},
Erc20: pallet_erc20::{Pallet, Call, Storage, Event<T>},
DdcMetricsOffchainWorker: pallet_ddc_metrics_offchain_worker::{Pallet, Call, Storage, Event<T>},
}
);

Expand All @@ -1278,7 +1268,6 @@ pub type SignedExtra = (
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_asset_tx_payment::ChargeAssetTxPayment<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
Expand Down
1 change: 0 additions & 1 deletion bin/node/test-runner-example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ impl ChainInfo for NodeTemplateChainInfo {
frame_system::Pallet::<Self::Runtime>::account_nonce(from),
),
frame_system::CheckWeight::<Self::Runtime>::new(),
pallet_asset_tx_payment::ChargeAssetTxPayment::<Self::Runtime>::from(0, None),
)
}
}
Expand Down
1 change: 0 additions & 1 deletion bin/node/testing/src/keyring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ pub fn signed_extra(nonce: Index, extra_fee: Balance) -> SignedExtra {
frame_system::CheckEra::from(Era::mortal(256, 0)),
frame_system::CheckNonce::from(nonce),
frame_system::CheckWeight::new(),
pallet_asset_tx_payment::ChargeAssetTxPayment::from(extra_fee, None),
)
}

Expand Down

0 comments on commit 139f570

Please sign in to comment.