Skip to content

Commit 877989a

Browse files
Merge pull request #143 from OriginTrail/release/testnet
Mainnet Release 1.6.0
2 parents feb9eac + caa4416 commit 877989a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+4677
-4094
lines changed

Cargo.lock

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

Cargo.toml

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

node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "neuroweb-node"
3-
version = "1.5.2"
3+
version = "1.6.0"
44
authors = ["TraceLabs"]
55
description = "NeuroWeb - Cumulus FRAME-based Substrate Node"
66
license = "GPL-3.0-only"

node/src/chain_spec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
88
use std::{collections::BTreeMap, str::FromStr};
99

1010
/// Specialized `ChainSpec` for the normal parachain runtime.
11-
pub type ChainSpec =
12-
sc_service::GenericChainSpec<neuroweb_runtime::RuntimeGenesisConfig, Extensions>;
11+
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
1312

1413
/// The default XCM version to set in genesis config.
1514
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
@@ -193,6 +192,7 @@ fn testnet_genesis(
193192
)
194193
})
195194
.collect(),
195+
non_authority_keys: vec![],
196196
},
197197
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
198198
// of this.

node/src/command.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ use log::info;
99
use neuroweb_runtime::Block;
1010
use sc_cli::{
1111
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
12-
NetworkParams, Result, SharedParams, SubstrateCli,
12+
NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli,
1313
};
1414
use sc_service::{
1515
config::{BasePath, PrometheusConfig},
1616
PartialComponents,
1717
};
1818
use sp_runtime::traits::AccountIdConversion;
19-
use std::net::SocketAddr;
2019

