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

Commit

Permalink
Remove FeeMarket RPC (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav authored and jiguantong committed May 18, 2022
1 parent 8c876b7 commit 30598fd
Show file tree
Hide file tree
Showing 11 changed files with 397 additions and 136 deletions.
447 changes: 379 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runtime-benchmarks = [
# crates.io
array-bytes = { version = "1.5" }
async-trait = { version = "0.1" }
clap = { version = "3.1", features = ["derive"] }
clap = { version = "3.1", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
futures = { version = "0.3" }
jsonrpc-core = { version = "18.0" }
Expand Down Expand Up @@ -97,13 +97,10 @@ cumulus-client-network = { git = "https://github.com/paritytech
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }

# darwinia-network
pallet-fee-market-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }

# polkadot
polkadot-cli = { features = ["rococo-native"], git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
Expand Down
3 changes: 1 addition & 2 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ version = "5.2.0-rc1"
# crates.io
jsonrpc-core = { version = "18.0" }
# darwinia-network
dc-primitives = { path = "../primitives" }
pallet-fee-market-rpc = { git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
dc-primitives = { path = "../primitives" }
# paritytech
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18" }
Expand Down
4 changes: 0 additions & 4 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ where
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ sp_block_builder::BlockBuilder<Block>
+ pallet_fee_market_rpc::FeeMarketRuntimeApi<Block, Balance>,

P: 'static + Send + Sync + sc_transaction_pool_api::TransactionPool,
{
// --- paritytech ---
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
use substrate_frame_rpc_system::{FullSystem, SystemApi};
// --- darwinia-network ---
use pallet_fee_market_rpc::*;

let mut io = IoHandler::default();
let FullDeps {
Expand All @@ -81,7 +78,6 @@ where
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(
client.clone(),
)));
io.extend_with(FeeMarketApi::to_delegate(FeeMarket::new(client.clone())));

io
}
6 changes: 2 additions & 4 deletions runtime/crab-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ cumulus-primitives-utility = { default-features = false, git = "https://git
pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
# darwinia
dc-common-runtime = { default-features = false, path = "../common" }
dc-primitives = { default-features = false, path = "../../primitives" }
pallet-fee-market-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
dc-common-runtime = { default-features = false, path = "../common" }
dc-primitives = { default-features = false, path = "../../primitives" }
# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
pallet-xcm-benchmarks = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
Expand Down Expand Up @@ -93,7 +92,6 @@ std = [
# darwinia
"dc-common-runtime/std",
"dc-primitives/std",
"pallet-fee-market-rpc-runtime-api/std",
# polkadot
"pallet-xcm/std",
"polkadot-parachain/std",
Expand Down
9 changes: 0 additions & 9 deletions runtime/crab-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,6 @@ sp_api::impl_runtime_apis! {
}
}

impl pallet_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance> for Runtime {
fn market_fee() -> Option<pallet_fee_market_rpc_runtime_api::Fee<Balance>> {
Default::default()
}
fn in_process_orders() -> pallet_fee_market_rpc_runtime_api::InProcessOrders {
Default::default()
}
}

#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (
Expand Down
6 changes: 2 additions & 4 deletions runtime/darwinia-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ cumulus-primitives-utility = { default-features = false, git = "https://git
pallet-collator-selection = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
parachain-info = { default-features = false, git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.18" }
# darwinia
dc-common-runtime = { default-features = false, path = "../common" }
dc-primitives = { default-features = false, path = "../../primitives" }
pallet-fee-market-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
dc-common-runtime = { default-features = false, path = "../common" }
dc-primitives = { default-features = false, path = "../../primitives" }
# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
pallet-xcm-benchmarks = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
Expand Down Expand Up @@ -89,7 +88,6 @@ std = [
"parachain-info/std",
"dc-common-runtime/std",
"dc-primitives/std",
"pallet-fee-market-rpc-runtime-api/std",
"pallet-xcm/std",
"polkadot-parachain/std",
"xcm/std",
Expand Down
9 changes: 0 additions & 9 deletions runtime/darwinia-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,6 @@ sp_api::impl_runtime_apis! {
}
}

impl pallet_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance> for Runtime {
fn market_fee() -> Option<pallet_fee_market_rpc_runtime_api::Fee<Balance>> {
Default::default()
}
fn in_process_orders() -> pallet_fee_market_rpc_runtime_api::InProcessOrders {
Default::default()
}
}

#[cfg(feature = "runtime-benchmarks")]
impl frame_benchmarking::Benchmark<Block> for Runtime {
fn benchmark_metadata(extra: bool) -> (
Expand Down
24 changes: 11 additions & 13 deletions runtime/pangolin-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,17 @@ parachain-info = { default-features = false, git = "https://git
dc-common-runtime = { default-features = false, path = "../common" }
dc-primitives = { default-features = false, path = "../../primitives" }
# darwinia-bridges-substrate
bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-pangolin = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-pangolin-parachain = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-fee-market-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-message-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-pangolin = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-pangolin-parachain = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-polkadot-core = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-grandpa = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-bridge-messages = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
pallet-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-bridges-substrate", branch = "polkadot-v0.9.18" }
# polkadot
pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
pallet-xcm-benchmarks = { optional = true, default-features = false, git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.18" }
Expand Down Expand Up @@ -116,7 +115,6 @@ std = [
"pallet-bridge-grandpa/std",
"pallet-bridge-messages/std",
"pallet-fee-market/std",
"pallet-fee-market-rpc-runtime-api/std",
# polkadot
"pallet-xcm/std",
"polkadot-parachain/std",
Expand Down
16 changes: 0 additions & 16 deletions runtime/pangolin-parachain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,6 @@ sp_api::impl_runtime_apis! {
}
}

impl pallet_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance> for Runtime {
fn market_fee() -> Option<pallet_fee_market_rpc_runtime_api::Fee<Balance>> {
if let Some(fee) = FeeMarket::market_fee() {
return Some(pallet_fee_market_rpc_runtime_api::Fee {
amount: fee,
});
}
None
}
fn in_process_orders() -> pallet_fee_market_rpc_runtime_api::InProcessOrders {
return pallet_fee_market_rpc_runtime_api::InProcessOrders {
orders: FeeMarket::in_process_orders(),
}
}
}

impl bp_pangolin::PangolinFinalityApi<Block> for Runtime {
fn best_finalized() -> (bp_pangolin::BlockNumber, bp_pangolin::Hash) {
let header = BridgePangolinGrandpa::best_finalized();
Expand Down
2 changes: 0 additions & 2 deletions src/service/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub trait RuntimeApiCollection:
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ pallet_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance>
{
}
impl<Api> RuntimeApiCollection for Api where
Expand All @@ -27,6 +26,5 @@ impl<Api> RuntimeApiCollection for Api where
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
+ substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ pallet_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance>
{
}

0 comments on commit 30598fd

Please sign in to comment.