Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into agustin-map-rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
Agusrodri committed Nov 26, 2024
2 parents a81c935 + b866a6e commit b79e861
Show file tree
Hide file tree
Showing 70 changed files with 2,888 additions and 2,755 deletions.
1,688 changes: 861 additions & 827 deletions Cargo.lock

Large diffs are not rendered by default.

598 changes: 299 additions & 299 deletions Cargo.toml

Large diffs are not rendered by default.

31 changes: 18 additions & 13 deletions client/node-common/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ use {
sc_network::{config::FullNetworkConfiguration, NetworkBlock},
sc_network_sync::SyncingService,
sc_network_transactions::TransactionsHandlerController,
sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor},
sc_service::{
Configuration, KeystoreContainer, NetworkStarter, SpawnTaskHandle, TFullBackend,
TFullClient, TaskManager,
Expand All @@ -65,6 +64,7 @@ use {
#[allow(deprecated)]
use sc_executor::NativeElseWasmExecutor;
use sp_api::StorageProof;
use sp_core::traits::SpawnNamed;

tp_traits::alias!(
pub trait MinimalRuntimeApi<
Expand Down Expand Up @@ -250,6 +250,7 @@ where

let heap_pages =
parachain_config
.executor
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
extra_pages: h as u32,
Expand All @@ -260,12 +261,13 @@ where
// to change once we start having runtime_cache_sizes, or
// run nodes with the maximum for this value
let mut wasm_builder = WasmExecutor::builder()
.with_execution_method(parachain_config.wasm_method)
.with_execution_method(parachain_config.executor.wasm_method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(parachain_config.max_runtime_instances)
.with_runtime_cache_size(parachain_config.runtime_cache_size);
if let Some(ref wasmtime_precompiled_path) = parachain_config.wasmtime_precompiled {
.with_max_runtime_instances(parachain_config.executor.max_runtime_instances)
.with_runtime_cache_size(parachain_config.executor.runtime_cache_size);
if let Some(ref wasmtime_precompiled_path) = parachain_config.executor.wasmtime_precompiled
{
wasm_builder = wasm_builder.with_wasmtime_precompiled_path(wasmtime_precompiled_path);
}

Expand Down Expand Up @@ -383,7 +385,10 @@ where
import_queue_service: _,
} = self;

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

let import_queue_service = import_queue.service();
let spawn_handle = task_manager.spawn_handle();
Expand Down Expand Up @@ -461,7 +466,10 @@ where
import_queue_service: _,
} = self;

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

let metrics = Net::register_notification_metrics(
parachain_config
Expand All @@ -479,7 +487,7 @@ where
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
warp_sync_params: None,
warp_sync_config: None,
block_announce_validator_builder: None,
net_config,
block_relay: None,
Expand Down Expand Up @@ -515,10 +523,7 @@ where
self,
parachain_config: Configuration,
rpc_builder: Box<
dyn Fn(
DenyUnsafe,
SubscriptionTaskExecutor,
) -> Result<RpcModule<TRpc>, sc_service::Error>,
dyn Fn(Arc<(dyn SpawnNamed + 'static)>) -> Result<RpcModule<TRpc>, sc_service::Error>,
>,
) -> sc_service::error::Result<NodeBuilder<T, Network<BlockOf<T>>, (), SImportQueueService>>
where
Expand Down Expand Up @@ -594,7 +599,7 @@ where
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
if collator {
if let Err(err) = SUBSTRATE_REFERENCE_HARDWARE.check_hardware(hwbench) {
if let Err(err) = SUBSTRATE_REFERENCE_HARDWARE.check_hardware(hwbench, false) {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
err
Expand Down
12 changes: 7 additions & 5 deletions client/service-container-chain/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use {
sc_network::config::MultiaddrWithPeerId,
sc_service::BasePath,
sp_runtime::Storage,
std::{collections::BTreeMap, net::SocketAddr},
std::collections::BTreeMap,
url::Url,
};

Expand Down Expand Up @@ -147,7 +147,7 @@ impl ContainerChainCli {
base.base
.import_params
.wasmtime_precompiled
.clone_from(&para_config.wasmtime_precompiled);
.clone_from(&para_config.executor.wasmtime_precompiled);
}

// Set container base path to the same value as orchestrator base_path.
Expand Down Expand Up @@ -325,7 +325,10 @@ impl sc_cli::CliConfiguration<Self> for ContainerChainCli {
self.shared_params().base_path()
}

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

Expand All @@ -344,10 +347,9 @@ impl sc_cli::CliConfiguration<Self> for ContainerChainCli {
_support_url: &String,
_impl_version: &String,
_logger_hook: F,
_config: &sc_service::Configuration,
) -> sc_cli::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: 5 additions & 1 deletion client/service-container-chain/src/data_preservers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>

use frame_support::__private::sp_tracing::tracing::Instrument;
use {
crate::spawner::{wait_for_paritydb_lock, Spawner},
dc_orchestrator_chain_interface::{
Expand All @@ -33,7 +34,6 @@ async fn try_fut<T, E>(fut: impl Future<Output = Result<T, E>>) -> Result<T, E>

/// Watch assignements by indefinitly listening to finalized block notifications and switching to
/// the chain the profile is assigned to.
#[sc_tracing::logging::prefix_logs_with("Data Preserver Assignment Watcher")]
pub async fn task_watch_assignment(spawner: impl Spawner, profile_id: ProfileId) {
use dc_orchestrator_chain_interface::DataPreserverAssignment as Assignment;

Expand Down Expand Up @@ -111,6 +111,10 @@ pub async fn task_watch_assignment(spawner: impl Spawner, profile_id: ProfileId)

Ok(())
})
.instrument(sc_tracing::tracing::info_span!(
sc_tracing::logging::PREFIX_LOG_SPAN,
name = "Data Preserver Assignment Watcher",
))
.await
{
log::error!("Error in data preservers assignement watching task: {e:?}");
Expand Down
14 changes: 3 additions & 11 deletions client/service-container-chain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ use {
rpc::{ManualSeal, ManualSealApiServer},
EngineCommand,
},
sc_rpc::DenyUnsafe,
sc_transaction_pool_api::TransactionPool,
sp_api::ProvideRuntimeApi,
sp_block_builder::BlockBuilder,
Expand All @@ -49,8 +48,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,
/// Manual seal command sink
pub command_sink: Option<futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
/// Channels for manual xcm messages (downward, hrmp)
Expand Down Expand Up @@ -92,12 +89,11 @@ where
let FullDeps {
client,
pool,
deny_unsafe,
command_sink,
xcm_senders,
} = deps;

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

if let Some(command_sink) = command_sink {
module.merge(
Expand Down Expand Up @@ -144,10 +140,7 @@ pub mod generate_rpc_builder {
pub type XcmSenders = (flume::Sender<Vec<u8>>, flume::Sender<(ParaId, Vec<u8>)>);
pub type Network = dyn sc_network::service::traits::NetworkService;
pub type CompleteRpcBuilder = Box<
dyn Fn(
sc_rpc::DenyUnsafe,
sc_rpc::SubscriptionTaskExecutor,
) -> Result<jsonrpsee::RpcModule<()>, ServiceError>,
dyn Fn(sc_rpc::SubscriptionTaskExecutor) -> Result<jsonrpsee::RpcModule<()>, ServiceError>,
>;

pub struct GenerateRpcBuilderParams<'a, RuntimeApi: MinimalContainerRuntimeApi> {
Expand Down Expand Up @@ -205,11 +198,10 @@ mod impl_generate_rpc_builder {
let client = client.clone();
let transaction_pool = transaction_pool.clone();

Ok(Box::new(move |deny_unsafe, _| {
Ok(Box::new(move |_| {
let deps = FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
deny_unsafe,
command_sink: command_sink.clone(),
xcm_senders: xcm_senders.clone(),
};
Expand Down
Loading

0 comments on commit b79e861

Please sign in to comment.