Skip to content

Commit 188c91f

Browse files
To stable2409 (#1706)
* Initialize * Companion for paritytech/polkadot-sdk#4977 * Companion for paritytech/polkadot-sdk#5078 * Companion for paritytech/polkadot-sdk#5214 * Companion for paritytech/polkadot-sdk#5431 * Companion for paritytech/polkadot-sdk#4792 * Companion for paritytech/polkadot-sdk#5613 * Companion for paritytech/polkadot-sdk#7688 * Fixes * Companion for paritytech/polkadot-sdk#5364 * Fixes * Disable storage limit & fix format issue * Benchmark only * Patch evm * Update patch info * Fixes --------- Co-authored-by: bear <[email protected]>
1 parent 12e1604 commit 188c91f

File tree

26 files changed

+1656
-1508
lines changed

26 files changed

+1656
-1508
lines changed

Cargo.lock

Lines changed: 1405 additions & 1275 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 138 additions & 139 deletions
Large diffs are not rendered by default.

node/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ substrate-build-script-utils = { workspace = true }
1414
array-bytes = { workspace = true }
1515
async-trait = { version = "0.1" }
1616
clap = { version = "4.4", features = ["derive"] }
17+
color-eyre = { version = "0.6" }
1718
color-print = { version = "0.3" }
1819
futures = { version = "0.3" }
19-
jsonrpsee = { version = "0.23", features = ["server"] }
20+
jsonrpsee = { version = "0.24", features = ["server"] }
2021
log = { workspace = true }
2122
serde = { workspace = true }
2223
serde_json = { version = "1.0", features = ["arbitrary_precision"] }

node/src/command.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.
1818

1919
// std
20-
use std::{env, fs, io::ErrorKind, net::SocketAddr, path::PathBuf, result::Result as StdResult};
20+
use std::{env, fs, io::ErrorKind, path::PathBuf, result::Result as StdResult};
2121
// darwinia
2222
use crate::{
2323
chain_spec::*,
@@ -30,7 +30,7 @@ use cumulus_client_cli::CollatorOptions;
3030
use cumulus_primitives_core::ParaId;
3131
use sc_cli::{
3232
CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams,
33-
Result, SharedParams, SubstrateCli,
33+
Result, RpcEndpoint, SharedParams, SubstrateCli,
3434
};
3535
use sc_network::{
3636
config::NetworkBackendType, Litep2pNetworkBackend, NetworkBackend, NetworkWorker,
@@ -144,7 +144,7 @@ impl CliConfiguration<Self> for RelayChainCli {
144144
Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into)))
145145
}
146146

147-
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
147+
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<Vec<RpcEndpoint>>> {
148148
self.base.base.rpc_addr(default_listen_port)
149149
}
150150

@@ -156,15 +156,9 @@ impl CliConfiguration<Self> for RelayChainCli {
156156
self.base.base.prometheus_config(default_listen_port, chain_spec)
157157
}
158158

159-
fn init<F>(
160-
&self,
161-
_support_url: &String,
162-
_impl_version: &String,
163-
_logger_hook: F,
164-
_config: &sc_service::Configuration,
165-
) -> Result<()>
159+
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()>
166160
where
167-
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
161+
F: FnOnce(&mut sc_cli::LoggerBuilder),
168162
{
169163
unreachable!("PolkadotCli is never initialized; qed");
170164
}

node/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ mod rpc;
2828
mod service;
2929

3030
fn main() -> sc_cli::Result<()> {
31+
color_eyre::install().unwrap();
32+
3133
command::run()
3234
}

