Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0c56e4c
change trait for retrieve
Ad96el Nov 14, 2023
2df9776
identity provider
Ad96el Nov 15, 2023
e1f186d
alter traits
Ad96el Nov 15, 2023
f20beba
compiling
Ad96el Nov 16, 2023
bc2bdc2
Merge branch 'aa/dip' into ag-dip-benchmarks
Ad96el Nov 16, 2023
fddc666
runtime missing
Ad96el Nov 16, 2023
681dc77
Clean up runtime-common Cargo.toml
ntn-x2 Nov 17, 2023
279d241
DIP provider pallet benchmarks WIP
ntn-x2 Nov 17, 2023
7fe3593
intermediate state
Ad96el Nov 21, 2023
2ccadf5
compiling
Ad96el Nov 21, 2023
70431ef
std error with features
Ad96el Nov 21, 2023
538a234
compiling
Ad96el Nov 22, 2023
cacf04c
remove stuff
Ad96el Nov 22, 2023
870f424
remove whitespaces
Ad96el Nov 22, 2023
22ccaad
remove generic
Ad96el Nov 22, 2023
c8aed6f
feature error
Ad96el Nov 22, 2023
da6314d
feature error
Ad96el Nov 22, 2023
5706638
with working features
Ad96el Nov 22, 2023
14748ef
linked accounts missing
Ad96el Nov 23, 2023
0cba1d1
finish worst case for LinkedDidInfoOf
Ad96el Nov 23, 2023
90f5fe4
give money
Ad96el Nov 23, 2023
cc00b0b
add default weights
Ad96el Nov 23, 2023
d276f0e
has to be reverted. Add provider and cosumer to peregrine
Ad96el Nov 23, 2023
489806f
lockfile
Ad96el Nov 23, 2023
b493baf
adjust cargo toml
Ad96el Nov 23, 2023
8b97889
compiling
Ad96el Nov 24, 2023
048b72d
comment
Ad96el Nov 24, 2023
192e665
compiling
Ad96el Nov 24, 2023
a5d246e
clean up
Ad96el Nov 24, 2023
b0f42c4
clean up
Ad96el Nov 24, 2023
db976e4
remove trait
Ad96el Nov 24, 2023
11f9e28
comment
Ad96el Nov 24, 2023
faf0a30
comments
Ad96el Nov 24, 2023
e94caab
pallet storage deposit!
Ad96el Nov 24, 2023
2481a5a
Merge branch 'aa/dip' into ag-dip-benchmarks
Ad96el Nov 24, 2023
650d311
add weightinfo
Ad96el Nov 24, 2023
3b33c61
add weight logic
Ad96el Nov 24, 2023
9dfcf03
remove comments
Ad96el Nov 24, 2023
ad270c5
remove comments
Ad96el Nov 24, 2023
1fe7290
change imports
Ad96el Nov 29, 2023
daea05f
change default implementation
Ad96el Nov 29, 2023
76c79bf
remove dummy impl
Ad96el Nov 29, 2023
9594535
remove casts
Ad96el Nov 29, 2023
9899e4d
alter feature flag
Ad96el Nov 29, 2023
8b7dc12
Update pallets/pallet-did-lookup/src/try_state.rs
Ad96el Nov 29, 2023
34c2aad
change trait implementation
Ad96el Nov 29, 2023
757f1cf
Merge branch 'ag-dip-benchmarks' of github.com:KILTprotocol/kilt-node…
Ad96el Nov 29, 2023
a3daa24
revert
Ad96el Nov 29, 2023
9625dfc
adjust mocks
Ad96el Nov 29, 2023
1c70fcb
fix mock
Ad96el Nov 29, 2023
052254a
limit linked accounts
Ad96el Nov 29, 2023
1f59a54
compiling
Ad96el Nov 29, 2023
e73c686
changed max accounts
Ad96el Nov 29, 2023
e91bb50
none not some
Ad96el Nov 29, 2023
e8f0200
clippy
Ad96el Nov 29, 2023
4fad41b
fmt cargo file
Ad96el Nov 30, 2023
42414a5
change error
Ad96el Nov 30, 2023
0bad8c0
change comment
Ad96el Nov 30, 2023
6b3e1e3
remove dev mode
Ad96el Nov 30, 2023
c0efd83
Remove clone in benchmarks
ntn-x2 Dec 1, 2023
78e0959
Benchmarks for pallet-relay-store
ntn-x2 Dec 1, 2023
09f1f6c
Fix features
ntn-x2 Dec 1, 2023
387767b
Default weights
ntn-x2 Dec 1, 2023
7a8e572
Fix compilation
ntn-x2 Dec 1, 2023
b33e6ca
Revert logic
ntn-x2 Dec 1, 2023
2d3ee23
Merge commit '55e45f8f952bd07ec3d6925ac26455c95a92fe9e' into ag-dip-b…
ntn-x2 Dec 1, 2023
459ab82
Final changes
ntn-x2 Dec 1, 2023
69ad8e4
Remove some TODOs and FIXMEs
ntn-x2 Dec 1, 2023
e64d943
Fix features in node binaries
ntn-x2 Dec 4, 2023
82ac447
Fix features
ntn-x2 Dec 5, 2023
b7add42
Compiling
ntn-x2 Dec 5, 2023
8a44925
Benchmarks working
ntn-x2 Dec 5, 2023
1ccc2fe
Compiling
ntn-x2 Dec 5, 2023
20b0d16
Weights
ntn-x2 Dec 6, 2023
3c5e579
Last fixes
ntn-x2 Dec 6, 2023
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/kilt-dip-support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pallet-relay-store.workspace = true
pallet-web3-names.workspace = true