2120
fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
2221
Ok(match id {
@@ -242,7 +241,10 @@ pub fn run() -> Result<()> {
242241
let hwbench = (!cli.no_hardware_benchmarks)
243242
.then_some(config.database.path().map(|database_path| {
244243
let _ = std::fs::create_dir_all(&database_path);
245-
sc_sysinfo::gather_hwbench(Some(database_path))
244+
sc_sysinfo::gather_hwbench(
245+
Some(database_path),
246+
&SUBSTRATE_REFERENCE_HARDWARE,
247+
)
246248
}))
247249
.flatten();
248250

@@ -339,7 +341,7 @@ impl CliConfiguration<Self> for RelayChainCli {
339341
.or_else(|| self.base_path.clone().map(Into::into)))
340342
}
341343

342-
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
344+
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<Vec<RpcEndpoint>>> {
343345
self.base.base.rpc_addr(default_listen_port)
344346
}
345347

@@ -353,15 +355,9 @@ impl CliConfiguration<Self> for RelayChainCli {
353355
.prometheus_config(default_listen_port, chain_spec)
354356
}
355357

356-
fn init<F>(
357-
&self,
358-
_support_url: &String,
359-
_impl_version: &String,
360-
_logger_hook: F,
361-
_config: &sc_service::Configuration,
362-
) -> Result<()>
358+
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()>
363359
where
364-
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
360+
F: FnOnce(&mut sc_cli::LoggerBuilder),
365361
{
366362
unreachable!("PolkadotCli is never initialized; qed");
367363
}

node/src/rpc.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use sc_client_api::{
2222
};
2323
use sc_network::service::traits::NetworkService;
2424
use sc_network_sync::SyncingService;
25-
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
25+
pub use sc_rpc::SubscriptionTaskExecutor;
2626
use sc_transaction_pool::{ChainApi, Pool};
2727
use sc_transaction_pool_api::TransactionPool;
2828
use sp_api::{CallApiAt, ProvideRuntimeApi};
@@ -44,8 +44,6 @@ pub struct FullDeps<C, P, A: ChainApi> {
4444
pub graph: Arc<Pool<A>>,
4545
/// Chain syncing service
4646
pub sync: Arc<SyncingService<Block>>,
47-
/// Whether to deny unsafe calls
48-
pub deny_unsafe: DenyUnsafe,
4947
/// The Node authority flag
5048
pub is_authority: bool,
5149
/// Network service
@@ -107,7 +105,6 @@ where
107105
client,
108106
pool,
109107
graph,
110-
deny_unsafe,
111108
network,
112109
backend,
113110
is_authority,
@@ -119,7 +116,7 @@ where
119116
block_data_cache,
120117
} = deps;
121118

122-
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
119+
module.merge(System::new(client.clone(), pool.clone()).into_rpc())?;
123120
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
124121

125122
let signers = Vec::new();

node/src/service.rs

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use sc_client_api::BlockchainEvents;
2929
use sc_consensus::ImportQueue;
3030
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
3131
use sc_network::{NetworkBackend, NetworkBlock};
32-
use sc_network_sync::SyncingService;
3332
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
3433
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
3534
use sp_keystore::KeystorePtr;
@@ -118,17 +117,18 @@ pub fn new_partial(
118117
.transpose()?;
119118

120119
let heap_pages = config
120+
.executor
121121
.default_heap_pages
122122
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
123123
extra_pages: h as _,
124124
});
125125

126126
let executor = WasmExecutor::builder()
127-
.with_execution_method(config.wasm_method)
127+
.with_execution_method(config.executor.wasm_method)
128128
.with_onchain_heap_alloc_strategy(heap_pages)
129129
.with_offchain_heap_alloc_strategy(heap_pages)
130-
.with_max_runtime_instances(config.max_runtime_instances)
131-
.with_runtime_cache_size(config.runtime_cache_size)
130+
.with_max_runtime_instances(config.executor.max_runtime_instances)
131+
.with_runtime_cache_size(config.executor.runtime_cache_size)
132132
.build();
133133

134134
let (client, backend, keystore_container, task_manager) =
@@ -222,12 +222,14 @@ where
222222
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
223223

224224
let validator = parachain_config.role.is_authority();
225-
let prometheus_registry = parachain_config.prometheus_registry().cloned();
226225
let is_authority = parachain_config.role.is_authority();
227226
let transaction_pool = params.transaction_pool.clone();
228227
let import_queue_service = params.import_queue.service();
229-
let net_config =
230-
sc_network::config::FullNetworkConfiguration::<_, _, N>::new(&parachain_config.network);
228+
let prometheus_registry = parachain_config.prometheus_registry().cloned();
229+
let net_config = sc_network::config::FullNetworkConfiguration::<_, _, N>::new(
230+
&parachain_config.network,
231+
prometheus_registry.clone(),
232+
);
231233

232234
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
233235
build_network(BuildNetworkParams {
@@ -318,13 +320,12 @@ where
318320
let frontier_backend = frontier_backend.clone();
319321
let pubsub_notification_sinks = pubsub_notification_sinks.clone();
320322

321-
Box::new(move |deny_unsafe, subscription_task_executor| {
323+
Box::new(move |subscription_task_executor| {
322324
let deps = crate::rpc::FullDeps {
323325
client: client.clone(),
324326
pool: transaction_pool.clone(),
325327
graph: transaction_pool.pool().clone(),
326328
sync: sync.clone(),
327-
deny_unsafe,
328329
is_authority,
329330
network: network.clone(),
330331
backend: frontier_backend.clone(),
@@ -369,7 +370,7 @@ where
369370
// Here you can check whether the hardware meets your chains' requirements. Putting a link
370371
// in there and swapping out the requirements for your own are probably a good idea. The
371372
// requirements for a para-chain are dictated by its relay-chain.
372-
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
373+
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench, validator) {
373374
Err(err) if validator => {
374375
log::warn!(
375376
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority' find out more at:\n\
@@ -487,7 +488,7 @@ fn start_aura_consensus(
487488
task_manager: &TaskManager,
488489
relay_chain_interface: Arc<dyn RelayChainInterface>,
489490
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
490-
sync_oracle: Arc<SyncingService<Block>>,
491+
sync_service: Arc<sc_network_sync::SyncingService<Block>>,
491492
keystore: KeystorePtr,
492493
para_id: ParaId,
493494
collator_key: CollatorPair,
@@ -511,8 +512,8 @@ fn start_aura_consensus(
511512
.map_err(|e| sc_service::Error::Application(Box::new(e)))?;
512513

513514
let announce_block = {
514-
let sync_service = sync_oracle.clone();
515-
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
515+
let sync = sync_service.clone();
516+
Arc::new(move |hash, data| sync.announce_block(hash, data))
516517
};
517518

518519
let collator_service = cumulus_client_collator::service::CollatorService::new(
@@ -522,33 +523,31 @@ fn start_aura_consensus(
522523
client.clone(),
523524
);
524525

525-
let fut =
526-
aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _, _>(
527-
AuraParams {
528-
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
529-
block_import: block_import.clone(),
530-
para_client: client.clone(),
531-
para_backend: backend.clone(),
532-
relay_client: relay_chain_interface.clone(),
533-
code_hash_provider: move |block_hash| {
534-
client
535-
.code_at(block_hash)
536-
.ok()
537-
.map(|c| ValidationCode::from(c).hash())
538-
},
539-
sync_oracle: sync_oracle.clone(),
540-
keystore,
541-
collator_key,
542-
para_id,
543-
overseer_handle,
544-
relay_chain_slot_duration: Duration::from_secs(6),
545-
proposer: cumulus_client_consensus_proposer::Proposer::new(proposer_factory),
546-
collator_service,
547-
// We got around 500ms for proposing
548-
authoring_duration: Duration::from_millis(1500),
549-
reinitialize: false,
526+
let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _>(
527+
AuraParams {
528+
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
529+
block_import: block_import.clone(),
530+
para_client: client.clone(),
531+
para_backend: backend.clone(),
532+
relay_client: relay_chain_interface.clone(),
533+
code_hash_provider: move |block_hash| {
534+
client
535+
.code_at(block_hash)
536+
.ok()
537+
.map(|c| ValidationCode::from(c).hash())
550538
},
551-
);
539+
keystore,
540+
collator_key,
541+
para_id,
542+
overseer_handle,
543+
relay_chain_slot_duration: Duration::from_secs(6),
544+
proposer: cumulus_client_consensus_proposer::Proposer::new(proposer_factory),
545+
collator_service,
546+
// We got around 500ms for proposing
547+
authoring_duration: Duration::from_millis(1500),
548+
reinitialize: false,
549+
},
550+
);
552551

553552
task_manager
554553
.spawn_essential_handle()

pallets/wrapper/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-wrapper"
3-
version = "0.1.0"
3+
version = "1.1.0"
44
description = "TRAC token wrapper pallet for converting between foreign and local TRAC assets"
55
authors.workspace = true
66
edition.workspace = true

pallets/wrapper/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ pub mod pallet {
233233
local_trac_asset_id,
234234
&who,
235235
amount,
236+
frame_support::traits::tokens::Preservation::Expendable,
236237
frame_support::traits::tokens::Precision::Exact,
237238
frame_support::traits::tokens::Fortitude::Polite,
238239
)
@@ -281,6 +282,7 @@ pub mod pallet {
281282

282283
impl<T: Config> Pallet<T> {
283284
/// Get the account ID of the pallet
285+
/// Translates to gJpDhAL2bdaamftxXHXTbNxL6EZcXrgSmeLJzn2ficD3n4oWV
284286
pub fn pallet_account_id() -> T::AccountId {
285287
T::PalletId::get().into_account_truncating()
286288
}

pallets/wrapper/src/mock.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl pallet_assets::Config for Test {
111111
}
112112

113113
parameter_types! {
114-
pub const WrapperPalletId: PalletId = PalletId(*b"pwrapper");
114+
pub const WrapperPalletId: PalletId = PalletId(*b"p/wrpper");
115115
pub const LocalTracAssetId: AssetId = 1;
116116
pub const ForeignTracAssetId: AssetId = 2;
117117
}
@@ -165,6 +165,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
165165
// Give BOB some foreign TRAC
166166
(ForeignTracAssetId::get(), BOB, 500000),
167167
],
168+
next_asset_id: None,
168169
}
169170
.assimilate_storage(&mut t)
170171
.unwrap();

0 commit comments

Comments
 (0)