node/src/rpc.rs

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ pub struct FullDeps<C, P, A: sc_transaction_pool::ChainApi, CIDP> {
4040
pub pool: Arc<P>,
4141
/// Graph pool instance.
4242
pub graph: Arc<sc_transaction_pool::Pool<A>>,
43-
/// Whether to deny unsafe calls
44-
pub deny_unsafe: sc_rpc::DenyUnsafe,
4543
/// The Node authority flag
4644
pub is_authority: bool,
4745
/// Network service
@@ -88,7 +86,23 @@ where
8886

8987
/// Instantiate all RPC extensions.
9088
pub fn create_full<C, P, Be, A, EC, CIDP>(
91-
deps: FullDeps<C, P, A, CIDP>,
89+
FullDeps {
90+
client,
91+
pool,
92+
graph,
93+
is_authority,
94+
network,
95+
sync,
96+
filter_pool,
97+
frontier_backend,
98+
max_past_logs,
99+
fee_history_cache,
100+
fee_history_cache_limit,
101+
storage_override,
102+
block_data_cache,
103+
forced_parent_hashes,
104+
pending_create_inherent_data_providers,
105+
}: FullDeps<C, P, A, CIDP>,
92106
subscription_task_executor: sc_rpc::SubscriptionTaskExecutor,
93107
pubsub_notification_sinks: Arc<
94108
fc_mapping_sync::EthereumBlockNotificationSinks<
@@ -132,29 +146,11 @@ where
132146
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
133147
use substrate_frame_rpc_system::{System, SystemApiServer};
134148

135-
let mut module = RpcExtension::new(());
136-
let FullDeps {
137-
client,
138-
pool,
139-
graph,
140-
deny_unsafe,
141-
is_authority,
142-
network,
143-
sync,
144-
filter_pool,
145-
frontier_backend,
146-
max_past_logs,
147-
fee_history_cache,
148-
fee_history_cache_limit,
149-
storage_override,
150-
block_data_cache,
151-
forced_parent_hashes,
152-
pending_create_inherent_data_providers,
153-
} = deps;
149+
let mut io = RpcExtension::new(());
154150

155-
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
156-
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
157-
module.merge(
151+
io.merge(System::new(client.clone(), pool.clone()).into_rpc())?;
152+
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
153+
io.merge(
158154
Eth::<Block, C, P, _, Be, A, CIDP, EC>::new(
159155
client.clone(),
160156
pool.clone(),
@@ -179,7 +175,7 @@ where
179175

180176
let tx_pool = TxPool::new(client.clone(), graph.clone());
181177
if let Some(filter_pool) = filter_pool {
182-
module.merge(
178+
io.merge(
183179
EthFilter::new(
184180
client.clone(),
185181
frontier_backend,
@@ -193,7 +189,7 @@ where
193189
)?;
194190
}
195191

196-
module.merge(
192+
io.merge(
197193
EthPubSub::new(
198194
pool,
199195
client.clone(),
@@ -204,7 +200,7 @@ where
204200
)
205201
.into_rpc(),
206202
)?;
207-
module.merge(
203+
io.merge(
208204
Net::new(
209205
client.clone(),
210206
network,
@@ -213,21 +209,21 @@ where
213209
)
214210
.into_rpc(),
215211
)?;
216-
module.merge(Web3::new(client.clone()).into_rpc())?;
217-
module.merge(tx_pool.into_rpc())?;
212+
io.merge(Web3::new(client.clone()).into_rpc())?;
213+
io.merge(tx_pool.into_rpc())?;
218214

219215
if let Some(tracing_config) = maybe_tracing_config {
220216
if let Some(trace_filter_requester) = tracing_config.tracing_requesters.trace {
221-
module.merge(
217+
io.merge(
222218
Trace::new(client, trace_filter_requester, tracing_config.trace_filter_max_count)
223219
.into_rpc(),
224220
)?;
225221
}
226222

227223
if let Some(debug_requester) = tracing_config.tracing_requesters.debug {
228-
module.merge(Debug::new(debug_requester).into_rpc())?;
224+
io.merge(Debug::new(debug_requester).into_rpc())?;
229225
}
230226
}
231227

232-
Ok(module)
228+
Ok(io)
233229
}

node/src/service/instant_finalize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ where
4343
}
4444

4545
async fn import_block(
46-
&mut self,
46+
&self,
4747
mut block_import_params: sc_consensus::BlockImportParams<Block>,
4848
) -> Result<sc_consensus::ImportResult, Self::Error> {
4949
block_import_params.finalized = true;

node/src/service/mod.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ where
177177
Ok((worker, telemetry))
178178
})
179179
.transpose()?;
180-
let executor = sc_service::new_wasm_executor::<HostFunctions>(config);
180+
let executor = sc_service::new_wasm_executor::<HostFunctions>(&config.executor);
181181
let (client, backend, keystore_container, task_manager) =
182182
sc_service::new_full_parts_record_import::<Block, RuntimeApi, _>(
183183
config,
@@ -297,7 +297,10 @@ where
297297
.then_some(database_path.as_ref().map(|p| {
298298
let _ = std::fs::create_dir_all(p);
299299

300-
sc_sysinfo::gather_hwbench(Some(p))
300+
sc_sysinfo::gather_hwbench(
301+
Some(p),
302+
&frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE,
303+
)
301304
}))
302305
.flatten();
303306
let (relay_chain_interface, collator_key) =
@@ -315,8 +318,10 @@ where
315318
let collator = parachain_config.role.is_authority();
316319
let prometheus_registry = parachain_config.prometheus_registry().cloned();
317320
let import_queue_service = import_queue.service();
318-
let net_config =
319-
<sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(&parachain_config.network);
321+
let net_config = <sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(
322+
&parachain_config.network,
323+
prometheus_registry.clone(),
324+
);
320325
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
321326
cumulus_client_service::build_network(cumulus_client_service::BuildNetworkParams {
322327
parachain_config: &parachain_config,
@@ -366,7 +371,7 @@ where
366371
> = Default::default();
367372
let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
368373
// for ethereum-compatibility rpc.
369-
parachain_config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
374+
parachain_config.rpc.id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
370375
let tracing_requesters = frontier::spawn_tasks(
371376
&task_manager,
372377
client.clone(),
@@ -424,12 +429,11 @@ where
424429
Ok((timestamp, parachain_inherent_data))
425430
};
426431

427-
Box::new(move |deny_unsafe, subscription_task_executor| {
432+
Box::new(move |subscription_task_executor| {
428433
let deps = crate::rpc::FullDeps {
429434
client: client.clone(),
430435
pool: pool.clone(),
431436
graph: pool.pool().clone(),
432-
deny_unsafe,
433437
is_authority: collator,
434438
network: network.clone(),
435439
sync: sync_service.clone(),
@@ -494,7 +498,7 @@ where
494498
// in there and swapping out the requirements for your own are probably a good idea. The
495499
// requirements for a para-chain are dictated by its relay-chain.
496500
if let Err(e) =
497-
frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench)
501+
frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench, false)
498502
{
499503
log::warn!(
500504
"⚠️ The hardware does not meet the minimal requirements {e} for role 'Authority'.",
@@ -673,7 +677,7 @@ where
673677
proposer,
674678
collator_service,
675679
// Very limited proposal time.
676-
authoring_duration: Duration::from_millis(1_500),
680+
authoring_duration: Duration::from_millis(2_000),
677681
reinitialize: false,
678682
};
679683
let fut = cumulus_client_consensus_aura::collators::lookahead::run::<
@@ -734,8 +738,11 @@ where
734738
_telemetry_worker_handle,
735739
),
736740
} = new_partial::<RuntimeApi>(&config, eth_rpc_config)?;
737-
let net_config =
738-
<sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(&config.network);
741+
let prometheus_registry = config.prometheus_registry().cloned();
742+
let net_config = <sc_network::config::FullNetworkConfiguration<_, _, Net>>::new(
743+
&config.network,
744+
prometheus_registry.clone(),
745+
);
739746
let metrics = Net::register_notification_metrics(None);
740747
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
741748
sc_service::build_network(sc_service::BuildNetworkParams {
@@ -746,7 +753,7 @@ where
746753
spawn_handle: task_manager.spawn_handle(),
747754
import_queue,
748755
block_announce_validator_builder: None,
749-
warp_sync_params: None,
756+
warp_sync_config: None,
750757
block_relay: None,
751758
metrics,
752759
})?;
@@ -880,7 +887,6 @@ where
880887
log::warn!("You could add --alice or --bob to make dev chain seal instantly.");
881888
}
882889

883-
let prometheus_registry = config.prometheus_registry().cloned();
884890
let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(
885891
task_manager.spawn_handle(),
886892
storage_override.clone(),
@@ -893,7 +899,7 @@ where
893899
> = Default::default();
894900
let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
895901
// for ethereum-compatibility rpc.
896-
config.rpc_id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
902+
config.rpc.id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider));
897903
let tracing_requesters = frontier::spawn_tasks(
898904
&task_manager,
899905
client.clone(),
@@ -952,12 +958,11 @@ where
952958
Ok((timestamp, parachain_inherent_data))
953959
};
954960

955-
Box::new(move |deny_unsafe, subscription_task_executor| {
961+
Box::new(move |subscription_task_executor| {
956962
let deps = crate::rpc::FullDeps {
957963
client: client.clone(),
958964
pool: pool.clone(),
959965
graph: pool.pool().clone(),
960-
deny_unsafe,
961966
is_authority: collator,
962967
network: network.clone(),
963968
sync: sync_service.clone(),

pallet/account-migration/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ std = [
5050
"pallet-assets/std",
5151
"pallet-balances/std",
5252
"sp-core/std",
53-
"sp-io/std",
5453
"sp-runtime/std",
5554
"sp-std/std",
5655
# polkadot-sdk optional

pallet/account-migration/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@
4343
#![cfg_attr(not(feature = "std"), no_std)]
4444
#![deny(missing_docs)]
4545

46-
#[cfg(test)]
46+
#[cfg(feature = "runtime-benchmarks")]
47+
mod benchmarking;
48+
#[cfg(all(test, feature = "runtime-benchmarks"))]
4749
mod mock;
4850
#[cfg(test)]
4951
mod tests;
5052

51-
#[cfg(feature = "runtime-benchmarks")]
52-
mod benchmarking;
53-
5453
mod weights;
5554
pub use weights::WeightInfo;
5655

0 commit comments

Comments
 (0)