# Parity dependencies
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
parity-scale-codec = {workspace = true, features = ["derive"]}
scale-info = {workspace = true, features = ["derive"]}

# Substrate dependencies
frame-system.workspace = true
Expand Down Expand Up @@ -81,6 +81,6 @@ std = [
]
runtime-benchmarks = [
"pallet-dip-consumer/runtime-benchmarks",
"rococo-runtime/runtime-benchmarks",
"pallet-dip-provider/runtime-benchmarks",
"rococo-runtime/runtime-benchmarks"
]
1 change: 0 additions & 1 deletion crates/kilt-dip-support/src/export/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ mod v0 {
// 1.2 If so, extract the state root from the header
let state_root_at_height = proof.relay_header.state_root;

// FIXME: Compilation error
// 2. Verify relay chain proof
let provider_parachain_header =
ParachainHeadProofVerifier::<RelayChainInfo>::verify_proof_for_parachain_with_root(
Expand Down
1 change: 1 addition & 0 deletions dip-template/runtimes/dip-consumer/src/dip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,5 @@ impl DipCallOriginFilter<RuntimeCall> for DipCallFilter {

impl pallet_relay_store::Config for Runtime {
type MaxRelayBlocksStored = ConstU32<100>;
type WeightInfo = ();
}
3 changes: 1 addition & 2 deletions dip-template/runtimes/dip-consumer/src/origin_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ impl EnsureOrigin<RuntimeOrigin> for EnsureDipOriginAdapter {

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin() -> Result<RuntimeOrigin, ()> {
// TODO: Replace with actual DIP origin upon benchmarking
Ok(RuntimeOrigin::root())
EnsureDipOrigin::<DidIdentifier, AccountId, MerkleProofVerifierOutput>::try_successful_origin()
}
}

Expand Down
9 changes: 7 additions & 2 deletions dip-template/runtimes/dip-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ cumulus-primitives-utility.workspace = true
pallet-collator-selection.workspace = true
parachain-info.workspace = true

# Benchmarks
frame-benchmarking = {workspace = true, optional = true}

[features]
default = [
"std",
Expand Down Expand Up @@ -115,7 +118,8 @@ std = [
"cumulus-primitives-timestamp/std",
"cumulus-primitives-utility/std",
"pallet-collator-selection/std",
"parachain-info/std"
"parachain-info/std",
"frame-benchmarking?/std",
]
runtime-benchmarks = [
"did/runtime-benchmarks",
Expand All @@ -126,5 +130,6 @@ runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"pallet-utility/runtime-benchmarks"
"pallet-utility/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
]
24 changes: 24 additions & 0 deletions dip-template/runtimes/dip-provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,30 @@ impl pallet_web3_names::Config for Runtime {
type WeightInfo = ();
}

#[cfg(feature = "runtime-benchmarks")]
mod benches {
frame_benchmarking::define_benchmarks!(
[frame_system, SystemBench::<Runtime>]
[cumulus_pallet_parachain_system, ParachainSystem]
[pallet_timestamp, Timestamp]
[pallet_sudo, Sudo]
[pallet_utility, Utility]
[pallet_balances, Balances]
[pallet_transaction_payment, TransactionPayment]
[pallet_authorship, Authorship]
[pallet_collator_selection, CollatorSelection]
[pallet_session, Session]
[pallet_aura, Aura]
[cumulus_pallet_aura_ext, AuraExt]
[did, Did]
[pallet_did_lookup, DidLookup]
[pallet_web3_names, Web3Names]
[pallet_deposit_storage, DepositStorage]
[pallet_dip_provider, DipProvider]
[frame_benchmarking::baseline, Baseline::<Runtime>]
);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps I made a mistake. I compiled the branch using: cargo build --features runtime-benchmarks.

When I run: ./target/debug/dip-provider-node-template -h, the benchmark command is not appearing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mhh, I might have missed some dependency when the benchmark feature is enabled. I will investigate that

impl_runtime_apis! {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> SlotDuration {
Expand Down
32 changes: 21 additions & 11 deletions pallets/pallet-deposit-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,29 @@ frame-benchmarking = {workspace = true, optional = true}
pallet-balances = {workspace = true, optional = true}

[features]
default = [ "std" ]
default = ["std"]
std = [
"frame-support/std",
"frame-system/std",
"kilt-support/std",
"log/std",
"pallet-dip-provider/std",
"parity-scale-codec/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
"frame-support/std",
"frame-system/std",
"kilt-support/std",
"log/std",
"pallet-dip-provider/std",
"parity-scale-codec/std",
"scale-info/std",
"sp-runtime/std",
"sp-std/std",
"frame-benchmarking?/std",
"pallet-balances?/std",
]

runtime-benchmarks = [ "frame-benchmarking", "pallet-balances" ]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"kilt-support/runtime-benchmarks",
"pallet-dip-provider/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
]

try-runtime = [ "kilt-support/try-runtime" ]
2 changes: 1 addition & 1 deletion pallets/pallet-deposit-storage/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use sp_runtime::SaturatedConversion;
T::AccountId: Instanciate,
T: Config + pallet_balances::Config,
T::Namespace: Default
) ]
)]
mod benchmarks {

use sp_runtime::BoundedVec;
Expand Down
2 changes: 1 addition & 1 deletion pallets/pallet-deposit-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![recursion_limit = "256"]

pub mod default_weights;
mod default_weights;
mod deposit;
pub mod traits;

Expand Down
1 change: 0 additions & 1 deletion pallets/pallet-did-lookup/src/try_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub(crate) fn do_try_state<T: Config>() -> Result<(), TryRuntimeError> {
linked_account_id, did_identifier
))
);

Ok(())
},
)
Expand Down
11 changes: 6 additions & 5 deletions pallets/pallet-dip-consumer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ version.workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dev-dependencies]
kilt-support = {workspace = true, features = ["mock", "try-runtime"]}
sp-io = {workspace = true, features = ["std"]}
sp-keystore = {workspace = true, features = ["std"]}
sp-runtime = {workspace = true, features = ["std"]}

