Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9ebe103
make it compile without external errors
Ad96el Apr 28, 2025
6b8e1aa
pallets compile
Ad96el Apr 28, 2025
a2805a3
make spiritnet and peregrine compile
Ad96el Apr 29, 2025
13e5356
make node compile
Ad96el Apr 29, 2025
05ef908
compiling dip templates
Ad96el Apr 29, 2025
024eab3
compiling all components
Ad96el Apr 30, 2025
1a3972b
tests are passing
Ad96el Apr 30, 2025
e4ad393
first clean up
Ad96el Apr 30, 2025
e34baf6
clean up
Ad96el Apr 30, 2025
0ac1918
test passing with all features and all targets
Ad96el Apr 30, 2025
b6c3523
Merge branch 'develop' into chore/polkadot-1.8.0
Ad96el Apr 30, 2025
4aaa34c
add missing migrations
Ad96el Apr 30, 2025
4ae0217
add benchmarks
Ad96el Apr 30, 2025
6908b8a
clippy
Ad96el Apr 30, 2025
f092087
clippy
Ad96el Apr 30, 2025
27b7024
clippy
Ad96el Apr 30, 2025
436b810
clippy fix
Ad96el May 2, 2025
cd4a4a8
clippy fix all features and targets
Ad96el May 2, 2025
760a21c
fmt
Ad96el May 2, 2025
9223a16
clippy
Ad96el May 5, 2025
2490c56
peregrine benchmark
Ad96el May 5, 2025
7bd6d0d
benchmarking
Ad96el May 5, 2025
5d89fb7
clippy
Ad96el May 5, 2025
5eb7f14
fmt
Ad96el May 5, 2025
1d0186d
cargo deny
Ad96el May 5, 2025
d30fdfe
fmt
Ad96el May 5, 2025
193124a
cargo deny
Ad96el May 5, 2025
7014926
cargo deny
Ad96el May 6, 2025
b32b6d1
Merge branch 'develop' into chore/polkadot-1.8.0
Ad96el May 6, 2025
b825044
fix benchmarking
Ad96el May 6, 2025
feda985
cargo docs
Ad96el May 6, 2025
4c555e6
Merge branch 'develop' into chore/polkadot-1.8.0
Ad96el May 6, 2025
ba49f36
add missing migration
Ad96el May 6, 2025
d713122
Merge remote-tracking branch 'origin' into chore/polkadot-1.8.0
Ad96el May 7, 2025
14d65e3
remove wasm
Ad96el May 7, 2025
6ba2f43
benchmark scheduler
Ad96el May 12, 2025
2b62fdd
update cargo toml
Ad96el May 12, 2025
6be123a
improve error handling
Ad96el May 12, 2025
d53c707
use right rust version for CI
Ad96el May 15, 2025
624da4f
Merge branch 'develop' into chore/polkadot-1.8.0
Ad96el May 16, 2025
147fdde
feat: Ismp (#888)
Ad96el May 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,506 changes: 3,822 additions & 2,684 deletions Cargo.lock

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/kilt-dip-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
version = { workspace = true }

[dev-dependencies]
cumulus-pallet-parachain-system = { workspace = true, features = ["parameterized-consensus-hook", "std"] }
cumulus-pallet-parachain-system = { workspace = true, features = ["std"] }
cumulus-primitives-core = { workspace = true }
enum-iterator = { workspace = true }
hex-literal = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ mod dip_revealed_details_and_verified_did_signature_freshness {
details: DidPublicKeyDetails {
// This key should be filtered out from the result, since it does not verify successfully for the
// provided payload and signature.
key: DidVerificationKey::from(ed25519::Public([100; 32])).into(),
key: DidVerificationKey::from(ed25519::Public::from_raw([100; 32])).into(),
block_number: 0u32,
},
}
Expand Down Expand Up @@ -176,7 +176,7 @@ mod dip_revealed_details_and_verified_did_signature_freshness {

#[test]
fn retrieve_signing_leaves_for_payload_no_key_present() {
let did_auth_key: DidVerificationKey<AccountId32> = ed25519::Public([0u8; 32]).into();
let did_auth_key: DidVerificationKey<AccountId32> = ed25519::Public::from_raw([0u8; 32]).into();
let revealed_leaves: BoundedVec<RevealedDidMerkleProofLeaf<u32, AccountId32, u32, (), ()>, ConstU32<1>> =
vec![RevealedDidKey {
id: 0u32,
Expand All @@ -192,7 +192,7 @@ mod dip_revealed_details_and_verified_did_signature_freshness {
let revealed_details: DipRevealedDetailsAndVerifiedDidSignatureFreshness<_, _, _, _, _, 1> =
DipRevealedDetailsAndVerifiedDidSignatureFreshness {
revealed_leaves,
signature: ed25519::Signature([100u8; 64]).into(),
signature: ed25519::Signature::from_raw([100u8; 64]).into(),
};
assert_err!(
revealed_details.retrieve_signing_leaves_for_payload(&().encode()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ where
{
fn default() -> Self {
Self {
signature: DidSignature::Ed25519(sp_core::ed25519::Signature([0u8; 64])),
signature: DidSignature::Ed25519(sp_core::ed25519::Signature::from_raw([0u8; 64])),
valid_until: BlockNumber::default(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ mod dip_did_proof_with_verified_relay_state_root {
type SS58Prefix = ConstU16<1>;
type SystemWeightInfo = ();
type Version = ();

type MultiBlockMigrator = ();
type SingleBlockMigrations = ();
type PostInherents = ();
type PostTransactions = ();
type PreInherents = ();
}

impl pallet_dip_provider::Config for TestProviderRuntime {
Expand Down Expand Up @@ -482,7 +488,7 @@ mod dip_did_proof_with_verified_subject_commitment {
id: hex!("50da6646d21f19b4d7d9f80d5beb103fbef7f4bb95eb94e0c02552175b1bff3a").into(),
relationship: DidVerificationKeyRelationship::Authentication.into(),
details: DidPublicKeyDetails {
key: DidVerificationKey::Ed25519(ed25519::Public(hex!(
key: DidVerificationKey::Ed25519(ed25519::Public::from_raw(hex!(
"43a72e714401762df66b68c26dfbdf2682aaec9f2474eca4613e424a0fbafd3c"
)))
.into(),
Expand Down
9 changes: 7 additions & 2 deletions crates/kilt-dip-primitives/src/verifier/parachain/v0/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ impl frame_system::Config for TestRuntime {
type SS58Prefix = ConstU16<1>;
type SystemWeightInfo = ();
type Version = ();
type MultiBlockMigrator = ();
type SingleBlockMigrations = ();
type PostInherents = ();
type PostTransactions = ();
type PreInherents = ();
}

parameter_types! {
Expand Down Expand Up @@ -227,15 +232,15 @@ pub(crate) fn cross_chain_proof_with_authentication_key_and_web3_name() -> Parac
id: hex!("a99e99fc7ce5529bc72a0846778d0f62137ddcbab51a1af2d3e91752962d91b4").into(),
relationship: DidVerificationKeyRelationship::Authentication.into(),
details: DidPublicKeyDetails {
key: DidVerificationKey::Sr25519(sr25519::Public(hex!("9cf53cf19360e5cac6055254c77d91a79701381c47e03e17c3284aa85edc851e"))).into(),
key: DidVerificationKey::Sr25519(sr25519::Public::from_raw(hex!("9cf53cf19360e5cac6055254c77d91a79701381c47e03e17c3284aa85edc851e"))).into(),
block_number: 144
}
}.into(),
RevealedWeb3Name {
web3_name: b"9f61d55037c5886b03966c9".to_vec().try_into().unwrap(),
claimed_at: 144
}.into()
] }, signature: TimeBoundDidSignature::new(did::DidSignature::Sr25519(sr25519::Signature(hex!("3cd5e72f04d248e5155bfdabb94c308a88368db63a8a0cafc15fb3204a709b07da028cf85bd450d9a2bdb6679f2b07ac69188101185ab3acd9f41419cbfb3c81"))), SIGNATURE_VALID_UNTIL) }
] }, signature: TimeBoundDidSignature::new(did::DidSignature::Sr25519(sr25519::Signature::from_raw(hex!("3cd5e72f04d248e5155bfdabb94c308a88368db63a8a0cafc15fb3204a709b07da028cf85bd450d9a2bdb6679f2b07ac69188101185ab3acd9f41419cbfb3c81"))), SIGNATURE_VALID_UNTIL) }
}

// Aliases requires because the pallet does not expose anything public.
Expand Down
3 changes: 2 additions & 1 deletion dip-template/nodes/dip-consumer/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};

const PARA_ID: u32 = 2_001;

pub type ChainSpec = GenericChainSpec<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = GenericChainSpec<Extensions>;
type AccountPublic = <Signature as Verify>::Signer;

pub(crate) fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -97,6 +97,7 @@ fn testnet_genesis(
.into_iter()
.map(|(acc, aura)| (acc.clone(), acc, template_session_keys(aura)))
.collect(),
..Default::default()
},
..Default::default()
}
Expand Down
27 changes: 10 additions & 17 deletions dip-template/nodes/dip-consumer/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

// If you feel like getting in touch with us, you can do so at <hello@kilt.io>

use std::{fs::create_dir_all, iter::once, net::SocketAddr};
use std::{fs::create_dir_all, iter::once};

use cumulus_primitives_core::ParaId;
use dip_consumer_runtime_template::Block;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, LoggerBuilder,
NetworkParams, Result, SharedParams, SubstrateCli,
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
SharedParams, SubstrateCli,
};
use sc_service::{
config::{BasePath, PrometheusConfig},
Configuration, Role, RpcMethods, TransactionPoolOptions,
Role, RpcMethods, TransactionPoolOptions,
};
use sc_sysinfo::gather_hwbench;
use sc_telemetry::TelemetryEndpoints;
Expand Down Expand Up @@ -196,7 +196,9 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<Block, ()>(config))
runner.sync_run(|config| {
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(config.chain_spec))
})
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -235,7 +237,7 @@ pub fn run() -> Result<()> {
let hwbench = (!cli.no_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = create_dir_all(database_path);
gather_hwbench(Some(database_path))
gather_hwbench(Some(database_path), &SUBSTRATE_REFERENCE_HARDWARE)
}))
.flatten();

Expand Down Expand Up @@ -310,7 +312,7 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}

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

Expand All @@ -322,16 +324,7 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.prometheus_config(default_listen_port, chain_spec)
}

fn init<F>(
&self,
_support_url: &String,
_impl_version: &String,
_logger_hook: F,
_config: &Configuration,
) -> Result<()>
where
F: FnOnce(&mut LoggerBuilder, &Configuration),
{
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()> {
unreachable!("PolkadotCli is never initialized; qed");
}

Expand Down
10 changes: 2 additions & 8 deletions dip-template/nodes/dip-consumer/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#![warn(missing_docs)]

pub use sc_rpc_api::DenyUnsafe;
use substrate_frame_rpc_system::AccountNonceApi;

use std::{error::Error, sync::Arc};
Expand All @@ -37,7 +36,6 @@ pub type RpcExtension = RpcModule<()>;
pub struct FullDeps<C, P> {
pub client: Arc<C>,
pub pool: Arc<P>,
pub deny_unsafe: DenyUnsafe,
}

pub fn create_full<C, P>(deps: FullDeps<C, P>) -> Result<RpcExtension, Box<dyn Error + Send + Sync>>
Expand All @@ -57,13 +55,9 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcExtension::new(());
let FullDeps {
client,
pool,
deny_unsafe,
} = deps;
let FullDeps { client, pool } = deps;

module.merge(System::new(Arc::clone(&client), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(Arc::clone(&client), pool).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
48 changes: 25 additions & 23 deletions dip-template/nodes/dip-consumer/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use frame_benchmarking::benchmarking::HostFunctions;
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_client_api::Backend;
use sc_consensus::{DefaultImportQueue, ImportQueue};
#[allow(deprecated)]
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
Expand Down Expand Up @@ -67,6 +68,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
}
}

#[allow(deprecated)]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next major release will already contain the omninode. Therefore, I kept the changes as minimal as possible, as they get anyway dropped in the next polkadot dependency update.

type ParachainExecutor = NativeElseWasmExecutor<ParachainNativeExecutor>;
type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
type ParachainBackend = TFullBackend<Block>;
Expand Down Expand Up @@ -97,6 +99,7 @@ pub fn new_partial(
})
.transpose()?;

#[allow(deprecated)]
let executor = sc_service::new_native_or_wasm_executor(config);

let (client, backend, keystore_container, task_manager) = new_full_parts::<Block, RuntimeApi, _>(
Expand Down Expand Up @@ -175,7 +178,10 @@ async fn start_node_impl(
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = Arc::clone(&params.transaction_pool);
let import_queue_service = params.import_queue.service();
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);
let net_config = sc_network::config::FullNetworkConfiguration::<_, _, sc_network::NetworkWorker<Block, Hash>>::new(
&parachain_config.network,
prometheus_registry.clone(),
);

let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
Expand All @@ -194,34 +200,34 @@ async fn start_node_impl(
if parachain_config.offchain_worker.enabled {
use futures::FutureExt;

let offchain_workers = sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
keystore: Some(params.keystore_container.keystore()),
offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(transaction_pool.clone())),
network_provider: Arc::new(network.clone()),
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
});

task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: Arc::clone(&client),
keystore: Some(params.keystore_container.keystore()),
offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(Arc::clone(&transaction_pool))),
#[allow(clippy::clone_on_ref_ptr)]
network_provider: network.clone(),
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
})
.run(Arc::clone(&client), task_manager.spawn_handle())
.boxed(),
offchain_workers
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
}

