Skip to content

Commit

Permalink
fix breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Oct 28, 2024
1 parent 4b587d6 commit 4689446
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion client/consensus/nimbus-consensus/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ where
}

async fn import_block(
&mut self,
&self,
mut block_import_params: sc_consensus::BlockImportParams<Block>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
// If we are in the parachain context, best block is determined by the relay chain
Expand Down
1 change: 1 addition & 0 deletions precompiles/assets-erc20/src/eip2612.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ where
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait,
AssetIdOf<Runtime, Instance>: Display,
Runtime::AccountId: Into<H160>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
fn compute_domain_separator(address: H160, asset_id: AssetIdOf<Runtime, Instance>) -> [u8; 32] {
let asset_name = pallet_assets::Pallet::<Runtime, Instance>::name(asset_id.clone());
Expand Down
1 change: 1 addition & 0 deletions precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ where
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin: OriginTrait,
AssetIdOf<Runtime, Instance>: Display,
Runtime::AccountId: Into<H160>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
/// PrecompileSet discriminant. Allows to knows if the address maps to an asset id,
/// and if this is the case which one.
Expand Down
1 change: 1 addition & 0 deletions precompiles/balances-erc20/src/eip2612.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256>,
Metadata: Erc20Metadata,
Instance: InstanceToPrefix + 'static,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
pub fn compute_domain_separator(address: H160) -> [u8; 32] {
let name: H256 = keccak_256(Metadata::name().as_bytes()).into();
Expand Down
1 change: 1 addition & 0 deletions precompiles/balances-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ where
BalanceOf<Runtime, Instance>: TryFrom<U256> + Into<U256>,
Metadata: Erc20Metadata,
Instance: InstanceToPrefix + 'static,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
#[precompile::public("totalSupply()")]
#[precompile::view]
Expand Down
1 change: 1 addition & 0 deletions precompiles/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ where
From<Option<Runtime::AccountId>>,
<Runtime as frame_system::Config>::RuntimeCall: From<pallet_xcm::Call<Runtime>>,
LocationMatcher: AccountIdToLocationMatcher<<Runtime as frame_system::Config>::AccountId>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
#[precompile::public(
"transferAssetsLocation(\
Expand Down
5 changes: 4 additions & 1 deletion precompiles/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ where
<Runtime as frame_system::Config>::RuntimeCall:
From<ProxyCall<Runtime>> + From<BalancesCall<Runtime>>,
<Runtime as pallet_balances::Config<()>>::Balance: TryFrom<U256> + Into<U256>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
fn is_allowed(_caller: H160, selector: Option<u32>) -> bool {
match selector {
Expand Down Expand Up @@ -86,6 +87,7 @@ where
<Runtime as frame_system::Config>::RuntimeCall:
From<ProxyCall<Runtime>> + From<BalancesCall<Runtime>>,
<Runtime as pallet_balances::Config<()>>::Balance: TryFrom<U256> + Into<U256>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
fn is_allowed(_caller: H160, selector: Option<u32>) -> bool {
match selector {
Expand Down Expand Up @@ -147,6 +149,7 @@ where
<Runtime as frame_system::Config>::RuntimeCall:
From<ProxyCall<Runtime>> + From<BalancesCall<Runtime>>,
<Runtime as pallet_balances::Config<()>>::Balance: TryFrom<U256> + Into<U256>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
/// Register a proxy account for the sender that is able to make calls on its behalf.
/// The dispatch origin for this call must be Signed.
Expand Down Expand Up @@ -180,7 +183,7 @@ where
handle.record_db_read::<Runtime>(
28 + (29 * (<Runtime as pallet_proxy::Config>::MaxProxies::get() as usize)) + 8,
)?;
if ProxyPallet::<Runtime>::proxies(&origin)
if ProxyPallet::<Runtime>::proxies(origin.clone())
.0
.iter()
.any(|pd| pd.delegate == delegate)
Expand Down
2 changes: 2 additions & 0 deletions precompiles/xcm-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ where
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin:
From<Option<Runtime::AccountId>>,
<Runtime as frame_system::Config>::RuntimeCall: From<pallet_xcm::Call<Runtime>>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
fn is_allowed(_caller: H160, selector: Option<u32>) -> bool {
match selector {
Expand Down Expand Up @@ -102,6 +103,7 @@ where
<<Runtime as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin:
From<Option<Runtime::AccountId>>,
<Runtime as frame_system::Config>::RuntimeCall: From<pallet_xcm::Call<Runtime>>,
<Runtime as pallet_evm::Config>::AddressMapping: AddressMapping<Runtime::AccountId>,
{
#[precompile::public("multilocationToAddress((uint8,bytes[]))")]
#[precompile::view]
Expand Down
16 changes: 4 additions & 12 deletions template/node/src/command.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use std::net::SocketAddr;

use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::BenchmarkCmd;
use log::info;
use moonkit_template_runtime::Block;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, SharedParams, SubstrateCli,
NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_runtime::traits::AccountIdConversion;
Expand Down Expand Up @@ -325,7 +323,7 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| Some(self.base_path.clone().into())))
}

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

Expand All @@ -339,15 +337,9 @@ impl CliConfiguration<Self> for RelayChainCli {
.prometheus_config(default_listen_port, chain_spec)
}

fn init<F>(
&self,
_support_url: &String,
_impl_version: &String,
_logger_hook: F,
_config: &sc_service::Configuration,
) -> Result<()>
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()>
where
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
F: FnOnce(&mut sc_cli::LoggerBuilder),
{
unreachable!("PolkadotCli is never initialized; qed");
}
Expand Down
6 changes: 1 addition & 5 deletions template/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::sync::Arc;
use moonkit_template_runtime::{opaque::Block, AccountId, Balance, Nonce};

use sc_client_api::AuxStore;
pub use sc_rpc::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand All @@ -25,8 +24,6 @@ pub struct FullDeps<C, P> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}

/// Instantiate all RPC extensions.
Expand All @@ -53,10 +50,9 @@ where
let FullDeps {
client,
pool,
deny_unsafe,
} = deps;

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;

Ok(module)
Expand Down
22 changes: 11 additions & 11 deletions template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,18 @@ pub fn new_partial(
.transpose()?;

let heap_pages = config
.executor
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
extra_pages: h as _,
});

let wasm = WasmExecutor::builder()
.with_execution_method(config.wasm_method)
.with_execution_method(config.executor.wasm_method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.with_max_runtime_instances(config.executor.max_runtime_instances)
.with_runtime_cache_size(config.executor.runtime_cache_size)
.build();

let executor = ParachainExecutor::new_with_wasm_executor(wasm);
Expand Down Expand Up @@ -240,7 +241,7 @@ where
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();

let net_config = FullNetworkConfiguration::<_, _, N>::new(&parachain_config.network);
let net_config = FullNetworkConfiguration::<_, _, N>::new(&parachain_config.network, prometheus_registry.clone());

let metrics = N::register_notification_metrics(
parachain_config
Expand All @@ -259,7 +260,7 @@ where
block_announce_validator_builder: Some(Box::new(|_| {
Box::new(block_announce_validator)
})),
warp_sync_params: None,
warp_sync_config: None,
net_config,
block_relay: None,
metrics,
Expand All @@ -269,11 +270,10 @@ where
let client = client.clone();
let transaction_pool = transaction_pool.clone();

Box::new(move |deny_unsafe, _| {
Box::new(move |_| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
deny_unsafe,
};

crate::rpc::create_full(deps).map_err(Into::into)
Expand Down Expand Up @@ -442,7 +442,8 @@ where
other: (_, mut telemetry, _),
} = new_partial(&config, false)?;

let net_config = FullNetworkConfiguration::<_, _, N>::new(&config.network);
let prometheus_registry = config.prometheus_registry().cloned();
let net_config = FullNetworkConfiguration::<_, _, N>::new(&config.network, prometheus_registry.clone());

let metrics = N::register_notification_metrics(
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
Expand All @@ -456,7 +457,7 @@ where
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync_params: None,
warp_sync_config: None,
net_config,
block_relay: None,
metrics,
Expand Down Expand Up @@ -490,11 +491,10 @@ where
let client = client.clone();
let transaction_pool = transaction_pool.clone();

Box::new(move |deny_unsafe, _| {
Box::new(move |_| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
deny_unsafe,
};

crate::rpc::create_full(deps).map_err(Into::into)
Expand Down
4 changes: 1 addition & 3 deletions template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,9 +688,7 @@ construct_runtime!(
{
// System support stuff.
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
ParachainSystem: cumulus_pallet_parachain_system::{
Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned,
} = 1,
ParachainSystem: cumulus_pallet_parachain_system = 1,
RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip::{Pallet, Storage} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
ParachainInfo: staging_parachain_info::{Pallet, Storage, Config<T>} = 4,
Expand Down

0 comments on commit 4689446

Please sign in to comment.