Files
pezkuwi-subxt/substrate/bin/node/cli/Cargo.toml
T
gupnik 60c77a2e9a Adds syntax for marking calls feeless (#1926)
Fixes https://github.com/paritytech/polkadot-sdk/issues/1725

This PR adds the following changes:
1. An attribute `pallet::feeless_if` that can be optionally attached to
a call like so:
```rust
#[pallet::feeless_if(|_origin: &OriginFor<T>, something: &u32| -> bool {
	*something == 0
})]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
     ....
}
```
The closure passed accepts references to arguments as specified in the
call fn. It returns a boolean that denotes the conditions required for
this call to be "feeless".

2. A signed extension `SkipCheckIfFeeless<T: SignedExtension>` that
wraps a transaction payment processor such as
`pallet_transaction_payment::ChargeTransactionPayment`. It checks for
all calls annotated with `pallet::feeless_if` to see if the conditions
are met. If so, the wrapped signed extension is not called, essentially
making the call feeless.

In order to use this, you can simply replace your existing signed
extension that manages transaction payment like so:
```diff
- pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
+ pallet_skip_feeless_payment::SkipCheckIfFeeless<
+	Runtime,
+	pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
+ >,
```

### Todo
- [x] Tests
- [x] Docs
- [x] Prdoc

---------

Co-authored-by: Nikhil Gupta <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
2023-11-13 19:14:41 +05:30

202 lines
8.2 KiB
TOML

[package]
name = "staging-node-cli"
version = "3.0.0-dev"
authors.workspace = true
description = "Generic Substrate node implementation in Rust."
build = "build.rs"
edition.workspace = true
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
default-run = "substrate-node"
homepage = "https://substrate.io"
repository.workspace = true
publish = false
[package.metadata.wasm-pack.profile.release]
# `wasm-opt` has some problems on linux, see
# https://github.com/rustwasm/wasm-pack/issues/781 etc.
wasm-opt = false
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[badges]
travis-ci = { repository = "paritytech/substrate" }
maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "paritytech/substrate" }
is-it-maintained-open-issues = { repository = "paritytech/substrate" }
# The same node binary as the `substrate` (defined in the workspace `Cargo.toml`) binary,
# but just exposed by this crate here.
[[bin]]
name = "substrate-node"
path = "bin/main.rs"
required-features = ["cli"]
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
# third-party dependencies
array-bytes = "6.1"
clap = { version = "4.4.6", features = ["derive"], optional = true }
codec = { package = "parity-scale-codec", version = "3.6.1" }
serde = { version = "1.0.188", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
futures = "0.3.21"
log = "0.4.17"
rand = "0.8"
# primitives
sp-authority-discovery = { path = "../../../primitives/authority-discovery" }
sp-consensus-babe = { path = "../../../primitives/consensus/babe" }
grandpa-primitives = { package = "sp-consensus-grandpa", path = "../../../primitives/consensus/grandpa" }
sp-api = { path = "../../../primitives/api" }
sp-core = { path = "../../../primitives/core" }
sp-runtime = { path = "../../../primitives/runtime" }
sp-timestamp = { path = "../../../primitives/timestamp" }
sp-inherents = { path = "../../../primitives/inherents" }
sp-keyring = { path = "../../../primitives/keyring" }
sp-keystore = { path = "../../../primitives/keystore" }
sp-consensus = { path = "../../../primitives/consensus/common" }
sp-transaction-storage-proof = { path = "../../../primitives/transaction-storage-proof" }
sp-io = { path = "../../../primitives/io" }
sp-mixnet = { path = "../../../primitives/mixnet" }
sp-statement-store = { path = "../../../primitives/statement-store" }
# client dependencies
sc-client-api = { path = "../../../client/api" }
sc-chain-spec = { path = "../../../client/chain-spec" }
sc-consensus = { path = "../../../client/consensus/common" }
sc-transaction-pool = { path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { path = "../../../client/transaction-pool/api" }
sc-statement-store = { path = "../../../client/statement-store" }
sc-network = { path = "../../../client/network" }
sc-network-common = { path = "../../../client/network/common" }
sc-network-sync = { path = "../../../client/network/sync" }
sc-network-statement = { path = "../../../client/network/statement" }
sc-consensus-slots = { path = "../../../client/consensus/slots" }
sc-consensus-babe = { path = "../../../client/consensus/babe" }
grandpa = { package = "sc-consensus-grandpa", path = "../../../client/consensus/grandpa" }
sc-rpc = { path = "../../../client/rpc" }
sc-basic-authorship = { path = "../../../client/basic-authorship" }
sc-service = { path = "../../../client/service", default-features = false}
sc-telemetry = { path = "../../../client/telemetry" }
sc-executor = { path = "../../../client/executor" }
sc-authority-discovery = { path = "../../../client/authority-discovery" }
sc-mixnet = { path = "../../../client/mixnet" }
sc-sync-state-rpc = { path = "../../../client/sync-state-rpc" }
sc-sysinfo = { path = "../../../client/sysinfo" }
sc-storage-monitor = { path = "../../../client/storage-monitor" }
sc-offchain = { path = "../../../client/offchain" }
# frame dependencies
frame-system = { path = "../../../frame/system" }
frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api" }
pallet-assets = { path = "../../../frame/assets" }
pallet-asset-conversion-tx-payment = { path = "../../../frame/transaction-payment/asset-conversion-tx-payment" }
pallet-asset-tx-payment = { path = "../../../frame/transaction-payment/asset-tx-payment" }
pallet-im-online = { path = "../../../frame/im-online", default-features = false}
pallet-skip-feeless-payment = { path = "../../../frame/transaction-payment/skip-feeless-payment", default-features = false}
# node-specific dependencies
kitchensink-runtime = { path = "../runtime" }
node-rpc = { path = "../rpc" }
node-primitives = { path = "../primitives" }
node-executor = { package = "staging-node-executor", path = "../executor" }
# CLI-specific dependencies
sc-cli = { path = "../../../client/cli", optional = true}
frame-benchmarking-cli = { path = "../../../utils/frame/benchmarking-cli", optional = true}
node-inspect = { package = "staging-node-inspect", path = "../inspect", optional = true}
try-runtime-cli = { path = "../../../utils/frame/try-runtime/cli", optional = true}
serde_json = "1.0.108"
[dev-dependencies]
sc-keystore = { path = "../../../client/keystore" }
sc-client-db = { path = "../../../client/db" }
sc-consensus = { path = "../../../client/consensus/common" }
sc-consensus-babe = { path = "../../../client/consensus/babe" }
sc-consensus-epochs = { path = "../../../client/consensus/epochs" }
sc-service-test = { path = "../../../client/service/test" }
sc-block-builder = { path = "../../../client/block-builder" }
sp-tracing = { path = "../../../primitives/tracing" }
sp-blockchain = { path = "../../../primitives/blockchain" }
futures = "0.3.21"
tempfile = "3.1.0"
assert_cmd = "2.0.2"
nix = { version = "0.26.1", features = ["signal"] }
regex = "1.6.0"
platforms = "3.0"
soketto = "0.7.1"
criterion = { version = "0.4.0", features = ["async_tokio"] }
tokio = { version = "1.22.0", features = ["macros", "time", "parking_lot"] }
tokio-util = { version = "0.7.4", features = ["compat"] }
wait-timeout = "0.2"
substrate-rpc-client = { path = "../../../utils/frame/rpc/client" }
pallet-timestamp = { path = "../../../frame/timestamp" }
substrate-cli-test-utils = { path = "../../../test-utils/cli" }
[build-dependencies]
clap = { version = "4.4.6", optional = true }
clap_complete = { version = "4.0.2", optional = true }
node-inspect = { package = "staging-node-inspect", path = "../inspect", optional = true}
frame-benchmarking-cli = { path = "../../../utils/frame/benchmarking-cli", optional = true}
substrate-build-script-utils = { path = "../../../utils/build-script-utils", optional = true}
substrate-frame-cli = { path = "../../../utils/frame/frame-utilities-cli", optional = true}
try-runtime-cli = { path = "../../../utils/frame/try-runtime/cli", optional = true}
sc-cli = { path = "../../../client/cli", optional = true }
pallet-balances = { path = "../../../frame/balances" }
sc-storage-monitor = { path = "../../../client/storage-monitor" }
[features]
default = [ "cli" ]
cli = [
"clap",
"clap_complete",
"frame-benchmarking-cli",
"node-inspect",
"sc-cli",
"sc-service/rocksdb",
"substrate-build-script-utils",
"substrate-frame-cli",
"try-runtime-cli",
]
runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"kitchensink-runtime/runtime-benchmarks",
"pallet-asset-tx-payment/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-skip-feeless-payment/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"sc-client-db/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = [
"frame-system/try-runtime",
"kitchensink-runtime/try-runtime",
"pallet-asset-conversion-tx-payment/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/try-runtime",
"pallet-im-online/try-runtime",
"pallet-skip-feeless-payment/try-runtime",
"pallet-timestamp/try-runtime",
"sp-runtime/try-runtime",
"substrate-cli-test-utils/try-runtime",
"try-runtime-cli/try-runtime",
]
[[bench]]
name = "transaction_pool"
harness = false
[[bench]]
name = "block_production"
harness = false