let rpc_builder = {
let client = Arc::clone(&client);
let transaction_pool = Arc::clone(&transaction_pool);

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

create_full(deps).map_err(Into::into)
Expand All @@ -245,7 +251,7 @@ async fn start_node_impl(

if let Some(hwbench) = hwbench {
print_hwbench(&hwbench);
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench, false) {
Err(err) if validator => {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
Expand Down Expand Up @@ -357,7 +363,7 @@ fn start_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
sync_oracle: Arc<SyncingService<Block>>,
_sync_oracle: Arc<SyncingService<Block>>,
keystore: KeystorePtr,
relay_chain_slot_duration: Duration,
para_id: ParaId,
Expand All @@ -367,8 +373,6 @@ fn start_consensus(
) -> Result<(), sc_service::Error> {
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams};

let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
Arc::clone(&client),
Expand All @@ -393,20 +397,18 @@ fn start_consensus(
para_backend: backend,
relay_client: relay_chain_interface,
code_hash_provider: move |block_hash| client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()),
sync_oracle,
keystore,
collator_key,
para_id,
overseer_handle,
slot_duration,
relay_chain_slot_duration,
proposer,
collator_service,
authoring_duration: Duration::from_millis(500),
reinitialize: false,
};

let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _, _>(params);
let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _>(params);
task_manager.spawn_essential_handle().spawn("aura", None, fut);

Ok(())
Expand Down
3 changes: 2 additions & 1 deletion dip-template/nodes/dip-provider/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};

const PARA_ID: u32 = 2_000;

pub type ChainSpec = GenericChainSpec<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = GenericChainSpec<Extensions>;
type AccountPublic = <Signature as Verify>::Signer;

pub(crate) fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -97,6 +97,7 @@ fn testnet_genesis(
.into_iter()
.map(|(acc, aura)| (acc.clone(), acc, template_session_keys(aura)))
.collect(),
..Default::default()
},
..Default::default()
}
Expand Down
Loading