Skip to content

Commit

Permalink
chore: DIP improvements (#602)
Browse files Browse the repository at this point in the history
Fixes KILTprotocol/ticket#3054.

It also contains a **breaking change** for cross-chain DID signature
verifications. The signature now has a `valid_until` field, as discussed
in
#494 (comment).

Besides that, other changes include:

* A new set of types representing different stages of a cross-chain DIP
proof, during the verification process. Everything starts with either a
`RelayDipDidProof` or a `ParachainDipDidProof` and ends, if the whole
verification flow succeeds, with a `DipVerifiedInfo`.
* A generic `verify_storage_value_proof` that is used to verify a single
storage element with a storage proof.
* The `KiltVersionedParachainVerifier` now also depends on the
relaychain runtime, which removes the need for some traits that provided
just type definitions, such as `RelayChainStorageInfo` and
`RelayChainStateInfo`.
* Errors conversions into `u8` now start from `1` instead of `0`, for
disambiguating between an error returning `u8::MAX` and another case
returning `u8::MAX + 0`.
* Refactoring of the different modules.

**No unit tests or benchmarks yet, but this code should make it easier
to do all of those**.
  • Loading branch information
ntn-x2 authored Feb 22, 2024
1 parent 350bc85 commit 62a1373
Show file tree
Hide file tree
Showing 33 changed files with 2,554 additions and 2,924 deletions.
21 changes: 1 addition & 20 deletions Cargo.lock

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

13 changes: 0 additions & 13 deletions crates/kilt-dip-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,8 @@ sp-state-machine.workspace = true
sp-std.workspace = true
sp-trie.workspace = true

# Polkadot dependencies
rococo-runtime.workspace = true
xcm.workspace = true
xcm-executor.workspace = true

# Cumulus dependencies
cumulus-pallet-parachain-system.workspace = true
cumulus-primitives-core.workspace = true
parachain-info.workspace = true

[dev-dependencies]
hex-literal.workspace = true
Expand Down Expand Up @@ -75,16 +68,10 @@ std = [
"sp-state-machine/std",
"sp-std/std",
"sp-trie/std",
"rococo-runtime/std",
"xcm/std",
"xcm-executor/std",
"cumulus-pallet-parachain-system/std",
"cumulus-primitives-core/std",
"parachain-info/std",
]
runtime-benchmarks = [
"kilt-support/runtime-benchmarks",
"pallet-dip-consumer/runtime-benchmarks",
"pallet-dip-provider/runtime-benchmarks",
"rococo-runtime/runtime-benchmarks"
]
223 changes: 0 additions & 223 deletions crates/kilt-dip-primitives/src/did.rs

This file was deleted.

12 changes: 8 additions & 4 deletions crates/kilt-dip-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@

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

pub mod did;
/// Module to deal with cross-chain Merkle proof as generated by the KILT chain.
pub mod merkle;
/// Module to deal with cross-chain state proofs.
pub mod state_proofs;
/// Collection of traits used throughout the crate and useful for both providers
/// and consumers.
pub mod traits;
pub mod utils;
/// Verifier module containing types that implement the verifier component to be
/// deployed both on a sibling parachain and on a parent relaychain.
pub mod verifier;

pub use state_proofs::relaychain::RelayStateRootsViaRelayStorePallet;
pub use traits::{FrameSystemDidSignatureContext, ProviderParachainStateInfoViaProviderPallet};
pub use utils::BoundedBlindedValue;
pub use merkle::latest::*;
pub use traits::RelayStateRootsViaRelayStorePallet;
pub use verifier::*;
Loading

0 comments on commit 62a1373

Please sign in to comment.