From 47c0e85731260f72e94a144ec49cd75ba46e48e0 Mon Sep 17 00:00:00 2001 From: tgmichel Date: Tue, 28 Feb 2023 09:35:33 +0100 Subject: [PATCH 01/17] `BlockId` removal in `fc-rpc` (#1003) --- client/rpc/src/eth/block.rs | 49 ++++++++++----- client/rpc/src/eth/cache/mod.rs | 14 ++--- client/rpc/src/eth/client.rs | 10 ++- client/rpc/src/eth/execute.rs | 30 ++++----- client/rpc/src/eth/fee.rs | 8 ++- client/rpc/src/eth/filter.rs | 17 +++-- client/rpc/src/eth/state.rs | 16 +++-- client/rpc/src/eth/transaction.rs | 56 +++++++++-------- client/rpc/src/eth_pubsub.rs | 14 ++--- client/rpc/src/lib.rs | 32 +++++----- client/rpc/src/overrides/mod.rs | 62 +++++++++++-------- .../rpc/src/overrides/schema_v1_override.rs | 35 +++++------ .../rpc/src/overrides/schema_v2_override.rs | 37 +++++------ .../rpc/src/overrides/schema_v3_override.rs | 37 +++++------ 14 files changed, 223 insertions(+), 194 deletions(-) diff --git a/client/rpc/src/eth/block.rs b/client/rpc/src/eth/block.rs index ea4ee845b5..556286b6a2 100644 --- a/client/rpc/src/eth/block.rs +++ b/client/rpc/src/eth/block.rs @@ -27,7 +27,10 @@ use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::traits::{BlakeTwo256, Block as BlockT}; +use sp_runtime::{ + generic::BlockId, + traits::{BlakeTwo256, Block as BlockT}, +}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -51,7 +54,7 @@ where let block_data_cache = Arc::clone(&self.block_data_cache); let backend = Arc::clone(&self.backend); - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( client.as_ref(), backend.as_ref(), hash, @@ -61,19 +64,21 @@ where Some(hash) => hash, _ => return Ok(None), }; - let substrate_hash = client - .expect_block_hash_from_id(&id) - .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache .current_transaction_statuses(schema, substrate_hash) .await; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); + let base_fee = client + .runtime_api() + .gas_price(&BlockId::Hash(substrate_hash)) + .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => Ok(Some(rich_block_build( @@ -108,8 +113,10 @@ where .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -135,7 +142,7 @@ where } pub fn block_transaction_count_by_hash(&self, hash: H256) -> Result> { - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( self.client.as_ref(), self.backend.as_ref(), hash, @@ -145,14 +152,16 @@ where Some(hash) => hash, _ => return Ok(None), }; - let schema = - frontier_backend_client::onchain_storage_schema::(self.client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + self.client.as_ref(), + substrate_hash, + ); let block = self .overrides .schemas .get(&schema) .unwrap_or(&self.overrides.fallback) - .current_block(&id); + .current_block(substrate_hash); match block { Some(block) => Ok(Some(U256::from(block.transactions.len()))), @@ -176,14 +185,20 @@ where Some(id) => id, None => return Ok(None), }; - let schema = - frontier_backend_client::onchain_storage_schema::(self.client.as_ref(), id); + let substrate_hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; + let schema = frontier_backend_client::onchain_storage_schema::( + self.client.as_ref(), + substrate_hash, + ); let block = self .overrides .schemas .get(&schema) .unwrap_or(&self.overrides.fallback) - .current_block(&id); + .current_block(substrate_hash); match block { Some(block) => Ok(Some(U256::from(block.transactions.len()))), diff --git a/client/rpc/src/eth/cache/mod.rs b/client/rpc/src/eth/cache/mod.rs index 990d6a17a1..8391317848 100644 --- a/client/rpc/src/eth/cache/mod.rs +++ b/client/rpc/src/eth/cache/mod.rs @@ -132,7 +132,7 @@ impl EthBlockDataCacheTask { task_tx.clone(), move |handler| FetchedCurrentBlock { block_hash, - block: handler.current_block(&BlockId::Hash(block_hash)), + block: handler.current_block(block_hash), }, ), FetchedCurrentBlock { block_hash, block } => { @@ -162,8 +162,7 @@ impl EthBlockDataCacheTask { task_tx.clone(), move |handler| FetchedCurrentTransactionStatuses { block_hash, - statuses: handler - .current_transaction_statuses(&BlockId::Hash(block_hash)), + statuses: handler.current_transaction_statuses(block_hash), }, ), FetchedCurrentTransactionStatuses { @@ -319,9 +318,8 @@ where FeeHistoryCacheItem, Option ) { - let id = BlockId::Hash(hash); let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + frontier_backend_client::onchain_storage_schema::(client.as_ref(), hash); let handler = overrides .schemas .get(&schema) @@ -343,10 +341,10 @@ where .collect() }; - let block = handler.current_block(&id); + let block = handler.current_block(hash); let mut block_number: Option = None; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); - let receipts = handler.current_receipts(&id); + let base_fee = client.runtime_api().gas_price(&BlockId::Hash(hash)).unwrap_or_default(); + let receipts = handler.current_receipts(hash); let mut result = FeeHistoryCacheItem { base_fee: if base_fee > U256::from(u64::MAX) { u64::MAX } else { base_fee.low_u64() }, gas_used_ratio: 0f64, diff --git a/client/rpc/src/eth/client.rs b/client/rpc/src/eth/client.rs index 4f29c8333b..54f8c77179 100644 --- a/client/rpc/src/eth/client.rs +++ b/client/rpc/src/eth/client.rs @@ -69,18 +69,16 @@ where } pub fn author(&self) -> Result { - let block = BlockId::Hash(self.client.info().best_hash); - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - block, - ); + let hash = self.client.info().best_hash; + let schema = + frontier_backend_client::onchain_storage_schema::(self.client.as_ref(), hash); Ok(self .overrides .schemas .get(&schema) .unwrap_or(&self.overrides.fallback) - .current_block(&block) + .current_block(hash) .ok_or_else(|| internal_err("fetching author through override failed"))? .header .beneficiary) diff --git a/client/rpc/src/eth/execute.rs b/client/rpc/src/eth/execute.rs index 0b06996a0e..ae17c2887e 100644 --- a/client/rpc/src/eth/execute.rs +++ b/client/rpc/src/eth/execute.rs @@ -325,7 +325,8 @@ where const MIN_GAS_PER_TX: U256 = U256([21_000, 0, 0, 0]); // Get best hash (TODO missing support for estimating gas historically) - let best_hash = client.info().best_hash; + let substrate_hash = client.info().best_hash; + let id = BlockId::Hash(substrate_hash); // Adapt request for gas estimation. let request = EGA::adapt_request(request); @@ -339,7 +340,7 @@ where if let Some(to) = request.to { let to_code = client .runtime_api() - .account_code_at(&BlockId::Hash(best_hash), to) + .account_code_at(&id, to) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; if to_code.is_empty() { return Ok(MIN_GAS_PER_TX); @@ -361,9 +362,10 @@ where }; let block_gas_limit = { - let substrate_hash = client.info().best_hash; - let id = BlockId::Hash(substrate_hash); - let schema = frontier_backend_client::onchain_storage_schema::(&client, id); + let schema = frontier_backend_client::onchain_storage_schema::( + &client, + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; block @@ -389,7 +391,7 @@ where } // If gas limit is not specified in the request we either use the multiplier if supported // or fallback to the block gas limit. - None => match api.gas_limit_multiplier_support(&BlockId::Hash(best_hash)) { + None => match api.gas_limit_multiplier_support(&id) { Ok(_) => max_gas_limit, _ => block_gas_limit, }, @@ -400,7 +402,7 @@ where let gas_price = gas_price.unwrap_or_default(); if gas_price > U256::zero() { let balance = api - .account_basic(&BlockId::Hash(best_hash), from) + .account_basic(&id, from) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))? .balance; let mut available = balance; @@ -468,7 +470,7 @@ where // Legacy pre-london #[allow(deprecated)] api.call_before_version_2( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), to, data, @@ -484,7 +486,7 @@ where // Post-london #[allow(deprecated)] api.call_before_version_4( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), to, data, @@ -501,7 +503,7 @@ where // Post-london + access list support let access_list = access_list.unwrap_or_default(); api.call( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), to, data, @@ -529,7 +531,7 @@ where // Legacy pre-london #[allow(deprecated)] api.create_before_version_2( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -544,7 +546,7 @@ where // Post-london #[allow(deprecated)] api.create_before_version_4( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -560,7 +562,7 @@ where // Post-london + access list support let access_list = access_list.unwrap_or_default(); api.create( - &BlockId::Hash(best_hash), + &id, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -592,7 +594,7 @@ where let api_version = if let Ok(Some(api_version)) = client .runtime_api() - .api_version::>(&BlockId::Hash(best_hash)) + .api_version::>(&id) { api_version } else { diff --git a/client/rpc/src/eth/fee.rs b/client/rpc/src/eth/fee.rs index 3d405a1b58..f734fbcb0e 100644 --- a/client/rpc/src/eth/fee.rs +++ b/client/rpc/src/eth/fee.rs @@ -131,9 +131,13 @@ where response.gas_used_ratio.last(), response.base_fee_per_gas.last(), ) { + let substrate_hash = + self.client.expect_block_hash_from_id(&id).map_err(|_| { + internal_err(format!("Expect block number from id: {}", id)) + })?; let schema = frontier_backend_client::onchain_storage_schema::( self.client.as_ref(), - id, + substrate_hash, ); let handler = self .overrides @@ -142,7 +146,7 @@ where .unwrap_or(&self.overrides.fallback); let default_elasticity = sp_runtime::Permill::from_parts(125_000); let elasticity = handler - .elasticity(&id) + .elasticity(substrate_hash) .unwrap_or(default_elasticity) .deconstruct(); let elasticity = elasticity as f64 / 1_000_000f64; diff --git a/client/rpc/src/eth/filter.rs b/client/rpc/src/eth/filter.rs index e45169f3d0..226023b5a9 100644 --- a/client/rpc/src/eth/filter.rs +++ b/client/rpc/src/eth/filter.rs @@ -249,7 +249,7 @@ where let schema = frontier_backend_client::onchain_storage_schema::( client.as_ref(), - id, + substrate_hash, ); let block = block_data_cache.current_block(schema, substrate_hash).await; @@ -366,7 +366,7 @@ where let mut ret: Vec = Vec::new(); if let Some(hash) = filter.block_hash { - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( client.as_ref(), backend.as_ref(), hash, @@ -376,12 +376,10 @@ where Some(hash) => hash, _ => return Ok(Vec::new()), }; - let substrate_hash = client - .expect_block_hash_from_id(&id) - .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -462,7 +460,8 @@ where .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = frontier_backend_client::onchain_storage_schema::(client, id); + let schema = + frontier_backend_client::onchain_storage_schema::(client, substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; diff --git a/client/rpc/src/eth/state.rs b/client/rpc/src/eth/state.rs index 2a051f8706..e631fd0ada 100644 --- a/client/rpc/src/eth/state.rs +++ b/client/rpc/src/eth/state.rs @@ -92,16 +92,20 @@ where self.backend.as_ref(), Some(number), ) { + let substrate_hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; let schema = frontier_backend_client::onchain_storage_schema::( self.client.as_ref(), - id, + substrate_hash, ); Ok(self .overrides .schemas .get(&schema) .unwrap_or(&self.overrides.fallback) - .storage_at(&id, address, index) + .storage_at(substrate_hash, address, index) .unwrap_or_default()) } else { Ok(H256::default()) @@ -165,9 +169,13 @@ where self.backend.as_ref(), Some(number), ) { + let substrate_hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; let schema = frontier_backend_client::onchain_storage_schema::( self.client.as_ref(), - id, + substrate_hash, ); Ok(self @@ -175,7 +183,7 @@ where .schemas .get(&schema) .unwrap_or(&self.overrides.fallback) - .account_code_at(&id, address) + .account_code_at(substrate_hash, address) .unwrap_or_default() .into()) } else { diff --git a/client/rpc/src/eth/transaction.rs b/client/rpc/src/eth/transaction.rs index a5b17b3e44..d87388f0e6 100644 --- a/client/rpc/src/eth/transaction.rs +++ b/client/rpc/src/eth/transaction.rs @@ -126,7 +126,7 @@ where } }; - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( client.as_ref(), backend.as_ref(), hash, @@ -136,19 +136,21 @@ where Some(hash) => hash, _ => return Ok(None), }; - let substrate_hash = client - .expect_block_hash_from_id(&id) - .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache .current_transaction_statuses(schema, substrate_hash) .await; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); + let base_fee = client + .runtime_api() + .gas_price(&BlockId::Hash(substrate_hash)) + .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => Ok(Some(transaction_build( @@ -170,7 +172,7 @@ where let block_data_cache = Arc::clone(&self.block_data_cache); let backend = Arc::clone(&self.backend); - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( client.as_ref(), backend.as_ref(), hash, @@ -180,21 +182,23 @@ where Some(hash) => hash, _ => return Ok(None), }; - let substrate_hash = client - .expect_block_hash_from_id(&id) - .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; let index = index.value(); - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache .current_transaction_statuses(schema, substrate_hash) .await; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); + let base_fee = client + .runtime_api() + .gas_price(&BlockId::Hash(substrate_hash)) + .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => { @@ -237,8 +241,10 @@ where .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; let index = index.value(); - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -284,7 +290,7 @@ where None => return Ok(None), }; - let id = match frontier_backend_client::load_hash::( + let substrate_hash = match frontier_backend_client::load_hash::( client.as_ref(), backend.as_ref(), hash, @@ -294,12 +300,11 @@ where Some(hash) => hash, _ => return Ok(None), }; - let substrate_hash = client - .expect_block_hash_from_id(&id) - .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), id); + let schema = frontier_backend_client::onchain_storage_schema::( + client.as_ref(), + substrate_hash, + ); let handler = overrides .schemas .get(&schema) @@ -309,8 +314,9 @@ where let statuses = block_data_cache .current_transaction_statuses(schema, substrate_hash) .await; - let receipts = handler.current_receipts(&id); - let is_eip1559 = handler.is_eip1559(&id); + + let receipts = handler.current_receipts(substrate_hash); + let is_eip1559 = handler.is_eip1559(substrate_hash); match (block, statuses, receipts) { (Some(block), Some(statuses), Some(receipts)) => { @@ -385,7 +391,7 @@ where EthereumTransaction::EIP2930(t) => t.gas_price, EthereumTransaction::EIP1559(t) => client .runtime_api() - .gas_price(&id) + .gas_price(&BlockId::Hash(substrate_hash)) .unwrap_or_default() .checked_add(t.max_priority_fee_per_gas) .unwrap_or_else(U256::max_value) diff --git a/client/rpc/src/eth_pubsub.rs b/client/rpc/src/eth_pubsub.rs index 6f21ebf055..01dacaf347 100644 --- a/client/rpc/src/eth_pubsub.rs +++ b/client/rpc/src/eth_pubsub.rs @@ -229,20 +229,20 @@ where .import_notification_stream() .filter_map(move |notification| { if notification.is_new_best { - let id = BlockId::Hash(notification.hash); + let substrate_hash = notification.hash; let schema = frontier_backend_client::onchain_storage_schema::< B, C, BE, - >(client.as_ref(), id); + >(client.as_ref(), notification.hash); let handler = overrides .schemas .get(&schema) .unwrap_or(&overrides.fallback); - let block = handler.current_block(&id); - let receipts = handler.current_receipts(&id); + let block = handler.current_block(substrate_hash); + let receipts = handler.current_receipts(substrate_hash); match (receipts, block) { (Some(receipts), Some(block)) => { @@ -269,19 +269,17 @@ where .import_notification_stream() .filter_map(move |notification| { if notification.is_new_best { - let id = BlockId::Hash(notification.hash); - let schema = frontier_backend_client::onchain_storage_schema::< B, C, BE, - >(client.as_ref(), id); + >(client.as_ref(), notification.hash); let handler = overrides .schemas .get(&schema) .unwrap_or(&overrides.fallback); - let block = handler.current_block(&id); + let block = handler.current_block(notification.hash); futures::future::ready(block) } else { futures::future::ready(None) diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 171b912fd5..3c65bccf08 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -77,7 +77,11 @@ pub mod frontier_backend_client { { Ok(match number.unwrap_or(BlockNumber::Latest) { BlockNumber::Hash { hash, .. } => { - load_hash::(client, backend, hash).unwrap_or(None) + if let Ok(Some(hash)) = load_hash::(client, backend, hash) { + Some(BlockId::Hash(hash)) + } else { + None + } } BlockNumber::Num(number) => Some(BlockId::Number(number.unique_saturated_into())), BlockNumber::Latest => Some(BlockId::Hash(client.info().best_hash)), @@ -92,7 +96,7 @@ pub mod frontier_backend_client { client: &C, backend: &fc_db::Backend, hash: H256, - ) -> RpcResult>> + ) -> RpcResult> where B: BlockT + Send + Sync + 'static, C: HeaderBackend + Send + Sync + 'static, @@ -105,7 +109,7 @@ pub mod frontier_backend_client { if let Some(substrate_hashes) = substrate_hashes { for substrate_hash in substrate_hashes { if is_canon::(client, substrate_hash) { - return Ok(Some(BlockId::Hash(substrate_hash))); + return Ok(Some(substrate_hash)); } } } @@ -143,7 +147,7 @@ pub mod frontier_backend_client { pub fn onchain_storage_schema( client: &C, - at: BlockId, + hash: B::Hash, ) -> EthereumStorageSchema where B: BlockT + Send + Sync + 'static, @@ -151,15 +155,11 @@ pub mod frontier_backend_client { BE: Backend + 'static, BE::State: StateBackend, { - if let Ok(Some(hash)) = client.block_hash_from_id(&at) { - match client.storage(hash, &StorageKey(PALLET_ETHEREUM_SCHEMA.to_vec())) { - Ok(Some(bytes)) => Decode::decode(&mut &bytes.0[..]) - .ok() - .unwrap_or(EthereumStorageSchema::Undefined), - _ => EthereumStorageSchema::Undefined, - } - } else { - EthereumStorageSchema::Undefined + match client.storage(hash, &StorageKey(PALLET_ETHEREUM_SCHEMA.to_vec())) { + Ok(Some(bytes)) => Decode::decode(&mut &bytes.0[..]) + .ok() + .unwrap_or(EthereumStorageSchema::Undefined), + _ => EthereumStorageSchema::Undefined, } } @@ -347,7 +347,7 @@ mod tests { ) .unwrap() .unwrap(), - BlockId::Hash(b1_hash), + b1_hash, ); // A1 -> B2 @@ -376,7 +376,7 @@ mod tests { ) .unwrap() .unwrap(), - BlockId::Hash(b1_hash), + b1_hash, ); // B2 -> C1. B2 branch is now canon. @@ -396,7 +396,7 @@ mod tests { ) .unwrap() .unwrap(), - BlockId::Hash(b2_hash), + b2_hash, ); } } diff --git a/client/rpc/src/overrides/mod.rs b/client/rpc/src/overrides/mod.rs index c7bf4ac284..f54e56ef1f 100644 --- a/client/rpc/src/overrides/mod.rs +++ b/client/rpc/src/overrides/mod.rs @@ -48,22 +48,22 @@ pub struct OverrideHandle { /// optimized implementation avoids spawning a runtime and the overhead associated with it. pub trait StorageOverride { /// For a given account address, returns pallet_evm::AccountCodes. - fn account_code_at(&self, block: &BlockId, address: H160) -> Option>; + fn account_code_at(&self, block_hash: Block::Hash, address: H160) -> Option>; /// For a given account address and index, returns pallet_evm::AccountStorages. - fn storage_at(&self, block: &BlockId, address: H160, index: U256) -> Option; + fn storage_at(&self, block_hash: Block::Hash, address: H160, index: U256) -> Option; /// Return the current block. - fn current_block(&self, block: &BlockId) -> Option; + fn current_block(&self, block_hash: Block::Hash) -> Option; /// Return the current receipt. - fn current_receipts(&self, block: &BlockId) -> Option>; + fn current_receipts(&self, block_hash: Block::Hash) -> Option>; /// Return the current transaction status. fn current_transaction_statuses( &self, - block: &BlockId, + block_hash: Block::Hash, ) -> Option>; /// Return the base fee at the given height. - fn elasticity(&self, block: &BlockId) -> Option; + fn elasticity(&self, block_hash: Block::Hash) -> Option; /// Return `true` if the request BlockId is post-eip1559. - fn is_eip1559(&self, block: &BlockId) -> bool; + fn is_eip1559(&self, block_hash: Block::Hash) -> bool; } fn storage_prefix_build(module: &[u8], storage: &[u8]) -> Vec { @@ -99,27 +99,27 @@ where C::Api: EthereumRuntimeRPCApi, { /// For a given account address, returns pallet_evm::AccountCodes. - fn account_code_at(&self, block: &BlockId, address: H160) -> Option> { + fn account_code_at(&self, block_hash: Block::Hash, address: H160) -> Option> { self.client .runtime_api() - .account_code_at(block, address) + .account_code_at(&BlockId::Hash(block_hash), address) .ok() } /// For a given account address and index, returns pallet_evm::AccountStorages. - fn storage_at(&self, block: &BlockId, address: H160, index: U256) -> Option { + fn storage_at(&self, block_hash: Block::Hash, address: H160, index: U256) -> Option { self.client .runtime_api() - .storage_at(block, address, index) + .storage_at(&BlockId::Hash(block_hash), address, index) .ok() } /// Return the current block. - fn current_block(&self, block: &BlockId) -> Option { + fn current_block(&self, block_hash: Block::Hash) -> Option { let api = self.client.runtime_api(); let api_version = if let Ok(Some(api_version)) = - api.api_version::>(block) + api.api_version::>(&BlockId::Hash(block_hash)) { api_version } else { @@ -127,19 +127,21 @@ where }; if api_version == 1 { #[allow(deprecated)] - let old_block = api.current_block_before_version_2(block).ok()?; + let old_block = api + .current_block_before_version_2(&BlockId::Hash(block_hash)) + .ok()?; old_block.map(|block| block.into()) } else { - api.current_block(block).ok()? + api.current_block(&BlockId::Hash(block_hash)).ok()? } } /// Return the current receipt. - fn current_receipts(&self, block: &BlockId) -> Option> { + fn current_receipts(&self, block_hash: Block::Hash) -> Option> { let api = self.client.runtime_api(); let api_version = if let Ok(Some(api_version)) = - api.api_version::>(block) + api.api_version::>(&BlockId::Hash(block_hash)) { api_version } else { @@ -147,7 +149,9 @@ where }; if api_version < 4 { #[allow(deprecated)] - let old_receipts = api.current_receipts_before_version_4(block).ok()?; + let old_receipts = api + .current_receipts_before_version_4(&BlockId::Hash(block_hash)) + .ok()?; old_receipts.map(|receipts| { receipts .into_iter() @@ -162,35 +166,41 @@ where .collect() }) } else { - self.client.runtime_api().current_receipts(block).ok()? + self.client + .runtime_api() + .current_receipts(&BlockId::Hash(block_hash)) + .ok()? } } /// Return the current transaction status. fn current_transaction_statuses( &self, - block: &BlockId, + block_hash: Block::Hash, ) -> Option> { self.client .runtime_api() - .current_transaction_statuses(block) + .current_transaction_statuses(&BlockId::Hash(block_hash)) .ok()? } /// Return the elasticity multiplier at the give post-eip1559 height. - fn elasticity(&self, block: &BlockId) -> Option { - if self.is_eip1559(block) { - self.client.runtime_api().elasticity(block).ok()? + fn elasticity(&self, block_hash: Block::Hash) -> Option { + if self.is_eip1559(block_hash) { + self.client + .runtime_api() + .elasticity(&BlockId::Hash(block_hash)) + .ok()? } else { None } } - fn is_eip1559(&self, block: &BlockId) -> bool { + fn is_eip1559(&self, block_hash: Block::Hash) -> bool { if let Ok(Some(api_version)) = self .client .runtime_api() - .api_version::>(block) + .api_version::>(&BlockId::Hash(block_hash)) { return api_version >= 2; } diff --git a/client/rpc/src/overrides/schema_v1_override.rs b/client/rpc/src/overrides/schema_v1_override.rs index 53b90cee82..4c4a91cd20 100644 --- a/client/rpc/src/overrides/schema_v1_override.rs +++ b/client/rpc/src/overrides/schema_v1_override.rs @@ -22,7 +22,6 @@ use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; -use sp_api::BlockId; use sp_blockchain::HeaderBackend; use sp_runtime::{ traits::{BlakeTwo256, Block as BlockT}, @@ -57,12 +56,10 @@ where BE: Backend + 'static, BE::State: StateBackend, { - fn query_storage(&self, id: &BlockId, key: &StorageKey) -> Option { - if let Ok(Some(hash)) = self.client.block_hash_from_id(id) { - if let Ok(Some(data)) = self.client.storage(hash, key) { - if let Ok(result) = Decode::decode(&mut &data.0[..]) { - return Some(result); - } + fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { + if let Ok(Some(data)) = self.client.storage(block_hash, key) { + if let Ok(result) = Decode::decode(&mut &data.0[..]) { + return Some(result); } } None @@ -77,14 +74,14 @@ where BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. - fn account_code_at(&self, block: &BlockId, address: H160) -> Option> { + fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { let mut key: Vec = storage_prefix_build(PALLET_EVM, EVM_ACCOUNT_CODES); key.extend(blake2_128_extend(address.as_bytes())); - self.query_storage::>(block, &StorageKey(key)) + self.query_storage::>(block_hash, &StorageKey(key)) } /// For a given account address and index, returns pallet_evm::AccountStorages. - fn storage_at(&self, block: &BlockId, address: H160, index: U256) -> Option { + fn storage_at(&self, block_hash: B::Hash, address: H160, index: U256) -> Option { let tmp: &mut [u8; 32] = &mut [0; 32]; index.to_big_endian(tmp); @@ -92,13 +89,13 @@ where key.extend(blake2_128_extend(address.as_bytes())); key.extend(blake2_128_extend(tmp)); - self.query_storage::(block, &StorageKey(key)) + self.query_storage::(block_hash, &StorageKey(key)) } /// Return the current block. - fn current_block(&self, block: &BlockId) -> Option { + fn current_block(&self, block_hash: B::Hash) -> Option { self.query_storage::( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_BLOCK, @@ -108,9 +105,9 @@ where } /// Return the current receipt. - fn current_receipts(&self, block: &BlockId) -> Option> { + fn current_receipts(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_RECEIPTS, @@ -132,9 +129,9 @@ where } /// Return the current transaction status. - fn current_transaction_statuses(&self, block: &BlockId) -> Option> { + fn current_transaction_statuses(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_TRANSACTION_STATUS, @@ -143,11 +140,11 @@ where } /// Prior to eip-1559 there is no elasticity. - fn elasticity(&self, _block: &BlockId) -> Option { + fn elasticity(&self, _block_hash: B::Hash) -> Option { None } - fn is_eip1559(&self, _block: &BlockId) -> bool { + fn is_eip1559(&self, _block_hash: B::Hash) -> bool { false } } diff --git a/client/rpc/src/overrides/schema_v2_override.rs b/client/rpc/src/overrides/schema_v2_override.rs index 45ade02575..b8ba3f120d 100644 --- a/client/rpc/src/overrides/schema_v2_override.rs +++ b/client/rpc/src/overrides/schema_v2_override.rs @@ -22,7 +22,6 @@ use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; -use sp_api::BlockId; use sp_blockchain::HeaderBackend; use sp_runtime::{ traits::{BlakeTwo256, Block as BlockT}, @@ -57,12 +56,10 @@ where BE: Backend + 'static, BE::State: StateBackend, { - fn query_storage(&self, id: &BlockId, key: &StorageKey) -> Option { - if let Ok(Some(hash)) = self.client.block_hash_from_id(id) { - if let Ok(Some(data)) = self.client.storage(hash, key) { - if let Ok(result) = Decode::decode(&mut &data.0[..]) { - return Some(result); - } + fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { + if let Ok(Some(data)) = self.client.storage(block_hash, key) { + if let Ok(result) = Decode::decode(&mut &data.0[..]) { + return Some(result); } } None @@ -77,14 +74,14 @@ where BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. - fn account_code_at(&self, block: &BlockId, address: H160) -> Option> { + fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { let mut key: Vec = storage_prefix_build(PALLET_EVM, EVM_ACCOUNT_CODES); key.extend(blake2_128_extend(address.as_bytes())); - self.query_storage::>(block, &StorageKey(key)) + self.query_storage::>(block_hash, &StorageKey(key)) } /// For a given account address and index, returns pallet_evm::AccountStorages. - fn storage_at(&self, block: &BlockId, address: H160, index: U256) -> Option { + fn storage_at(&self, block_hash: B::Hash, address: H160, index: U256) -> Option { let tmp: &mut [u8; 32] = &mut [0; 32]; index.to_big_endian(tmp); @@ -92,13 +89,13 @@ where key.extend(blake2_128_extend(address.as_bytes())); key.extend(blake2_128_extend(tmp)); - self.query_storage::(block, &StorageKey(key)) + self.query_storage::(block_hash, &StorageKey(key)) } /// Return the current block. - fn current_block(&self, block: &BlockId) -> Option { + fn current_block(&self, block_hash: B::Hash) -> Option { self.query_storage::( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_BLOCK, @@ -107,9 +104,9 @@ where } /// Return the current receipt. - fn current_receipts(&self, block: &BlockId) -> Option> { + fn current_receipts(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_RECEIPTS, @@ -131,9 +128,9 @@ where } /// Return the current transaction status. - fn current_transaction_statuses(&self, block: &BlockId) -> Option> { + fn current_transaction_statuses(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_TRANSACTION_STATUS, @@ -142,10 +139,10 @@ where } /// Return the elasticity at the given height. - fn elasticity(&self, block: &BlockId) -> Option { + fn elasticity(&self, block_hash: B::Hash) -> Option { let default_elasticity = Some(Permill::from_parts(125_000)); let elasticity = self.query_storage::( - block, + block_hash, &StorageKey(storage_prefix_build(PALLET_BASE_FEE, BASE_FEE_ELASTICITY)), ); if elasticity.is_some() { @@ -155,7 +152,7 @@ where } } - fn is_eip1559(&self, _block: &BlockId) -> bool { + fn is_eip1559(&self, _block_hash: B::Hash) -> bool { true } } diff --git a/client/rpc/src/overrides/schema_v3_override.rs b/client/rpc/src/overrides/schema_v3_override.rs index 6e41fd12f8..aaa053543c 100644 --- a/client/rpc/src/overrides/schema_v3_override.rs +++ b/client/rpc/src/overrides/schema_v3_override.rs @@ -22,7 +22,6 @@ use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; -use sp_api::BlockId; use sp_blockchain::HeaderBackend; use sp_runtime::{ traits::{BlakeTwo256, Block as BlockT}, @@ -57,12 +56,10 @@ where BE: Backend + 'static, BE::State: StateBackend, { - fn query_storage(&self, id: &BlockId, key: &StorageKey) -> Option { - if let Ok(Some(hash)) = self.client.block_hash_from_id(id) { - if let Ok(Some(data)) = self.client.storage(hash, key) { - if let Ok(result) = Decode::decode(&mut &data.0[..]) { - return Some(result); - } + fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { + if let Ok(Some(data)) = self.client.storage(block_hash, key) { + if let Ok(result) = Decode::decode(&mut &data.0[..]) { + return Some(result); } } None @@ -77,14 +74,14 @@ where BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. - fn account_code_at(&self, block: &BlockId, address: H160) -> Option> { + fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { let mut key: Vec = storage_prefix_build(PALLET_EVM, EVM_ACCOUNT_CODES); key.extend(blake2_128_extend(address.as_bytes())); - self.query_storage::>(block, &StorageKey(key)) + self.query_storage::>(block_hash, &StorageKey(key)) } /// For a given account address and index, returns pallet_evm::AccountStorages. - fn storage_at(&self, block: &BlockId, address: H160, index: U256) -> Option { + fn storage_at(&self, block_hash: B::Hash, address: H160, index: U256) -> Option { let tmp: &mut [u8; 32] = &mut [0; 32]; index.to_big_endian(tmp); @@ -92,13 +89,13 @@ where key.extend(blake2_128_extend(address.as_bytes())); key.extend(blake2_128_extend(tmp)); - self.query_storage::(block, &StorageKey(key)) + self.query_storage::(block_hash, &StorageKey(key)) } /// Return the current block. - fn current_block(&self, block: &BlockId) -> Option { + fn current_block(&self, block_hash: B::Hash) -> Option { self.query_storage::( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_BLOCK, @@ -107,9 +104,9 @@ where } /// Return the current receipt. - fn current_receipts(&self, block: &BlockId) -> Option> { + fn current_receipts(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_RECEIPTS, @@ -118,9 +115,9 @@ where } /// Return the current transaction status. - fn current_transaction_statuses(&self, block: &BlockId) -> Option> { + fn current_transaction_statuses(&self, block_hash: B::Hash) -> Option> { self.query_storage::>( - block, + block_hash, &StorageKey(storage_prefix_build( PALLET_ETHEREUM, ETHEREUM_CURRENT_TRANSACTION_STATUS, @@ -129,10 +126,10 @@ where } /// Return the elasticity at the given height. - fn elasticity(&self, block: &BlockId) -> Option { + fn elasticity(&self, block_hash: B::Hash) -> Option { let default_elasticity = Some(Permill::from_parts(125_000)); let elasticity = self.query_storage::( - block, + block_hash, &StorageKey(storage_prefix_build(PALLET_BASE_FEE, BASE_FEE_ELASTICITY)), ); if elasticity.is_some() { @@ -142,7 +139,7 @@ where } } - fn is_eip1559(&self, _block: &BlockId) -> bool { + fn is_eip1559(&self, _block_hash: B::Hash) -> bool { true } } From 558812128d7823c39a40cde9174f5bbccfde5ae9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:36:08 +0100 Subject: [PATCH 02/17] Bump vuepress from 1.9.8 to 1.9.9 in /docs (#1006) Bumps [vuepress](https://github.com/vuejs/vuepress/tree/HEAD/packages/vuepress) from 1.9.8 to 1.9.9. - [Release notes](https://github.com/vuejs/vuepress/releases) - [Changelog](https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md) - [Commits](https://github.com/vuejs/vuepress/commits/v1.9.9/packages/vuepress) --- updated-dependencies: - dependency-name: vuepress dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/package.json | 2 +- docs/yarn.lock | 138 +++++++++++++++++++++++----------------------- 2 files changed, 70 insertions(+), 70 deletions(-) diff --git a/docs/package.json b/docs/package.json index 6d6acac16c..7861c646ac 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,6 +13,6 @@ }, "license": "Apache-2.0", "dependencies": { - "vuepress": "^1.9.8" + "vuepress": "^1.9.9" } } diff --git a/docs/yarn.lock b/docs/yarn.lock index b3024890b9..d31524cd79 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -1184,19 +1184,19 @@ optionalDependencies: prettier "^1.18.2" -"@vuepress/core@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.9.8.tgz#56acf26d7c1a3c82b0b57bc778fef73024dc1854" - integrity sha512-ZDm253vcjKlWIxd6c18aZWJZkWCmhBUXRT/X5eKFEoDO3aQatb+OpFYP6eH3zufD2VXjZwE5kV4MAMwtBHK+DQ== +"@vuepress/core@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.9.9.tgz#aa8bc4497fcbb6aab9c1e290944d422edeb20495" + integrity sha512-Ekgu409ZSgvAV9n14F3DaEWtgkwrEicg1nWs0gbxGgUCdREeX/7rwxSfKwWwBjCwfCUKR2L3+6pXGjzxex0t+g== dependencies: "@babel/core" "^7.8.4" "@vue/babel-preset-app" "^4.1.2" - "@vuepress/markdown" "1.9.8" - "@vuepress/markdown-loader" "1.9.8" - "@vuepress/plugin-last-updated" "1.9.8" - "@vuepress/plugin-register-components" "1.9.8" - "@vuepress/shared-utils" "1.9.8" - "@vuepress/types" "1.9.8" + "@vuepress/markdown" "1.9.9" + "@vuepress/markdown-loader" "1.9.9" + "@vuepress/plugin-last-updated" "1.9.9" + "@vuepress/plugin-register-components" "1.9.9" + "@vuepress/shared-utils" "1.9.9" + "@vuepress/types" "1.9.9" autoprefixer "^9.5.1" babel-loader "^8.0.4" bundle-require "2.1.8" @@ -1231,21 +1231,21 @@ webpack-merge "^4.1.2" webpackbar "3.2.0" -"@vuepress/markdown-loader@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.9.8.tgz#a08c527cdf1089d45a0067dbad600571e0bb3052" - integrity sha512-rurhMqwq5h32nXlJG/ezrgzp7twkJtExBxh3bH+iUeuuPKoyTzd5+YI8lrOELXPsRXlvPoMZ9KQioW/D8xAmvA== +"@vuepress/markdown-loader@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/markdown-loader/-/markdown-loader-1.9.9.tgz#b44e446a04808b9aef503d32fdcbc1e7fb7afef4" + integrity sha512-nyY+sytuQaDLEIk6Yj9JFUfSQpe9/sz30xQFkGCYqi0lQTRGQM6IcRDgfcTS7b25A0qRlwpDGBfKQiGGMZKSfg== dependencies: - "@vuepress/markdown" "1.9.8" + "@vuepress/markdown" "1.9.9" loader-utils "^1.1.0" lru-cache "^5.1.1" -"@vuepress/markdown@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.9.8.tgz#7c2ec75c20d4249fe52c0bb98ae4d70a176377cd" - integrity sha512-7OaCXp2SMtf9pFf513U52aUtDf5gWWe8pT+NQA8hOU6jCNSJGex3izEEve1sPmLmsJWGjmVEAeKesGNg4wQE0A== +"@vuepress/markdown@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/markdown/-/markdown-1.9.9.tgz#1f582e6302e91a09491ca7bd0c8bcf9683140e03" + integrity sha512-JzFdBdGe5aoiKSaEgF+h3JLDXNVfWPI5DJWXrIt7rhhkMJesF6HowIznPLdXqukzHfXHcPvo9oQ4o6eT0YmVGA== dependencies: - "@vuepress/shared-utils" "1.9.8" + "@vuepress/shared-utils" "1.9.9" markdown-it "^8.4.1" markdown-it-anchor "^5.0.2" markdown-it-chain "^1.3.0" @@ -1253,49 +1253,49 @@ markdown-it-table-of-contents "^0.4.0" prismjs "^1.13.0" -"@vuepress/plugin-active-header-links@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.9.8.tgz#64a9b9018e7f8138a8b49119002e3421c24c23ec" - integrity sha512-yyUwn/DOF5Gbxc5fFbiBNqz7XmRAVHyYZNTgsJooQX+E11DH9XCuJ0sWN3HHee1aVwmz2w94KYsoueiBTgfJ8g== +"@vuepress/plugin-active-header-links@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-active-header-links/-/plugin-active-header-links-1.9.9.tgz#fad96c550bea0b204fe16266cff1405e8636c1e1" + integrity sha512-lTnIhbuALjOjFts33jJD8r4ScNBxnZ6MtmePKEwvYlC3J9uvngs1Htpb1JzLEX9QCydt+bhLmZ92bTXn/PdTpg== dependencies: - "@vuepress/types" "1.9.8" + "@vuepress/types" "1.9.9" lodash.debounce "^4.0.8" -"@vuepress/plugin-last-updated@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.9.8.tgz#ab4db23138398d7e141066867b8cf19ac730f1b4" - integrity sha512-tMmqKEEXV9Ask/MErJrVSDxRW6uEYm7UvUmfo6SbIoYjyLiNV8UCzmLPT+hAEixNuxuMReoI3rn/v60JiYPUZA== +"@vuepress/plugin-last-updated@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-last-updated/-/plugin-last-updated-1.9.9.tgz#a7cb5f39b2793c8d113de08a514c316c26cc38c1" + integrity sha512-MV4csmM0/lye83VtkOc+b8fs0roi7mvE7BmCCOE39Z6t8nv/ZmEPOwKeHD0+hXPT+ZfoATYvDcsYU7uxbdw0Pw== dependencies: - "@vuepress/types" "1.9.8" + "@vuepress/types" "1.9.9" cross-spawn "^6.0.5" -"@vuepress/plugin-nprogress@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.9.8.tgz#78132a59c1139d9a225441fa69e4af82d0ffe945" - integrity sha512-RW2n2VTnc36zPUMlQ9+uOu57ao9RKDvOIGoFqTPqvORiTI56VnyAipOv+79EqTky6DqXSG+ixzq+oE9gSJ8cXA== +"@vuepress/plugin-nprogress@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-nprogress/-/plugin-nprogress-1.9.9.tgz#4fee4818ddc8ddc6a1778b7f2b74ab784c90915d" + integrity sha512-+3fLxjwTLH8MeU54E7i1ovRu9KzBom2lvSeUsu9B8PuLyrETAqW7Pe1H66awEEALEe0ZnnEU4d7SeVe9ljsLAQ== dependencies: - "@vuepress/types" "1.9.8" + "@vuepress/types" "1.9.9" nprogress "^0.2.0" -"@vuepress/plugin-register-components@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.9.8.tgz#fea0a86c49e32f77585b86e10b7713a24cd254d7" - integrity sha512-TPa+HDKSevhXKvAh7zboGlGCaGXY/vzx/b7YtHzxKwHJE3Orj/aGNimG8ZvILjDXhzmrPCX+WghquiwYeco5Nw== +"@vuepress/plugin-register-components@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-register-components/-/plugin-register-components-1.9.9.tgz#95be133d6ef33c03f410caae8eb1fabdf27a7999" + integrity sha512-tddnAiSmJsIWWPzE7TcbGU8xzndXf4a8i4BfIev2QzSUnIOQFZDGXUAsCkw4/f9N9UFxQSObjFPzTeUUxb7EvA== dependencies: - "@vuepress/shared-utils" "1.9.8" - "@vuepress/types" "1.9.8" + "@vuepress/shared-utils" "1.9.9" + "@vuepress/types" "1.9.9" -"@vuepress/plugin-search@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.9.8.tgz#89bb96527f4a9c0bd34ecc476f24eb421fccd907" - integrity sha512-LLZag4Rj1ZF679ubmkqvDyXv5/o0uxbvHFZjD7d+xWRRV6PZrw47Idep8HXlVcmL43BLdxQ//STiibPJpbWdXQ== +"@vuepress/plugin-search@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-search/-/plugin-search-1.9.9.tgz#d30804b86f9b7f54b3db0b987a288433be3cfd7b" + integrity sha512-W/FE+YHoXDD4qk2wu5yRMkti271TA4y+7UBMrmCavvVAGrLIRnaZfswRUgIiDlEthBc+Pn8/As/Dy1jFTLBa9A== dependencies: - "@vuepress/types" "1.9.8" + "@vuepress/types" "1.9.9" -"@vuepress/shared-utils@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.9.8.tgz#1ecaf148409001fee9c00c6951dc719c9a279523" - integrity sha512-34VfkChKRrs0waWEXugDPcBB4Cp6TnKwNQaTpa8GwpLFfQw627/mWi2IiuSwTyFNZdSXxZJV6e5blejmUlGh0g== +"@vuepress/shared-utils@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/shared-utils/-/shared-utils-1.9.9.tgz#f6561ec2264d54e4e459d17678766ffe09f4bfc6" + integrity sha512-qhk/7QF5LgMEXhEB1hlqreGFgkz4p2pmaBBNFxnAnYmSwmyO+u/oFOpZLI16QRx9Wg6ekR2ENmByQLxV7y4lJg== dependencies: chalk "^2.3.2" escape-html "^1.0.3" @@ -1322,15 +1322,15 @@ toml "^3.0.0" upath "^1.1.0" -"@vuepress/theme-default@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.9.8.tgz#303ed3c73e37c3821e6447f90ead2e5629856560" - integrity sha512-j0wC6fvRtlRRCg0chbYzNlTTeov36ASxfRaE+r/9kKZAFM0NDCQr3N79jYVx2vEVvlgrjq51moe1WgFqjjFPUg== +"@vuepress/theme-default@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/theme-default/-/theme-default-1.9.9.tgz#26f1965e1204445fa617308d3b06f134baab4936" + integrity sha512-de0FiOwM/h3rFTBSZK0NNBB117lA/e3IHusU7Xm2XeZRiZ/EE3yvbWclZnbbRNt3YjDMmrWXEW/kBTBxfiMuWQ== dependencies: - "@vuepress/plugin-active-header-links" "1.9.8" - "@vuepress/plugin-nprogress" "1.9.8" - "@vuepress/plugin-search" "1.9.8" - "@vuepress/types" "1.9.8" + "@vuepress/plugin-active-header-links" "1.9.9" + "@vuepress/plugin-nprogress" "1.9.9" + "@vuepress/plugin-search" "1.9.9" + "@vuepress/types" "1.9.9" docsearch.js "^2.5.2" lodash "^4.17.15" stylus "^0.54.8" @@ -1338,10 +1338,10 @@ vuepress-plugin-container "^2.0.2" vuepress-plugin-smooth-scroll "^0.0.3" -"@vuepress/types@1.9.8": - version "1.9.8" - resolved "https://registry.yarnpkg.com/@vuepress/types/-/types-1.9.8.tgz#bf22bae02e265bc1f7b016495a236fa3ba97fa5c" - integrity sha512-ygRFqILi4SQjExxvpVUFXB/h76dN+k8GrDWYhAgmox1zhWEEzsskbqewXGKWE48RW9EJDYGgh8jy+CWvm7ILXg== +"@vuepress/types@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/types/-/types-1.9.9.tgz#7c21e4c91c13e58e2ff303ded9ad7425805cb07d" + integrity sha512-ukGW49ILzLhIc7CltHMr+BeIjWKloJNN1mrvbDz3beycp9b9kgH+DXNdRIK9QCKr4fJsy7x08vNMwZr9Nq/PTQ== dependencies: "@types/markdown-it" "^10.0.0" "@types/webpack-dev-server" "^3" @@ -7936,14 +7936,14 @@ vuepress-plugin-smooth-scroll@^0.0.3: dependencies: smoothscroll-polyfill "^0.4.3" -vuepress@^1.9.8: - version "1.9.8" - resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.9.8.tgz#8bc436eb89ece2d95339a2a1cd7bfc6a53fcd8d3" - integrity sha512-bjfSSRHlpxsZIrJo4Ds0mjt01lwC5H/a7ynDqub4zgXl7/osSsM6GmEgIqlc8oMAQ7j3nY7EBsHdAyrQamPjwA== +vuepress@^1.9.9: + version "1.9.9" + resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.9.9.tgz#75b313f48a21b2eeb435cad52333f26b3b8a7404" + integrity sha512-CU94W3EdWaCavGx2VSvQJMI/hyv+m/YMdrvJJw67EVfmmJJDb1iTGrilDgLd0qsyrXzBy0Ru9Qi6rkf4IwcOTg== dependencies: - "@vuepress/core" "1.9.8" - "@vuepress/theme-default" "1.9.8" - "@vuepress/types" "1.9.8" + "@vuepress/core" "1.9.9" + "@vuepress/theme-default" "1.9.9" + "@vuepress/types" "1.9.9" cac "^6.5.6" envinfo "^7.2.0" opencollective-postinstall "^2.0.2" From b984ff19acd20a3434f2b2ff481266413c9b8f4f Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Tue, 28 Feb 2023 18:34:37 +0800 Subject: [PATCH 03/17] feat: add fc-storage (#1005) * feat: add fc-storage move storage overrides of `fc-rpc` into a new crate `fc-storage` * move onchain_storage_schema function into fc-storage * remove useless trait bound * move overrides_handle function into fc-storage * ignore some explicit generic --- Cargo.lock | 20 ++++- Cargo.toml | 2 + client/rpc/Cargo.toml | 1 + client/rpc/src/eth/block.rs | 20 +---- client/rpc/src/eth/cache/mod.rs | 10 +-- client/rpc/src/eth/client.rs | 5 +- client/rpc/src/eth/execute.rs | 6 +- client/rpc/src/eth/fee.rs | 6 +- client/rpc/src/eth/filter.rs | 14 +--- client/rpc/src/eth/mod.rs | 3 +- client/rpc/src/eth/state.rs | 10 +-- client/rpc/src/eth/transaction.rs | 20 +---- client/rpc/src/eth_pubsub.rs | 21 +++--- client/rpc/src/lib.rs | 34 ++------- client/storage/CHANGELOG.md | 1 + client/storage/Cargo.toml | 27 +++++++ client/storage/src/lib.rs | 74 +++++++++++++++++++ client/{rpc => storage}/src/overrides/mod.rs | 17 +++-- .../src/overrides/schema_v1_override.rs | 13 +--- .../src/overrides/schema_v2_override.rs | 13 +--- .../src/overrides/schema_v3_override.rs | 13 +--- template/node/Cargo.toml | 2 +- template/node/src/rpc/eth.rs | 41 +--------- 23 files changed, 188 insertions(+), 185 deletions(-) create mode 100644 client/storage/CHANGELOG.md create mode 100644 client/storage/Cargo.toml create mode 100644 client/storage/src/lib.rs rename client/{rpc => storage}/src/overrides/mod.rs (94%) rename client/{rpc => storage}/src/overrides/schema_v1_override.rs (92%) rename client/{rpc => storage}/src/overrides/schema_v2_override.rs (93%) rename client/{rpc => storage}/src/overrides/schema_v3_override.rs (92%) diff --git a/Cargo.lock b/Cargo.lock index cf14f081c0..9ddd29b033 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1926,6 +1926,7 @@ dependencies = [ "evm", "fc-db", "fc-rpc-core", + "fc-storage", "fp-ethereum", "fp-rpc", "fp-storage", @@ -1974,6 +1975,23 @@ dependencies = [ "serde_json", ] +[[package]] +name = "fc-storage" +version = "1.0.0-dev" +dependencies = [ + "ethereum", + "ethereum-types", + "fp-rpc", + "fp-storage", + "parity-scale-codec", + "sc-client-api", + "sp-api", + "sp-blockchain", + "sp-io", + "sp-runtime", + "sp-storage", +] + [[package]] name = "fdlimit" version = "0.2.1" @@ -2398,10 +2416,10 @@ dependencies = [ "fc-mapping-sync", "fc-rpc", "fc-rpc-core", + "fc-storage", "fp-dynamic-fee", "fp-evm", "fp-rpc", - "fp-storage", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", diff --git a/Cargo.toml b/Cargo.toml index e22ed2bf38..93769f35d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ members = [ "client/rpc-core", "client/rpc", "client/db", + "client/storage", "client/mapping-sync", "primitives/consensus", "primitives/dynamic-fee", @@ -121,6 +122,7 @@ fc-db = { version = "2.0.0-dev", path = "client/db" } fc-mapping-sync = { version = "2.0.0-dev", path = "client/mapping-sync" } fc-rpc = { version = "2.0.0-dev", path = "client/rpc" } fc-rpc-core = { version = "1.1.0-dev", path = "client/rpc-core" } +fc-storage = { version = "1.0.0-dev", path = "client/storage" } # Frontier Primitive fp-consensus = { version = "2.0.0-dev", path = "primitives/consensus", default-features = false } fp-dynamic-fee = { version = "1.0.0", path = "primitives/dynamic-fee", default-features = false } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index f45fedeb8c..0870f14bc7 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -46,6 +46,7 @@ sp-storage = { workspace = true } # Frontier fc-db = { workspace = true } fc-rpc-core = { workspace = true } +fc-storage = { workspace = true } fp-ethereum = { workspace = true, features = ["std"] } fp-rpc = { workspace = true, features = ["std"] } fp-storage = { workspace = true, features = ["std"] } diff --git a/client/rpc/src/eth/block.rs b/client/rpc/src/eth/block.rs index 556286b6a2..f2324af95b 100644 --- a/client/rpc/src/eth/block.rs +++ b/client/rpc/src/eth/block.rs @@ -65,10 +65,7 @@ where _ => return Ok(None), }; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -113,10 +110,7 @@ where .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -152,10 +146,7 @@ where Some(hash) => hash, _ => return Ok(None), }; - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(self.client.as_ref(), substrate_hash); let block = self .overrides .schemas @@ -189,10 +180,7 @@ where .client .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(self.client.as_ref(), substrate_hash); let block = self .overrides .schemas diff --git a/client/rpc/src/eth/cache/mod.rs b/client/rpc/src/eth/cache/mod.rs index 8391317848..de9d94b910 100644 --- a/client/rpc/src/eth/cache/mod.rs +++ b/client/rpc/src/eth/cache/mod.rs @@ -42,14 +42,11 @@ use sp_runtime::{ }; // Frontier use fc_rpc_core::types::*; +use fc_storage::{OverrideHandle, StorageOverride}; use fp_rpc::{EthereumRuntimeRPCApi, TransactionStatus}; use fp_storage::EthereumStorageSchema; use self::lru_cache::LRUCacheByteLimited; -use crate::{ - frontier_backend_client, - overrides::{OverrideHandle, StorageOverride}, -}; type WaitList = HashMap>>>; @@ -198,7 +195,7 @@ impl EthBlockDataCacheTask { handler_call: F, ) where T: Clone + scale_codec::Encode, - F: FnOnce(&Box + Send + Sync>) -> EthBlockDataCacheMessage, + F: FnOnce(&Box>) -> EthBlockDataCacheMessage, F: Send + 'static, { // Data is cached, we respond immediately. @@ -318,8 +315,7 @@ where FeeHistoryCacheItem, Option ) { - let schema = - frontier_backend_client::onchain_storage_schema::(client.as_ref(), hash); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), hash); let handler = overrides .schemas .get(&schema) diff --git a/client/rpc/src/eth/client.rs b/client/rpc/src/eth/client.rs index 54f8c77179..b7d585aee7 100644 --- a/client/rpc/src/eth/client.rs +++ b/client/rpc/src/eth/client.rs @@ -33,7 +33,7 @@ use sp_runtime::{ use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; -use crate::{eth::Eth, frontier_backend_client, internal_err}; +use crate::{eth::Eth, internal_err}; impl Eth where @@ -70,8 +70,7 @@ where pub fn author(&self) -> Result { let hash = self.client.info().best_hash; - let schema = - frontier_backend_client::onchain_storage_schema::(self.client.as_ref(), hash); + let schema = fc_storage::onchain_storage_schema(self.client.as_ref(), hash); Ok(self .overrides diff --git a/client/rpc/src/eth/execute.rs b/client/rpc/src/eth/execute.rs index ae17c2887e..a96a17fd76 100644 --- a/client/rpc/src/eth/execute.rs +++ b/client/rpc/src/eth/execute.rs @@ -362,12 +362,8 @@ where }; let block_gas_limit = { - let schema = frontier_backend_client::onchain_storage_schema::( - &client, - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; - block .ok_or_else(|| internal_err("block unavailable, cannot query gas limit"))? .header diff --git a/client/rpc/src/eth/fee.rs b/client/rpc/src/eth/fee.rs index f734fbcb0e..2c9412a5c2 100644 --- a/client/rpc/src/eth/fee.rs +++ b/client/rpc/src/eth/fee.rs @@ -135,10 +135,8 @@ where self.client.expect_block_hash_from_id(&id).map_err(|_| { internal_err(format!("Expect block number from id: {}", id)) })?; - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - substrate_hash, - ); + let schema = + fc_storage::onchain_storage_schema(self.client.as_ref(), substrate_hash); let handler = self .overrides .schemas diff --git a/client/rpc/src/eth/filter.rs b/client/rpc/src/eth/filter.rs index 226023b5a9..e651a38b12 100644 --- a/client/rpc/src/eth/filter.rs +++ b/client/rpc/src/eth/filter.rs @@ -247,10 +247,8 @@ where internal_err(format!("Expect block number from id: {}", id)) })?; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = + fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; if let Some(block) = block { @@ -376,10 +374,7 @@ where Some(hash) => hash, _ => return Ok(Vec::new()), }; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -460,8 +455,7 @@ where .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = - frontier_backend_client::onchain_storage_schema::(client, substrate_hash); + let schema = fc_storage::onchain_storage_schema(client, substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; diff --git a/client/rpc/src/eth/mod.rs b/client/rpc/src/eth/mod.rs index 04d49079c6..f481b06be0 100644 --- a/client/rpc/src/eth/mod.rs +++ b/client/rpc/src/eth/mod.rs @@ -49,9 +49,10 @@ use sp_runtime::{ }; // Frontier use fc_rpc_core::{types::*, EthApiServer}; +use fc_storage::OverrideHandle; use fp_rpc::{ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi, TransactionStatus}; -use crate::{internal_err, overrides::OverrideHandle, public_key, signer::EthSigner}; +use crate::{internal_err, public_key, signer::EthSigner}; pub use self::{ cache::{EthBlockDataCacheTask, EthTask}, diff --git a/client/rpc/src/eth/state.rs b/client/rpc/src/eth/state.rs index e631fd0ada..953c416d3f 100644 --- a/client/rpc/src/eth/state.rs +++ b/client/rpc/src/eth/state.rs @@ -96,10 +96,7 @@ where .client .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(self.client.as_ref(), substrate_hash); Ok(self .overrides .schemas @@ -173,10 +170,7 @@ where .client .expect_block_hash_from_id(&id) .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; - let schema = frontier_backend_client::onchain_storage_schema::( - self.client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(self.client.as_ref(), substrate_hash); Ok(self .overrides diff --git a/client/rpc/src/eth/transaction.rs b/client/rpc/src/eth/transaction.rs index d87388f0e6..861382a11f 100644 --- a/client/rpc/src/eth/transaction.rs +++ b/client/rpc/src/eth/transaction.rs @@ -137,10 +137,7 @@ where _ => return Ok(None), }; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -185,10 +182,7 @@ where let index = index.value(); - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -241,10 +235,7 @@ where .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; let index = index.value(); - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let block = block_data_cache.current_block(schema, substrate_hash).await; let statuses = block_data_cache @@ -301,10 +292,7 @@ where _ => return Ok(None), }; - let schema = frontier_backend_client::onchain_storage_schema::( - client.as_ref(), - substrate_hash, - ); + let schema = fc_storage::onchain_storage_schema(client.as_ref(), substrate_hash); let handler = overrides .schemas .get(&schema) diff --git a/client/rpc/src/eth_pubsub.rs b/client/rpc/src/eth_pubsub.rs index 01dacaf347..235015d8bb 100644 --- a/client/rpc/src/eth_pubsub.rs +++ b/client/rpc/src/eth_pubsub.rs @@ -44,10 +44,9 @@ use fc_rpc_core::{ }, EthPubSubApiServer, }; +use fc_storage::OverrideHandle; use fp_rpc::EthereumRuntimeRPCApi; -use crate::{frontier_backend_client, overrides::OverrideHandle}; - #[derive(Debug)] pub struct EthereumSubIdProvider; @@ -231,11 +230,10 @@ where if notification.is_new_best { let substrate_hash = notification.hash; - let schema = frontier_backend_client::onchain_storage_schema::< - B, - C, - BE, - >(client.as_ref(), notification.hash); + let schema = fc_storage::onchain_storage_schema( + client.as_ref(), + substrate_hash, + ); let handler = overrides .schemas .get(&schema) @@ -269,11 +267,10 @@ where .import_notification_stream() .filter_map(move |notification| { if notification.is_new_best { - let schema = frontier_backend_client::onchain_storage_schema::< - B, - C, - BE, - >(client.as_ref(), notification.hash); + let schema = fc_storage::onchain_storage_schema( + client.as_ref(), + notification.hash, + ); let handler = overrides .schemas .get(&schema) diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 3c65bccf08..5388bdb892 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -28,7 +28,6 @@ mod eth; mod eth_pubsub; mod net; -mod overrides; mod signer; mod web3; @@ -36,10 +35,6 @@ pub use self::{ eth::{format, EstimateGasAdapter, Eth, EthBlockDataCacheTask, EthFilter, EthTask}, eth_pubsub::{EthPubSub, EthereumSubIdProvider}, net::Net, - overrides::{ - OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override, - SchemaV3Override, StorageOverride, - }, signer::{EthDevSigner, EthSigner}, web3::Web3, }; @@ -47,24 +42,25 @@ pub use ethereum::TransactionV2 as EthereumTransaction; pub use fc_rpc_core::{ EthApiServer, EthFilterApiServer, EthPubSubApiServer, NetApiServer, Web3ApiServer, }; +pub use fc_storage::{ + OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, SchemaV2Override, + SchemaV3Override, StorageOverride, +}; pub mod frontier_backend_client { use super::internal_err; use ethereum_types::H256; use jsonrpsee::core::RpcResult; - use scale_codec::Decode; // Substrate - use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; use sp_blockchain::HeaderBackend; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto, Zero}, + traits::{Block as BlockT, UniqueSaturatedInto, Zero}, }; - use sp_storage::StorageKey; // Frontier use fc_rpc_core::types::BlockNumber; - use fp_storage::{EthereumStorageSchema, PALLET_ETHEREUM_SCHEMA}; + use fp_storage::EthereumStorageSchema; pub fn native_block_id( client: &C, @@ -145,24 +141,6 @@ pub mod frontier_backend_client { Ok(()) } - pub fn onchain_storage_schema( - client: &C, - hash: B::Hash, - ) -> EthereumStorageSchema - where - B: BlockT + Send + Sync + 'static, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, - BE: Backend + 'static, - BE::State: StateBackend, - { - match client.storage(hash, &StorageKey(PALLET_ETHEREUM_SCHEMA.to_vec())) { - Ok(Some(bytes)) => Decode::decode(&mut &bytes.0[..]) - .ok() - .unwrap_or(EthereumStorageSchema::Undefined), - _ => EthereumStorageSchema::Undefined, - } - } - pub fn is_canon(client: &C, target_hash: H256) -> bool where B: BlockT + Send + Sync + 'static, diff --git a/client/storage/CHANGELOG.md b/client/storage/CHANGELOG.md new file mode 100644 index 0000000000..96727b78f7 --- /dev/null +++ b/client/storage/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog for `fc-storage` diff --git a/client/storage/Cargo.toml b/client/storage/Cargo.toml new file mode 100644 index 0000000000..b259cb0c66 --- /dev/null +++ b/client/storage/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "fc-storage" +version = "1.0.0-dev" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +description = "Ethereum storage compatibility layer for Substrate." +authors = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +ethereum = { workspace = true, features = ["with-codec"] } +ethereum-types = { workspace = true } +scale-codec = { package = "parity-scale-codec", workspace = true } + +# Substrate +sc-client-api = { workspace = true } +sp-api = { workspace = true } +sp-blockchain = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-storage = { workspace = true } +# Frontier +fp-rpc = { workspace = true, features = ["default"] } +fp-storage = { workspace = true, features = ["default"] } diff --git a/client/storage/src/lib.rs b/client/storage/src/lib.rs new file mode 100644 index 0000000000..88ef59f8e1 --- /dev/null +++ b/client/storage/src/lib.rs @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// This file is part of Frontier. +// +// Copyright (c) 2020-2022 Parity Technologies (UK) Ltd. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +mod overrides; +pub use self::overrides::*; + +use std::{collections::BTreeMap, sync::Arc}; + +use scale_codec::Decode; +// Substrate +use sc_client_api::{backend::Backend, StorageProvider}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; +use sp_runtime::traits::Block as BlockT; +use sp_storage::StorageKey; +// Frontier +use fp_storage::{EthereumStorageSchema, PALLET_ETHEREUM_SCHEMA}; + +pub fn overrides_handle(client: Arc) -> Arc> +where + B: BlockT, + C: ProvideRuntimeApi, + C::Api: fp_rpc::EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, + BE: Backend + 'static, +{ + let mut overrides_map = BTreeMap::new(); + overrides_map.insert( + EthereumStorageSchema::V1, + Box::new(SchemaV1Override::new(client.clone())) as Box>, + ); + overrides_map.insert( + EthereumStorageSchema::V2, + Box::new(SchemaV2Override::new(client.clone())) as Box>, + ); + overrides_map.insert( + EthereumStorageSchema::V3, + Box::new(SchemaV3Override::new(client.clone())) as Box>, + ); + + Arc::new(OverrideHandle { + schemas: overrides_map, + fallback: Box::new(RuntimeApiStorageOverride::::new(client)), + }) +} + +pub fn onchain_storage_schema(client: &C, hash: B::Hash) -> EthereumStorageSchema +where + B: BlockT, + C: StorageProvider + HeaderBackend, + BE: Backend, +{ + match client.storage(hash, &StorageKey(PALLET_ETHEREUM_SCHEMA.to_vec())) { + Ok(Some(bytes)) => Decode::decode(&mut &bytes.0[..]) + .ok() + .unwrap_or(EthereumStorageSchema::Undefined), + _ => EthereumStorageSchema::Undefined, + } +} diff --git a/client/rpc/src/overrides/mod.rs b/client/storage/src/overrides/mod.rs similarity index 94% rename from client/rpc/src/overrides/mod.rs rename to client/storage/src/overrides/mod.rs index f54e56ef1f..3f2966b062 100644 --- a/client/rpc/src/overrides/mod.rs +++ b/client/storage/src/overrides/mod.rs @@ -32,13 +32,14 @@ mod schema_v1_override; mod schema_v2_override; mod schema_v3_override; -pub use schema_v1_override::SchemaV1Override; -pub use schema_v2_override::SchemaV2Override; -pub use schema_v3_override::SchemaV3Override; +pub use self::{ + schema_v1_override::SchemaV1Override, schema_v2_override::SchemaV2Override, + schema_v3_override::SchemaV3Override, +}; pub struct OverrideHandle { - pub schemas: BTreeMap + Send + Sync>>, - pub fallback: Box + Send + Sync>, + pub schemas: BTreeMap>>, + pub fallback: Box>, } /// Something that can fetch Ethereum-related data. This trait is quite similar to the runtime API, @@ -46,7 +47,7 @@ pub struct OverrideHandle { /// Having this trait is useful because it allows optimized implementations that fetch data from a /// State Backend with some assumptions about pallet-ethereum's storage schema. Using such an /// optimized implementation avoids spawning a runtime and the overhead associated with it. -pub trait StorageOverride { +pub trait StorageOverride: Send + Sync { /// For a given account address, returns pallet_evm::AccountCodes. fn account_code_at(&self, block_hash: Block::Hash, address: H160) -> Option>; /// For a given account address and index, returns pallet_evm::AccountStorages. @@ -94,8 +95,8 @@ impl RuntimeApiStorageOverride { impl StorageOverride for RuntimeApiStorageOverride where - Block: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + Send + Sync + 'static, + Block: BlockT, + C: ProvideRuntimeApi + Send + Sync, C::Api: EthereumRuntimeRPCApi, { /// For a given account address, returns pallet_evm::AccountCodes. diff --git a/client/rpc/src/overrides/schema_v1_override.rs b/client/storage/src/overrides/schema_v1_override.rs similarity index 92% rename from client/rpc/src/overrides/schema_v1_override.rs rename to client/storage/src/overrides/schema_v1_override.rs index 4c4a91cd20..477699cc7f 100644 --- a/client/rpc/src/overrides/schema_v1_override.rs +++ b/client/storage/src/overrides/schema_v1_override.rs @@ -21,12 +21,9 @@ use std::{marker::PhantomData, sync::Arc}; use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - traits::{BlakeTwo256, Block as BlockT}, - Permill, -}; +use sp_runtime::{traits::Block as BlockT, Permill}; use sp_storage::StorageKey; // Frontier use fp_rpc::TransactionStatus; @@ -51,10 +48,9 @@ impl SchemaV1Override { impl SchemaV1Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { if let Ok(Some(data)) = self.client.storage(block_hash, key) { @@ -68,10 +64,9 @@ where impl StorageOverride for SchemaV1Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { diff --git a/client/rpc/src/overrides/schema_v2_override.rs b/client/storage/src/overrides/schema_v2_override.rs similarity index 93% rename from client/rpc/src/overrides/schema_v2_override.rs rename to client/storage/src/overrides/schema_v2_override.rs index b8ba3f120d..fef92aa9a0 100644 --- a/client/rpc/src/overrides/schema_v2_override.rs +++ b/client/storage/src/overrides/schema_v2_override.rs @@ -21,12 +21,9 @@ use std::{marker::PhantomData, sync::Arc}; use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - traits::{BlakeTwo256, Block as BlockT}, - Permill, -}; +use sp_runtime::{traits::Block as BlockT, Permill}; use sp_storage::StorageKey; // Frontier use fp_rpc::TransactionStatus; @@ -51,10 +48,9 @@ impl SchemaV2Override { impl SchemaV2Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { if let Ok(Some(data)) = self.client.storage(block_hash, key) { @@ -68,10 +64,9 @@ where impl StorageOverride for SchemaV2Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { diff --git a/client/rpc/src/overrides/schema_v3_override.rs b/client/storage/src/overrides/schema_v3_override.rs similarity index 92% rename from client/rpc/src/overrides/schema_v3_override.rs rename to client/storage/src/overrides/schema_v3_override.rs index aaa053543c..a833d0aa59 100644 --- a/client/rpc/src/overrides/schema_v3_override.rs +++ b/client/storage/src/overrides/schema_v3_override.rs @@ -21,12 +21,9 @@ use std::{marker::PhantomData, sync::Arc}; use ethereum_types::{H160, H256, U256}; use scale_codec::Decode; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - traits::{BlakeTwo256, Block as BlockT}, - Permill, -}; +use sp_runtime::{traits::Block as BlockT, Permill}; use sp_storage::StorageKey; // Frontier use fp_rpc::TransactionStatus; @@ -51,10 +48,9 @@ impl SchemaV3Override { impl SchemaV3Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { if let Ok(Some(data)) = self.client.storage(block_hash, key) { @@ -68,10 +64,9 @@ where impl StorageOverride for SchemaV3Override where - B: BlockT + Send + Sync + 'static, + B: BlockT, C: StorageProvider + HeaderBackend + Send + Sync + 'static, BE: Backend + 'static, - BE::State: StateBackend, { /// For a given account address, returns pallet_evm::AccountCodes. fn account_code_at(&self, block_hash: B::Hash, address: H160) -> Option> { diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index 84aa127aa9..d2d6796567 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -71,10 +71,10 @@ fc-db = { workspace = true } fc-mapping-sync = { workspace = true } fc-rpc = { workspace = true } fc-rpc-core = { workspace = true } +fc-storage = { workspace = true } fp-dynamic-fee = { workspace = true, features = ["std"] } fp-evm = { workspace = true, features = ["std"] } fp-rpc = { workspace = true, features = ["std"] } -fp-storage = { workspace = true, features = ["std"] } frontier-template-runtime = { workspace = true, features = ["std"] } [build-dependencies] diff --git a/template/node/src/rpc/eth.rs b/template/node/src/rpc/eth.rs index b71431c4e1..8cdd13b966 100644 --- a/template/node/src/rpc/eth.rs +++ b/template/node/src/rpc/eth.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeMap, sync::Arc}; +use std::sync::Arc; use jsonrpsee::RpcModule; // Substrate @@ -16,12 +16,9 @@ use sp_core::H256; use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT}; // Frontier use fc_db::Backend as FrontierBackend; -pub use fc_rpc::{ - EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override, - SchemaV2Override, SchemaV3Override, StorageOverride, -}; +pub use fc_rpc::{EthBlockDataCacheTask, OverrideHandle, StorageOverride}; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; -use fp_storage::EthereumStorageSchema; +pub use fc_storage::overrides_handle; /// Extra dependencies for Ethereum compatibility. pub struct EthDeps { @@ -80,38 +77,6 @@ impl Clone for EthDeps } } -pub fn overrides_handle(client: Arc) -> Arc> -where - C: ProvideRuntimeApi + StorageProvider + AuxStore, - C: HeaderBackend + HeaderMetadata + 'static, - C::Api: fp_rpc::EthereumRuntimeRPCApi, - BE: Backend + 'static, - BE::State: StateBackend, - B: BlockT, -{ - let mut overrides_map = BTreeMap::new(); - overrides_map.insert( - EthereumStorageSchema::V1, - Box::new(SchemaV1Override::new(client.clone())) - as Box + Send + Sync>, - ); - overrides_map.insert( - EthereumStorageSchema::V2, - Box::new(SchemaV2Override::new(client.clone())) - as Box + Send + Sync>, - ); - overrides_map.insert( - EthereumStorageSchema::V3, - Box::new(SchemaV3Override::new(client.clone())) - as Box + Send + Sync>, - ); - - Arc::new(OverrideHandle { - schemas: overrides_map, - fallback: Box::new(RuntimeApiStorageOverride::::new(client)), - }) -} - /// Instantiate Ethereum-compatible RPC extensions. pub fn create_eth( mut io: RpcModule<()>, From 340ff4eb69bbe63f514c9942259d8bede42402ba Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Wed, 1 Mar 2023 17:42:55 +0800 Subject: [PATCH 04/17] chore(client): remove useless trait bound (#1009) --- Cargo.lock | 2 - client/cli/src/frontier_db_cmd/mapping_db.rs | 6 +- client/cli/src/frontier_db_cmd/mod.rs | 6 +- client/cli/src/frontier_db_cmd/tests.rs | 70 +++++++++---------- client/consensus/Cargo.toml | 1 - client/consensus/src/lib.rs | 15 ++-- client/db/src/lib.rs | 5 +- client/db/src/parity_db_adapter.rs | 5 +- client/db/src/upgrade.rs | 46 +++++------- client/db/src/utils.rs | 36 +++------- client/mapping-sync/src/lib.rs | 44 +++++++----- client/mapping-sync/src/worker.rs | 21 +++--- client/rpc/Cargo.toml | 1 - client/rpc/src/eth/block.rs | 14 ++-- client/rpc/src/eth/cache/mod.rs | 16 ++--- client/rpc/src/eth/client.rs | 15 ++-- client/rpc/src/eth/execute.rs | 17 ++--- client/rpc/src/eth/fee.rs | 13 ++-- client/rpc/src/eth/filter.rs | 22 +++--- client/rpc/src/eth/mod.rs | 28 ++++---- client/rpc/src/eth/state.rs | 16 ++--- client/rpc/src/eth/submit.rs | 17 ++--- client/rpc/src/eth/transaction.rs | 13 ++-- client/rpc/src/eth_pubsub.rs | 16 ++--- client/rpc/src/lib.rs | 51 +++++++------- client/rpc/src/net.rs | 6 +- client/rpc/src/web3.rs | 5 +- client/storage/src/lib.rs | 5 +- .../src/overrides/schema_v1_override.rs | 4 +- .../src/overrides/schema_v2_override.rs | 4 +- .../src/overrides/schema_v3_override.rs | 4 +- template/node/src/rpc/eth.rs | 23 +++--- template/node/src/rpc/mod.rs | 19 +++-- 33 files changed, 259 insertions(+), 307 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ddd29b033..3697523a03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1868,7 +1868,6 @@ dependencies = [ "fc-db", "fp-consensus", "fp-rpc", - "sc-client-api", "sc-consensus", "sp-api", "sp-block-builder", @@ -1956,7 +1955,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-storage", "substrate-prometheus-endpoint", "substrate-test-runtime-client", "tempfile", diff --git a/client/cli/src/frontier_db_cmd/mapping_db.rs b/client/cli/src/frontier_db_cmd/mapping_db.rs index e8847b1b6d..cf12ee96d2 100644 --- a/client/cli/src/frontier_db_cmd/mapping_db.rs +++ b/client/cli/src/frontier_db_cmd/mapping_db.rs @@ -21,6 +21,8 @@ use std::sync::Arc; use ethereum_types::H256; use serde::Deserialize; // Substrate +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; // Frontier use fp_rpc::EthereumRuntimeRPCApi; @@ -46,9 +48,9 @@ pub struct MappingDb<'a, C, B: BlockT> { impl<'a, C, B: BlockT> MappingDb<'a, C, B> where - C: sp_api::ProvideRuntimeApi, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - C: sp_blockchain::HeaderBackend, + C: HeaderBackend, { pub fn new(cmd: &'a FrontierDbCmd, client: Arc, backend: Arc>) -> Self { Self { diff --git a/client/cli/src/frontier_db_cmd/mod.rs b/client/cli/src/frontier_db_cmd/mod.rs index 976697deb6..b3f8762e38 100644 --- a/client/cli/src/frontier_db_cmd/mod.rs +++ b/client/cli/src/frontier_db_cmd/mod.rs @@ -29,6 +29,8 @@ use ethereum_types::H256; use serde::Deserialize; // Substrate use sc_cli::{PruningParams, SharedParams}; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use self::{ @@ -102,9 +104,9 @@ impl FrontierDbCmd { backend: Arc>, ) -> sc_cli::Result<()> where - C: sp_api::ProvideRuntimeApi, + C: ProvideRuntimeApi, C::Api: fp_rpc::EthereumRuntimeRPCApi, - C: sp_blockchain::HeaderBackend, + C: HeaderBackend, { match self.column { Column::Meta => { diff --git a/client/cli/src/frontier_db_cmd/tests.rs b/client/cli/src/frontier_db_cmd/tests.rs index 9e16e143ea..f3e22c5c99 100644 --- a/client/cli/src/frontier_db_cmd/tests.rs +++ b/client/cli/src/frontier_db_cmd/tests.rs @@ -26,6 +26,7 @@ use tempfile::tempdir; // Substrate use sc_block_builder::BlockBuilderProvider; use sc_cli::DatabasePruningMode; +use sp_blockchain::HeaderBackend; use sp_consensus::BlockOrigin; use sp_io::hashing::twox_128; use sp_runtime::{ @@ -45,14 +46,11 @@ use crate::frontier_db_cmd::{Column, FrontierDbCmd, Operation}; type OpaqueBlock = Block, substrate_test_runtime_client::runtime::Extrinsic>; -pub fn open_frontier_backend( +pub fn open_frontier_backend>( client: Arc, path: PathBuf, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend, -{ - Ok(Arc::new(fc_db::Backend::::new( +) -> Result>, String> { + Ok(Arc::new(fc_db::Backend::::new( client, &fc_db::DatabaseSettings { source: sc_client_db::DatabaseSource::RocksDb { @@ -129,8 +127,8 @@ fn schema_create_success_if_value_is_empty() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().ethereum_schema(), Ok(None)); @@ -160,8 +158,8 @@ fn schema_create_fails_if_value_is_not_empty() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let data_before = vec![(EthereumStorageSchema::V2, H256::default())]; @@ -191,8 +189,8 @@ fn schema_read_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().ethereum_schema(), Ok(None)); @@ -223,8 +221,8 @@ fn schema_update_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().ethereum_schema(), Ok(None)); // Run the command @@ -250,8 +248,8 @@ fn schema_delete_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let data = vec![(EthereumStorageSchema::V2, H256::default())]; @@ -281,8 +279,8 @@ fn tips_create_success_if_value_is_empty() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().current_syncing_tips(), Ok(vec![])); // Run the command @@ -310,8 +308,8 @@ fn tips_create_fails_if_value_is_not_empty() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let data_before = vec![H256::default()]; @@ -340,8 +338,8 @@ fn tips_read_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().current_syncing_tips(), Ok(vec![])); @@ -371,8 +369,8 @@ fn tips_update_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); assert_eq!(backend.meta().current_syncing_tips(), Ok(vec![])); // Run the command @@ -398,8 +396,8 @@ fn tips_delete_works() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let data = vec![H256::default()]; @@ -429,8 +427,8 @@ fn non_existent_meta_static_keys_are_no_op() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let client = client; let data = vec![(EthereumStorageSchema::V1, H256::default())]; @@ -503,8 +501,8 @@ fn not_deserializable_input_value_is_no_op() { let (client, _) = TestClientBuilder::new().build_with_native_executor::(None); let client = Arc::new(client); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); let client = client; // Run the Create command @@ -560,8 +558,8 @@ fn commitment_create() { let test_value_path = test_json_file(&tmp, &TestValue::Commitment(block_hash)); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); // Run the command using some ethereum block hash as key. let ethereum_block_hash = H256::default(); @@ -645,8 +643,8 @@ fn commitment_update() { let test_value_path = test_json_file(&tmp, &TestValue::Commitment(block_a1_hash)); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); // Run the command using some ethereum block hash as key. let ethereum_block_hash = H256::default(); @@ -767,8 +765,8 @@ fn mapping_read_works() { let test_value_path = test_json_file(&tmp, &TestValue::Commitment(block_hash)); // Create a temporary frontier secondary DB. - let backend = - open_frontier_backend(client.clone(), tmp.into_path()).expect("a temporary db was created"); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); // Create command using some ethereum block hash as key. let ethereum_block_hash = H256::default(); diff --git a/client/consensus/Cargo.toml b/client/consensus/Cargo.toml index f95f5454e1..83b8e69a68 100644 --- a/client/consensus/Cargo.toml +++ b/client/consensus/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] async-trait = "0.1" thiserror = "1.0" # Substrate -sc-client-api = { workspace = true } sc-consensus = { workspace = true } sp-api = { workspace = true } sp-block-builder = { workspace = true, features = ["std"] } diff --git a/client/consensus/src/lib.rs b/client/consensus/src/lib.rs index 88b3a4361d..39b17cce14 100644 --- a/client/consensus/src/lib.rs +++ b/client/consensus/src/lib.rs @@ -19,11 +19,10 @@ use std::{collections::HashMap, marker::PhantomData, sync::Arc}; // Substrate -use sc_client_api::{backend::AuxStore, BlockOf}; use sc_consensus::{BlockCheckParams, BlockImport, BlockImportParams, ImportResult}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder as BlockBuilderApi; -use sp_blockchain::{well_known_cache_keys::Id as CacheKeyId, HeaderBackend}; +use sp_blockchain::well_known_cache_keys::Id as CacheKeyId; use sp_consensus::Error as ConsensusError; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; // Frontier @@ -82,11 +81,10 @@ impl, C> Clone for FrontierBlockImp impl FrontierBlockImport where B: BlockT, - I: BlockImport> + Send + Sync, + I: BlockImport>, I::Error: Into, - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + AuxStore + BlockOf, - C::Api: EthereumRuntimeRPCApi, - C::Api: BlockBuilderApi, + C: ProvideRuntimeApi, + C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, { pub fn new(inner: I, client: Arc, backend: Arc>) -> Self { Self { @@ -104,9 +102,8 @@ where B: BlockT, I: BlockImport> + Send + Sync, I::Error: Into, - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + AuxStore + BlockOf, - C::Api: EthereumRuntimeRPCApi, - C::Api: BlockBuilderApi, + C: ProvideRuntimeApi + Send + Sync, + C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, { type Error = ConsensusError; type Transaction = sp_api::TransactionFor; diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 64c43533af..8f7499dde7 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -31,6 +31,7 @@ use parking_lot::Mutex; use scale_codec::{Decode, Encode}; // Substrate pub use sc_client_db::DatabaseSource; +use sp_blockchain::HeaderBackend; use sp_core::H256; pub use sp_database::Database; use sp_runtime::traits::Block as BlockT; @@ -71,7 +72,7 @@ pub fn frontier_database_dir(db_config_dir: &Path, db_path: &str) -> PathBuf { } impl Backend { - pub fn open>( + pub fn open>( client: Arc, database: &DatabaseSource, db_config_dir: &Path, @@ -102,7 +103,7 @@ impl Backend { ) } - pub fn new>( + pub fn new>( client: Arc, config: &DatabaseSettings, ) -> Result { diff --git a/client/db/src/parity_db_adapter.rs b/client/db/src/parity_db_adapter.rs index 26168ec34f..e527c2f116 100644 --- a/client/db/src/parity_db_adapter.rs +++ b/client/db/src/parity_db_adapter.rs @@ -16,9 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use sp_database::{error::DatabaseError, Change, ColumnId, Transaction}; - -use crate::Database; +// Substrate +use sp_database::{error::DatabaseError, Change, ColumnId, Database, Transaction}; fn handle_err(result: parity_db::Result) -> T { match result { diff --git a/client/db/src/upgrade.rs b/client/db/src/upgrade.rs index cd00239f27..523918a9de 100644 --- a/client/db/src/upgrade.rs +++ b/client/db/src/upgrade.rs @@ -24,11 +24,12 @@ use std::{ }; use scale_codec::{Decode, Encode}; +// Substrate +use sc_client_db::DatabaseSource; +use sp_blockchain::HeaderBackend; use sp_core::H256; use sp_runtime::traits::Block as BlockT; -use crate::DatabaseSource; - /// Version file name. const VERSION_FILE_NAME: &str = "db_version"; @@ -90,14 +91,11 @@ impl fmt::Display for UpgradeError { } /// Upgrade database to current version. -pub(crate) fn upgrade_db( +pub(crate) fn upgrade_db>( client: Arc, db_path: &Path, source: &DatabaseSource, -) -> UpgradeResult<()> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> UpgradeResult<()> { let db_version = current_version(db_path)?; match db_version { 0 => return Err(UpgradeError::UnsupportedVersion(db_version)), @@ -167,13 +165,10 @@ fn version_file_path(path: &Path) -> PathBuf { /// Migration from version1 to version2: /// - The format of the Ethereum<>Substrate block mapping changed to support equivocation. /// - Migrating schema from One-to-one to One-to-many (EthHash: Vec) relationship. -pub(crate) fn migrate_1_to_2_rocks_db( +pub(crate) fn migrate_1_to_2_rocks_db>( client: Arc, db_path: &Path, -) -> UpgradeResult -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> UpgradeResult { log::info!("🔨 Running Frontier DB migration from version 1 to version 2. Please wait."); let mut res = UpgradeVersion1To2Summary { success: 0, @@ -251,13 +246,10 @@ where Ok(res) } -pub(crate) fn migrate_1_to_2_parity_db( +pub(crate) fn migrate_1_to_2_parity_db>( client: Arc, db_path: &Path, -) -> UpgradeResult -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> UpgradeResult { log::info!("🔨 Running Frontier DB migration from version 1 to version 2. Please wait."); let mut res = UpgradeVersion1To2Summary { success: 0, @@ -342,26 +334,22 @@ mod tests { }; use scale_codec::Encode; + use sp_blockchain::HeaderBackend; use sp_core::H256; use sp_runtime::{ generic::{Block, BlockId, Header}, - traits::BlakeTwo256, + traits::{BlakeTwo256, Block as BlockT}, }; use tempfile::tempdir; type OpaqueBlock = Block, substrate_test_runtime_client::runtime::Extrinsic>; - pub fn open_frontier_backend( + pub fn open_frontier_backend>( client: Arc, setting: &crate::DatabaseSettings, - ) -> Result>, String> - where - C: sp_blockchain::HeaderBackend, - { - Ok(Arc::new(crate::Backend::::new( - client, setting, - )?)) + ) -> Result>, String> { + Ok(Arc::new(crate::Backend::::new(client, setting)?)) } #[test] @@ -406,7 +394,7 @@ mod tests { let mut transaction_hashes = vec![]; { // Create a temporary frontier secondary DB. - let backend = open_frontier_backend(client.clone(), &setting) + let backend = open_frontier_backend::(client.clone(), &setting) .expect("a temporary db was created"); // Fill the tmp db with some data @@ -487,8 +475,8 @@ mod tests { let _ = super::upgrade_db::(client.clone(), &path, &setting.source); // Check data after migration - let backend = - open_frontier_backend(client, &setting).expect("a temporary db was created"); + let backend = open_frontier_backend::(client, &setting) + .expect("a temporary db was created"); for (i, original_ethereum_hash) in ethereum_hashes.iter().enumerate() { let canon_substrate_block_hash = substrate_hashes.get(i).expect("Block hash"); let mapped_block = backend diff --git a/client/db/src/utils.rs b/client/db/src/utils.rs index bf11e7d9f6..777ac33099 100644 --- a/client/db/src/utils.rs +++ b/client/db/src/utils.rs @@ -18,17 +18,15 @@ use std::{path::Path, sync::Arc}; +use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use crate::{Database, DatabaseSettings, DatabaseSource, DbHash}; -pub fn open_database( +pub fn open_database>( client: Arc, config: &DatabaseSettings, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> Result>, String> { let db: Arc> = match &config.source { DatabaseSource::ParityDb { path } => { open_parity_db::(client, path, &config.source)? @@ -53,15 +51,12 @@ where } #[cfg(feature = "kvdb-rocksdb")] -fn open_kvdb_rocksdb( +fn open_kvdb_rocksdb>( client: Arc, path: &Path, create: bool, _source: &DatabaseSource, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> Result>, String> { // first upgrade database to required version #[cfg(not(test))] match crate::upgrade::upgrade_db::(client, path, _source) { @@ -80,27 +75,21 @@ where } #[cfg(not(feature = "kvdb-rocksdb"))] -fn open_kvdb_rocksdb( +fn open_kvdb_rocksdb>( _client: Arc, _path: &Path, _create: bool, _source: &DatabaseSource, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> Result>, String> { Err("Missing feature flags `kvdb-rocksdb`".to_string()) } #[cfg(feature = "parity-db")] -fn open_parity_db( +fn open_parity_db>( client: Arc, path: &Path, _source: &DatabaseSource, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> Result>, String> { // first upgrade database to required version #[cfg(not(test))] match crate::upgrade::upgrade_db::(client, path, _source) { @@ -118,13 +107,10 @@ where } #[cfg(not(feature = "parity-db"))] -fn open_parity_db( +fn open_parity_db>( _client: Arc, _path: &Path, _source: &DatabaseSource, -) -> Result>, String> -where - C: sp_blockchain::HeaderBackend + Send + Sync, -{ +) -> Result>, String> { Err("Missing feature flags `parity-db`".to_string()) } diff --git a/client/mapping-sync/src/lib.rs b/client/mapping-sync/src/lib.rs index c9a0bb4d81..f84397b327 100644 --- a/client/mapping-sync/src/lib.rs +++ b/client/mapping-sync/src/lib.rs @@ -23,9 +23,9 @@ mod worker; pub use worker::{MappingSyncWorker, SyncStrategy}; // Substrate -use sc_client_api::BlockOf; +use sc_client_api::backend::Backend; use sp_api::{ApiExt, ProvideRuntimeApi}; -use sp_blockchain::HeaderBackend; +use sp_blockchain::{Backend as _, HeaderBackend}; use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, Header as HeaderT, Zero}, @@ -66,7 +66,7 @@ pub fn sync_genesis_block( header: &Block::Header, ) -> Result<(), String> where - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + BlockOf, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, { let id = BlockId::Hash(header.hash()); @@ -106,22 +106,26 @@ where Ok(()) } -pub fn sync_one_block( +pub fn sync_one_block( client: &C, - substrate_backend: &B, + substrate_backend: &BE, frontier_backend: &fc_db::Backend, sync_from: ::Number, strategy: SyncStrategy, ) -> Result where - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + BlockOf, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - B: sp_blockchain::HeaderBackend + sp_blockchain::Backend, + C: HeaderBackend, + BE: Backend, { let mut current_syncing_tips = frontier_backend.meta().current_syncing_tips()?; if current_syncing_tips.is_empty() { - let mut leaves = substrate_backend.leaves().map_err(|e| format!("{:?}", e))?; + let mut leaves = substrate_backend + .blockchain() + .leaves() + .map_err(|e| format!("{:?}", e))?; if leaves.is_empty() { return Ok(false); } @@ -130,9 +134,12 @@ where let mut operating_header = None; while let Some(checking_tip) = current_syncing_tips.pop() { - if let Some(checking_header) = - fetch_header(substrate_backend, frontier_backend, checking_tip, sync_from)? - { + if let Some(checking_header) = fetch_header( + substrate_backend.blockchain(), + frontier_backend, + checking_tip, + sync_from, + )? { operating_header = Some(checking_header); break; } @@ -170,18 +177,19 @@ where } } -pub fn sync_blocks( +pub fn sync_blocks( client: &C, - substrate_backend: &B, + substrate_backend: &BE, frontier_backend: &fc_db::Backend, limit: usize, sync_from: ::Number, strategy: SyncStrategy, ) -> Result where - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + BlockOf, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - B: sp_blockchain::HeaderBackend + sp_blockchain::Backend, + C: HeaderBackend, + BE: Backend, { let mut synced_any = false; @@ -199,14 +207,14 @@ where Ok(synced_any) } -pub fn fetch_header( - substrate_backend: &B, +pub fn fetch_header( + substrate_backend: &BE, frontier_backend: &fc_db::Backend, checking_tip: Block::Hash, sync_from: ::Number, ) -> Result, String> where - B: sp_blockchain::HeaderBackend + sp_blockchain::Backend, + BE: HeaderBackend, { if frontier_backend.mapping().is_synced(&checking_tip)? { return Ok(None); diff --git a/client/mapping-sync/src/worker.rs b/client/mapping-sync/src/worker.rs index d62c2047ab..6fbe25d705 100644 --- a/client/mapping-sync/src/worker.rs +++ b/client/mapping-sync/src/worker.rs @@ -25,7 +25,7 @@ use futures::{ use futures_timer::Delay; use log::debug; // Substrate -use sc_client_api::{BlockOf, ImportNotifications}; +use sc_client_api::{backend::Backend, client::ImportNotifications}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; @@ -38,13 +38,13 @@ pub enum SyncStrategy { Parachain, } -pub struct MappingSyncWorker { +pub struct MappingSyncWorker { import_notifications: ImportNotifications, timeout: Duration, inner_delay: Option, client: Arc, - substrate_backend: Arc, + substrate_backend: Arc, frontier_backend: Arc>, have_next: bool, @@ -53,14 +53,14 @@ pub struct MappingSyncWorker { strategy: SyncStrategy, } -impl Unpin for MappingSyncWorker {} +impl Unpin for MappingSyncWorker {} -impl MappingSyncWorker { +impl MappingSyncWorker { pub fn new( import_notifications: ImportNotifications, timeout: Duration, client: Arc, - substrate_backend: Arc, + substrate_backend: Arc, frontier_backend: Arc>, retry_times: usize, sync_from: ::Number, @@ -83,11 +83,12 @@ impl MappingSyncWorker { } } -impl Stream for MappingSyncWorker +impl Stream for MappingSyncWorker where - C: ProvideRuntimeApi + Send + Sync + HeaderBackend + BlockOf, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - B: sc_client_api::Backend, + C: HeaderBackend, + BE: Backend, { type Item = (); @@ -123,7 +124,7 @@ where match crate::sync_blocks( self.client.as_ref(), - self.substrate_backend.blockchain(), + self.substrate_backend.as_ref(), self.frontier_backend.as_ref(), self.retry_times, self.sync_from, diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 0870f14bc7..6775cb5ea2 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -42,7 +42,6 @@ sp-consensus = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-storage = { workspace = true } # Frontier fc-db = { workspace = true } fc-rpc-core = { workspace = true } diff --git a/client/rpc/src/eth/block.rs b/client/rpc/src/eth/block.rs index f2324af95b..96a357382d 100644 --- a/client/rpc/src/eth/block.rs +++ b/client/rpc/src/eth/block.rs @@ -21,16 +21,13 @@ use std::sync::Arc; use ethereum_types::{H256, U256}; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::{ - generic::BlockId, - traits::{BlakeTwo256, Block as BlockT}, -}; +use sp_runtime::{generic::BlockId, traits::Block as BlockT}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -42,12 +39,11 @@ use crate::{ impl Eth where - B: BlockT + Send + Sync + 'static, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + B: BlockT, C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - BE: Backend + 'static, - BE::State: StateBackend, + C: HeaderBackend + StorageProvider + 'static, + BE: Backend, { pub async fn block_by_hash(&self, hash: H256, full: bool) -> Result> { let client = Arc::clone(&self.client); diff --git a/client/rpc/src/eth/cache/mod.rs b/client/rpc/src/eth/cache/mod.rs index de9d94b910..1dcd755e35 100644 --- a/client/rpc/src/eth/cache/mod.rs +++ b/client/rpc/src/eth/cache/mod.rs @@ -25,12 +25,12 @@ use std::{ }; use ethereum::BlockV2 as EthereumBlock; -use ethereum_types::{H256, U256}; +use ethereum_types::U256; use futures::StreamExt; use tokio::sync::{mpsc, oneshot}; // Substrate use sc_client_api::{ - backend::{Backend, StateBackend, StorageProvider}, + backend::{Backend, StorageProvider}, client::BlockchainEvents, }; use sc_service::SpawnTaskHandle; @@ -38,7 +38,7 @@ use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, Header as HeaderT, UniqueSaturatedInto}, + traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}, }; // Frontier use fc_rpc_core::types::*; @@ -274,12 +274,12 @@ pub struct EthTask(PhantomData<(B, C, BE)>); impl EthTask where - B: BlockT, - C: ProvideRuntimeApi + StorageProvider + BlockchainEvents, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: BlockchainEvents + 'static, + C: HeaderBackend + StorageProvider, BE: Backend + 'static, - BE::State: StateBackend, { pub async fn filter_pool_task( client: Arc, @@ -311,7 +311,7 @@ where } // Calculates the cache for a single block #[rustfmt::skip] - let fee_history_cache_item = |hash: H256| -> ( + let fee_history_cache_item = |hash: B::Hash| -> ( FeeHistoryCacheItem, Option ) { diff --git a/client/rpc/src/eth/client.rs b/client/rpc/src/eth/client.rs index b7d585aee7..17f97bdf19 100644 --- a/client/rpc/src/eth/client.rs +++ b/client/rpc/src/eth/client.rs @@ -16,10 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use ethereum_types::{H160, H256, U256, U64}; +use ethereum_types::{H160, U256, U64}; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; @@ -27,7 +27,7 @@ use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto}, + traits::{Block as BlockT, UniqueSaturatedInto}, }; // Frontier use fc_rpc_core::types::*; @@ -37,12 +37,11 @@ use crate::{eth::Eth, internal_err}; impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - BE: Backend + 'static, - BE::State: StateBackend, + C: HeaderBackend + StorageProvider + 'static, + BE: Backend, { pub fn protocol_version(&self) -> Result { Ok(1) diff --git a/client/rpc/src/eth/execute.rs b/client/rpc/src/eth/execute.rs index a96a17fd76..e377d29bb6 100644 --- a/client/rpc/src/eth/execute.rs +++ b/client/rpc/src/eth/execute.rs @@ -18,21 +18,17 @@ use std::sync::Arc; -use ethereum_types::{H256, U256}; +use ethereum_types::U256; use evm::{ExitError, ExitReason}; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - generic::BlockId, - traits::{BlakeTwo256, Block as BlockT}, - SaturatedConversion, -}; +use sp_runtime::{generic::BlockId, traits::Block as BlockT, SaturatedConversion}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -65,12 +61,11 @@ impl EstimateGasAdapter for () { impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, A: ChainApi + 'static, EGA: EstimateGasAdapter, { diff --git a/client/rpc/src/eth/fee.rs b/client/rpc/src/eth/fee.rs index 2c9412a5c2..94c6b1bff1 100644 --- a/client/rpc/src/eth/fee.rs +++ b/client/rpc/src/eth/fee.rs @@ -16,17 +16,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use ethereum_types::{H256, U256}; +use ethereum_types::U256; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto}, + traits::{Block as BlockT, UniqueSaturatedInto}, }; // Frontier use fc_rpc_core::types::*; @@ -36,12 +36,11 @@ use crate::{eth::Eth, frontier_backend_client, internal_err}; impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, { pub fn gas_price(&self) -> Result { let block = BlockId::Hash(self.client.info().best_hash); diff --git a/client/rpc/src/eth/filter.rs b/client/rpc/src/eth/filter.rs index e651a38b12..ef23800108 100644 --- a/client/rpc/src/eth/filter.rs +++ b/client/rpc/src/eth/filter.rs @@ -22,13 +22,13 @@ use ethereum::BlockV2 as EthereumBlock; use ethereum_types::{H256, U256}; use jsonrpsee::core::{async_trait, RpcResult as Result}; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, NumberFor, One, Saturating, UniqueSaturatedInto}, + traits::{Block as BlockT, NumberFor, One, Saturating, UniqueSaturatedInto}, }; // Frontier use fc_rpc_core::{types::*, EthFilterApiServer}; @@ -69,8 +69,8 @@ impl EthFilter { impl EthFilter where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend, { fn create_filter(&self, filter_type: FilterType) -> Result { let block_number = @@ -111,12 +111,11 @@ where #[async_trait] impl EthFilterApiServer for EthFilter where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, { fn new_filter(&self, filter: Filter) -> Result { self.create_filter(FilterType::Log(filter)) @@ -426,12 +425,11 @@ async fn filter_range_logs( to: NumberFor, ) -> Result<()> where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, { // Max request duration of 10 seconds. let max_duration = time::Duration::from_secs(10); diff --git a/client/rpc/src/eth/mod.rs b/client/rpc/src/eth/mod.rs index f481b06be0..864d79dab2 100644 --- a/client/rpc/src/eth/mod.rs +++ b/client/rpc/src/eth/mod.rs @@ -34,7 +34,7 @@ use ethereum::{BlockV2 as EthereumBlock, TransactionV2 as EthereumTransaction}; use ethereum_types::{H160, H256, H512, H64, U256, U64}; use jsonrpsee::core::{async_trait, RpcResult as Result}; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network::NetworkService; use sc_network_common::ExHashT; use sc_transaction_pool::{ChainApi, Pool}; @@ -45,12 +45,14 @@ use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; use sp_runtime::{ generic::BlockId, - traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto}, + traits::{Block as BlockT, UniqueSaturatedInto}, }; // Frontier use fc_rpc_core::{types::*, EthApiServer}; use fc_storage::OverrideHandle; -use fp_rpc::{ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi, TransactionStatus}; +use fp_rpc::{ + ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi, TransactionStatus, +}; use crate::{internal_err, public_key, signer::EthSigner}; @@ -158,14 +160,13 @@ impl Eth EthApiServer for Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: BlockBuilderApi + ConvertTransactionRuntimeApi + EthereumRuntimeRPCApi, - P: TransactionPool + Send + Sync + 'static, - CT: fp_rpc::ConvertTransaction<::Extrinsic> + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, + P: TransactionPool + 'static, + CT: ConvertTransaction<::Extrinsic> + Send + Sync + 'static, A: ChainApi + 'static, EGA: EstimateGasAdapter + Send + Sync + 'static, { @@ -507,12 +508,11 @@ fn pending_runtime_api<'a, B: BlockT, C, BE, A: ChainApi>( graph: &'a Pool, ) -> Result> where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, - BE: Backend + 'static, - BE::State: StateBackend, + C: HeaderBackend + StorageProvider + 'static, + BE: Backend, A: ChainApi + 'static, { // In case of Pending, we need an overlayed state to query over. diff --git a/client/rpc/src/eth/state.rs b/client/rpc/src/eth/state.rs index 953c416d3f..ce26afb9cc 100644 --- a/client/rpc/src/eth/state.rs +++ b/client/rpc/src/eth/state.rs @@ -20,17 +20,14 @@ use ethereum_types::{H160, H256, U256}; use jsonrpsee::core::RpcResult as Result; use scale_codec::Encode; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sc_transaction_pool_api::{InPoolTransaction, TransactionPool}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - generic::BlockId, - traits::{BlakeTwo256, Block as BlockT}, -}; +use sp_runtime::{generic::BlockId, traits::Block as BlockT}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -42,13 +39,12 @@ use crate::{ impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: BlockBuilderApi + EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, - P: TransactionPool + Send + Sync + 'static, + P: TransactionPool + 'static, A: ChainApi + 'static, { pub fn balance(&self, address: H160, number: Option) -> Result { diff --git a/client/rpc/src/eth/submit.rs b/client/rpc/src/eth/submit.rs index dbfabd6500..ee4a676f4d 100644 --- a/client/rpc/src/eth/submit.rs +++ b/client/rpc/src/eth/submit.rs @@ -20,7 +20,7 @@ use ethereum_types::H256; use futures::future::TryFutureExt; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sc_transaction_pool_api::TransactionPool; @@ -28,9 +28,7 @@ use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; use sp_runtime::{ - generic::BlockId, - traits::{BlakeTwo256, Block as BlockT}, - transaction_validity::TransactionSource, + generic::BlockId, traits::Block as BlockT, transaction_validity::TransactionSource, }; // Frontier use fc_rpc_core::types::*; @@ -43,14 +41,13 @@ use crate::{ impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: BlockBuilderApi + ConvertTransactionRuntimeApi + EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, - P: TransactionPool + Send + Sync + 'static, - CT: ConvertTransaction<::Extrinsic> + Send + Sync + 'static, + P: TransactionPool + 'static, + CT: ConvertTransaction<::Extrinsic> + 'static, A: ChainApi + 'static, { pub async fn send_transaction(&self, request: TransactionRequest) -> Result { diff --git a/client/rpc/src/eth/transaction.rs b/client/rpc/src/eth/transaction.rs index 861382a11f..9405416f29 100644 --- a/client/rpc/src/eth/transaction.rs +++ b/client/rpc/src/eth/transaction.rs @@ -22,17 +22,14 @@ use ethereum::TransactionV2 as EthereumTransaction; use ethereum_types::{H256, U256, U64}; use jsonrpsee::core::RpcResult as Result; // Substrate -use sc_client_api::backend::{Backend, StateBackend, StorageProvider}; +use sc_client_api::backend::{Backend, StorageProvider}; use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sc_transaction_pool_api::InPoolTransaction; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::{ - generic::BlockId, - traits::{BlakeTwo256, Block as BlockT}, -}; +use sp_runtime::{generic::BlockId, traits::Block as BlockT}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -44,11 +41,11 @@ use crate::{ impl Eth where - B: BlockT + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider + HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, - BE::State: StateBackend, A: ChainApi + 'static, { pub async fn transaction_by_hash(&self, hash: H256) -> Result> { diff --git a/client/rpc/src/eth_pubsub.rs b/client/rpc/src/eth_pubsub.rs index 235015d8bb..8e7bd9e39c 100644 --- a/client/rpc/src/eth_pubsub.rs +++ b/client/rpc/src/eth_pubsub.rs @@ -24,7 +24,7 @@ use futures::{FutureExt as _, StreamExt as _}; use jsonrpsee::{types::SubscriptionResult, SubscriptionSink}; // Substrate use sc_client_api::{ - backend::{Backend, StateBackend, StorageProvider}, + backend::{Backend, StorageProvider}, client::BlockchainEvents, }; use sc_network::{NetworkService, NetworkStatusProvider}; @@ -35,7 +35,7 @@ use sp_api::{ApiExt, BlockId, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle; use sp_core::hashing::keccak_256; -use sp_runtime::traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto}; +use sp_runtime::traits::{Block as BlockT, UniqueSaturatedInto}; // Frontier use fc_rpc_core::{ types::{ @@ -69,7 +69,7 @@ pub struct EthPubSub { impl EthPubSub where - C: HeaderBackend + Send + Sync + 'static, + C: HeaderBackend, { pub fn new( pool: Arc

, @@ -195,13 +195,13 @@ impl EthSubscriptionResult { impl EthPubSubApiServer for EthPubSub where - B: BlockT + Send + Sync + 'static, - P: TransactionPool + Send + Sync + 'static, - C: ProvideRuntimeApi + StorageProvider + BlockchainEvents, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + P: TransactionPool + 'static, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: BlockchainEvents + 'static, + C: HeaderBackend + StorageProvider, BE: Backend + 'static, - BE::State: StateBackend, { fn subscribe( &self, diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 5388bdb892..58c50b75d5 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -68,8 +68,8 @@ pub mod frontier_backend_client { number: Option, ) -> RpcResult>> where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { Ok(match number.unwrap_or(BlockNumber::Latest) { BlockNumber::Hash { hash, .. } => { @@ -94,8 +94,8 @@ pub mod frontier_backend_client { hash: H256, ) -> RpcResult> where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { let substrate_hashes = backend .mapping() @@ -116,8 +116,8 @@ pub mod frontier_backend_client { backend: &fc_db::Backend, ) -> RpcResult>> where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { let cache = backend .meta() @@ -131,8 +131,8 @@ pub mod frontier_backend_client { new_cache: Vec<(EthereumStorageSchema, H256)>, ) -> RpcResult<()> where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { backend .meta() @@ -141,10 +141,10 @@ pub mod frontier_backend_client { Ok(()) } - pub fn is_canon(client: &C, target_hash: H256) -> bool + pub fn is_canon(client: &C, target_hash: B::Hash) -> bool where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { if let Ok(Some(number)) = client.number(target_hash) { if let Ok(Some(hash)) = client.hash(number) { @@ -161,8 +161,8 @@ pub mod frontier_backend_client { only_canonical: bool, ) -> RpcResult> where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + Send + Sync + 'static, + B: BlockT, + C: HeaderBackend + 'static, { let transaction_metadata = backend .mapping() @@ -245,10 +245,11 @@ mod tests { use futures::executor; use sc_block_builder::BlockBuilderProvider; + use sp_blockchain::HeaderBackend; use sp_consensus::BlockOrigin; use sp_runtime::{ generic::{Block, BlockId, Header}, - traits::BlakeTwo256, + traits::{BlakeTwo256, Block as BlockT}, }; use substrate_test_runtime_client::{ prelude::*, DefaultTestClientBuilderExt, TestClientBuilder, @@ -258,14 +259,11 @@ mod tests { type OpaqueBlock = Block, substrate_test_runtime_client::runtime::Extrinsic>; - fn open_frontier_backend( + fn open_frontier_backend>( client: Arc, path: PathBuf, - ) -> Result>, String> - where - C: sp_blockchain::HeaderBackend, - { - Ok(Arc::new(fc_db::Backend::::new( + ) -> Result>, String> { + Ok(Arc::new(fc_db::Backend::::new( client, &fc_db::DatabaseSettings { source: sc_client_db::DatabaseSource::RocksDb { @@ -287,7 +285,8 @@ mod tests { let mut client = Arc::new(client); // Create a temporary frontier secondary DB. - let frontier_backend = open_frontier_backend(client.clone(), tmp.into_path()).unwrap(); + let backend = open_frontier_backend::(client.clone(), tmp.into_path()) + .expect("a temporary db was created"); // A random ethereum block hash to use let ethereum_block_hash = sp_core::H256::random(); @@ -314,13 +313,13 @@ mod tests { ethereum_block_hash, ethereum_transaction_hashes: vec![], }; - let _ = frontier_backend.mapping().write_hashes(commitment); + let _ = backend.mapping().write_hashes(commitment); // Expect B1 to be canon assert_eq!( super::frontier_backend_client::load_hash( client.as_ref(), - frontier_backend.as_ref(), + backend.as_ref(), ethereum_block_hash ) .unwrap() @@ -343,13 +342,13 @@ mod tests { ethereum_block_hash, ethereum_transaction_hashes: vec![], }; - let _ = frontier_backend.mapping().write_hashes(commitment); + let _ = backend.mapping().write_hashes(commitment); // Still expect B1 to be canon assert_eq!( super::frontier_backend_client::load_hash( client.as_ref(), - frontier_backend.as_ref(), + backend.as_ref(), ethereum_block_hash ) .unwrap() @@ -369,7 +368,7 @@ mod tests { assert_eq!( super::frontier_backend_client::load_hash( client.as_ref(), - frontier_backend.as_ref(), + backend.as_ref(), ethereum_block_hash ) .unwrap() diff --git a/client/rpc/src/net.rs b/client/rpc/src/net.rs index 6066a11f2a..4b12efc014 100644 --- a/client/rpc/src/net.rs +++ b/client/rpc/src/net.rs @@ -18,7 +18,6 @@ use std::sync::Arc; -use ethereum_types::H256; use jsonrpsee::core::RpcResult as Result; // Substrate use sc_network::NetworkService; @@ -55,9 +54,10 @@ impl Net { impl NetApiServer for Net where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + ProvideRuntimeApi + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + 'static, { fn version(&self) -> Result { let hash = self.client.info().best_hash; diff --git a/client/rpc/src/web3.rs b/client/rpc/src/web3.rs index 417db683b2..4f97b78315 100644 --- a/client/rpc/src/web3.rs +++ b/client/rpc/src/web3.rs @@ -48,9 +48,10 @@ impl Web3 { impl Web3ApiServer for Web3 where - B: BlockT + Send + Sync + 'static, - C: HeaderBackend + ProvideRuntimeApi + Send + Sync + 'static, + B: BlockT, + C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, + C: HeaderBackend + 'static, { fn client_version(&self) -> Result { let hash = self.client.info().best_hash; diff --git a/client/storage/src/lib.rs b/client/storage/src/lib.rs index 88ef59f8e1..b9496a6e69 100644 --- a/client/storage/src/lib.rs +++ b/client/storage/src/lib.rs @@ -29,13 +29,14 @@ use sp_blockchain::HeaderBackend; use sp_runtime::traits::Block as BlockT; use sp_storage::StorageKey; // Frontier +use fp_rpc::EthereumRuntimeRPCApi; use fp_storage::{EthereumStorageSchema, PALLET_ETHEREUM_SCHEMA}; pub fn overrides_handle(client: Arc) -> Arc> where B: BlockT, C: ProvideRuntimeApi, - C::Api: fp_rpc::EthereumRuntimeRPCApi, + C::Api: EthereumRuntimeRPCApi, C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { @@ -62,7 +63,7 @@ where pub fn onchain_storage_schema(client: &C, hash: B::Hash) -> EthereumStorageSchema where B: BlockT, - C: StorageProvider + HeaderBackend, + C: HeaderBackend + StorageProvider, BE: Backend, { match client.storage(hash, &StorageKey(PALLET_ETHEREUM_SCHEMA.to_vec())) { diff --git a/client/storage/src/overrides/schema_v1_override.rs b/client/storage/src/overrides/schema_v1_override.rs index 477699cc7f..088e7fd0d1 100644 --- a/client/storage/src/overrides/schema_v1_override.rs +++ b/client/storage/src/overrides/schema_v1_override.rs @@ -49,7 +49,7 @@ impl SchemaV1Override { impl SchemaV1Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { @@ -65,7 +65,7 @@ where impl StorageOverride for SchemaV1Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { /// For a given account address, returns pallet_evm::AccountCodes. diff --git a/client/storage/src/overrides/schema_v2_override.rs b/client/storage/src/overrides/schema_v2_override.rs index fef92aa9a0..d21cf1e40e 100644 --- a/client/storage/src/overrides/schema_v2_override.rs +++ b/client/storage/src/overrides/schema_v2_override.rs @@ -49,7 +49,7 @@ impl SchemaV2Override { impl SchemaV2Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { @@ -65,7 +65,7 @@ where impl StorageOverride for SchemaV2Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { /// For a given account address, returns pallet_evm::AccountCodes. diff --git a/client/storage/src/overrides/schema_v3_override.rs b/client/storage/src/overrides/schema_v3_override.rs index a833d0aa59..6dd3494bb2 100644 --- a/client/storage/src/overrides/schema_v3_override.rs +++ b/client/storage/src/overrides/schema_v3_override.rs @@ -49,7 +49,7 @@ impl SchemaV3Override { impl SchemaV3Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { fn query_storage(&self, block_hash: B::Hash, key: &StorageKey) -> Option { @@ -65,7 +65,7 @@ where impl StorageOverride for SchemaV3Override where B: BlockT, - C: StorageProvider + HeaderBackend + Send + Sync + 'static, + C: HeaderBackend + StorageProvider + 'static, BE: Backend + 'static, { /// For a given account address, returns pallet_evm::AccountCodes. diff --git a/template/node/src/rpc/eth.rs b/template/node/src/rpc/eth.rs index 8cdd13b966..5e61585541 100644 --- a/template/node/src/rpc/eth.rs +++ b/template/node/src/rpc/eth.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use jsonrpsee::RpcModule; // Substrate use sc_client_api::{ - backend::{AuxStore, Backend, StateBackend, StorageProvider}, + backend::{Backend, StorageProvider}, client::BlockchainEvents, }; use sc_network::NetworkService; @@ -11,14 +11,15 @@ use sc_rpc::SubscriptionTaskExecutor; use sc_transaction_pool::{ChainApi, Pool}; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; -use sp_core::H256; -use sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_db::Backend as FrontierBackend; pub use fc_rpc::{EthBlockDataCacheTask, OverrideHandle, StorageOverride}; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; pub use fc_storage::overrides_handle; +use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi}; /// Extra dependencies for Ethereum compatibility. pub struct EthDeps { @@ -84,19 +85,15 @@ pub fn create_eth( subscription_task_executor: SubscriptionTaskExecutor, ) -> Result, Box> where - C: ProvideRuntimeApi + StorageProvider + AuxStore, - C: BlockchainEvents, - C: HeaderBackend + HeaderMetadata + 'static, - C::Api: sp_block_builder::BlockBuilder, - C::Api: fp_rpc::EthereumRuntimeRPCApi, - C::Api: fp_rpc::ConvertTransactionRuntimeApi, + B: BlockT, + C: ProvideRuntimeApi, + C::Api: BlockBuilderApi + EthereumRuntimeRPCApi + ConvertTransactionRuntimeApi, + C: BlockchainEvents + 'static, + C: HeaderBackend + HeaderMetadata + StorageProvider, BE: Backend + 'static, - BE::State: StateBackend, P: TransactionPool + 'static, A: ChainApi + 'static, - CT: fp_rpc::ConvertTransaction<::Extrinsic> + Send + Sync + 'static, - B: BlockT, - B::Header: HeaderT, + CT: ConvertTransaction<::Extrinsic> + Send + Sync + 'static, { use fc_rpc::{ Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub, diff --git a/template/node/src/rpc/mod.rs b/template/node/src/rpc/mod.rs index e5e0165056..c8ece5713b 100644 --- a/template/node/src/rpc/mod.rs +++ b/template/node/src/rpc/mod.rs @@ -6,7 +6,7 @@ use futures::channel::mpsc; use jsonrpsee::RpcModule; // Substrate use sc_client_api::{ - backend::{AuxStore, Backend, StateBackend, StorageProvider}, + backend::{Backend, StorageProvider}, client::BlockchainEvents, }; use sc_consensus_manual_seal::rpc::EngineCommand; @@ -15,9 +15,8 @@ use sc_rpc_api::DenyUnsafe; use sc_service::TransactionPool; use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; -use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; -use sp_runtime::traits::{BlakeTwo256, Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Runtime use frontier_template_runtime::{opaque::Block, AccountId, Balance, Hash, Index}; @@ -44,17 +43,17 @@ pub fn create_full( subscription_task_executor: SubscriptionTaskExecutor, ) -> Result, Box> where - BE: Backend + 'static, - BE::State: StateBackend, - C: ProvideRuntimeApi + StorageProvider + AuxStore, - C: BlockchainEvents, - C: HeaderBackend + HeaderMetadata, - C: Send + Sync + 'static, + C: ProvideRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, - C::Api: BlockBuilder, + C::Api: sp_block_builder::BlockBuilder, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: fp_rpc::ConvertTransactionRuntimeApi, C::Api: fp_rpc::EthereumRuntimeRPCApi, + C: BlockchainEvents + 'static, + C: HeaderBackend + + HeaderMetadata + + StorageProvider, + BE: Backend + 'static, P: TransactionPool + 'static, A: ChainApi + 'static, CT: fp_rpc::ConvertTransaction<::Extrinsic> + Send + Sync + 'static, From aa4db0784da9b3bdca333d22018833e24a72b969 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Wed, 1 Mar 2023 22:26:48 +0800 Subject: [PATCH 05/17] update substrate to polkadot-v0.9.38 (#1004) * update substrate to polkadot-v0.9.38 * use features = ["default"] instead of features = ["std"] --- Cargo.lock | 378 +++++++++++++---------- client/cli/Cargo.toml | 6 +- client/consensus/Cargo.toml | 6 +- client/db/Cargo.toml | 2 +- client/mapping-sync/Cargo.toml | 4 +- client/rpc/Cargo.toml | 6 +- frame/ethereum/Cargo.toml | 2 +- frame/ethereum/src/lib.rs | 4 +- frame/evm/Cargo.toml | 2 +- frame/evm/precompile/dispatch/Cargo.toml | 2 +- frame/evm/test-vector-support/Cargo.toml | 2 +- template/node/Cargo.toml | 32 +- template/node/src/main.rs | 6 +- template/node/src/service.rs | 2 +- template/runtime/src/lib.rs | 9 + 15 files changed, 270 insertions(+), 193 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3697523a03..97b3d45f6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,6 +137,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -440,7 +452,7 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "sp-api", "sp-beefy", @@ -832,9 +844,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.4" +version = "4.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" dependencies = [ "bitflags", "clap_derive", @@ -1388,6 +1400,17 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "derive_builder" version = "0.11.2" @@ -1604,7 +1627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "sha2 0.9.9", @@ -2094,7 +2117,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", ] @@ -2197,9 +2220,10 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", + "frame-support-procedural", "frame-system", "linregress", "log", @@ -2215,12 +2239,13 @@ dependencies = [ "sp-runtime-interface", "sp-std", "sp-storage", + "static_assertions", ] [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "Inflector", "array-bytes", @@ -2267,7 +2292,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -2295,7 +2320,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "bitflags", "frame-metadata", @@ -2327,10 +2352,11 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "Inflector", "cfg-expr", + "derive-syn-parse", "frame-support-procedural-tools", "itertools", "proc-macro2", @@ -2341,7 +2367,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2353,7 +2379,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "proc-macro2", "quote", @@ -2363,7 +2389,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "log", @@ -2381,7 +2407,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-benchmarking", "frame-support", @@ -2396,7 +2422,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "sp-api", @@ -2836,9 +2862,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "heck" version = "0.4.0" @@ -3149,7 +3181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -4005,7 +4037,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -4134,7 +4166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -4405,6 +4437,20 @@ dependencies = [ "memoffset 0.6.5", ] +[[package]] +name = "nix" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +dependencies = [ + "bitflags", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", + "static_assertions", +] + [[package]] name = "nohash-hasher" version = "0.2.0" @@ -4552,7 +4598,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.12.3", "indexmap", "memchr", ] @@ -4639,7 +4685,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -4655,14 +4701,13 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", "impl-trait-for-tuples", "parity-scale-codec", "scale-info", - "sp-authorship", "sp-runtime", "sp-std", ] @@ -4670,7 +4715,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-benchmarking", "frame-support", @@ -4694,7 +4739,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-benchmarking", "frame-support", @@ -4898,7 +4943,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-benchmarking", "frame-support", @@ -4937,7 +4982,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -4958,7 +5003,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -4972,7 +5017,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-benchmarking", "frame-support", @@ -4990,7 +5035,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -5006,7 +5051,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5022,7 +5067,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5034,7 +5079,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-support", "frame-system", @@ -5980,7 +6025,7 @@ dependencies = [ "log", "netlink-packet-route", "netlink-proto", - "nix", + "nix 0.24.3", "thiserror", "tokio", ] @@ -6154,7 +6199,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "log", "sp-core", @@ -6165,7 +6210,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "futures-timer", @@ -6188,7 +6233,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6204,7 +6249,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -6219,7 +6264,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6230,7 +6275,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "chrono", @@ -6270,7 +6315,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "fnv", "futures", @@ -6296,7 +6341,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "hash-db", "kvdb", @@ -6309,6 +6354,7 @@ dependencies = [ "parking_lot 0.12.1", "sc-client-api", "sc-state-db", + "schnellru", "sp-arithmetic", "sp-blockchain", "sp-core", @@ -6321,7 +6367,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -6346,7 +6392,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -6375,7 +6421,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "fork-tree", @@ -6413,7 +6459,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6426,7 +6472,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "assert_matches", "async-trait", @@ -6460,7 +6506,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -6483,7 +6529,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "lru", "parity-scale-codec", @@ -6507,7 +6553,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -6520,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "log", "sc-allocator", @@ -6533,7 +6579,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "cfg-if", "libc", @@ -6550,9 +6596,9 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ - "ahash", + "ahash 0.8.3", "array-bytes", "async-trait", "dyn-clone", @@ -6590,7 +6636,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "ansi_term", "futures", @@ -6605,7 +6651,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "async-trait", @@ -6620,7 +6666,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "async-trait", @@ -6662,7 +6708,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "cid", "futures", @@ -6681,7 +6727,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "bitflags", @@ -6707,9 +6753,9 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ - "ahash", + "ahash 0.8.3", "futures", "futures-timer", "libp2p", @@ -6725,7 +6771,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "futures", @@ -6746,7 +6792,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "async-trait", @@ -6778,7 +6824,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "futures", @@ -6797,7 +6843,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "bytes", @@ -6827,7 +6873,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "libp2p", @@ -6840,7 +6886,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6849,7 +6895,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "jsonrpsee", @@ -6873,12 +6919,13 @@ dependencies = [ "sp-runtime", "sp-session", "sp-version", + "tokio", ] [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -6897,7 +6944,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "http", "jsonrpsee", @@ -6912,7 +6959,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "futures", @@ -6938,7 +6985,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "directories", @@ -6969,6 +7016,7 @@ dependencies = [ "sc-rpc", "sc-rpc-server", "sc-rpc-spec-v2", + "sc-storage-monitor", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -7003,7 +7051,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "log", "parity-scale-codec", @@ -7011,10 +7059,26 @@ dependencies = [ "sp-core", ] +[[package]] +name = "sc-storage-monitor" +version = "0.1.0" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +dependencies = [ + "clap", + "futures", + "log", + "nix 0.26.2", + "sc-client-db", + "sc-utils", + "sp-core", + "thiserror", + "tokio", +] + [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "libc", @@ -7033,7 +7097,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "chrono", "futures", @@ -7052,7 +7116,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "ansi_term", "atty", @@ -7083,7 +7147,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7094,13 +7158,14 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", "futures-timer", "linked-hash-map", "log", + "num-traits", "parity-scale-codec", "parking_lot 0.12.1", "sc-client-api", @@ -7120,7 +7185,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -7134,7 +7199,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "backtrace", "futures", @@ -7180,6 +7245,17 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -7352,9 +7428,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ "itoa", "ryu", @@ -7540,7 +7616,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "hash-db", "log", @@ -7558,7 +7634,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "blake2", "proc-macro-crate", @@ -7570,7 +7646,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -7583,7 +7659,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "integer-sqrt", "num-traits", @@ -7594,22 +7670,10 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "sp-authorship" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" -dependencies = [ - "async-trait", - "parity-scale-codec", - "sp-inherents", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -7626,7 +7690,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "sp-api", @@ -7638,7 +7702,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "log", @@ -7656,7 +7720,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -7674,7 +7738,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "parity-scale-codec", @@ -7692,7 +7756,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "merlin", @@ -7715,7 +7779,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -7727,7 +7791,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -7740,7 +7804,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "base58", @@ -7782,7 +7846,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "blake2", "byteorder", @@ -7796,7 +7860,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "proc-macro2", "quote", @@ -7807,7 +7871,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -7816,7 +7880,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "proc-macro2", "quote", @@ -7826,7 +7890,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "environmental", "parity-scale-codec", @@ -7837,7 +7901,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "finality-grandpa", "log", @@ -7855,7 +7919,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -7869,7 +7933,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "bytes", "ed25519", @@ -7894,7 +7958,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "lazy_static", "sp-core", @@ -7905,7 +7969,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures", @@ -7922,7 +7986,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "thiserror", "zstd", @@ -7931,7 +7995,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -7949,7 +8013,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "sp-api", "sp-core", @@ -7959,7 +8023,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "backtrace", "lazy_static", @@ -7969,7 +8033,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "rustc-hash", "serde", @@ -7979,7 +8043,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "either", "hash256-std-hasher", @@ -8001,7 +8065,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8019,7 +8083,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "Inflector", "proc-macro-crate", @@ -8031,7 +8095,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -8045,7 +8109,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -8057,7 +8121,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "hash-db", "log", @@ -8077,12 +8141,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8095,7 +8159,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "futures-timer", @@ -8110,7 +8174,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "sp-std", @@ -8122,7 +8186,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "sp-api", "sp-runtime", @@ -8131,7 +8195,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "async-trait", "log", @@ -8147,18 +8211,18 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ - "ahash", + "ahash 0.8.3", "hash-db", - "hashbrown", + "hashbrown 0.12.3", "lazy_static", - "lru", "memory-db", "nohash-hasher", "parity-scale-codec", "parking_lot 0.12.1", "scale-info", + "schnellru", "sp-core", "sp-std", "thiserror", @@ -8170,7 +8234,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8187,7 +8251,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8198,7 +8262,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "impl-trait-for-tuples", "log", @@ -8211,7 +8275,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "parity-scale-codec", "scale-info", @@ -8383,7 +8447,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "platforms", ] @@ -8391,7 +8455,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8410,7 +8474,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "hyper", "log", @@ -8422,7 +8486,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "array-bytes", "async-trait", @@ -8448,7 +8512,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "beefy-merkle-tree", "cfg-if", @@ -8491,7 +8555,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "futures", "parity-scale-codec", @@ -8510,7 +8574,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#946507ba9ef13e263534176b7b74e26fc56efbd4" +source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" dependencies = [ "ansi_term", "build-helper", @@ -8984,7 +9048,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -9358,9 +9422,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" +checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" dependencies = [ "anyhow", "libc", @@ -9374,9 +9438,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" dependencies = [ "anyhow", "cxx", @@ -9386,9 +9450,9 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.110.2" +version = "0.111.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" +checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" dependencies = [ "anyhow", "cc", @@ -9868,7 +9932,7 @@ dependencies = [ "lazy_static", "libc", "log", - "nix", + "nix 0.24.3", "rand 0.8.5", "thiserror", "tokio", diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 0d8fe0f4d8..a5a0689d72 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -22,8 +22,8 @@ sp-blockchain = { workspace = true } sp-runtime = { workspace = true } # Frontier fc-db = { workspace = true } -fp-rpc = { workspace = true, features = ["std"] } -fp-storage = { workspace = true, features = ["std"] } +fp-rpc = { workspace = true, features = ["default"] } +fp-storage = { workspace = true, features = ["default"] } [dev-dependencies] futures = "0.3.21" @@ -36,4 +36,4 @@ sp-consensus = { workspace = true } sp-io = { workspace = true } substrate-test-runtime-client = { workspace = true } # Frontier -frontier-template-runtime = { workspace = true, features = ["std", "with-rocksdb-weights"] } +frontier-template-runtime = { workspace = true, features = ["default"] } diff --git a/client/consensus/Cargo.toml b/client/consensus/Cargo.toml index 83b8e69a68..5330da29fe 100644 --- a/client/consensus/Cargo.toml +++ b/client/consensus/Cargo.toml @@ -16,11 +16,11 @@ thiserror = "1.0" # Substrate sc-consensus = { workspace = true } sp-api = { workspace = true } -sp-block-builder = { workspace = true, features = ["std"] } +sp-block-builder = { workspace = true, features = ["default"] } sp-blockchain = { workspace = true } sp-consensus = { workspace = true } sp-runtime = { workspace = true } # Frontier fc-db = { workspace = true } -fp-consensus = { workspace = true, features = ["std"] } -fp-rpc = { workspace = true, features = ["std"] } +fp-consensus = { workspace = true, features = ["default"] } +fp-rpc = { workspace = true, features = ["default"] } diff --git a/client/db/Cargo.toml b/client/db/Cargo.toml index 43d183a6eb..57002e6d6f 100644 --- a/client/db/Cargo.toml +++ b/client/db/Cargo.toml @@ -24,7 +24,7 @@ sp-core = { workspace = true } sp-database = { workspace = true } sp-runtime = { workspace = true } # Frontier -fp-storage = { workspace = true, features = ["std"] } +fp-storage = { workspace = true, features = ["default"] } [features] default = ["kvdb-rocksdb", "parity-db"] diff --git a/client/mapping-sync/Cargo.toml b/client/mapping-sync/Cargo.toml index f90df1c90c..80957cd616 100644 --- a/client/mapping-sync/Cargo.toml +++ b/client/mapping-sync/Cargo.toml @@ -21,5 +21,5 @@ sp-blockchain = { workspace = true } sp-runtime = { workspace = true } # Frontier fc-db = { workspace = true } -fp-consensus = { workspace = true, features = ["std"] } -fp-rpc = { workspace = true, features = ["std"] } +fp-consensus = { workspace = true, features = ["default"] } +fp-rpc = { workspace = true, features = ["default"] } diff --git a/client/rpc/Cargo.toml b/client/rpc/Cargo.toml index 6775cb5ea2..14b3c7f9a0 100644 --- a/client/rpc/Cargo.toml +++ b/client/rpc/Cargo.toml @@ -46,9 +46,9 @@ sp-runtime = { workspace = true } fc-db = { workspace = true } fc-rpc-core = { workspace = true } fc-storage = { workspace = true } -fp-ethereum = { workspace = true, features = ["std"] } -fp-rpc = { workspace = true, features = ["std"] } -fp-storage = { workspace = true, features = ["std"] } +fp-ethereum = { workspace = true, features = ["default"] } +fp-rpc = { workspace = true, features = ["default"] } +fp-storage = { workspace = true, features = ["default"] } [dev-dependencies] tempfile = "3.3.0" diff --git a/frame/ethereum/Cargo.toml b/frame/ethereum/Cargo.toml index e4fbb3d972..e6c6f3c836 100644 --- a/frame/ethereum/Cargo.toml +++ b/frame/ethereum/Cargo.toml @@ -39,7 +39,7 @@ pallet-evm = { workspace = true } hex = "0.4.3" libsecp256k1 = { workspace = true, features = ["static-context", "hmac"] } # Substrate -pallet-balances = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["default"] } sp-core = { workspace = true } [features] diff --git a/frame/ethereum/src/lib.rs b/frame/ethereum/src/lib.rs index 1f21a5001d..f351101510 100644 --- a/frame/ethereum/src/lib.rs +++ b/frame/ethereum/src/lib.rs @@ -91,8 +91,8 @@ impl> + From> EnsureOrigin } #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> O { - O::from(RawOrigin::EthereumTransaction(Default::default())) + fn try_successful_origin() -> Result { + Ok(O::from(RawOrigin::EthereumTransaction(Default::default()))) } } diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 15676a46fd..d5bd7084cf 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -34,7 +34,7 @@ fp-evm = { workspace = true } [dev-dependencies] # Substrate -pallet-balances = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["default"] } pallet-evm-precompile-simple = { workspace = true } [features] diff --git a/frame/evm/precompile/dispatch/Cargo.toml b/frame/evm/precompile/dispatch/Cargo.toml index a383cf8a7f..b2be365313 100644 --- a/frame/evm/precompile/dispatch/Cargo.toml +++ b/frame/evm/precompile/dispatch/Cargo.toml @@ -19,7 +19,7 @@ scale-codec = { package = "parity-scale-codec", workspace = true } scale-info = { workspace = true } # Substrate frame-system = { workspace = true } -pallet-balances = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["default"] } pallet-timestamp = { workspace = true } pallet-utility = { workspace = true } sp-core = { workspace = true } diff --git a/frame/evm/test-vector-support/Cargo.toml b/frame/evm/test-vector-support/Cargo.toml index 446818fc9b..6434383e44 100644 --- a/frame/evm/test-vector-support/Cargo.toml +++ b/frame/evm/test-vector-support/Cargo.toml @@ -15,4 +15,4 @@ serde_json = { workspace = true } # Substrate sp-core = { workspace = true } # Frontier -fp-evm = { workspace = true, features = ["std"] } +fp-evm = { workspace = true, features = ["default"] } diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index d2d6796567..76097bf7ca 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -38,21 +38,21 @@ sc-service = { workspace = true } sc-telemetry = { workspace = true } sc-transaction-pool = { workspace = true } sc-transaction-pool-api = { workspace = true } -sp-api = { workspace = true, features = ["std"] } +sp-api = { workspace = true, features = ["default"] } sp-block-builder = { workspace = true } sp-blockchain = { workspace = true } -sp-consensus-aura = { workspace = true, features = ["std"] } -sp-core = { workspace = true, features = ["std"] } -sp-finality-grandpa = { workspace = true, features = ["std"] } -sp-inherents = { workspace = true, features = ["std"] } +sp-consensus-aura = { workspace = true, features = ["default"] } +sp-core = { workspace = true, features = ["default"] } +sp-finality-grandpa = { workspace = true, features = ["default"] } +sp-inherents = { workspace = true, features = ["default"] } sp-keyring = { workspace = true } -sp-offchain = { workspace = true, features = ["std"] } -sp-runtime = { workspace = true, features = ["std"] } -sp-session = { workspace = true, features = ["std"] } -sp-state-machine = { workspace = true, features = ["std"] } -sp-timestamp = { workspace = true, features = ["std"] } -sp-transaction-pool = { workspace = true, features = ["std"] } -sp-trie = { workspace = true, features = ["std"] } +sp-offchain = { workspace = true, features = ["default"] } +sp-runtime = { workspace = true, features = ["default"] } +sp-session = { workspace = true, features = ["default"] } +sp-state-machine = { workspace = true, features = ["default"] } +sp-timestamp = { workspace = true, features = ["default"] } +sp-transaction-pool = { workspace = true, features = ["default"] } +sp-trie = { workspace = true, features = ["default"] } # These dependencies are used for RPC frame-system-rpc-runtime-api = { workspace = true } pallet-transaction-payment-rpc = { workspace = true } @@ -72,10 +72,10 @@ fc-mapping-sync = { workspace = true } fc-rpc = { workspace = true } fc-rpc-core = { workspace = true } fc-storage = { workspace = true } -fp-dynamic-fee = { workspace = true, features = ["std"] } -fp-evm = { workspace = true, features = ["std"] } -fp-rpc = { workspace = true, features = ["std"] } -frontier-template-runtime = { workspace = true, features = ["std"] } +fp-dynamic-fee = { workspace = true, features = ["default"] } +fp-evm = { workspace = true, features = ["default"] } +fp-rpc = { workspace = true, features = ["default"] } +frontier-template-runtime = { workspace = true, features = ["default"] } [build-dependencies] substrate-build-script-utils = { workspace = true } diff --git a/template/node/src/main.rs b/template/node/src/main.rs index b00d6c4b35..3adb9624c0 100644 --- a/template/node/src/main.rs +++ b/template/node/src/main.rs @@ -1,7 +1,11 @@ //! Substrate Node Template CLI library. #![warn(missing_docs)] -#![allow(clippy::type_complexity, clippy::too_many_arguments)] +#![allow( + clippy::type_complexity, + clippy::too_many_arguments, + clippy::large_enum_variant +)] #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/template/node/src/service.rs b/template/node/src/service.rs index 20fba528f9..d456e1057b 100644 --- a/template/node/src/service.rs +++ b/template/node/src/service.rs @@ -118,7 +118,7 @@ where let select_chain = sc_consensus::LongestChain::new(backend.clone()); let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import( client.clone(), - &(client.clone() as Arc<_>), + &client, select_chain.clone(), telemetry.as_ref().map(|x| x.handle()), )?; diff --git a/template/runtime/src/lib.rs b/template/runtime/src/lib.rs index 42a758c32a..2fbea2d6e0 100644 --- a/template/runtime/src/lib.rs +++ b/template/runtime/src/lib.rs @@ -236,6 +236,7 @@ impl pallet_grandpa::Config for Runtime { type WeightInfo = (); type MaxAuthorities = ConstU32<32>; + type MaxSetIdSessionEntries = (); } parameter_types! { @@ -784,6 +785,14 @@ impl_runtime_apis! { ) -> pallet_transaction_payment::FeeDetails { TransactionPayment::query_fee_details(uxt, len) } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } } impl sp_session::SessionKeys for Runtime { From 0535842137360e80f36bbe3d6a5333d6ad8b9c8a Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Fri, 3 Mar 2023 15:43:37 +0800 Subject: [PATCH 06/17] feat: add a new post log type into header digest and provide a compatible mapping-sync worker (#1011) --- Cargo.lock | 1 + client/mapping-sync/Cargo.toml | 1 + client/mapping-sync/src/lib.rs | 92 ++++++++++++++++++++++++------- client/mapping-sync/src/worker.rs | 12 +++- primitives/consensus/src/lib.rs | 31 ++++------- template/node/src/eth.rs | 1 + 6 files changed, 96 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97b3d45f6f..0bb5934df1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1928,6 +1928,7 @@ name = "fc-mapping-sync" version = "2.0.0-dev" dependencies = [ "fc-db", + "fc-storage", "fp-consensus", "fp-rpc", "futures", diff --git a/client/mapping-sync/Cargo.toml b/client/mapping-sync/Cargo.toml index 80957cd616..5ca2705103 100644 --- a/client/mapping-sync/Cargo.toml +++ b/client/mapping-sync/Cargo.toml @@ -21,5 +21,6 @@ sp-blockchain = { workspace = true } sp-runtime = { workspace = true } # Frontier fc-db = { workspace = true } +fc-storage = { workspace = true } fp-consensus = { workspace = true, features = ["default"] } fp-rpc = { workspace = true, features = ["default"] } diff --git a/client/mapping-sync/src/lib.rs b/client/mapping-sync/src/lib.rs index f84397b327..70d5794968 100644 --- a/client/mapping-sync/src/lib.rs +++ b/client/mapping-sync/src/lib.rs @@ -22,8 +22,10 @@ mod worker; pub use worker::{MappingSyncWorker, SyncStrategy}; +use std::sync::Arc; + // Substrate -use sc_client_api::backend::Backend; +use sc_client_api::backend::{Backend, StorageProvider}; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::{Backend as _, HeaderBackend}; use sp_runtime::{ @@ -31,31 +33,78 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, Zero}, }; // Frontier -use fp_consensus::FindLogError; +use fc_storage::OverrideHandle; +use fp_consensus::{FindLogError, Hashes, Log, PostLog, PreLog}; use fp_rpc::EthereumRuntimeRPCApi; -pub fn sync_block( +pub fn sync_block( + client: &C, + overrides: Arc>, backend: &fc_db::Backend, header: &Block::Header, -) -> Result<(), String> { +) -> Result<(), String> +where + C: StorageProvider + HeaderBackend, + BE: Backend, +{ + let substrate_block_hash = header.hash(); match fp_consensus::find_log(header.digest()) { Ok(log) => { - let post_hashes = log.into_hashes(); - - let mapping_commitment = fc_db::MappingCommitment { - block_hash: header.hash(), - ethereum_block_hash: post_hashes.block_hash, - ethereum_transaction_hashes: post_hashes.transaction_hashes, + let gen_from_hashes = |hashes: Hashes| -> fc_db::MappingCommitment { + fc_db::MappingCommitment { + block_hash: substrate_block_hash, + ethereum_block_hash: hashes.block_hash, + ethereum_transaction_hashes: hashes.transaction_hashes, + } + }; + let gen_from_block = |block| -> fc_db::MappingCommitment { + let hashes = Hashes::from_block(block); + gen_from_hashes(hashes) }; - backend.mapping().write_hashes(mapping_commitment)?; - - Ok(()) - } - Err(FindLogError::NotFound) => { - backend.mapping().write_none(header.hash())?; - Ok(()) + match log { + Log::Pre(PreLog::Block(block)) => { + let mapping_commitment = gen_from_block(block); + backend.mapping().write_hashes(mapping_commitment) + } + Log::Post(post_log) => match post_log { + PostLog::Hashes(hashes) => { + let mapping_commitment = gen_from_hashes(hashes); + backend.mapping().write_hashes(mapping_commitment) + } + PostLog::Block(block) => { + let mapping_commitment = gen_from_block(block); + backend.mapping().write_hashes(mapping_commitment) + } + PostLog::BlockHash(expect_eth_block_hash) => { + let schema = + fc_storage::onchain_storage_schema(client, substrate_block_hash); + let ethereum_block = overrides + .schemas + .get(&schema) + .unwrap_or(&overrides.fallback) + .current_block(substrate_block_hash); + match ethereum_block { + Some(block) => { + let got_eth_block_hash = block.header.hash(); + if got_eth_block_hash != expect_eth_block_hash { + Err(format!( + "Ethereum block hash mismatch: \ + frontier consensus digest ({expect_eth_block_hash:?}), \ + db state ({got_eth_block_hash:?})" + )) + } else { + let mapping_commitment = gen_from_block(block); + backend.mapping().write_hashes(mapping_commitment) + } + } + None => backend.mapping().write_none(substrate_block_hash), + } + } + }, + } } + Err(FindLogError::NotFound) => backend.mapping().write_none(substrate_block_hash), Err(FindLogError::MultipleLogs) => Err("Multiple logs found".to_string()), } } @@ -109,6 +158,7 @@ where pub fn sync_one_block( client: &C, substrate_backend: &BE, + overrides: Arc>, frontier_backend: &fc_db::Backend, sync_from: ::Number, strategy: SyncStrategy, @@ -116,7 +166,7 @@ pub fn sync_one_block( where C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - C: HeaderBackend, + C: HeaderBackend + StorageProvider, BE: Backend, { let mut current_syncing_tips = frontier_backend.meta().current_syncing_tips()?; @@ -167,7 +217,7 @@ where { return Ok(false); } - sync_block(frontier_backend, &operating_header)?; + sync_block(client, overrides, frontier_backend, &operating_header)?; current_syncing_tips.push(*operating_header.parent_hash()); frontier_backend @@ -180,6 +230,7 @@ where pub fn sync_blocks( client: &C, substrate_backend: &BE, + overrides: Arc>, frontier_backend: &fc_db::Backend, limit: usize, sync_from: ::Number, @@ -188,7 +239,7 @@ pub fn sync_blocks( where C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - C: HeaderBackend, + C: HeaderBackend + StorageProvider, BE: Backend, { let mut synced_any = false; @@ -198,6 +249,7 @@ where || sync_one_block( client, substrate_backend, + overrides.clone(), frontier_backend, sync_from, strategy, diff --git a/client/mapping-sync/src/worker.rs b/client/mapping-sync/src/worker.rs index 6fbe25d705..06702cbe1a 100644 --- a/client/mapping-sync/src/worker.rs +++ b/client/mapping-sync/src/worker.rs @@ -25,11 +25,15 @@ use futures::{ use futures_timer::Delay; use log::debug; // Substrate -use sc_client_api::{backend::Backend, client::ImportNotifications}; +use sc_client_api::{ + backend::{Backend, StorageProvider}, + client::ImportNotifications, +}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; // Frontier +use fc_storage::OverrideHandle; use fp_rpc::EthereumRuntimeRPCApi; #[derive(Copy, Clone, Eq, PartialEq)] @@ -45,6 +49,7 @@ pub struct MappingSyncWorker { client: Arc, substrate_backend: Arc, + overrides: Arc>, frontier_backend: Arc>, have_next: bool, @@ -61,6 +66,7 @@ impl MappingSyncWorker { timeout: Duration, client: Arc, substrate_backend: Arc, + overrides: Arc>, frontier_backend: Arc>, retry_times: usize, sync_from: ::Number, @@ -73,6 +79,7 @@ impl MappingSyncWorker { client, substrate_backend, + overrides, frontier_backend, have_next: true, @@ -87,7 +94,7 @@ impl Stream for MappingSyncWorker where C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, - C: HeaderBackend, + C: HeaderBackend + StorageProvider, BE: Backend, { type Item = (); @@ -125,6 +132,7 @@ where match crate::sync_blocks( self.client.as_ref(), self.substrate_backend.as_ref(), + self.overrides.clone(), self.frontier_backend.as_ref(), self.retry_times, self.sync_from, diff --git a/primitives/consensus/src/lib.rs b/primitives/consensus/src/lib.rs index f66b782bad..370d3a40c6 100644 --- a/primitives/consensus/src/lib.rs +++ b/primitives/consensus/src/lib.rs @@ -34,16 +34,6 @@ pub enum Log { Post(PostLog), } -impl Log { - pub fn into_hashes(self) -> Hashes { - match self { - Log::Post(PostLog::Hashes(post_hashes)) => post_hashes, - Log::Post(PostLog::Block(block)) => Hashes::from_block(block), - Log::Pre(PreLog::Block(block)) => Hashes::from_block(block), - } - } -} - #[derive(Decode, Encode, Clone, PartialEq, Eq)] pub enum PreLog { #[codec(index = 3)] @@ -52,10 +42,15 @@ pub enum PreLog { #[derive(Decode, Encode, Clone, PartialEq, Eq)] pub enum PostLog { + /// Ethereum block hash and txn hashes. #[codec(index = 1)] Hashes(Hashes), + /// Ethereum block. #[codec(index = 2)] Block(ethereum::BlockV2), + /// Ethereum block hash. + #[codec(index = 3)] + BlockHash(H256), } #[derive(Decode, Encode, Clone, PartialEq, Eq)] @@ -68,17 +63,13 @@ pub struct Hashes { impl Hashes { pub fn from_block(block: ethereum::BlockV2) -> Self { - let mut transaction_hashes = Vec::new(); - - for t in &block.transactions { - transaction_hashes.push(t.hash()); - } - - let block_hash = block.header.hash(); - Hashes { - transaction_hashes, - block_hash, + block_hash: block.header.hash(), + transaction_hashes: block + .transactions + .into_iter() + .map(|txn| txn.hash()) + .collect(), } } } diff --git a/template/node/src/eth.rs b/template/node/src/eth.rs index 4bae5d9099..cf0b6c56b6 100644 --- a/template/node/src/eth.rs +++ b/template/node/src/eth.rs @@ -128,6 +128,7 @@ pub fn spawn_frontier_tasks( Duration::new(6, 0), client.clone(), backend, + overrides.clone(), frontier_backend, 3, 0, From 98aacf69e976340338f81455e48e8b330007e544 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Tue, 7 Mar 2023 19:18:27 +0800 Subject: [PATCH 07/17] feat: provide a parameter for the runtime config to choose what to include in the PostLog (#1014) * feat: provide a parameter for the runtime config to choose what to include in the PostLog * use parameter_types macro * fix on_finalize --- frame/ethereum/src/lib.rs | 40 ++++++++++++++++++++++++++++--------- frame/ethereum/src/mock.rs | 6 +++++- template/runtime/src/lib.rs | 7 ++++++- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/frame/ethereum/src/lib.rs b/frame/ethereum/src/lib.rs index f351101510..3a474bfdf5 100644 --- a/frame/ethereum/src/lib.rs +++ b/frame/ethereum/src/lib.rs @@ -163,6 +163,13 @@ where } } +#[derive(Copy, Clone, Eq, PartialEq, Default)] +pub enum PostLogContent { + #[default] + BlockAndTxnHashes, + OnlyBlockHash, +} + pub use self::pallet::*; #[frame_support::pallet] @@ -185,13 +192,18 @@ pub mod pallet { type RuntimeEvent: From + IsType<::RuntimeEvent>; /// How Ethereum state root is calculated. type StateRoot: Get; + /// What's included in the PostLog. + type PostLogContent: Get; } #[pallet::hooks] impl Hooks> for Pallet { fn on_finalize(n: T::BlockNumber) { >::store_block( - fp_consensus::find_pre_log(&frame_system::Pallet::::digest()).is_err(), + match fp_consensus::find_pre_log(&frame_system::Pallet::::digest()) { + Ok(_) => None, + Err(_) => Some(T::PostLogContent::get()), + }, U256::from(UniqueSaturatedInto::::unique_saturated_into( frame_system::Pallet::::block_number(), )), @@ -332,7 +344,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::store_block(false, U256::zero()); + >::store_block(None, U256::zero()); frame_support::storage::unhashed::put::( PALLET_ETHEREUM_SCHEMA, &EthereumStorageSchema::V3, @@ -375,7 +387,7 @@ impl Pallet { Some(H160::from(H256::from(sp_io::hashing::keccak_256(&pubkey)))) } - fn store_block(post_log: bool, block_number: U256) { + fn store_block(post_log: Option, block_number: U256) { let mut transactions = Vec::new(); let mut statuses = Vec::new(); let mut receipts = Vec::new(); @@ -426,12 +438,22 @@ impl Pallet { CurrentTransactionStatuses::::put(statuses.clone()); BlockHash::::insert(block_number, block.header.hash()); - if post_log { - let digest = DigestItem::Consensus( - FRONTIER_ENGINE_ID, - PostLog::Hashes(fp_consensus::Hashes::from_block(block)).encode(), - ); - frame_system::Pallet::::deposit_log(digest); + match post_log { + Some(PostLogContent::BlockAndTxnHashes) => { + let digest = DigestItem::Consensus( + FRONTIER_ENGINE_ID, + PostLog::Hashes(fp_consensus::Hashes::from_block(block)).encode(), + ); + frame_system::Pallet::::deposit_log(digest); + } + Some(PostLogContent::OnlyBlockHash) => { + let digest = DigestItem::Consensus( + FRONTIER_ENGINE_ID, + PostLog::BlockHash(block.header.hash()).encode(), + ); + frame_system::Pallet::::deposit_log(digest); + } + None => { /* do nothing*/ } } } diff --git a/frame/ethereum/src/mock.rs b/frame/ethereum/src/mock.rs index 4928dca369..5e41224e9d 100644 --- a/frame/ethereum/src/mock.rs +++ b/frame/ethereum/src/mock.rs @@ -143,7 +143,6 @@ parameter_types! { } pub struct HashedAddressMapping; - impl AddressMapping for HashedAddressMapping { fn into_account_id(address: H160) -> AccountId32 { let mut data = [0u8; 32]; @@ -172,9 +171,14 @@ impl pallet_evm::Config for Test { type FindAuthor = FindAuthorTruncated; } +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; +} + impl Config for Test { type RuntimeEvent = RuntimeEvent; type StateRoot = IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; } impl fp_self_contained::SelfContainedCall for RuntimeCall { diff --git a/template/runtime/src/lib.rs b/template/runtime/src/lib.rs index 2fbea2d6e0..4b0aec6759 100644 --- a/template/runtime/src/lib.rs +++ b/template/runtime/src/lib.rs @@ -44,7 +44,7 @@ use pallet_transaction_payment::CurrencyAdapter; // Frontier use fp_evm::weight_per_gas; use fp_rpc::TransactionStatus; -use pallet_ethereum::{Call::transact, Transaction as EthereumTransaction}; +use pallet_ethereum::{Call::transact, PostLogContent, Transaction as EthereumTransaction}; use pallet_evm::{ Account as EVMAccount, EnsureAddressTruncated, FeeCalculator, HashedAddressMapping, Runner, }; @@ -345,9 +345,14 @@ impl pallet_evm::Config for Runtime { type FindAuthor = FindAuthorTruncated; } +parameter_types! { + pub const PostBlockAndTxnHashes: PostLogContent = PostLogContent::BlockAndTxnHashes; +} + impl pallet_ethereum::Config for Runtime { type RuntimeEvent = RuntimeEvent; type StateRoot = pallet_ethereum::IntermediateStateRoot; + type PostLogContent = PostBlockAndTxnHashes; } parameter_types! { From 58c568964dc32dd96153b7d113ac2df58d27de2b Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Tue, 7 Mar 2023 22:37:05 +0800 Subject: [PATCH 08/17] update substrate to polkadot-v0.9.39 (#1010) --- Cargo.lock | 646 +++++++++--------- client/cli/src/frontier_db_cmd/mapping_db.rs | 8 +- client/cli/src/frontier_db_cmd/tests.rs | 14 +- client/db/src/upgrade.rs | 14 +- client/mapping-sync/src/lib.rs | 19 +- client/rpc/src/eth/block.rs | 11 +- client/rpc/src/eth/cache/mod.rs | 7 +- client/rpc/src/eth/client.rs | 7 +- client/rpc/src/eth/execute.rs | 78 +-- client/rpc/src/eth/fee.rs | 9 +- client/rpc/src/eth/mod.rs | 14 +- client/rpc/src/eth/state.rs | 25 +- client/rpc/src/eth/submit.rs | 33 +- client/rpc/src/eth/transaction.rs | 21 +- client/rpc/src/eth_pubsub.rs | 10 +- client/rpc/src/lib.rs | 8 +- client/rpc/src/net.rs | 4 +- client/rpc/src/web3.rs | 4 +- client/storage/src/overrides/mod.rs | 31 +- .../self-contained/src/unchecked_extrinsic.rs | 4 +- template/node/Cargo.toml | 1 + template/node/src/service.rs | 38 +- 22 files changed, 512 insertions(+), 494 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0bb5934df1..eb9aa5af2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,7 +317,7 @@ dependencies = [ "slab", "socket2", "waker-fn", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -450,13 +450,12 @@ dependencies = [ ] [[package]] -name = "beefy-merkle-tree" +name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "sp-api", - "sp-beefy", - "sp-runtime", + "hash-db", + "log", ] [[package]] @@ -604,6 +603,18 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bounded-collections" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a071c348a5ef6da1d3a87166b408170b46002382b1dda83992b5c2208cefb370" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + [[package]] name = "bs58" version = "0.4.0" @@ -647,6 +658,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +[[package]] +name = "bytemuck" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" + [[package]] name = "byteorder" version = "1.4.3" @@ -690,15 +707,16 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.14.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" dependencies = [ "camino", "cargo-platform", "semver 1.0.16", "serde", "serde_json", + "thiserror", ] [[package]] @@ -978,18 +996,18 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" +checksum = "91b18cf92869a6ae85cde3af4bc4beb6154efa8adef03b18db2ad413d5bce3a2" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" +checksum = "567d9f6e919bac076f39b902a072686eaf9e6d015baa34d10a61b85105b7af59" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -999,6 +1017,7 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli 0.26.2", + "hashbrown 0.12.3", "log", "regalloc2", "smallvec", @@ -1007,33 +1026,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" +checksum = "1e72b2d5ec8917b2971fe83850187373d0a186db4748a7c23a5f48691b8d92bb" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" +checksum = "3461c0e0c2ebbeb92533aacb27e219289f60dc84134ef34fbf2d77c9eddf07ef" [[package]] name = "cranelift-entity" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +checksum = "af684f7f7b01427b1942c7102673322a51b9d6f261e9663dc5e5595786775531" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" +checksum = "7d361ed0373cf5f086b49c499aa72227b646a64f899f32e34312f97c0fadff75" dependencies = [ "cranelift-codegen", "log", @@ -1043,15 +1062,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" +checksum = "cef4f8f3984d772c199a48896d2fb766f96301bf71b371e03a2b99f4f3b7b931" [[package]] name = "cranelift-native" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" +checksum = "f98e4e99a353703475d5acb402b9c13482d41d8a4008b352559bd560afb90363" dependencies = [ "cranelift-codegen", "libc", @@ -1060,9 +1079,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.88.2" +version = "0.93.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" +checksum = "a1e3f4f0779a1b0f286a6ef19835d8665f88326e656a6d7d84fa9a39fa38ca32" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2052,7 +2071,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -2118,7 +2137,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", ] @@ -2221,7 +2240,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-support-procedural", @@ -2246,7 +2265,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "Inflector", "array-bytes", @@ -2293,7 +2312,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -2321,7 +2340,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "bitflags", "frame-metadata", @@ -2353,7 +2372,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "Inflector", "cfg-expr", @@ -2368,7 +2387,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2380,7 +2399,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "proc-macro2", "quote", @@ -2390,7 +2409,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "log", @@ -2408,7 +2427,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-benchmarking", "frame-support", @@ -2423,7 +2442,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "sp-api", @@ -2466,6 +2485,7 @@ dependencies = [ "sc-executor", "sc-finality-grandpa", "sc-network", + "sc-network-common", "sc-rpc", "sc-rpc-api", "sc-service", @@ -2871,6 +2891,9 @@ name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] [[package]] name = "heck" @@ -3223,12 +3246,6 @@ dependencies = [ "webrtc-util", ] -[[package]] -name = "io-lifetimes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" - [[package]] name = "io-lifetimes" version = "1.0.4" @@ -3236,7 +3253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" dependencies = [ "libc", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -3270,9 +3287,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ "hermit-abi 0.2.6", - "io-lifetimes 1.0.4", - "rustix 0.36.7", - "windows-sys 0.42.0", + "io-lifetimes", + "rustix", + "windows-sys", ] [[package]] @@ -3993,20 +4010,13 @@ dependencies = [ [[package]] name = "linregress" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c601a85f5ecd1aba625247bca0031585fb1c446461b142878a16f8245ddeb8" +checksum = "475015a7f8f017edb28d2e69813be23500ad4b32cfe3421c4148efc97324ee52" dependencies = [ "nalgebra", - "statrs", ] -[[package]] -name = "linux-raw-sys" -version = "0.0.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" - [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -4130,7 +4140,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "rustix 0.36.7", + "rustix", ] [[package]] @@ -4212,7 +4222,7 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -4324,9 +4334,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.27.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "462fffe4002f4f2e1f6a9dcf12cc1a6fc0e15989014efc02a941d3e0f5dc2120" +checksum = "f6515c882ebfddccaa73ead7320ca28036c4bc84c9bcca3cc0cbba8efe89223a" dependencies = [ "approx", "matrixmultiply", @@ -4334,17 +4344,15 @@ dependencies = [ "num-complex", "num-rational", "num-traits", - "rand 0.8.5", - "rand_distr", "simba", "typenum", ] [[package]] name = "nalgebra-macros" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" +checksum = "d232c68884c0c99810a5a4d333ef7e47689cfd0edc85efc9e54e1e6bf5212766" dependencies = [ "proc-macro2", "quote", @@ -4558,7 +4566,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -4686,7 +4693,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -4702,7 +4709,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -4716,7 +4723,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-benchmarking", "frame-support", @@ -4740,7 +4747,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-benchmarking", "frame-support", @@ -4766,6 +4773,49 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "pallet-beefy" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" +dependencies = [ + "frame-support", + "frame-system", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-beefy", + "sp-runtime", + "sp-session", + "sp-staking", + "sp-std", +] + +[[package]] +name = "pallet-beefy-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" +dependencies = [ + "array-bytes", + "binary-merkle-tree", + "frame-support", + "frame-system", + "log", + "pallet-beefy", + "pallet-mmr", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-beefy", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-dynamic-fee" version = "4.0.0-dev" @@ -4944,7 +4994,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-benchmarking", "frame-support", @@ -4980,10 +5030,27 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-mmr" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -5004,7 +5071,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -5018,7 +5085,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-benchmarking", "frame-support", @@ -5036,7 +5103,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -5052,7 +5119,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5068,7 +5135,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5080,7 +5147,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-support", "frame-system", @@ -5113,9 +5180,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.2.2" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ab01d0f889e957861bc65888d5ccbe82c158d0270136ba46820d43837cdf72" +checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -5201,7 +5268,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -5383,7 +5450,7 @@ dependencies = [ "libc", "log", "wepoll-ffi", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -5749,16 +5816,6 @@ dependencies = [ "getrandom 0.2.8", ] -[[package]] -name = "rand_distr" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" -dependencies = [ - "num-traits", - "rand 0.8.5", -] - [[package]] name = "rand_hc" version = "0.2.0" @@ -5872,9 +5929,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.3.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" +checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" dependencies = [ "fxhash", "log", @@ -5908,6 +5965,18 @@ version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +[[package]] +name = "region" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +dependencies = [ + "bitflags", + "libc", + "mach", + "winapi", +] + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -6091,20 +6160,6 @@ dependencies = [ "nom", ] -[[package]] -name = "rustix" -version = "0.35.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes 0.7.5", - "libc", - "linux-raw-sys 0.0.46", - "windows-sys 0.42.0", -] - [[package]] name = "rustix" version = "0.36.7" @@ -6113,10 +6168,10 @@ checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" dependencies = [ "bitflags", "errno", - "io-lifetimes 1.0.4", + "io-lifetimes", "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.42.0", + "linux-raw-sys", + "windows-sys", ] [[package]] @@ -6188,6 +6243,15 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +[[package]] +name = "safe_arch" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794821e4ccb0d9f979512f9c1973480123f9bd62a90d74ab0f9426fcf8f4a529" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -6200,7 +6264,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "log", "sp-core", @@ -6211,7 +6275,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "futures-timer", @@ -6234,7 +6298,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6250,7 +6314,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -6265,7 +6329,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6276,7 +6340,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "chrono", @@ -6316,7 +6380,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "fnv", "futures", @@ -6342,7 +6406,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "hash-db", "kvdb", @@ -6368,7 +6432,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -6393,7 +6457,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -6422,7 +6486,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "fork-tree", @@ -6440,6 +6504,7 @@ dependencies = [ "sc-consensus-slots", "sc-keystore", "sc-telemetry", + "scale-info", "schnorrkel", "sp-api", "sp-application-crypto", @@ -6460,7 +6525,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6473,7 +6538,7 @@ dependencies = [ [[package]] name = "sc-consensus-manual-seal" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "assert_matches", "async-trait", @@ -6507,7 +6572,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -6530,7 +6595,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "lru", "parity-scale-codec", @@ -6554,7 +6619,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -6567,7 +6632,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "log", "sc-allocator", @@ -6580,13 +6645,14 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ + "anyhow", "cfg-if", "libc", "log", "once_cell", - "rustix 0.35.13", + "rustix", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -6597,7 +6663,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ahash 0.8.3", "array-bytes", @@ -6637,7 +6703,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ansi_term", "futures", @@ -6652,7 +6718,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "async-trait", @@ -6667,7 +6733,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "async-trait", @@ -6682,6 +6748,7 @@ dependencies = [ "libp2p", "log", "lru", + "mockall", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", @@ -6709,7 +6776,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "cid", "futures", @@ -6728,7 +6795,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "bitflags", @@ -6754,7 +6821,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ahash 0.8.3", "futures", @@ -6772,7 +6839,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "futures", @@ -6793,7 +6860,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "async-trait", @@ -6825,7 +6892,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "futures", @@ -6844,7 +6911,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "bytes", @@ -6874,7 +6941,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "libp2p", @@ -6887,7 +6954,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6896,7 +6963,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "jsonrpsee", @@ -6926,7 +6993,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -6945,7 +7012,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "http", "jsonrpsee", @@ -6960,7 +7027,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "futures", @@ -6986,7 +7053,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "directories", @@ -7052,7 +7119,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "log", "parity-scale-codec", @@ -7063,7 +7130,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "clap", "futures", @@ -7079,7 +7146,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "libc", @@ -7098,7 +7165,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "chrono", "futures", @@ -7117,7 +7184,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ansi_term", "atty", @@ -7148,7 +7215,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7159,7 +7226,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -7186,7 +7253,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -7200,7 +7267,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "backtrace", "futures", @@ -7243,7 +7310,7 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -7533,14 +7600,15 @@ dependencies = [ [[package]] name = "simba" -version = "0.5.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e82063457853d00243beda9952e910b82593e4b07ae9f721b9278a99a0d3d5c" +checksum = "50582927ed6f77e4ac020c057f37a268fc6aebc29225050365aacbb9deeeddc4" dependencies = [ "approx", "num-complex", "num-traits", "paste", + "wide", ] [[package]] @@ -7617,7 +7685,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "hash-db", "log", @@ -7635,7 +7703,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "blake2", "proc-macro-crate", @@ -7647,7 +7715,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -7660,7 +7728,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "integer-sqrt", "num-traits", @@ -7674,8 +7742,9 @@ dependencies = [ [[package]] name = "sp-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ + "lazy_static", "parity-scale-codec", "scale-info", "serde", @@ -7686,12 +7755,13 @@ dependencies = [ "sp-mmr-primitives", "sp-runtime", "sp-std", + "strum", ] [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "sp-api", @@ -7703,7 +7773,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "log", @@ -7721,7 +7791,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -7739,7 +7809,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "parity-scale-codec", @@ -7757,7 +7827,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "merlin", @@ -7780,7 +7850,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -7792,7 +7862,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -7805,12 +7875,13 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "base58", "bitflags", "blake2", + "bounded-collections", "dyn-clonable", "ed25519-zebra", "futures", @@ -7847,7 +7918,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "blake2", "byteorder", @@ -7861,7 +7932,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "proc-macro2", "quote", @@ -7872,7 +7943,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -7881,7 +7952,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "proc-macro2", "quote", @@ -7891,7 +7962,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "environmental", "parity-scale-codec", @@ -7902,7 +7973,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "finality-grandpa", "log", @@ -7920,11 +7991,12 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec", + "scale-info", "sp-core", "sp-runtime", "sp-std", @@ -7934,7 +8006,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "bytes", "ed25519", @@ -7959,7 +8031,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "lazy_static", "sp-core", @@ -7970,7 +8042,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures", @@ -7987,7 +8059,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "thiserror", "zstd", @@ -7996,7 +8068,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -8014,7 +8086,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "sp-api", "sp-core", @@ -8024,7 +8096,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "backtrace", "lazy_static", @@ -8034,7 +8106,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "rustc-hash", "serde", @@ -8044,7 +8116,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "either", "hash256-std-hasher", @@ -8066,7 +8138,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8084,7 +8156,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "Inflector", "proc-macro-crate", @@ -8096,7 +8168,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -8110,7 +8182,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -8122,7 +8194,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "hash-db", "log", @@ -8142,12 +8214,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8160,7 +8232,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "futures-timer", @@ -8175,7 +8247,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "sp-std", @@ -8187,7 +8259,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "sp-api", "sp-runtime", @@ -8196,7 +8268,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "async-trait", "log", @@ -8212,7 +8284,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ahash 0.8.3", "hash-db", @@ -8235,7 +8307,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8252,7 +8324,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8263,8 +8335,9 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ + "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", @@ -8276,7 +8349,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "parity-scale-codec", "scale-info", @@ -8359,19 +8432,6 @@ dependencies = [ "syn", ] -[[package]] -name = "statrs" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bdbb8e4e78216a85785a85d3ec3183144f98d0097b9281802c019bb07a6f05" -dependencies = [ - "approx", - "lazy_static", - "nalgebra", - "num-traits", - "rand 0.8.5", -] - [[package]] name = "strsim" version = "0.10.0" @@ -8448,7 +8508,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "platforms", ] @@ -8456,7 +8516,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8475,7 +8535,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "hyper", "log", @@ -8487,7 +8547,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "array-bytes", "async-trait", @@ -8513,9 +8573,8 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "beefy-merkle-tree", "cfg-if", "frame-support", "frame-system", @@ -8523,6 +8582,7 @@ dependencies = [ "log", "memory-db", "pallet-babe", + "pallet-beefy-mmr", "pallet-timestamp", "parity-scale-codec", "sc-service", @@ -8556,7 +8616,7 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "futures", "parity-scale-codec", @@ -8575,7 +8635,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#3bc3742d5c0c5269353d7809d9f8f91104a93273" +source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ "ansi_term", "build-helper", @@ -8852,7 +8912,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -9044,12 +9104,12 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.24.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" +checksum = "3390c0409daaa6027d6681393316f4ccd3ff82e1590a1e4725014e3ae2bf1920" dependencies = [ "hash-db", - "hashbrown 0.12.3", + "hashbrown 0.13.2", "log", "rustc-hex", "smallvec", @@ -9508,22 +9568,24 @@ dependencies = [ "memory_units", "num-rational", "num-traits", + "region", ] [[package]] name = "wasmparser" -version = "0.89.1" +version = "0.100.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" dependencies = [ "indexmap", + "url", ] [[package]] name = "wasmtime" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +checksum = "9010891d0b8e367c3be94ca35d7bc25c1de3240463bb1d61bcfc8c2233c4e0d0" dependencies = [ "anyhow", "bincode", @@ -9544,23 +9606,23 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] name = "wasmtime-asm-macros" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +checksum = "65805c663eaa8257b910666f6d4b056b5c7329750da754ba5df54f3af7dbf35c" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" +checksum = "2049ddfc1b10efc3c5591d0e84b9570ca50478f8818f3bfabb1a467918f53fb4" dependencies = [ "anyhow", "base64 0.13.1", @@ -9568,19 +9630,19 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.35.13", + "rustix", "serde", - "sha2 0.9.9", + "sha2 0.10.6", "toml", - "windows-sys 0.36.1", + "windows-sys", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" +checksum = "3f9065cad6a724fa838ec8497567e0b23acc26417bb2449f8d9d2021925c72f2" dependencies = [ "anyhow", "cranelift-codegen", @@ -9599,9 +9661,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +checksum = "4f964bb0b91fa021b8d1b488c62cc77b346c1dae6e3ebd010050b57c1f2ca657" dependencies = [ "anyhow", "cranelift-entity", @@ -9618,9 +9680,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +checksum = "b7a1d06f5d109539e0168fc74fa65e3948ac8dac3bb8cdbd08b62b36a0ae27b8" dependencies = [ "addr2line 0.17.0", "anyhow", @@ -9631,32 +9693,42 @@ dependencies = [ "log", "object 0.29.0", "rustc-demangle", - "rustix 0.35.13", "serde", "target-lexicon", - "thiserror", "wasmtime-environ", "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] name = "wasmtime-jit-debug" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +checksum = "f76ef2e410329aaf8555ac6571d6fe07711be0646dcdf7ff3ab750a42ed2e583" dependencies = [ "object 0.29.0", "once_cell", - "rustix 0.35.13", + "rustix", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1fd0f0dd79e7cc0f55b102e320d7c77ab76cd272008a8fd98e25b5777e2636" +dependencies = [ + "cfg-if", + "libc", + "windows-sys", ] [[package]] name = "wasmtime-runtime" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +checksum = "271aef9b4ca2e953a866293683f2db33cda46f6933c5e431e68d8373723d4ab6" dependencies = [ "anyhow", "cc", @@ -9669,19 +9741,18 @@ dependencies = [ "memoffset 0.6.5", "paste", "rand 0.8.5", - "rustix 0.35.13", - "thiserror", + "rustix", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.36.1", + "windows-sys", ] [[package]] name = "wasmtime-types" -version = "1.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +checksum = "b18144b0e45479a830ac9fcebfc71a16d90dc72d8ebd5679700eb3bfe974d7df" dependencies = [ "cranelift-entity", "serde", @@ -9960,6 +10031,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "wide" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b689b6c49d6549434bf944e6b0f39238cf63693cb7a147e9d887507fffa3b223" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "widestring" version = "0.5.1" @@ -10010,19 +10091,6 @@ dependencies = [ "windows_x86_64_msvc 0.34.0", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -10050,12 +10118,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.42.1" @@ -10068,12 +10130,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.42.1" @@ -10086,12 +10142,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.42.1" @@ -10104,12 +10154,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -10128,12 +10172,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.42.1" diff --git a/client/cli/src/frontier_db_cmd/mapping_db.rs b/client/cli/src/frontier_db_cmd/mapping_db.rs index cf12ee96d2..dfbd593d5f 100644 --- a/client/cli/src/frontier_db_cmd/mapping_db.rs +++ b/client/cli/src/frontier_db_cmd/mapping_db.rs @@ -23,7 +23,7 @@ use serde::Deserialize; // Substrate use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fp_rpc::EthereumRuntimeRPCApi; @@ -79,11 +79,10 @@ where .block_hash(ethereum_block_hash)? .is_none() { - let id = BlockId::Hash(*substrate_block_hash); let existing_transaction_hashes: Vec = if let Some(statuses) = self .client .runtime_api() - .current_transaction_statuses(&id) + .current_transaction_statuses(*substrate_block_hash) .map_err(|e| format!("{:?}", e))? { statuses @@ -138,11 +137,10 @@ where .block_hash(ethereum_block_hash)? .is_some() { - let id = BlockId::Hash(*substrate_block_hash); let existing_transaction_hashes: Vec = if let Some(statuses) = self .client .runtime_api() - .current_transaction_statuses(&id) + .current_transaction_statuses(*substrate_block_hash) .map_err(|e| format!("{:?}", e))? { statuses diff --git a/client/cli/src/frontier_db_cmd/tests.rs b/client/cli/src/frontier_db_cmd/tests.rs index f3e22c5c99..c45367ad14 100644 --- a/client/cli/src/frontier_db_cmd/tests.rs +++ b/client/cli/src/frontier_db_cmd/tests.rs @@ -30,7 +30,7 @@ use sp_blockchain::HeaderBackend; use sp_consensus::BlockOrigin; use sp_io::hashing::twox_128; use sp_runtime::{ - generic::{Block, BlockId, Header}, + generic::{Block, Header}, traits::{BlakeTwo256, Block as BlockT}, }; use substrate_test_runtime_client::{ @@ -626,11 +626,7 @@ fn commitment_update() { // Build a block A1 and fill the pallet-ethereum status. let mut builder = client - .new_block_at( - &BlockId::Hash(client.genesis_hash()), - Default::default(), - false, - ) + .new_block_at(client.genesis_hash(), Default::default(), false) .unwrap(); builder .push_storage_change(key.clone(), Some(statuses_a1.encode())) @@ -680,11 +676,7 @@ fn commitment_update() { let tmp = tempdir().expect("create a temporary directory"); let mut builder = client - .new_block_at( - &BlockId::Hash(client.genesis_hash()), - Default::default(), - false, - ) + .new_block_at(client.genesis_hash(), Default::default(), false) .unwrap(); builder .push_storage_change(key, Some(statuses_a2.encode())) diff --git a/client/db/src/upgrade.rs b/client/db/src/upgrade.rs index 523918a9de..919f440b3e 100644 --- a/client/db/src/upgrade.rs +++ b/client/db/src/upgrade.rs @@ -337,7 +337,7 @@ mod tests { use sp_blockchain::HeaderBackend; use sp_core::H256; use sp_runtime::{ - generic::{Block, BlockId, Header}, + generic::{Block, Header}, traits::{BlakeTwo256, Block as BlockT}, }; use tempfile::tempdir; @@ -406,11 +406,7 @@ mod tests { // Keep track of the canon hash to later verify the migration replaced it. // A1 let mut builder = client - .new_block_at( - &BlockId::Hash(previous_canon_block_hash), - Default::default(), - false, - ) + .new_block_at(previous_canon_block_hash, Default::default(), false) .unwrap(); builder.push_storage_change(vec![1], None).unwrap(); let block = builder.build().unwrap().block; @@ -418,11 +414,7 @@ mod tests { executor::block_on(client.import(BlockOrigin::Own, block)).unwrap(); // A2 let mut builder = client - .new_block_at( - &BlockId::Hash(previous_canon_block_hash), - Default::default(), - false, - ) + .new_block_at(previous_canon_block_hash, Default::default(), false) .unwrap(); builder.push_storage_change(vec![2], None).unwrap(); let block = builder.build().unwrap().block; diff --git a/client/mapping-sync/src/lib.rs b/client/mapping-sync/src/lib.rs index 70d5794968..774ad93cef 100644 --- a/client/mapping-sync/src/lib.rs +++ b/client/mapping-sync/src/lib.rs @@ -28,10 +28,7 @@ use std::sync::Arc; use sc_client_api::backend::{Backend, StorageProvider}; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::{Backend as _, HeaderBackend}; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, Header as HeaderT, Zero}, -}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Zero}; // Frontier use fc_storage::OverrideHandle; use fp_consensus::{FindLogError, Hashes, Log, PostLog, PreLog}; @@ -44,7 +41,7 @@ pub fn sync_block( header: &Block::Header, ) -> Result<(), String> where - C: StorageProvider + HeaderBackend, + C: HeaderBackend + StorageProvider, BE: Backend, { let substrate_block_hash = header.hash(); @@ -118,23 +115,23 @@ where C: ProvideRuntimeApi, C::Api: EthereumRuntimeRPCApi, { - let id = BlockId::Hash(header.hash()); + let substrate_block_hash = header.hash(); if let Some(api_version) = client .runtime_api() - .api_version::>(&id) + .api_version::>(substrate_block_hash) .map_err(|e| format!("{:?}", e))? { let block = if api_version > 1 { client .runtime_api() - .current_block(&id) + .current_block(substrate_block_hash) .map_err(|e| format!("{:?}", e))? } else { #[allow(deprecated)] let legacy_block = client .runtime_api() - .current_block_before_version_2(&id) + .current_block_before_version_2(substrate_block_hash) .map_err(|e| format!("{:?}", e))?; legacy_block.map(|block| block.into()) }; @@ -143,13 +140,13 @@ where .header .hash(); let mapping_commitment = fc_db::MappingCommitment:: { - block_hash: header.hash(), + block_hash: substrate_block_hash, ethereum_block_hash: block_hash, ethereum_transaction_hashes: Vec::new(), }; backend.mapping().write_hashes(mapping_commitment)?; } else { - backend.mapping().write_none(header.hash())?; + backend.mapping().write_none(substrate_block_hash)?; }; Ok(()) diff --git a/client/rpc/src/eth/block.rs b/client/rpc/src/eth/block.rs index 96a357382d..9f3e050ce2 100644 --- a/client/rpc/src/eth/block.rs +++ b/client/rpc/src/eth/block.rs @@ -27,7 +27,7 @@ use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -70,13 +70,13 @@ where let base_fee = client .runtime_api() - .gas_price(&BlockId::Hash(substrate_hash)) + .gas_price(substrate_hash) .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => Ok(Some(rich_block_build( block, - statuses.into_iter().map(Option::Some).collect(), + statuses.into_iter().map(Some).collect(), Some(hash), full, Some(base_fee), @@ -113,7 +113,10 @@ where .current_transaction_statuses(schema, substrate_hash) .await; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); + let base_fee = client + .runtime_api() + .gas_price(substrate_hash) + .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => { diff --git a/client/rpc/src/eth/cache/mod.rs b/client/rpc/src/eth/cache/mod.rs index 1dcd755e35..42e163d6fb 100644 --- a/client/rpc/src/eth/cache/mod.rs +++ b/client/rpc/src/eth/cache/mod.rs @@ -36,10 +36,7 @@ use sc_client_api::{ use sc_service::SpawnTaskHandle; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}, -}; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT, UniqueSaturatedInto}; // Frontier use fc_rpc_core::types::*; use fc_storage::{OverrideHandle, StorageOverride}; @@ -339,7 +336,7 @@ where let block = handler.current_block(hash); let mut block_number: Option = None; - let base_fee = client.runtime_api().gas_price(&BlockId::Hash(hash)).unwrap_or_default(); + let base_fee = client.runtime_api().gas_price(hash).unwrap_or_default(); let receipts = handler.current_receipts(hash); let mut result = FeeHistoryCacheItem { base_fee: if base_fee > U256::from(u64::MAX) { u64::MAX } else { base_fee.low_u64() }, diff --git a/client/rpc/src/eth/client.rs b/client/rpc/src/eth/client.rs index 17f97bdf19..82ba8948fa 100644 --- a/client/rpc/src/eth/client.rs +++ b/client/rpc/src/eth/client.rs @@ -25,10 +25,7 @@ use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, UniqueSaturatedInto}, -}; +use sp_runtime::traits::{Block as BlockT, UniqueSaturatedInto}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -101,7 +98,7 @@ where Ok(Some( self.client .runtime_api() - .chain_id(&BlockId::Hash(hash)) + .chain_id(hash) .map_err(|err| internal_err(format!("fetch runtime chain id failed: {:?}", err)))? .into(), )) diff --git a/client/rpc/src/eth/execute.rs b/client/rpc/src/eth/execute.rs index e377d29bb6..db73fe52f8 100644 --- a/client/rpc/src/eth/execute.rs +++ b/client/rpc/src/eth/execute.rs @@ -28,7 +28,7 @@ use sc_transaction_pool::ChainApi; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{generic::BlockId, traits::Block as BlockT, SaturatedConversion}; +use sp_runtime::{traits::Block as BlockT, SaturatedConversion}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -93,40 +93,41 @@ where ) }; - let (id, api) = match frontier_backend_client::native_block_id::( + let (substrate_hash, api) = match frontier_backend_client::native_block_id::( self.client.as_ref(), self.backend.as_ref(), number, )? { - Some(id) => (id, self.client.runtime_api()), + Some(id) => { + let hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| crate::err(JSON_RPC_ERROR_DEFAULT, "header not found", None))?; + (hash, self.client.runtime_api()) + } None => { // Not mapped in the db, assume pending. - let id = BlockId::Hash(self.client.info().best_hash); + let hash = self.client.info().best_hash; let api = pending_runtime_api(self.client.as_ref(), self.graph.as_ref())?; - (id, api) + (hash, api) } }; - if let Err(sp_blockchain::Error::UnknownBlock(_)) = - self.client.expect_block_hash_from_id(&id) + let api_version = if let Ok(Some(api_version)) = + api.api_version::>(substrate_hash) { - return Err(crate::err(JSON_RPC_ERROR_DEFAULT, "header not found", None)); - } - - let api_version = - if let Ok(Some(api_version)) = api.api_version::>(&id) { - api_version - } else { - return Err(internal_err("failed to retrieve Runtime Api version")); - }; + api_version + } else { + return Err(internal_err("failed to retrieve Runtime Api version")); + }; let block = if api_version > 1 { - api.current_block(&id) + api.current_block(substrate_hash) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))? } else { #[allow(deprecated)] let legacy_block = api - .current_block_before_version_2(&id) + .current_block_before_version_2(substrate_hash) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; legacy_block.map(|block| block.into()) }; @@ -150,7 +151,7 @@ where } // If gas limit is not specified in the request we either use the multiplier if supported // or fallback to the block gas limit. - None => match api.gas_limit_multiplier_support(&id) { + None => match api.gas_limit_multiplier_support(substrate_hash) { Ok(_) => max_gas_limit, _ => block_gas_limit, }, @@ -163,7 +164,7 @@ where // Legacy pre-london #[allow(deprecated)] let info = api.call_before_version_2( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -182,7 +183,7 @@ where // Post-london #[allow(deprecated)] let info = api.call_before_version_4( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -203,7 +204,7 @@ where let access_list = access_list.unwrap_or_default(); let info = api .call( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -234,7 +235,7 @@ where // Legacy pre-london #[allow(deprecated)] let info = api.create_before_version_2( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -249,14 +250,14 @@ where error_on_execution_failure(&info.exit_reason, &[])?; let code = api - .account_code_at(&id, info.value) + .account_code_at(substrate_hash, info.value) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; Ok(Bytes(code)) } else if api_version >= 2 && api_version < 4 { // Post-london #[allow(deprecated)] let info = api.create_before_version_4( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -272,7 +273,7 @@ where error_on_execution_failure(&info.exit_reason, &[])?; let code = api - .account_code_at(&id, info.value) + .account_code_at(substrate_hash, info.value) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; Ok(Bytes(code)) } else if api_version == 4 { @@ -280,7 +281,7 @@ where let access_list = access_list.unwrap_or_default(); let info = api .create( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -302,7 +303,7 @@ where error_on_execution_failure(&info.exit_reason, &[])?; let code = api - .account_code_at(&id, info.value) + .account_code_at(substrate_hash, info.value) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; Ok(Bytes(code)) } else { @@ -321,7 +322,6 @@ where // Get best hash (TODO missing support for estimating gas historically) let substrate_hash = client.info().best_hash; - let id = BlockId::Hash(substrate_hash); // Adapt request for gas estimation. let request = EGA::adapt_request(request); @@ -335,7 +335,7 @@ where if let Some(to) = request.to { let to_code = client .runtime_api() - .account_code_at(&id, to) + .account_code_at(substrate_hash, to) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))?; if to_code.is_empty() { return Ok(MIN_GAS_PER_TX); @@ -382,7 +382,7 @@ where } // If gas limit is not specified in the request we either use the multiplier if supported // or fallback to the block gas limit. - None => match api.gas_limit_multiplier_support(&id) { + None => match api.gas_limit_multiplier_support(substrate_hash) { Ok(_) => max_gas_limit, _ => block_gas_limit, }, @@ -393,7 +393,7 @@ where let gas_price = gas_price.unwrap_or_default(); if gas_price > U256::zero() { let balance = api - .account_basic(&id, from) + .account_basic(substrate_hash, from) .map_err(|err| internal_err(format!("runtime error: {:?}", err)))? .balance; let mut available = balance; @@ -461,7 +461,7 @@ where // Legacy pre-london #[allow(deprecated)] api.call_before_version_2( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -477,7 +477,7 @@ where // Post-london #[allow(deprecated)] api.call_before_version_4( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -494,7 +494,7 @@ where // Post-london + access list support let access_list = access_list.unwrap_or_default(); api.call( - &id, + substrate_hash, from.unwrap_or_default(), to, data, @@ -522,7 +522,7 @@ where // Legacy pre-london #[allow(deprecated)] api.create_before_version_2( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -537,7 +537,7 @@ where // Post-london #[allow(deprecated)] api.create_before_version_4( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -553,7 +553,7 @@ where // Post-london + access list support let access_list = access_list.unwrap_or_default(); api.create( - &id, + substrate_hash, from.unwrap_or_default(), data, value.unwrap_or_default(), @@ -585,7 +585,7 @@ where let api_version = if let Ok(Some(api_version)) = client .runtime_api() - .api_version::>(&id) + .api_version::>(substrate_hash) { api_version } else { diff --git a/client/rpc/src/eth/fee.rs b/client/rpc/src/eth/fee.rs index 94c6b1bff1..1c7570ae06 100644 --- a/client/rpc/src/eth/fee.rs +++ b/client/rpc/src/eth/fee.rs @@ -24,10 +24,7 @@ use sc_network_common::ExHashT; use sc_transaction_pool::ChainApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, UniqueSaturatedInto}, -}; +use sp_runtime::traits::{Block as BlockT, UniqueSaturatedInto}; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -43,11 +40,11 @@ where BE: Backend + 'static, { pub fn gas_price(&self) -> Result { - let block = BlockId::Hash(self.client.info().best_hash); + let block_hash = self.client.info().best_hash; self.client .runtime_api() - .gas_price(&block) + .gas_price(block_hash) .map_err(|err| internal_err(format!("fetch runtime chain id failed: {:?}", err))) } diff --git a/client/rpc/src/eth/mod.rs b/client/rpc/src/eth/mod.rs index 864d79dab2..f89f70c398 100644 --- a/client/rpc/src/eth/mod.rs +++ b/client/rpc/src/eth/mod.rs @@ -43,10 +43,7 @@ use sp_api::{Core, HeaderT, ProvideRuntimeApi}; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::{ - generic::BlockId, - traits::{Block as BlockT, UniqueSaturatedInto}, -}; +use sp_runtime::traits::{Block as BlockT, UniqueSaturatedInto}; // Frontier use fc_rpc_core::{types::*, EthApiServer}; use fc_storage::OverrideHandle; @@ -518,7 +515,6 @@ where // In case of Pending, we need an overlayed state to query over. let api = client.runtime_api(); let best_hash = client.info().best_hash; - let best = BlockId::Hash(best_hash); // Get all transactions in the ready queue. let xts: Vec<::Extrinsic> = graph .validated_pool() @@ -527,18 +523,18 @@ where .collect::::Extrinsic>>(); // Manually initialize the overlay. if let Ok(Some(header)) = client.header(best_hash) { - let parent_hash = BlockId::Hash(*header.parent_hash()); - api.initialize_block(&parent_hash, &header) + let parent_hash = *header.parent_hash(); + api.initialize_block(parent_hash, &header) .map_err(|e| internal_err(format!("Runtime api access error: {:?}", e)))?; // Apply the ready queue to the best block's state. for xt in xts { - let _ = api.apply_extrinsic(&best, xt); + let _ = api.apply_extrinsic(best_hash, xt); } Ok(api) } else { Err(internal_err(format!( "Cannot get header for block {:?}", - best + best_hash ))) } } diff --git a/client/rpc/src/eth/state.rs b/client/rpc/src/eth/state.rs index ce26afb9cc..c36c3308bf 100644 --- a/client/rpc/src/eth/state.rs +++ b/client/rpc/src/eth/state.rs @@ -27,7 +27,7 @@ use sc_transaction_pool_api::{InPoolTransaction, TransactionPool}; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -52,7 +52,7 @@ where if number == BlockNumber::Pending { let api = pending_runtime_api(self.client.as_ref(), self.graph.as_ref())?; Ok(api - .account_basic(&BlockId::Hash(self.client.info().best_hash), address) + .account_basic(self.client.info().best_hash, address) .map_err(|err| internal_err(format!("fetch runtime chain id failed: {:?}", err)))? .balance) } else if let Ok(Some(id)) = frontier_backend_client::native_block_id::( @@ -60,10 +60,14 @@ where self.backend.as_ref(), Some(number), ) { + let substrate_hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; Ok(self .client .runtime_api() - .account_basic(&id, address) + .account_basic(substrate_hash, address) .map_err(|err| internal_err(format!("fetch runtime chain id failed: {:?}", err)))? .balance) } else { @@ -81,7 +85,7 @@ where if number == BlockNumber::Pending { let api = pending_runtime_api(self.client.as_ref(), self.graph.as_ref())?; Ok(api - .storage_at(&BlockId::Hash(self.client.info().best_hash), address, index) + .storage_at(self.client.info().best_hash, address, index) .unwrap_or_default()) } else if let Ok(Some(id)) = frontier_backend_client::native_block_id::( self.client.as_ref(), @@ -107,12 +111,12 @@ where pub fn transaction_count(&self, address: H160, number: Option) -> Result { if let Some(BlockNumber::Pending) = number { - let block = BlockId::Hash(self.client.info().best_hash); + let substrate_hash = self.client.info().best_hash; let nonce = self .client .runtime_api() - .account_basic(&block, address) + .account_basic(substrate_hash, address) .map_err(|err| { internal_err(format!("fetch runtime account basic failed: {:?}", err)) })? @@ -141,10 +145,15 @@ where None => return Ok(U256::zero()), }; + let substrate_hash = self + .client + .expect_block_hash_from_id(&id) + .map_err(|_| internal_err(format!("Expect block number from id: {}", id)))?; + Ok(self .client .runtime_api() - .account_basic(&id, address) + .account_basic(substrate_hash, address) .map_err(|err| internal_err(format!("fetch runtime account basic failed: {:?}", err)))? .nonce) } @@ -154,7 +163,7 @@ where if number == BlockNumber::Pending { let api = pending_runtime_api(self.client.as_ref(), self.graph.as_ref())?; Ok(api - .account_code_at(&BlockId::Hash(self.client.info().best_hash), address) + .account_code_at(self.client.info().best_hash, address) .unwrap_or_default() .into()) } else if let Ok(Some(id)) = frontier_backend_client::native_block_id::( diff --git a/client/rpc/src/eth/submit.rs b/client/rpc/src/eth/submit.rs index ee4a676f4d..40ead2cd95 100644 --- a/client/rpc/src/eth/submit.rs +++ b/client/rpc/src/eth/submit.rs @@ -86,10 +86,7 @@ where let gas_limit = match request.gas { Some(gas_limit) => gas_limit, None => { - let block = self - .client - .runtime_api() - .current_block(&BlockId::Hash(hash)); + let block = self.client.runtime_api().current_block(hash); if let Ok(Some(block)) = block { block.header.gas_limit } else { @@ -148,11 +145,11 @@ where }; let transaction_hash = transaction.hash(); - let block_hash = BlockId::hash(self.client.info().best_hash); + let block_hash = self.client.info().best_hash; let api_version = match self .client .runtime_api() - .api_version::>(&block_hash) + .api_version::>(block_hash) { Ok(api_version) => api_version, _ => return Err(internal_err("cannot access runtime api")), @@ -162,7 +159,7 @@ where Some(2) => match self .client .runtime_api() - .convert_transaction(&block_hash, transaction) + .convert_transaction(block_hash, transaction) { Ok(extrinsic) => extrinsic, Err(_) => return Err(internal_err("cannot access runtime api")), @@ -174,7 +171,7 @@ where match self .client .runtime_api() - .convert_transaction_before_version_2(&block_hash, legacy_transaction) + .convert_transaction_before_version_2(block_hash, legacy_transaction) { Ok(extrinsic) => extrinsic, Err(_) => return Err(internal_err("cannot access runtime api")), @@ -200,7 +197,11 @@ where }; self.pool - .submit_one(&block_hash, TransactionSource::Local, extrinsic) + .submit_one( + &BlockId::Hash(block_hash), + TransactionSource::Local, + extrinsic, + ) .map_ok(move |_| transaction_hash) .map_err(|err| internal_err(format::Geth::pool_error(err))) .await @@ -219,11 +220,11 @@ where let transaction_hash = transaction.hash(); - let block_hash = BlockId::hash(self.client.info().best_hash); + let block_hash = self.client.info().best_hash; let api_version = match self .client .runtime_api() - .api_version::>(&block_hash) + .api_version::>(block_hash) { Ok(api_version) => api_version, _ => return Err(internal_err("cannot access runtime api")), @@ -233,7 +234,7 @@ where Some(2) => match self .client .runtime_api() - .convert_transaction(&block_hash, transaction) + .convert_transaction(block_hash, transaction) { Ok(extrinsic) => extrinsic, Err(_) => return Err(internal_err("cannot access runtime api")), @@ -245,7 +246,7 @@ where match self .client .runtime_api() - .convert_transaction_before_version_2(&block_hash, legacy_transaction) + .convert_transaction_before_version_2(block_hash, legacy_transaction) { Ok(extrinsic) => extrinsic, Err(_) => { @@ -273,7 +274,11 @@ where }; self.pool - .submit_one(&block_hash, TransactionSource::Local, extrinsic) + .submit_one( + &BlockId::Hash(block_hash), + TransactionSource::Local, + extrinsic, + ) .map_ok(move |_| transaction_hash) .map_err(|err| internal_err(format::Geth::pool_error(err))) .await diff --git a/client/rpc/src/eth/transaction.rs b/client/rpc/src/eth/transaction.rs index 9405416f29..cd524fa375 100644 --- a/client/rpc/src/eth/transaction.rs +++ b/client/rpc/src/eth/transaction.rs @@ -29,7 +29,7 @@ use sc_transaction_pool_api::InPoolTransaction; use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::hashing::keccak_256; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_rpc_core::types::*; use fp_rpc::EthereumRuntimeRPCApi; @@ -65,10 +65,10 @@ where Some((hash, index)) => (hash, index as usize), None => { let api = client.runtime_api(); - let best_block: BlockId = BlockId::Hash(client.info().best_hash); + let best_block = client.info().best_hash; let api_version = if let Ok(Some(api_version)) = - api.api_version::>(&best_block) + api.api_version::>(best_block) { api_version } else { @@ -97,12 +97,12 @@ where ); let ethereum_transactions: Vec = if api_version > 1 { - api.extrinsic_filter(&best_block, xts).map_err(|err| { + api.extrinsic_filter(best_block, xts).map_err(|err| { internal_err(format!("fetch runtime extrinsic filter failed: {:?}", err)) })? } else { #[allow(deprecated)] - let legacy = api.extrinsic_filter_before_version_2(&best_block, xts) + let legacy = api.extrinsic_filter_before_version_2(best_block, xts) .map_err(|err| { internal_err(format!( "fetch runtime extrinsic filter failed: {:?}", @@ -143,7 +143,7 @@ where let base_fee = client .runtime_api() - .gas_price(&BlockId::Hash(substrate_hash)) + .gas_price(substrate_hash) .unwrap_or_default(); match (block, statuses) { @@ -188,7 +188,7 @@ where let base_fee = client .runtime_api() - .gas_price(&BlockId::Hash(substrate_hash)) + .gas_price(substrate_hash) .unwrap_or_default(); match (block, statuses) { @@ -239,7 +239,10 @@ where .current_transaction_statuses(schema, substrate_hash) .await; - let base_fee = client.runtime_api().gas_price(&id).unwrap_or_default(); + let base_fee = client + .runtime_api() + .gas_price(substrate_hash) + .unwrap_or_default(); match (block, statuses) { (Some(block), Some(statuses)) => { @@ -376,7 +379,7 @@ where EthereumTransaction::EIP2930(t) => t.gas_price, EthereumTransaction::EIP1559(t) => client .runtime_api() - .gas_price(&BlockId::Hash(substrate_hash)) + .gas_price(substrate_hash) .unwrap_or_default() .checked_add(t.max_priority_fee_per_gas) .unwrap_or_else(U256::max_value) diff --git a/client/rpc/src/eth_pubsub.rs b/client/rpc/src/eth_pubsub.rs index 8e7bd9e39c..670f653358 100644 --- a/client/rpc/src/eth_pubsub.rs +++ b/client/rpc/src/eth_pubsub.rs @@ -31,7 +31,7 @@ use sc_network::{NetworkService, NetworkStatusProvider}; use sc_network_common::ExHashT; use sc_rpc::SubscriptionTaskExecutor; use sc_transaction_pool_api::TransactionPool; -use sp_api::{ApiExt, BlockId, ProvideRuntimeApi}; +use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle; use sp_core::hashing::keccak_256; @@ -292,12 +292,12 @@ where .import_notification_stream() .filter_map(move |txhash| { if let Some(xt) = pool.ready_transaction(&txhash) { - let best_block: BlockId = BlockId::Hash(client.info().best_hash); + let best_block = client.info().best_hash; let api = client.runtime_api(); let api_version = if let Ok(Some(api_version)) = - api.api_version::>(&best_block) + api.api_version::>(best_block) { api_version } else { @@ -307,11 +307,11 @@ where let xts = vec![xt.data().clone()]; let txs: Option> = if api_version > 1 { - api.extrinsic_filter(&best_block, xts).ok() + api.extrinsic_filter(best_block, xts).ok() } else { #[allow(deprecated)] if let Ok(legacy) = - api.extrinsic_filter_before_version_2(&best_block, xts) + api.extrinsic_filter_before_version_2(best_block, xts) { Some(legacy.into_iter().map(|tx| tx.into()).collect()) } else { diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 58c50b75d5..35c072cfdb 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -248,7 +248,7 @@ mod tests { use sp_blockchain::HeaderBackend; use sp_consensus::BlockOrigin; use sp_runtime::{ - generic::{Block, BlockId, Header}, + generic::{Block, Header}, traits::{BlakeTwo256, Block as BlockT}, }; use substrate_test_runtime_client::{ @@ -300,7 +300,7 @@ mod tests { // A1 -> B1 let mut builder = client - .new_block_at(&BlockId::Hash(a1_hash), Default::default(), false) + .new_block_at(a1_hash, Default::default(), false) .unwrap(); builder.push_storage_change(vec![1], None).unwrap(); let b1 = builder.build().unwrap().block; @@ -329,7 +329,7 @@ mod tests { // A1 -> B2 let mut builder = client - .new_block_at(&BlockId::Hash(a1_hash), Default::default(), false) + .new_block_at(a1_hash, Default::default(), false) .unwrap(); builder.push_storage_change(vec![2], None).unwrap(); let b2 = builder.build().unwrap().block; @@ -358,7 +358,7 @@ mod tests { // B2 -> C1. B2 branch is now canon. let mut builder = client - .new_block_at(&BlockId::Hash(b2_hash), Default::default(), false) + .new_block_at(b2_hash, Default::default(), false) .unwrap(); builder.push_storage_change(vec![1], None).unwrap(); let c1 = builder.build().unwrap().block; diff --git a/client/rpc/src/net.rs b/client/rpc/src/net.rs index 4b12efc014..b931b453be 100644 --- a/client/rpc/src/net.rs +++ b/client/rpc/src/net.rs @@ -24,7 +24,7 @@ use sc_network::NetworkService; use sc_network_common::{service::NetworkPeers, ExHashT}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_rpc_core::{types::PeerCount, NetApiServer}; use fp_rpc::EthereumRuntimeRPCApi; @@ -64,7 +64,7 @@ where Ok(self .client .runtime_api() - .chain_id(&BlockId::Hash(hash)) + .chain_id(hash) .map_err(|_| internal_err("fetch runtime chain id failed"))? .to_string()) } diff --git a/client/rpc/src/web3.rs b/client/rpc/src/web3.rs index 4f97b78315..4d702cda1d 100644 --- a/client/rpc/src/web3.rs +++ b/client/rpc/src/web3.rs @@ -24,7 +24,7 @@ use jsonrpsee::core::RpcResult as Result; use sp_api::{Core, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::keccak_256; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::traits::Block as BlockT; // Frontier use fc_rpc_core::{types::Bytes, Web3ApiServer}; use fp_rpc::EthereumRuntimeRPCApi; @@ -58,7 +58,7 @@ where let version = self .client .runtime_api() - .version(&BlockId::Hash(hash)) + .version(hash) .map_err(|err| internal_err(format!("fetch runtime version failed: {:?}", err)))?; Ok(format!( "{spec_name}/v{spec_version}.{impl_version}/{pkg_name}-{pkg_version}", diff --git a/client/storage/src/overrides/mod.rs b/client/storage/src/overrides/mod.rs index 3f2966b062..b30e3662d1 100644 --- a/client/storage/src/overrides/mod.rs +++ b/client/storage/src/overrides/mod.rs @@ -21,7 +21,7 @@ use std::{collections::BTreeMap, marker::PhantomData, sync::Arc}; use ethereum::BlockV2 as EthereumBlock; use ethereum_types::{H160, H256, U256}; // Substrate -use sp_api::{ApiExt, BlockId, ProvideRuntimeApi}; +use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_io::hashing::{blake2_128, twox_128}; use sp_runtime::{traits::Block as BlockT, Permill}; // Frontier @@ -103,7 +103,7 @@ where fn account_code_at(&self, block_hash: Block::Hash, address: H160) -> Option> { self.client .runtime_api() - .account_code_at(&BlockId::Hash(block_hash), address) + .account_code_at(block_hash, address) .ok() } @@ -111,7 +111,7 @@ where fn storage_at(&self, block_hash: Block::Hash, address: H160, index: U256) -> Option { self.client .runtime_api() - .storage_at(&BlockId::Hash(block_hash), address, index) + .storage_at(block_hash, address, index) .ok() } @@ -120,7 +120,7 @@ where let api = self.client.runtime_api(); let api_version = if let Ok(Some(api_version)) = - api.api_version::>(&BlockId::Hash(block_hash)) + api.api_version::>(block_hash) { api_version } else { @@ -128,12 +128,10 @@ where }; if api_version == 1 { #[allow(deprecated)] - let old_block = api - .current_block_before_version_2(&BlockId::Hash(block_hash)) - .ok()?; + let old_block = api.current_block_before_version_2(block_hash).ok()?; old_block.map(|block| block.into()) } else { - api.current_block(&BlockId::Hash(block_hash)).ok()? + api.current_block(block_hash).ok()? } } @@ -142,7 +140,7 @@ where let api = self.client.runtime_api(); let api_version = if let Ok(Some(api_version)) = - api.api_version::>(&BlockId::Hash(block_hash)) + api.api_version::>(block_hash) { api_version } else { @@ -150,9 +148,7 @@ where }; if api_version < 4 { #[allow(deprecated)] - let old_receipts = api - .current_receipts_before_version_4(&BlockId::Hash(block_hash)) - .ok()?; + let old_receipts = api.current_receipts_before_version_4(block_hash).ok()?; old_receipts.map(|receipts| { receipts .into_iter() @@ -169,7 +165,7 @@ where } else { self.client .runtime_api() - .current_receipts(&BlockId::Hash(block_hash)) + .current_receipts(block_hash) .ok()? } } @@ -181,17 +177,14 @@ where ) -> Option> { self.client .runtime_api() - .current_transaction_statuses(&BlockId::Hash(block_hash)) + .current_transaction_statuses(block_hash) .ok()? } /// Return the elasticity multiplier at the give post-eip1559 height. fn elasticity(&self, block_hash: Block::Hash) -> Option { if self.is_eip1559(block_hash) { - self.client - .runtime_api() - .elasticity(&BlockId::Hash(block_hash)) - .ok()? + self.client.runtime_api().elasticity(block_hash).ok()? } else { None } @@ -201,7 +194,7 @@ where if let Ok(Some(api_version)) = self .client .runtime_api() - .api_version::>(&BlockId::Hash(block_hash)) + .api_version::>(block_hash) { return api_version >= 2; } diff --git a/primitives/self-contained/src/unchecked_extrinsic.rs b/primitives/self-contained/src/unchecked_extrinsic.rs index 30f4d9f4d5..97032c7add 100644 --- a/primitives/self-contained/src/unchecked_extrinsic.rs +++ b/primitives/self-contained/src/unchecked_extrinsic.rs @@ -16,11 +16,11 @@ // limitations under the License. use frame_support::{ - codec::{Decode, Encode}, dispatch::{DispatchInfo, GetDispatchInfo}, - scale_info::TypeInfo, traits::ExtrinsicCall, }; +use scale_codec::{Decode, Encode}; +use scale_info::TypeInfo; use sp_runtime::{ traits::{ self, Checkable, Extrinsic, ExtrinsicMetadata, IdentifyAccount, MaybeDisplay, Member, diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index 76097bf7ca..a429a8b08a 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -32,6 +32,7 @@ sc-consensus-manual-seal = { workspace = true } sc-executor = { workspace = true } sc-finality-grandpa = { workspace = true } sc-network = { workspace = true } +sc-network-common = { workspace = true } sc-rpc = { workspace = true } sc-rpc-api = { workspace = true } sc-service = { workspace = true } diff --git a/template/node/src/service.rs b/template/node/src/service.rs index d456e1057b..b78f3713b1 100644 --- a/template/node/src/service.rs +++ b/template/node/src/service.rs @@ -8,6 +8,7 @@ use prometheus_endpoint::Registry; use sc_client_api::{BlockBackend, StateBackendFor}; use sc_consensus::BasicQueue; use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch}; +use sc_network_common::sync::warp::WarpSyncParams; use sc_service::{error::Error as ServiceError, Configuration, PartialComponents, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker}; use sp_api::{ConstructRuntimeApi, TransactionFor}; @@ -293,24 +294,23 @@ where &config.chain_spec, ); - let warp_sync: Option>> = - if sealing.is_some() { - None - } else { - config - .network - .extra_sets - .push(sc_finality_grandpa::grandpa_peers_set_config( - grandpa_protocol_name.clone(), - )); - Some(Arc::new( - sc_finality_grandpa::warp_proof::NetworkProvider::new( - backend.clone(), - grandpa_link.shared_authority_set().clone(), - Vec::default(), - ), - )) - }; + let warp_sync_params = if sealing.is_some() { + None + } else { + config + .network + .extra_sets + .push(sc_finality_grandpa::grandpa_peers_set_config( + grandpa_protocol_name.clone(), + )); + let warp_sync: Arc> = + Arc::new(sc_finality_grandpa::warp_proof::NetworkProvider::new( + backend.clone(), + grandpa_link.shared_authority_set().clone(), + Vec::default(), + )); + Some(WarpSyncParams::WithProvider(warp_sync)) + }; let (network, system_rpc_tx, tx_handler_controller, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { @@ -320,7 +320,7 @@ where spawn_handle: task_manager.spawn_handle(), import_queue, block_announce_validator_builder: None, - warp_sync, + warp_sync_params, })?; if config.offchain_worker.enabled { From 5af12e94d7dfc8a0208a290643a800f55de7b219 Mon Sep 17 00:00:00 2001 From: Wei Tang Date: Wed, 15 Mar 2023 14:05:22 +0100 Subject: [PATCH 09/17] Increase modexp gas cost when mod is even (#1017) * Increase modexp gas cost when mod is even * Fix tests --- frame/evm/precompile/modexp/src/lib.rs | 14 +++++++++++--- shell.nix | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frame/evm/precompile/modexp/src/lib.rs b/frame/evm/precompile/modexp/src/lib.rs index 6932df40ab..1b4aa66b0d 100644 --- a/frame/evm/precompile/modexp/src/lib.rs +++ b/frame/evm/precompile/modexp/src/lib.rs @@ -23,7 +23,7 @@ extern crate alloc; use alloc::{vec, vec::Vec}; use core::cmp::max; -use num::{BigUint, FromPrimitive, One, ToPrimitive, Zero}; +use num::{BigUint, FromPrimitive, Integer, One, ToPrimitive, Zero}; use fp_evm::{ ExitError, ExitSucceed, Precompile, PrecompileFailure, PrecompileHandle, PrecompileOutput, @@ -41,6 +41,7 @@ fn calculate_gas_cost( mod_length: u64, exponent: &BigUint, exponent_bytes: &[u8], + mod_is_even: bool, ) -> u64 { fn calculate_multiplication_complexity(base_length: u64, mod_length: u64) -> u64 { let max_length = max(base_length, mod_length); @@ -91,6 +92,7 @@ fn calculate_gas_cost( MIN_GAS_COST, multiplication_complexity * iteration_count / 3, ) + .saturating_mul(if mod_is_even { 20 } else { 1 }) } /// Copy bytes from input to target. @@ -196,7 +198,13 @@ impl Precompile for Modexp { let modulus = BigUint::from_bytes_be(&mod_buf); // do our gas accounting - let gas_cost = calculate_gas_cost(base_len as u64, mod_len as u64, &exponent, &exp_buf); + let gas_cost = calculate_gas_cost( + base_len as u64, + mod_len as u64, + &exponent, + &exp_buf, + modulus.is_even(), + ); handle.record_cost(gas_cost)?; @@ -510,6 +518,6 @@ mod tests { let _ = Modexp::execute(&mut handle).expect("Modexp::execute() returned error"); - assert_eq!(handle.gas_used, 7104); // gas used when ran in geth + assert_eq!(handle.gas_used, 7104 * 20); // gas used when ran in geth (x20) } } diff --git a/shell.nix b/shell.nix index 51b64ce669..b4c47b9b6f 100644 --- a/shell.nix +++ b/shell.nix @@ -2,7 +2,7 @@ let mozillaOverlay = import (builtins.fetchGit { url = "https://github.com/mozilla/nixpkgs-mozilla.git"; - rev = "4a07484cf0e49047f82d83fd119acffbad3b235f"; + rev = "78e723925daf5c9e8d0a1837ec27059e61649cb6"; }); nixpkgs = import { overlays = [ mozillaOverlay ]; }; rust-nightly = with nixpkgs; ((rustChannelOf { date = "2022-11-16"; channel = "nightly"; }).rust.override { From 8a5492f23925b0d7d2607e943982d90da017c3f2 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Wed, 15 Mar 2023 21:06:21 +0800 Subject: [PATCH 10/17] Fix check of EIP-3607 transaction for internal calls (#1018) * Improve check of EIP-3607 Only check the restrictions of EIP-3607 if the source of the EVM operation is from an external transaction. If the source of this EVM operation is from an internal call, like from `eth_call` or `eth_estimateGas` RPC, we will skip the checks for the EIP-3607. * fix eip-3607 tests * apply review suggtions --- frame/evm/src/runner/stack.rs | 8 +++++- frame/evm/src/tests.rs | 50 ++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/frame/evm/src/runner/stack.rs b/frame/evm/src/runner/stack.rs index be39912a48..3193b1c049 100644 --- a/frame/evm/src/runner/stack.rs +++ b/frame/evm/src/runner/stack.rs @@ -130,6 +130,10 @@ where >, ) -> (ExitReason, R), { + // Only check the restrictions of EIP-3607 if the source of the EVM operation is from an external transaction. + // If the source of this EVM operation is from an internal call, like from `eth_call` or `eth_estimateGas` RPC, + // we will skip the checks for the EIP-3607. + // // EIP-3607: https://eips.ethereum.org/EIPS/eip-3607 // Do not allow transactions for which `tx.sender` has any code deployed. // @@ -137,7 +141,9 @@ where // of a precompile. While mainnet Ethereum currently only has stateless precompiles, // projects using Frontier can have stateful precompiles that can manage funds or // which calls other contracts that expects this precompile address to be trustworthy. - if !>::get(source).is_empty() || precompiles.is_precompile(source) { + if is_transactional + && (!>::get(source).is_empty() || precompiles.is_precompile(source)) + { return Err(RunnerError { error: Error::::TransactionMustComeFromEOA, weight, diff --git a/frame/evm/src/tests.rs b/frame/evm/src/tests.rs index 1e8202ea43..b12ff74468 100644 --- a/frame/evm/src/tests.rs +++ b/frame/evm/src/tests.rs @@ -559,8 +559,9 @@ fn runner_max_fee_per_gas_gte_max_priority_fee_per_gas() { } #[test] -fn eip3607_transaction_from_contract_should_fail() { +fn eip3607_transaction_from_contract() { new_test_ext().execute_with(|| { + // external transaction match ::Runner::call( // Contract address. H160::from_str("1000000000000000000000000000000000000001").unwrap(), @@ -572,8 +573,8 @@ fn eip3607_transaction_from_contract_should_fail() { None, None, Vec::new(), - false, // non-transactional - true, // must be validated + true, // transactional + false, // not sure be validated &::config().clone(), ) { Err(RunnerError { @@ -582,12 +583,31 @@ fn eip3607_transaction_from_contract_should_fail() { }) => (), _ => panic!("Should have failed"), } + + // internal call + assert!(::Runner::call( + // Contract address. + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + Vec::new(), + U256::from(1u32), + 1000000, + None, + None, + None, + Vec::new(), + false, // non-transactional + true, // must be validated + &::config().clone(), + ) + .is_ok()); }); } #[test] -fn eip3607_transaction_from_precompile_should_fail() { +fn eip3607_transaction_from_precompile() { new_test_ext().execute_with(|| { + // external transaction match ::Runner::call( // Precompile address. H160::from_str("0000000000000000000000000000000000000001").unwrap(), @@ -599,8 +619,8 @@ fn eip3607_transaction_from_precompile_should_fail() { None, None, Vec::new(), - false, // non-transactional - true, // must be validated + true, // transactional + false, // not sure be validated &::config().clone(), ) { Err(RunnerError { @@ -609,5 +629,23 @@ fn eip3607_transaction_from_precompile_should_fail() { }) => (), _ => panic!("Should have failed"), } + + // internal call + assert!(::Runner::call( + // Contract address. + H160::from_str("0000000000000000000000000000000000000001").unwrap(), + H160::from_str("1000000000000000000000000000000000000001").unwrap(), + Vec::new(), + U256::from(1u32), + 1000000, + None, + None, + None, + Vec::new(), + false, // non-transactional + true, // must be validated + &::config().clone(), + ) + .is_ok()); }); } From 0b04dd3cd64c04abaa7313bf49eb24bf7b5bc96c Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Fri, 17 Mar 2023 04:43:56 +0800 Subject: [PATCH 11/17] chore: deny unused crate dependencies (#1020) * chore: deny unused crate dependencies * fix * apply review suggtions * fix error --- Cargo.lock | 1 + client/cli/src/lib.rs | 2 ++ client/consensus/src/lib.rs | 2 ++ client/db/src/lib.rs | 2 ++ client/mapping-sync/src/lib.rs | 1 + client/rpc-core/src/lib.rs | 2 ++ client/rpc/src/lib.rs | 1 + client/storage/src/lib.rs | 2 ++ frame/base-fee/Cargo.toml | 2 +- frame/base-fee/src/lib.rs | 1 + frame/dynamic-fee/Cargo.toml | 7 +++---- frame/dynamic-fee/src/lib.rs | 1 + frame/ethereum/Cargo.toml | 7 ++++--- frame/ethereum/src/lib.rs | 4 +++- frame/evm-chain-id/src/lib.rs | 1 + frame/evm/Cargo.toml | 2 +- frame/evm/precompile/blake2/src/lib.rs | 1 + frame/evm/precompile/bn128/src/lib.rs | 1 + frame/evm/precompile/curve25519/src/lib.rs | 1 + frame/evm/precompile/dispatch/Cargo.toml | 14 +++++++------- frame/evm/precompile/dispatch/src/lib.rs | 1 + frame/evm/precompile/ed25519/src/lib.rs | 1 + frame/evm/precompile/modexp/src/lib.rs | 1 + frame/evm/precompile/sha3fips/src/lib.rs | 1 + frame/evm/precompile/simple/src/lib.rs | 1 + frame/evm/src/lib.rs | 3 ++- frame/evm/test-vector-support/Cargo.toml | 2 +- frame/evm/test-vector-support/src/lib.rs | 2 ++ frame/hotfix-sufficients/Cargo.toml | 2 +- frame/hotfix-sufficients/src/lib.rs | 1 + primitives/consensus/src/lib.rs | 1 + primitives/dynamic-fee/Cargo.toml | 3 ++- primitives/dynamic-fee/src/lib.rs | 1 + primitives/ethereum/src/lib.rs | 1 + primitives/evm/src/lib.rs | 1 + primitives/rpc/src/lib.rs | 1 + primitives/self-contained/src/lib.rs | 1 + primitives/storage/src/lib.rs | 1 + rustfmt.toml | 1 + template/node/src/main.rs | 1 + template/runtime/src/lib.rs | 1 + 41 files changed, 62 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eb9aa5af2f..e9e444f4d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5149,6 +5149,7 @@ name = "pallet-utility" version = "4.0.0-dev" source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "parity-scale-codec", diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index 1d4c7e668f..e30cb5f4e3 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![deny(unused_crate_dependencies)] + mod frontier_db_cmd; pub use self::frontier_db_cmd::FrontierDbCmd; diff --git a/client/consensus/src/lib.rs b/client/consensus/src/lib.rs index 39b17cce14..d65655427d 100644 --- a/client/consensus/src/lib.rs +++ b/client/consensus/src/lib.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![deny(unused_crate_dependencies)] + use std::{collections::HashMap, marker::PhantomData, sync::Arc}; // Substrate diff --git a/client/db/src/lib.rs b/client/db/src/lib.rs index 8f7499dde7..f54defe718 100644 --- a/client/db/src/lib.rs +++ b/client/db/src/lib.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![deny(unused_crate_dependencies)] + #[cfg(feature = "parity-db")] mod parity_db_adapter; mod upgrade; diff --git a/client/mapping-sync/src/lib.rs b/client/mapping-sync/src/lib.rs index 774ad93cef..1853a9688b 100644 --- a/client/mapping-sync/src/lib.rs +++ b/client/mapping-sync/src/lib.rs @@ -17,6 +17,7 @@ // along with this program. If not, see . #![allow(clippy::too_many_arguments)] +#![deny(unused_crate_dependencies)] mod worker; diff --git a/client/rpc-core/src/lib.rs b/client/rpc-core/src/lib.rs index c595bf8a1e..701c095e2f 100644 --- a/client/rpc-core/src/lib.rs +++ b/client/rpc-core/src/lib.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![deny(unused_crate_dependencies)] + pub mod types; mod eth; diff --git a/client/rpc/src/lib.rs b/client/rpc/src/lib.rs index 35c072cfdb..7d4447cfbf 100644 --- a/client/rpc/src/lib.rs +++ b/client/rpc/src/lib.rs @@ -24,6 +24,7 @@ clippy::len_zero, clippy::new_without_default )] +#![deny(unused_crate_dependencies)] mod eth; mod eth_pubsub; diff --git a/client/storage/src/lib.rs b/client/storage/src/lib.rs index b9496a6e69..93ecc035ab 100644 --- a/client/storage/src/lib.rs +++ b/client/storage/src/lib.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![deny(unused_crate_dependencies)] + mod overrides; pub use self::overrides::*; diff --git a/frame/base-fee/Cargo.toml b/frame/base-fee/Cargo.toml index df30cc2a1f..dc89a53b4b 100644 --- a/frame/base-fee/Cargo.toml +++ b/frame/base-fee/Cargo.toml @@ -23,7 +23,7 @@ fp-evm = { workspace = true } [dev-dependencies] # Substrate -sp-io = { workspace = true } +sp-io = { workspace = true, features = ["default"] } [features] default = ["std"] diff --git a/frame/base-fee/src/lib.rs b/frame/base-fee/src/lib.rs index 2d562d7a51..4cb182032e 100644 --- a/frame/base-fee/src/lib.rs +++ b/frame/base-fee/src/lib.rs @@ -17,6 +17,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::comparison_chain)] +#![deny(unused_crate_dependencies)] #[cfg(test)] mod tests; diff --git a/frame/dynamic-fee/Cargo.toml b/frame/dynamic-fee/Cargo.toml index d08dfd43ae..b26de76fc0 100644 --- a/frame/dynamic-fee/Cargo.toml +++ b/frame/dynamic-fee/Cargo.toml @@ -18,7 +18,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } sp-inherents = { workspace = true } -sp-runtime = { workspace = true } sp-std = { workspace = true } # Frontier fp-dynamic-fee = { workspace = true } @@ -26,8 +25,9 @@ fp-evm = { workspace = true } [dev-dependencies] # Substrate -pallet-timestamp = { workspace = true } -sp-io = { workspace = true } +pallet-timestamp = { workspace = true, features = ["default"] } +sp-io = { workspace = true, features = ["default"] } +sp-runtime = { workspace = true, features = ["default"] } [features] default = ["std"] @@ -37,7 +37,6 @@ std = [ # Substrate "sp-core/std", "sp-inherents/std", - "sp-runtime/std", "sp-std/std", # Substrate "frame-system/std", diff --git a/frame/dynamic-fee/src/lib.rs b/frame/dynamic-fee/src/lib.rs index 4351364b28..64b5f3d3df 100644 --- a/frame/dynamic-fee/src/lib.rs +++ b/frame/dynamic-fee/src/lib.rs @@ -17,6 +17,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] #[cfg(test)] mod tests; diff --git a/frame/ethereum/Cargo.toml b/frame/ethereum/Cargo.toml index e6c6f3c836..1d58fb1303 100644 --- a/frame/ethereum/Cargo.toml +++ b/frame/ethereum/Cargo.toml @@ -14,7 +14,6 @@ targets = ["x86_64-unknown-linux-gnu"] ethereum = { workspace = true, features = ["with-codec"] } ethereum-types = { workspace = true } evm = { workspace = true, features = ["with-codec"] } -rlp = { workspace = true } scale-codec = { package = "parity-scale-codec", workspace = true } scale-info = { workspace = true } @@ -31,16 +30,18 @@ fp-consensus = { workspace = true } fp-ethereum = { workspace = true } fp-evm = { workspace = true } fp-rpc = { workspace = true } -fp-self-contained = { workspace = true } fp-storage = { workspace = true } pallet-evm = { workspace = true } [dev-dependencies] hex = "0.4.3" libsecp256k1 = { workspace = true, features = ["static-context", "hmac"] } +rlp = { workspace = true } # Substrate pallet-balances = { workspace = true, features = ["default"] } -sp-core = { workspace = true } +sp-core = { workspace = true, features = ["default"] } +# Frontier +fp-self-contained = { workspace = true, features = ["default"] } [features] default = ["std"] diff --git a/frame/ethereum/src/lib.rs b/frame/ethereum/src/lib.rs index 3a474bfdf5..72e47a4c6a 100644 --- a/frame/ethereum/src/lib.rs +++ b/frame/ethereum/src/lib.rs @@ -23,6 +23,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::comparison_chain, clippy::large_enum_variant)] +#![deny(unused_crate_dependencies)] #[cfg(all(feature = "std", test))] mod mock; @@ -64,7 +65,8 @@ pub use ethereum::{ }; pub use fp_rpc::TransactionStatus; -#[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, MaxEncodedLen, TypeInfo)] +#[derive(Clone, Eq, PartialEq, RuntimeDebug)] +#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)] pub enum RawOrigin { EthereumTransaction(H160), } diff --git a/frame/evm-chain-id/src/lib.rs b/frame/evm-chain-id/src/lib.rs index 589019f06e..04dd317814 100644 --- a/frame/evm-chain-id/src/lib.rs +++ b/frame/evm-chain-id/src/lib.rs @@ -26,6 +26,7 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] pub use pallet::*; diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index d5bd7084cf..542a701bd1 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -35,7 +35,7 @@ fp-evm = { workspace = true } [dev-dependencies] # Substrate pallet-balances = { workspace = true, features = ["default"] } -pallet-evm-precompile-simple = { workspace = true } +pallet-evm-precompile-simple = { workspace = true, features = ["default"] } [features] default = ["std"] diff --git a/frame/evm/precompile/blake2/src/lib.rs b/frame/evm/precompile/blake2/src/lib.rs index 50441f913b..09561c73b6 100644 --- a/frame/evm/precompile/blake2/src/lib.rs +++ b/frame/evm/precompile/blake2/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/bn128/src/lib.rs b/frame/evm/precompile/bn128/src/lib.rs index 10ca750c2a..1fd3060c8a 100644 --- a/frame/evm/precompile/bn128/src/lib.rs +++ b/frame/evm/precompile/bn128/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/curve25519/src/lib.rs b/frame/evm/precompile/curve25519/src/lib.rs index d2aa0d0d4f..29d62149d9 100644 --- a/frame/evm/precompile/curve25519/src/lib.rs +++ b/frame/evm/precompile/curve25519/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; use alloc::vec::Vec; diff --git a/frame/evm/precompile/dispatch/Cargo.toml b/frame/evm/precompile/dispatch/Cargo.toml index b2be365313..782f3b404f 100644 --- a/frame/evm/precompile/dispatch/Cargo.toml +++ b/frame/evm/precompile/dispatch/Cargo.toml @@ -18,14 +18,14 @@ pallet-evm = { workspace = true } scale-codec = { package = "parity-scale-codec", workspace = true } scale-info = { workspace = true } # Substrate -frame-system = { workspace = true } +frame-system = { workspace = true, features = ["default"] } pallet-balances = { workspace = true, features = ["default"] } -pallet-timestamp = { workspace = true } -pallet-utility = { workspace = true } -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } +pallet-timestamp = { workspace = true, features = ["default"] } +pallet-utility = { workspace = true, features = ["default"] } +sp-core = { workspace = true, features = ["default"] } +sp-io = { workspace = true, features = ["default"] } +sp-runtime = { workspace = true, features = ["default"] } +sp-std = { workspace = true, features = ["default"] } [features] default = ["std"] diff --git a/frame/evm/precompile/dispatch/src/lib.rs b/frame/evm/precompile/dispatch/src/lib.rs index 958a4a86cc..82aee787e7 100644 --- a/frame/evm/precompile/dispatch/src/lib.rs +++ b/frame/evm/precompile/dispatch/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/ed25519/src/lib.rs b/frame/evm/precompile/ed25519/src/lib.rs index 971730a579..8c1c841ce1 100644 --- a/frame/evm/precompile/ed25519/src/lib.rs +++ b/frame/evm/precompile/ed25519/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/modexp/src/lib.rs b/frame/evm/precompile/modexp/src/lib.rs index 1b4aa66b0d..87da646bce 100644 --- a/frame/evm/precompile/modexp/src/lib.rs +++ b/frame/evm/precompile/modexp/src/lib.rs @@ -17,6 +17,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::comparison_chain)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/sha3fips/src/lib.rs b/frame/evm/precompile/sha3fips/src/lib.rs index d76f9650bb..6f951d35e8 100644 --- a/frame/evm/precompile/sha3fips/src/lib.rs +++ b/frame/evm/precompile/sha3fips/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/precompile/simple/src/lib.rs b/frame/evm/precompile/simple/src/lib.rs index df4366679a..0791111fd0 100644 --- a/frame/evm/precompile/simple/src/lib.rs +++ b/frame/evm/precompile/simple/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] extern crate alloc; diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index a6b1406e2d..57fd000a67 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -52,8 +52,9 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -#![allow(clippy::too_many_arguments)] #![cfg_attr(test, feature(assert_matches))] +#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))] +#![allow(clippy::too_many_arguments)] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; diff --git a/frame/evm/test-vector-support/Cargo.toml b/frame/evm/test-vector-support/Cargo.toml index 6434383e44..bfa85744c8 100644 --- a/frame/evm/test-vector-support/Cargo.toml +++ b/frame/evm/test-vector-support/Cargo.toml @@ -13,6 +13,6 @@ hex = "0.4.3" serde = { workspace = true } serde_json = { workspace = true } # Substrate -sp-core = { workspace = true } +sp-core = { workspace = true, features = ["default"] } # Frontier fp-evm = { workspace = true, features = ["default"] } diff --git a/frame/evm/test-vector-support/src/lib.rs b/frame/evm/test-vector-support/src/lib.rs index 5b12131725..fd67f747f9 100644 --- a/frame/evm/test-vector-support/src/lib.rs +++ b/frame/evm/test-vector-support/src/lib.rs @@ -15,6 +15,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#![deny(unused_crate_dependencies)] + use std::fs; use evm::{Context, ExitError, ExitReason, ExitSucceed, Transfer}; diff --git a/frame/hotfix-sufficients/Cargo.toml b/frame/hotfix-sufficients/Cargo.toml index 0fbaff4322..e7c75cddda 100644 --- a/frame/hotfix-sufficients/Cargo.toml +++ b/frame/hotfix-sufficients/Cargo.toml @@ -26,7 +26,7 @@ pallet-evm = { workspace = true } [dev-dependencies] # Substrate -sp-io = { workspace = true } +sp-io = { workspace = true, features = ["default"] } [features] default = ["std"] diff --git a/frame/hotfix-sufficients/src/lib.rs b/frame/hotfix-sufficients/src/lib.rs index 37f9f6628b..86a45be36f 100644 --- a/frame/hotfix-sufficients/src/lib.rs +++ b/frame/hotfix-sufficients/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; diff --git a/primitives/consensus/src/lib.rs b/primitives/consensus/src/lib.rs index 370d3a40c6..e9643d8eee 100644 --- a/primitives/consensus/src/lib.rs +++ b/primitives/consensus/src/lib.rs @@ -17,6 +17,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::large_enum_variant)] +#![deny(unused_crate_dependencies)] use scale_codec::{Decode, Encode}; use sp_core::H256; diff --git a/primitives/dynamic-fee/Cargo.toml b/primitives/dynamic-fee/Cargo.toml index 0ddb16636c..6ecd0fefae 100644 --- a/primitives/dynamic-fee/Cargo.toml +++ b/primitives/dynamic-fee/Cargo.toml @@ -11,7 +11,7 @@ repository = { workspace = true } targets = ["x86_64-unknown-linux-gnu"] [dependencies] -async-trait = "0.1" +async-trait = { version = "0.1", optional = true } # Substrate sp-core = { workspace = true } sp-inherents = { workspace = true } @@ -19,6 +19,7 @@ sp-inherents = { workspace = true } [features] default = ["std"] std = [ + "async-trait", # Substrate "sp-core/std", "sp-inherents/std", diff --git a/primitives/dynamic-fee/src/lib.rs b/primitives/dynamic-fee/src/lib.rs index c3f098818a..f2a8101e45 100644 --- a/primitives/dynamic-fee/src/lib.rs +++ b/primitives/dynamic-fee/src/lib.rs @@ -18,6 +18,7 @@ //! Core types and inherents for dynamic fee. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] use sp_core::U256; use sp_inherents::InherentIdentifier; diff --git a/primitives/ethereum/src/lib.rs b/primitives/ethereum/src/lib.rs index eeead1b777..03d7092ea3 100644 --- a/primitives/ethereum/src/lib.rs +++ b/primitives/ethereum/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] pub use ethereum::{ AccessListItem, BlockV2 as Block, LegacyTransactionMessage, Log, ReceiptV3 as Receipt, diff --git a/primitives/evm/src/lib.rs b/primitives/evm/src/lib.rs index 43e0929cda..b7e8e38741 100644 --- a/primitives/evm/src/lib.rs +++ b/primitives/evm/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] mod precompile; mod validation; diff --git a/primitives/rpc/src/lib.rs b/primitives/rpc/src/lib.rs index 638c7074a5..a02882106d 100644 --- a/primitives/rpc/src/lib.rs +++ b/primitives/rpc/src/lib.rs @@ -17,6 +17,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::too_many_arguments)] +#![deny(unused_crate_dependencies)] use ethereum::Log; use ethereum_types::Bloom; diff --git a/primitives/self-contained/src/lib.rs b/primitives/self-contained/src/lib.rs index 3cc392cb94..e3590f6e55 100644 --- a/primitives/self-contained/src/lib.rs +++ b/primitives/self-contained/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] mod checked_extrinsic; mod unchecked_extrinsic; diff --git a/primitives/storage/src/lib.rs b/primitives/storage/src/lib.rs index 81a9e89c7d..db845bc2e2 100644 --- a/primitives/storage/src/lib.rs +++ b/primitives/storage/src/lib.rs @@ -16,6 +16,7 @@ // limitations under the License. #![cfg_attr(not(feature = "std"), no_std)] +#![deny(unused_crate_dependencies)] use scale_codec::{Decode, Encode}; diff --git a/rustfmt.toml b/rustfmt.toml index d66360b1bf..67966db319 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,4 @@ hard_tabs = true imports_granularity = "Crate" use_field_init_shorthand = true +merge_derives = false diff --git a/template/node/src/main.rs b/template/node/src/main.rs index 3adb9624c0..94c4643c1b 100644 --- a/template/node/src/main.rs +++ b/template/node/src/main.rs @@ -6,6 +6,7 @@ clippy::too_many_arguments, clippy::large_enum_variant )] +#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))] #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/template/runtime/src/lib.rs b/template/runtime/src/lib.rs index 4b0aec6759..1a79f745ca 100644 --- a/template/runtime/src/lib.rs +++ b/template/runtime/src/lib.rs @@ -4,6 +4,7 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] #![allow(clippy::new_without_default, clippy::or_fun_call)] +#![cfg_attr(feature = "runtime-benchmarks", deny(unused_crate_dependencies))] // Make the WASM binary available. #[cfg(feature = "std")] From 43616e438cbad167a0ccccdf6f5a85bc5184e556 Mon Sep 17 00:00:00 2001 From: bernardo Date: Fri, 17 Mar 2023 18:28:29 -0300 Subject: [PATCH 12/17] fp-account (#1019) * bootstrap fp-account * clippy * make IdentityAddressMapping support From * clippy * fix import warning * fix pallet-evm tests * fix pallet-hotfix-sufficients tests * use libsecp256k1::PublicKey::parse_compressed and sp_core::keccak_256 directly Co-authored-by: Qinxuan Chen * simplify keccak_256 hashing Co-authored-by: Qinxuan Chen * format derives Co-authored-by: Qinxuan Chen * merge_derives = false * fix imports * impl Debug for AccountId20 * simplify Display for EthereumSigner Co-authored-by: Qinxuan Chen * fmt * simplify keccak_256 hashing * simplify ecdsa path Co-authored-by: Qinxuan Chen * format derives Co-authored-by: Qinxuan Chen * use sp_io for keccak_256 Co-authored-by: Qinxuan Chen * remove sha3 dependency Co-authored-by: Qinxuan Chen * remove sha3 dependency Co-authored-by: Qinxuan Chen * remove sha3 dependency Co-authored-by: Qinxuan Chen * remove sha3 import * remove sha3 dependency * simplify keccak_256 hashing on tests Co-authored-by: Qinxuan Chen * remove serde imports Co-authored-by: Qinxuan Chen * add account docs * remove sp-keyring from template deps --------- Co-authored-by: Qinxuan Chen Co-authored-by: Wei Tang --- Cargo.lock | 42 ++++- Cargo.toml | 6 +- docs/accounts.md | 18 +++ frame/evm/Cargo.toml | 4 +- frame/evm/src/lib.rs | 25 ++- frame/evm/src/tests.rs | 6 +- frame/hotfix-sufficients/src/tests.rs | 12 +- primitives/account/Cargo.toml | 38 +++++ primitives/account/src/lib.rs | 211 ++++++++++++++++++++++++++ template/node/Cargo.toml | 2 +- template/node/src/benchmarking.rs | 18 +-- template/node/src/chain_spec.rs | 38 ++--- template/node/src/command.rs | 5 +- template/runtime/Cargo.toml | 2 + template/runtime/src/lib.rs | 15 +- 15 files changed, 387 insertions(+), 55 deletions(-) create mode 100644 docs/accounts.md create mode 100644 primitives/account/Cargo.toml create mode 100644 primitives/account/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index e9e444f4d3..051bb7586e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1743,7 +1743,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.4.0", "scale-info", "tiny-keccak", ] @@ -1776,7 +1776,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.4.0", "primitive-types", "scale-info", "uint", @@ -2151,6 +2151,23 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fp-account" +version = "1.0.0-dev" +dependencies = [ + "hex", + "impl-serde 0.3.2", + "libsecp256k1", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "fp-consensus" version = "2.0.0-dev" @@ -2461,6 +2478,7 @@ dependencies = [ "fc-rpc", "fc-rpc-core", "fc-storage", + "fp-account", "fp-dynamic-fee", "fp-evm", "fp-rpc", @@ -2500,7 +2518,6 @@ dependencies = [ "sp-core", "sp-finality-grandpa", "sp-inherents", - "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -2517,6 +2534,7 @@ dependencies = [ name = "frontier-template-runtime" version = "0.0.0" dependencies = [ + "fp-account", "fp-evm", "fp-rpc", "fp-self-contained", @@ -3178,6 +3196,15 @@ dependencies = [ "rlp", ] +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + [[package]] name = "impl-serde" version = "0.4.0" @@ -4869,6 +4896,7 @@ version = "6.0.0-dev" dependencies = [ "environmental", "evm", + "fp-account", "fp-evm", "frame-benchmarking", "frame-support", @@ -5543,7 +5571,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde", + "impl-serde 0.4.0", "scale-info", "uint", ] @@ -7888,7 +7916,7 @@ dependencies = [ "futures", "hash-db", "hash256-std-hasher", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1", "log", @@ -8222,7 +8250,7 @@ name = "sp-storage" version = "7.0.0" source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "ref-cast", "serde", @@ -8310,7 +8338,7 @@ name = "sp-version" version = "5.0.0" source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec", "parity-wasm", "scale-info", diff --git a/Cargo.toml b/Cargo.toml index 93769f35d1..fdacb19f1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ members = [ "client/db", "client/storage", "client/mapping-sync", + "primitives/account", "primitives/consensus", "primitives/dynamic-fee", "primitives/evm", @@ -41,9 +42,11 @@ environmental = { version = "1.1.3", default-features = false } ethereum = { version = "0.14.0", default-features = false } ethereum-types = { version = "0.14.1", default-features = false } evm = { version = "0.37.0", default-features = false } +impl-serde = { version = "0.3.1", default-features = false } jsonrpsee = "0.16.2" kvdb-rocksdb = "0.17.0" -libsecp256k1 = "0.7.1" +libsecp256k1 = { version = "0.7.1", default-features = false } +log = { version = "0.4.17", default-features = false } parity-db = "0.4.2" rlp = { version = "0.5", default-features = false } scale-codec = { package = "parity-scale-codec", version = "3.2.1", default-features = false, features = ["derive"] } @@ -124,6 +127,7 @@ fc-rpc = { version = "2.0.0-dev", path = "client/rpc" } fc-rpc-core = { version = "1.1.0-dev", path = "client/rpc-core" } fc-storage = { version = "1.0.0-dev", path = "client/storage" } # Frontier Primitive +fp-account = { version = "1.0.0-dev", path = "primitives/account", default-features = false } fp-consensus = { version = "2.0.0-dev", path = "primitives/consensus", default-features = false } fp-dynamic-fee = { version = "1.0.0", path = "primitives/dynamic-fee", default-features = false } fp-ethereum = { version = "1.0.0-dev", path = "primitives/ethereum", default-features = false } diff --git a/docs/accounts.md b/docs/accounts.md new file mode 100644 index 0000000000..e0b278c408 --- /dev/null +++ b/docs/accounts.md @@ -0,0 +1,18 @@ +Frontier provides two different strategies for handling `H160` addresses. + +# H256 -> H160 mapping + +The first strategy consists of of a truncated hash scheme, where the first 160 LE bytes of a `H256` address are used to form the `H160` address. + +`AccountId32` is the Account type used for `frame_system::pallet::Config::AccountId`. + +The Runtime's `Signature` type is configured as [`sp_runtime::MultiSignature`](https://docs.rs/sp-runtime/2.0.1/sp_runtime/enum.MultiSignature.html), which means signatures can be: +- `Sr25519` +- `Ed25519` +- `ECDSA` + +# Native H160 via AccountId20 + +The second strategy consists of using `fp-account` so that `AccountId20` is the Account type used for `frame_system::pallet::Config::AccountId`. + +The Runtime's `Signature` type is configured as `EthereumSigner`, which means only `ECDSA` signatures are supported. \ No newline at end of file diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 542a701bd1..8f888fe275 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -16,7 +16,7 @@ environmental = { workspace = true, optional = true } evm = { workspace = true, features = ["with-codec"] } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } impl-trait-for-tuples = "0.2.2" -log = { version = "0.4.17", default-features = false } +log = { workspace = true } rlp = { workspace = true } scale-codec = { package = "parity-scale-codec", workspace = true } scale-info = { workspace = true } @@ -30,6 +30,7 @@ sp-io = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } # Frontier +fp-account = { workspace = true } fp-evm = { workspace = true } [dev-dependencies] @@ -59,6 +60,7 @@ std = [ "sp-std/std", # Frontier "fp-evm/std", + "fp-account/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/frame/evm/src/lib.rs b/frame/evm/src/lib.rs index 57fd000a67..fdabd8b4ab 100644 --- a/frame/evm/src/lib.rs +++ b/frame/evm/src/lib.rs @@ -85,6 +85,7 @@ use sp_std::{cmp::min, vec::Vec}; pub use evm::{ Config as EvmConfig, Context, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed, }; +use fp_account::AccountId20; #[cfg(feature = "std")] use fp_evm::GenesisAccount; pub use fp_evm::{ @@ -604,6 +605,24 @@ where } } +/// Ensure that the address is AccountId20. +pub struct EnsureAccountId20; + +impl EnsureAddressOrigin for EnsureAccountId20 +where + OuterOrigin: Into, OuterOrigin>> + From>, +{ + type Success = AccountId20; + + fn try_address_origin(address: &H160, origin: OuterOrigin) -> Result { + let acc: AccountId20 = AccountId20::from(*address); + origin.into().and_then(|o| match o { + RawOrigin::Signed(who) if who == acc => Ok(who), + r => Err(OuterOrigin::from(r)), + }) + } +} + pub trait AddressMapping { fn into_account_id(address: H160) -> A; } @@ -611,9 +630,9 @@ pub trait AddressMapping { /// Identity address mapping. pub struct IdentityAddressMapping; -impl AddressMapping for IdentityAddressMapping { - fn into_account_id(address: H160) -> H160 { - address +impl> AddressMapping for IdentityAddressMapping { + fn into_account_id(address: H160) -> T { + address.into() } } diff --git a/frame/evm/src/tests.rs b/frame/evm/src/tests.rs index b12ff74468..65fc0e033b 100644 --- a/frame/evm/src/tests.rs +++ b/frame/evm/src/tests.rs @@ -414,8 +414,10 @@ fn handle_sufficient_reference() { new_test_ext().execute_with(|| { let addr = H160::from_str("1230000000000000000000000000000000000001").unwrap(); let addr_2 = H160::from_str("1234000000000000000000000000000000000001").unwrap(); - let substrate_addr = ::AddressMapping::into_account_id(addr); - let substrate_addr_2 = ::AddressMapping::into_account_id(addr_2); + let substrate_addr: ::AccountId = + ::AddressMapping::into_account_id(addr); + let substrate_addr_2: ::AccountId = + ::AddressMapping::into_account_id(addr_2); // Sufficients should increase when creating EVM accounts. let _ = >::insert(addr, &vec![0]); diff --git a/frame/hotfix-sufficients/src/tests.rs b/frame/hotfix-sufficients/src/tests.rs index eedbf06aa2..d5effd936e 100644 --- a/frame/hotfix-sufficients/src/tests.rs +++ b/frame/hotfix-sufficients/src/tests.rs @@ -62,8 +62,10 @@ fn test_hotfix_inc_account_sufficients_increments_if_nonce_nonzero() { let addr_2 = "1234000000000000000000000000000000000001" .parse::() .unwrap(); - let substrate_addr_1 = ::AddressMapping::into_account_id(addr_1); - let substrate_addr_2 = ::AddressMapping::into_account_id(addr_2); + let substrate_addr_1: ::AccountId = + ::AddressMapping::into_account_id(addr_1); + let substrate_addr_2: ::AccountId = + ::AddressMapping::into_account_id(addr_2); frame_system::Pallet::::inc_account_nonce(&substrate_addr_1); @@ -95,7 +97,8 @@ fn test_hotfix_inc_account_sufficients_increments_with_saturation_if_nonce_nonze let addr = "1230000000000000000000000000000000000001" .parse::() .unwrap(); - let substrate_addr = ::AddressMapping::into_account_id(addr); + let substrate_addr: ::AccountId = + ::AddressMapping::into_account_id(addr); frame_system::Account::::mutate(substrate_addr, |x| { x.nonce = 1; @@ -125,7 +128,8 @@ fn test_hotfix_inc_account_sufficients_does_not_increment_if_both_nonce_and_refs let addr = "1230000000000000000000000000000000000001" .parse::() .unwrap(); - let substrate_addr = ::AddressMapping::into_account_id(addr); + let substrate_addr: ::AccountId = + ::AddressMapping::into_account_id(addr); frame_system::Account::::mutate(substrate_addr, |x| { x.nonce = 1; diff --git a/primitives/account/Cargo.toml b/primitives/account/Cargo.toml new file mode 100644 index 0000000000..ae0bb217a3 --- /dev/null +++ b/primitives/account/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "fp-account" +version = "1.0.0-dev" +license = "Apache-2.0" +description = "Primitives for Frontier AccountId20." +authors = { workspace = true } +edition = { workspace = true } +repository = { workspace = true } + +[dependencies] +hex = { version = "0.4.3", default-features = false } +impl-serde = { workspace = true } +libsecp256k1 = { workspace = true, default-features = false } +log = { workspace = true } +scale-codec = { package = "parity-scale-codec", workspace = true } +scale-info = { workspace = true } +serde = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } + +[dev-dependencies] + +[features] +default = ["std"] +std = [ + "impl-serde/std", + "hex/std", + "libsecp256k1/std", + "log/std", + "serde/std", + # Substrate + "sp-io/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/primitives/account/src/lib.rs b/primitives/account/src/lib.rs new file mode 100644 index 0000000000..820666caba --- /dev/null +++ b/primitives/account/src/lib.rs @@ -0,0 +1,211 @@ +// SPDX-License-Identifier: Apache-2.0 +// This file is part of Frontier. +// +// Copyright (c) 2020-2023 Parity Technologies (UK) Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![cfg_attr(not(feature = "std"), no_std)] + +use scale_codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use sp_core::{ecdsa, H160, H256}; +use sp_io::hashing::keccak_256; + +/// A fully Ethereum-compatible `AccountId`. +/// Conforms to H160 address and ECDSA key standards. +/// Alternative to H256->H160 mapping. +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Default)] +#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)] +pub struct AccountId20(pub [u8; 20]); + +#[cfg(feature = "std")] +impl_serde::impl_fixed_hash_serde!(AccountId20, 20); + +#[cfg(feature = "std")] +impl std::fmt::Display for AccountId20 { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let address = hex::encode(self.0).trim_start_matches("0x").to_lowercase(); + let address_hash = hex::encode(keccak_256(address.as_bytes())); + + let checksum: String = + address + .char_indices() + .fold(String::from("0x"), |mut acc, (index, address_char)| { + let n = u16::from_str_radix(&address_hash[index..index + 1], 16) + .expect("Keccak256 hashed; qed"); + + if n > 7 { + // make char uppercase if ith character is 9..f + acc.push_str(&address_char.to_uppercase().to_string()) + } else { + // already lowercased + acc.push(address_char) + } + + acc + }); + write!(f, "{}", checksum) + } +} + +impl sp_std::fmt::Debug for AccountId20 { + fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + write!(f, "{:?}", H160(self.0)) + } +} + +impl From<[u8; 20]> for AccountId20 { + fn from(bytes: [u8; 20]) -> Self { + Self(bytes) + } +} + +impl From for [u8; 20] { + fn from(val: AccountId20) -> Self { + val.0 + } +} + +impl From for AccountId20 { + fn from(h160: H160) -> Self { + Self(h160.0) + } +} + +impl From for H160 { + fn from(val: AccountId20) -> Self { + H160(val.0) + } +} + +impl From for AccountId20 { + fn from(pk: ecdsa::Public) -> Self { + let decompressed = libsecp256k1::PublicKey::parse_compressed(&pk.0) + .expect("Wrong compressed public key provided") + .serialize(); + let mut m = [0u8; 64]; + m.copy_from_slice(&decompressed[1..65]); + let account = H160::from(H256::from(keccak_256(&m))); + Self(account.into()) + } +} + +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] +#[derive(Eq, PartialEq, Clone, Encode, Decode, sp_core::RuntimeDebug, TypeInfo)] +pub struct EthereumSignature(ecdsa::Signature); + +impl sp_runtime::traits::Verify for EthereumSignature { + type Signer = EthereumSigner; + fn verify>(&self, mut msg: L, signer: &AccountId20) -> bool { + let m = keccak_256(msg.get()); + match sp_io::crypto::secp256k1_ecdsa_recover(self.0.as_ref(), &m) { + Ok(pubkey) => AccountId20(H160::from(H256::from(keccak_256(&pubkey))).0) == *signer, + Err(sp_io::EcdsaVerifyError::BadRS) => { + log::error!(target: "evm", "Error recovering: Incorrect value of R or S"); + false + } + Err(sp_io::EcdsaVerifyError::BadV) => { + log::error!(target: "evm", "Error recovering: Incorrect value of V"); + false + } + Err(sp_io::EcdsaVerifyError::BadSignature) => { + log::error!(target: "evm", "Error recovering: Invalid signature"); + false + } + } + } +} + +impl EthereumSignature { + pub fn new(s: ecdsa::Signature) -> Self { + EthereumSignature(s) + } +} + +pub struct EthereumSigner([u8; 20]); + +impl From<[u8; 20]> for EthereumSigner { + fn from(x: [u8; 20]) -> Self { + EthereumSigner(x) + } +} + +impl sp_runtime::traits::IdentifyAccount for EthereumSigner { + type AccountId = AccountId20; + fn into_account(self) -> AccountId20 { + AccountId20(self.0) + } +} + +#[cfg(feature = "std")] +impl std::fmt::Display for EthereumSigner { + fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(fmt, "{:?}", H160::from(self.0)) + } +} + +impl From for EthereumSigner { + fn from(pk: ecdsa::Public) -> Self { + let decompressed = libsecp256k1::PublicKey::parse_compressed(&pk.0) + .expect("Wrong compressed public key provided") + .serialize(); + let mut m = [0u8; 64]; + m.copy_from_slice(&decompressed[1..65]); + let account = H160::from(H256::from(keccak_256(&m))); + EthereumSigner(account.into()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use sp_core::{ecdsa, Pair, H256}; + use sp_runtime::traits::IdentifyAccount; + + #[test] + fn test_derive_from_secret_key() { + let sk = hex::decode("eb3d6b0b0c794f6fd8964b4a28df99d4baa5f9c8d33603c4cc62504daa259358") + .unwrap(); + let hex_acc: [u8; 20] = hex::decode("98fa2838ee6471ae87135880f870a785318e6787") + .unwrap() + .try_into() + .unwrap(); + let acc = AccountId20::from(hex_acc); + + let pk = ecdsa::Pair::from_seed_slice(&sk).unwrap().public(); + let signer: EthereumSigner = pk.into(); + + assert_eq!(signer.into_account(), acc); + } + + #[test] + fn test_from_h160() { + let m = hex::decode("28490327ff4e60d44b8aadf5478266422ed01232cc712c2d617e5c650ca15b85") + .unwrap(); + let old: AccountId20 = H160::from(H256::from(keccak_256(&m))).into(); + let new: AccountId20 = H160::from_slice(&keccak_256(&m)[12..32]).into(); + assert_eq!(new, old); + } + + #[test] + fn test_account_display() { + let pk = ecdsa::Pair::from_string("//Alice", None) + .expect("static values are valid; qed") + .public(); + let signer: EthereumSigner = pk.into(); + let account: AccountId20 = signer.into_account(); + let account_fmt = format!("{}", account); + assert_eq!(account_fmt, "0xE04CC55ebEE1cBCE552f250e85c57B70B2E2625b"); + } +} diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index a429a8b08a..0d8497ffb9 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -46,7 +46,6 @@ sp-consensus-aura = { workspace = true, features = ["default"] } sp-core = { workspace = true, features = ["default"] } sp-finality-grandpa = { workspace = true, features = ["default"] } sp-inherents = { workspace = true, features = ["default"] } -sp-keyring = { workspace = true } sp-offchain = { workspace = true, features = ["default"] } sp-runtime = { workspace = true, features = ["default"] } sp-session = { workspace = true, features = ["default"] } @@ -73,6 +72,7 @@ fc-mapping-sync = { workspace = true } fc-rpc = { workspace = true } fc-rpc-core = { workspace = true } fc-storage = { workspace = true } +fp-account = { workspace = true } fp-dynamic-fee = { workspace = true, features = ["default"] } fp-evm = { workspace = true, features = ["default"] } fp-rpc = { workspace = true, features = ["default"] } diff --git a/template/node/src/benchmarking.rs b/template/node/src/benchmarking.rs index d0d5b5d584..81b88077b5 100644 --- a/template/node/src/benchmarking.rs +++ b/template/node/src/benchmarking.rs @@ -25,11 +25,11 @@ use scale_codec::Encode; // Substrate use sc_cli::Result; use sc_client_api::BlockBackend; -use sp_core::{sr25519, Pair}; +use sp_core::{ecdsa, Pair}; use sp_inherents::{InherentData, InherentDataProvider}; -use sp_keyring::Sr25519Keyring; -use sp_runtime::{generic::Era, AccountId32, OpaqueExtrinsic, SaturatedConversion}; +use sp_runtime::{generic::Era, OpaqueExtrinsic, SaturatedConversion}; // Frontier +use fp_account::AccountId20; use frontier_template_runtime::{self as runtime, AccountId, Balance, BalancesCall, SystemCall}; use crate::client::Client; @@ -58,7 +58,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { } fn build(&self, nonce: u32) -> std::result::Result { - let acc = Sr25519Keyring::Bob.pair(); + let acc = ecdsa::Pair::from_string("//Bob", None).expect("static values are valid; qed"); let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic( self.client.as_ref(), acc, @@ -101,12 +101,12 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { } fn build(&self, nonce: u32) -> std::result::Result { - let acc = Sr25519Keyring::Bob.pair(); + let acc = ecdsa::Pair::from_string("//Bob", None).expect("static values are valid; qed"); let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic( self.client.as_ref(), acc, BalancesCall::transfer_keep_alive { - dest: self.dest.clone().into(), + dest: self.dest.into(), value: self.value, } .into(), @@ -123,7 +123,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { /// Note: Should only be used for benchmarking. pub fn create_benchmark_extrinsic( client: &Client, - sender: sr25519::Pair, + sender: ecdsa::Pair, call: runtime::RuntimeCall, nonce: u32, ) -> runtime::UncheckedExtrinsic { @@ -171,8 +171,8 @@ pub fn create_benchmark_extrinsic( runtime::UncheckedExtrinsic::new_signed( call, - AccountId32::from(sender.public()).into(), - runtime::Signature::Sr25519(signature), + AccountId20::from(sender.public()).into(), + runtime::Signature::new(signature), extra, ) } diff --git a/template/node/src/chain_spec.rs b/template/node/src/chain_spec.rs index b4b1ffe392..05c14a6ec3 100644 --- a/template/node/src/chain_spec.rs +++ b/template/node/src/chain_spec.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; // Substrate use sc_service::ChainType; use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_core::{sr25519, storage::Storage, Pair, Public, H160, U256}; +use sp_core::{ecdsa, storage::Storage, Pair, Public, H160, U256}; use sp_finality_grandpa::AuthorityId as GrandpaId; use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_state_machine::BasicExternalities; @@ -78,13 +78,13 @@ pub fn development_config(enable_manual_seal: Option) -> DevChainSpec { genesis_config: testnet_genesis( wasm_binary, // Sudo account - get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Alice"), // Pre-funded accounts vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), ], // Initial PoA authorities vec![authority_keys_from_seed("Alice")], @@ -121,21 +121,21 @@ pub fn local_testnet_config() -> ChainSpec { wasm_binary, // Initial PoA authorities // Sudo account - get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Alice"), // Pre-funded accounts vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), ], vec![ authority_keys_from_seed("Alice"), diff --git a/template/node/src/command.rs b/template/node/src/command.rs index 975ee556b4..f8dc8e30e3 100644 --- a/template/node/src/command.rs +++ b/template/node/src/command.rs @@ -27,6 +27,9 @@ use crate::{ service::{self, db_config_dir}, }; +#[cfg(feature = "runtime-benchmarks")] +use crate::chain_spec::get_account_id_from_seed; + impl SubstrateCli for Cli { fn impl_name() -> String { "Frontier Node".into() @@ -187,7 +190,7 @@ pub fn run() -> sc_cli::Result<()> { Box::new(RemarkBuilder::new(client.clone())), Box::new(TransferKeepAliveBuilder::new( client.clone(), - sp_keyring::Sr25519Keyring::Alice.to_account_id(), + get_account_id_from_seed::("Alice"), ExistentialDeposit::get(), )), ]); diff --git a/template/runtime/Cargo.toml b/template/runtime/Cargo.toml index e20acb7a9f..a870753908 100644 --- a/template/runtime/Cargo.toml +++ b/template/runtime/Cargo.toml @@ -43,6 +43,7 @@ pallet-transaction-payment = { workspace = true } pallet-transaction-payment-rpc-runtime-api = { workspace = true } # Frontier +fp-account = { workspace = true } fp-evm = { workspace = true } fp-rpc = { workspace = true } fp-self-contained = { workspace = true } @@ -95,6 +96,7 @@ std = [ "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", # Frontier + "fp-account/std", "fp-evm/std", "fp-rpc/std", "fp-self-contained/std", diff --git a/template/runtime/src/lib.rs b/template/runtime/src/lib.rs index 1a79f745ca..da74c54dda 100644 --- a/template/runtime/src/lib.rs +++ b/template/runtime/src/lib.rs @@ -24,7 +24,7 @@ use sp_runtime::{ IdentifyAccount, NumberFor, PostDispatchInfoOf, UniqueSaturatedInto, Verify, }, transaction_validity::{TransactionSource, TransactionValidity, TransactionValidityError}, - ApplyExtrinsicResult, ConsensusEngineId, MultiSignature, Perbill, Permill, + ApplyExtrinsicResult, ConsensusEngineId, Perbill, Permill, }; use sp_std::{marker::PhantomData, prelude::*}; use sp_version::RuntimeVersion; @@ -43,11 +43,12 @@ use pallet_grandpa::{ }; use pallet_transaction_payment::CurrencyAdapter; // Frontier +use fp_account::EthereumSignature; use fp_evm::weight_per_gas; use fp_rpc::TransactionStatus; use pallet_ethereum::{Call::transact, PostLogContent, Transaction as EthereumTransaction}; use pallet_evm::{ - Account as EVMAccount, EnsureAddressTruncated, FeeCalculator, HashedAddressMapping, Runner, + Account as EVMAccount, EnsureAccountId20, FeeCalculator, IdentityAddressMapping, Runner, }; // A few exports that help ease life for downstream crates. @@ -62,7 +63,7 @@ use precompiles::FrontierPrecompiles; pub type BlockNumber = u32; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. -pub type Signature = MultiSignature; +pub type Signature = EthereumSignature; /// Some way of identifying an account on the chain. We intentionally make it equivalent /// to the public key of our transaction signing scheme. @@ -331,9 +332,9 @@ impl pallet_evm::Config for Runtime { type GasWeightMapping = pallet_evm::FixedGasWeightMapping; type WeightPerGas = WeightPerGas; type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping; - type CallOrigin = EnsureAddressTruncated; - type WithdrawOrigin = EnsureAddressTruncated; - type AddressMapping = HashedAddressMapping; + type CallOrigin = EnsureAccountId20; + type WithdrawOrigin = EnsureAccountId20; + type AddressMapping = IdentityAddressMapping; type Currency = Balances; type RuntimeEvent = RuntimeEvent; type PrecompilesType = FrontierPrecompiles; @@ -390,7 +391,7 @@ impl pallet_base_fee::Config for Runtime { } impl pallet_hotfix_sufficients::Config for Runtime { - type AddressMapping = HashedAddressMapping; + type AddressMapping = IdentityAddressMapping; type WeightInfo = pallet_hotfix_sufficients::weights::SubstrateWeight; } From ded6949b17e0553818714682ee4fadcf011a22cc Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Sun, 19 Mar 2023 23:35:05 +0800 Subject: [PATCH 13/17] adjust chain spec properties of template node (#1021) * adjust chain spec properties of template node * fix test * fix fmt * remove tokenSymbol --- Cargo.lock | 1 + Cargo.toml | 1 + template/node/Cargo.toml | 1 + template/node/src/chain_spec.rs | 17 +++++++++++++---- template/runtime/src/lib.rs | 4 ++-- ts-tests/tests/config.ts | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 051bb7586e..4204160c67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2495,6 +2495,7 @@ dependencies = [ "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "sc-basic-authorship", + "sc-chain-spec", "sc-cli", "sc-client-api", "sc-consensus", diff --git a/Cargo.toml b/Cargo.toml index fdacb19f1a..fed89bdd8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,7 @@ serde_json = "1.0" # Substrate Client sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } sc-client-db = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/template/node/Cargo.toml b/template/node/Cargo.toml index 0d8497ffb9..3c3581fafb 100644 --- a/template/node/Cargo.toml +++ b/template/node/Cargo.toml @@ -24,6 +24,7 @@ serde = { workspace = true } # Substrate prometheus-endpoint = { package = "substrate-prometheus-endpoint", workspace = true } sc-basic-authorship = { workspace = true } +sc-chain-spec = { workspace = true } sc-cli = { workspace = true } sc-client-api = { workspace = true } sc-consensus = { workspace = true } diff --git a/template/node/src/chain_spec.rs b/template/node/src/chain_spec.rs index 05c14a6ec3..e09fa944c2 100644 --- a/template/node/src/chain_spec.rs +++ b/template/node/src/chain_spec.rs @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, str::FromStr}; use serde::{Deserialize, Serialize}; // Substrate -use sc_service::ChainType; +use sc_chain_spec::{ChainType, Properties}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_core::{ecdsa, storage::Storage, Pair, Public, H160, U256}; use sp_finality_grandpa::AuthorityId as GrandpaId; @@ -10,7 +10,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_state_machine::BasicExternalities; // Frontier use frontier_template_runtime::{ - AccountId, EnableManualSeal, GenesisConfig, Signature, WASM_BINARY, + AccountId, EnableManualSeal, GenesisConfig, SS58Prefix, Signature, WASM_BINARY, }; // The URL for the telemetry server. @@ -64,6 +64,13 @@ pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { (get_from_seed::(s), get_from_seed::(s)) } +fn properties() -> Properties { + let mut properties = Properties::new(); + properties.insert("tokenDecimals".into(), 18.into()); + properties.insert("ss58Format".into(), SS58Prefix::get().into()); + properties +} + pub fn development_config(enable_manual_seal: Option) -> DevChainSpec { let wasm_binary = WASM_BINARY.expect("WASM not available"); @@ -88,7 +95,8 @@ pub fn development_config(enable_manual_seal: Option) -> DevChainSpec { ], // Initial PoA authorities vec![authority_keys_from_seed("Alice")], - 42, + // Ethereum chain ID + SS58Prefix::get() as u64, ), enable_manual_seal, } @@ -99,9 +107,10 @@ pub fn development_config(enable_manual_seal: Option) -> DevChainSpec { None, // Protocol ID None, + // Fork ID None, // Properties - None, + Some(properties()), // Extensions None, ) diff --git a/template/runtime/src/lib.rs b/template/runtime/src/lib.rs index da74c54dda..b196b4d97f 100644 --- a/template/runtime/src/lib.rs +++ b/template/runtime/src/lib.rs @@ -110,8 +110,8 @@ pub mod opaque { } pub const VERSION: RuntimeVersion = RuntimeVersion { - spec_name: create_runtime_str!("node-frontier-template"), - impl_name: create_runtime_str!("node-frontier-template"), + spec_name: create_runtime_str!("frontier-template"), + impl_name: create_runtime_str!("frontier-template"), authoring_version: 1, spec_version: 1, impl_version: 1, diff --git a/ts-tests/tests/config.ts b/ts-tests/tests/config.ts index 8fa1702b75..aae797f0e8 100644 --- a/ts-tests/tests/config.ts +++ b/ts-tests/tests/config.ts @@ -6,7 +6,7 @@ export const FIRST_CONTRACT_ADDRESS = "0xc2bf5f29a4384b1ab0c063e1c666f02121b6084 export const NODE_BINARY_NAME = "frontier-template-node"; -export const RUNTIME_SPEC_NAME = "node-frontier-template"; +export const RUNTIME_SPEC_NAME = "frontier-template"; export const RUNTIME_SPEC_VERSION = 1; export const RUNTIME_IMPL_VERSION = 1; From 2055e2c9a8d1bee0a165897e8ddb4bea10238d79 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Mon, 20 Mar 2023 16:07:00 +0800 Subject: [PATCH 14/17] Fix docs CI (#1024) * Fix docs CI * fix cargo doc warnings --- client/rpc-core/src/types/filter.rs | 2 +- docs/yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/rpc-core/src/types/filter.rs b/client/rpc-core/src/types/filter.rs index 76cfd4824e..72ffe325ce 100644 --- a/client/rpc-core/src/types/filter.rs +++ b/client/rpc-core/src/types/filter.rs @@ -67,7 +67,7 @@ where /// Filter Address pub type FilterAddress = VariadicValue; -/// Topic, supports `A` | `null` | `[A,B,C]` | `[A,[B,C]]` | [null,[B,C]] | [null,[null,C]] +/// Topic, supports `A` | `null` | `[A,B,C]` | `[A,[B,C]]` | `[null,[B,C]]` | `[null,[null,C]]` pub type Topic = VariadicValue>>>; /// FlatTopic, simplifies the matching logic. pub type FlatTopic = VariadicValue>; diff --git a/docs/yarn.lock b/docs/yarn.lock index d31524cd79..e551b16dbd 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -2226,9 +2226,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001219: - version "1.0.30001230" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001230.tgz#8135c57459854b2240b57a4a6786044bdc5a9f71" - integrity sha512-5yBd5nWCBS+jWKTcHOzXwo5xzcj4ePE/yjtkZyUV1BTUmrBaA9MRGC+e7mxnqXSA90CmCA8L3eKLaSUkt099IQ== + version "1.0.30001468" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001468.tgz#0101837c6a4e38e6331104c33dcfb3bdf367a4b7" + integrity sha512-zgAo8D5kbOyUcRAgSmgyuvBkjrGk5CGYG5TYgFdpQv+ywcyEpo1LOWoG8YmoflGnh+V+UsNuKYedsoYs0hzV5A== caseless@~0.12.0: version "0.12.0" From 736cef1309a91e7b7b3e6dc2a0019524c5252517 Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Mon, 20 Mar 2023 16:07:57 +0800 Subject: [PATCH 15/17] udpate impl-serde to v0.4.0 (#1023) use the same version as substrate --- Cargo.lock | 23 +++++++---------------- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4204160c67..cbcfc664f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1743,7 +1743,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.4.0", + "impl-serde", "scale-info", "tiny-keccak", ] @@ -1776,7 +1776,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.4.0", + "impl-serde", "primitive-types", "scale-info", "uint", @@ -2156,7 +2156,7 @@ name = "fp-account" version = "1.0.0-dev" dependencies = [ "hex", - "impl-serde 0.3.2", + "impl-serde", "libsecp256k1", "log", "parity-scale-codec", @@ -3197,15 +3197,6 @@ dependencies = [ "rlp", ] -[[package]] -name = "impl-serde" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" -dependencies = [ - "serde", -] - [[package]] name = "impl-serde" version = "0.4.0" @@ -5572,7 +5563,7 @@ dependencies = [ "fixed-hash", "impl-codec", "impl-rlp", - "impl-serde 0.4.0", + "impl-serde", "scale-info", "uint", ] @@ -7917,7 +7908,7 @@ dependencies = [ "futures", "hash-db", "hash256-std-hasher", - "impl-serde 0.4.0", + "impl-serde", "lazy_static", "libsecp256k1", "log", @@ -8251,7 +8242,7 @@ name = "sp-storage" version = "7.0.0" source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "impl-serde 0.4.0", + "impl-serde", "parity-scale-codec", "ref-cast", "serde", @@ -8339,7 +8330,7 @@ name = "sp-version" version = "5.0.0" source = "git+https://github.com/paritytech/substrate?branch=master#1837f423b494254e1d27834b1c9da34b2c0c2375" dependencies = [ - "impl-serde 0.4.0", + "impl-serde", "parity-scale-codec", "parity-wasm", "scale-info", diff --git a/Cargo.toml b/Cargo.toml index fed89bdd8e..ceb42d3fda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ environmental = { version = "1.1.3", default-features = false } ethereum = { version = "0.14.0", default-features = false } ethereum-types = { version = "0.14.1", default-features = false } evm = { version = "0.37.0", default-features = false } -impl-serde = { version = "0.3.1", default-features = false } +impl-serde = { version = "0.4.0", default-features = false } jsonrpsee = "0.16.2" kvdb-rocksdb = "0.17.0" libsecp256k1 = { version = "0.7.1", default-features = false } From ce490e2b3a6ba00b97200dbaad100e890f7a2d9d Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Thu, 23 Mar 2023 17:37:31 +0800 Subject: [PATCH 16/17] impl FromStr for AccountId20 (#1028) --- primitives/account/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/primitives/account/src/lib.rs b/primitives/account/src/lib.rs index 820666caba..d1be0e8e29 100644 --- a/primitives/account/src/lib.rs +++ b/primitives/account/src/lib.rs @@ -19,6 +19,7 @@ use scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; +// Substrate use sp_core::{ecdsa, H160, H256}; use sp_io::hashing::keccak_256; @@ -32,6 +33,17 @@ pub struct AccountId20(pub [u8; 20]); #[cfg(feature = "std")] impl_serde::impl_fixed_hash_serde!(AccountId20, 20); +#[cfg(feature = "std")] +impl std::str::FromStr for AccountId20 { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + H160::from_str(s) + .map(Into::into) + .map_err(|_| "invalid hex address.") + } +} + #[cfg(feature = "std")] impl std::fmt::Display for AccountId20 { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { From d13668c014c229fe786ffff2eed636a3fd2ef67d Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Thu, 23 Mar 2023 20:01:26 +0800 Subject: [PATCH 17/17] fix features of fp-account dependencies (#1025) * fix features of fp-account dependencies * make impl-serde optional --- frame/evm/Cargo.toml | 2 +- primitives/account/Cargo.toml | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/frame/evm/Cargo.toml b/frame/evm/Cargo.toml index 8f888fe275..8a82b5a60e 100644 --- a/frame/evm/Cargo.toml +++ b/frame/evm/Cargo.toml @@ -59,8 +59,8 @@ std = [ "sp-runtime/std", "sp-std/std", # Frontier - "fp-evm/std", "fp-account/std", + "fp-evm/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/primitives/account/Cargo.toml b/primitives/account/Cargo.toml index ae0bb217a3..a56506cca1 100644 --- a/primitives/account/Cargo.toml +++ b/primitives/account/Cargo.toml @@ -9,12 +9,14 @@ repository = { workspace = true } [dependencies] hex = { version = "0.4.3", default-features = false } -impl-serde = { workspace = true } -libsecp256k1 = { workspace = true, default-features = false } +impl-serde = { workspace = true, optional = true } +libsecp256k1 = { workspace = true } log = { workspace = true } scale-codec = { package = "parity-scale-codec", workspace = true } scale-info = { workspace = true } -serde = { workspace = true } +serde = { workspace = true, optional = true } + +# Substrate sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } @@ -25,14 +27,16 @@ sp-std = { workspace = true } [features] default = ["std"] std = [ - "impl-serde/std", "hex/std", + "impl-serde/std", "libsecp256k1/std", "log/std", - "serde/std", + "scale-codec/std", + "scale-info/std", + "serde", # Substrate - "sp-io/std", "sp-core/std", + "sp-io/std", "sp-runtime/std", "sp-std/std", ]