[dependencies]
frame-support.workspace = true
Expand All @@ -29,27 +29,28 @@ sp-std.workspace = true

# Benchmarks
frame-benchmarking = {workspace = true, optional = true}
sp-runtime.workspace = true
sp-runtime = {workspace = true, optional = true}

[features]
default = [ "std" ]

runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"kilt-support/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-benchmarking",
"sp-runtime/runtime-benchmarks",
]
std = [
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"kilt-support/std",
"parity-scale-codec/std",
"scale-info/std",
"sp-core/std",
"sp-std/std",
"frame-benchmarking?/std",
"sp-runtime?/std",
]

try-runtime = [ "kilt-support/try-runtime" ]
2 changes: 1 addition & 1 deletion pallets/pallet-dip-consumer/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use kilt_support::{
T::Identifier: Instanciate,
<<T as Config>::ProofVerifier as IdentityProofVerifier<T>>::Proof: GetWorstCase<IdentityContext<T::Identifier, T::AccountId>>,
<T as Config>::RuntimeCall: From<frame_system::Call<T>>,
) ]
)]
mod benchmarks {

use super::*;
Expand Down
6 changes: 4 additions & 2 deletions pallets/pallet-dip-consumer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#![cfg_attr(not(feature = "std"), no_std)]

pub mod default_weights;
mod default_weights;
pub mod identity;
pub mod traits;

Expand Down Expand Up @@ -104,7 +104,6 @@ pub mod pallet {
pub type Origin<T> =
DipOrigin<<T as Config>::Identifier, <T as frame_system::Config>::AccountId, VerificationResultOf<T>>;

// TODO: Benchmarking
#[pallet::call]
impl<T: Config> Pallet<T> {
// TODO: Replace with a SignedExtra.
Expand Down Expand Up @@ -138,6 +137,9 @@ pub mod pallet {
details: proof_verification_result,
};

// TODO: Maybe find a nicer way to exclude the call dispatched from the
// benchmarks while making sure the call is actually dispatched and passes any
// filters the consumer proof verifier has set.
#[cfg(not(feature = "runtime-benchmark"))]
let _ = call.dispatch(did_origin.into()).map_err(|e| e.error)?;
Ok(())
Expand Down
13 changes: 7 additions & 6 deletions pallets/pallet-dip-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ version.workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dev-dependencies]
kilt-support = {workspace = true, features = ["mock", "try-runtime"]}
kilt-support = {workspace = true, features = ["std", "mock", "try-runtime"]}
sp-io = {workspace = true, features = ["std"]}
sp-keystore = {workspace = true, features = ["std"]}
sp-runtime = {workspace = true, features = ["std"]}

[dependencies]
did.workspace = true
Expand All @@ -30,30 +31,30 @@ sp-std.workspace = true

# Benchmarks
frame-benchmarking = {workspace = true, optional = true}
sp-io = {workspace = true, optional = true}
sp-runtime.workspace = true
sp-runtime = {workspace = true, optional = true}

[features]
default = [ "std" ]

runtime-benchmarks = [
"did/runtime-benchmarks",
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"kilt-support/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-benchmarking",
"sp-runtime/runtime-benchmarks",
]
std = [
"did/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"kilt-support/std",
"parity-scale-codec/std",
"scale-info/std",
"sp-core/std",
"sp-std/std",
"frame-benchmarking?/std",
"sp-runtime?/std",
]

try-runtime = [ "did/try-runtime", "kilt-support/try-runtime" ]
4 changes: 2 additions & 2 deletions pallets/pallet-migration/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ pub mod runtime {
}

#[cfg(feature = "runtime-benchmarks")]
impl kilt_support::traits::GetWorstCase for TestSubjectId {
impl<Context> kilt_support::traits::GetWorstCase<Context> for TestSubjectId {
// Only used for benchmark testing, not really relevant.
fn worst_case(_context: ()) -> Self {
fn worst_case(_context: Context) -> Self {
crate::mock::TestSubjectId::default()
}
}
Expand Down
9 changes: 5 additions & 4 deletions pallets/pallet-relay-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ targets = ["x86_64-unknown-linux-gnu"]
[dev-dependencies]
cumulus-primitives-core = { workspace = true, features = ["std"] }
sp-io = {workspace = true, features = ["std"]}
sp-keystore = {workspace = true, features = ["std"]}
sp-runtime = {workspace = true, features = ["std"]}

[dependencies]
cumulus-pallet-parachain-system.workspace = true
Expand All @@ -25,12 +27,11 @@ log.workspace = true
parity-scale-codec = {workspace = true, features = ["derive"]}
scale-info = {workspace = true, features = ["derive"]}
sp-core.workspace = true
sp-keystore = {workspace = true, optional = true}
sp-runtime.workspace = true
sp-std.workspace = true

# Benchmarks
frame-benchmarking = {workspace = true, optional = true}
sp-runtime = {workspace = true, optional = true}

[features]
default = ["std"]
Expand All @@ -41,14 +42,14 @@ std = [
"parity-scale-codec/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
"sp-std/std",
"frame-benchmarking?/std",
"sp-runtime?/std",
]
runtime-benchmarks = [
"cumulus-pallet-parachain-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-benchmarking",
"sp-keystore"
"sp-runtime/runtime-benchmarks",
]
Loading