Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] feat: 1.9.0 release #460

Merged
merged 39 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
199e65e
chore: bump version to 1.9.0
wischli Nov 4, 2022
c595a47
fix: yorlin keys (#432)
weichweich Nov 7, 2022
8fe2c4d
chore: renaming runtime APIs for public credentials (#433)
ntn-x2 Nov 8, 2022
0d0044b
chore: bump spec versions to 10902
wischli Nov 14, 2022
d67c5c4
Revert "chore: bump spec versions to 10902"
wischli Nov 16, 2022
db1687f
ci: build latest only on non rc tags
wischli Nov 16, 2022
5f8b12c
chore: update bootnodes (#435)
weichweich Nov 18, 2022
655b923
Revert "feat: support linking ethereum accounts (#355)"
wischli Nov 4, 2022
6c0bded
feat: remove public credentials from spiritnet
weichweich Nov 7, 2022
654d00b
chore: update weights
kiltbot Nov 8, 2022
621997e
Revert "Revert "feat: support linking ethereum accounts (#355)""
wischli Nov 14, 2022
6185e94
Revert "feat: remove public credentials from spiritnet"
wischli Nov 14, 2022
339d303
chore: update toolchain versions (#439)
ntn-x2 Nov 29, 2022
81d881a
fix: apply new toolchain to init script
wischli Dec 5, 2022
431c1e9
feat: upgrade to Polkadot v0.9.32 (#434)
wischli Dec 6, 2022
70ba5ba
fix: staking API unclaimed rewards
wischli Dec 12, 2022
3a852e5
ci: add img build for dev tags
wischli Dec 19, 2022
4ac7610
fix: disable curl output (#444)
ggera Dec 19, 2022
8be0c41
fix: new spec (#443)
weichweich Jan 4, 2023
d861234
chore: update 2023 (#445)
weichweich Jan 5, 2023
5a85bf4
fix: toolchain version (#447)
ntn-x2 Jan 11, 2023
79ac365
chore: make clear that it's still under development (#451)
weichweich Jan 20, 2023
b6b8d4d
chore: update relay chain references (#449)
ntn-x2 Jan 20, 2023
b38b92a
chore: upgrade polkadot to v0.9.36 (#446)
trusch Jan 20, 2023
3cf77b7
feat: bump polkadot versions to v0.9.37 (#452)
trusch Jan 23, 2023
eecde66
chore: update srtool (#453)
weichweich Jan 23, 2023
59f8452
fix: add public credentials to benchmark (#455)
weichweich Jan 23, 2023
0a5e46d
feat: add block number for CTypes (#440)
ntn-x2 Jan 23, 2023
a12b0c8
chore: remove clone runtime (#456)
ntn-x2 Jan 24, 2023
4353493
chore: undo dev-tag image build (#454)
ggera Jan 24, 2023
519ff06
chore: refactor some more XCM config stuff (#457)
ntn-x2 Jan 26, 2023
eff278b
fix: on-chain storage version for pallets where it is missing (#458)
ntn-x2 Jan 30, 2023
7d56019
Merge remote-tracking branch 'origin/develop' into release-1.9.0
weichweich Jan 31, 2023
1566d84
chore: remove unused dependency
weichweich Jan 31, 2023
8964b10
Revert "Revert "Revert "feat: support linking ethereum accounts (#355…
ntn-x2 Feb 1, 2023
0f39ffe
chore: bump crates version to 1.9.0 and specs version to 1.8.9 (10890)
ntn-x2 Feb 1, 2023
5ea142e
Add missed migrations
ntn-x2 Feb 1, 2023
c1fd840
Add balances pallet migration with no accounts
ntn-x2 Feb 1, 2023
82308ce
Benchmarks
Feb 2, 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
Prev Previous commit
Next Next commit
Revert "feat: remove public credentials from spiritnet"
This reverts commit 6d4fcc6.
  • Loading branch information
wischli committed Nov 23, 2022
commit 6185e9466004d54e42dddf20cee023df4a65ac35
2 changes: 2 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions runtimes/spiritnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ hex-literal = {workspace = true, optional = true}
# RPC & Runtime API
frame-system-rpc-runtime-api.workspace = true
kilt-runtime-api-did.workspace = true
kilt-runtime-api-public-credentials.workspace = true
kilt-runtime-api-staking.workspace = true
pallet-transaction-payment-rpc-runtime-api.workspace = true

Expand All @@ -39,6 +40,7 @@ pallet-did-lookup.workspace = true
pallet-inflation.workspace = true
pallet-web3-names.workspace = true
parachain-staking.workspace = true
public-credentials.workspace = true
runtime-common.workspace = true

# Substrate dependencies
Expand Down Expand Up @@ -134,6 +136,7 @@ runtime-benchmarks = [
"pallet-vesting/runtime-benchmarks",
"pallet-web3-names/runtime-benchmarks",
"parachain-staking/runtime-benchmarks",
"public-credentials/runtime-benchmarks",
"runtime-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
Expand All @@ -159,6 +162,7 @@ std = [
"frame-system/std",
"frame-try-runtime/std",
"kilt-runtime-api-did/std",
"kilt-runtime-api-public-credentials/std",
"kilt-runtime-api-staking/std",
"kilt-support/std",
"log/std",
Expand Down Expand Up @@ -187,6 +191,7 @@ std = [
"pallet-xcm/std",
"parachain-info/std",
"parachain-staking/std",
"public-credentials/std",
"runtime-common/std",
"scale-info/std",
"sp-api/std",
Expand Down Expand Up @@ -243,5 +248,6 @@ try-runtime = [
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"parachain-staking/try-runtime",
"public-credentials/try-runtime",
"runtime-common/try-runtime",
]
52 changes: 52 additions & 0 deletions runtimes/spiritnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ use sp_version::RuntimeVersion;
use xcm_executor::XcmExecutor;

use delegation::DelegationAc;
use kilt_support::traits::ItemFilter;
use pallet_did_lookup::linkable_account::LinkableAccountId;
pub use parachain_staking::InflationInfo;
pub use public_credentials;

use runtime_common::{
assets::{AssetDid, PublicCredentialsFilter},
authorization::{AuthorizationId, PalletAuthorize},
constants::{self, EXISTENTIAL_DEPOSIT, KILT},
errors::PublicCredentialsApiError,
fees::{ToAuthor, WeightToFee},
pallet_id, AccountId, AuthorityId, Balance, BlockHashCount, BlockLength, BlockNumber, BlockWeights, DidIdentifier,
FeeSplit, Hash, Header, Index, Signature, SlowAdjustingFeeUpdate,
Expand Down Expand Up @@ -666,6 +670,23 @@ impl pallet_utility::Config for Runtime {

impl pallet_randomness_collective_flip::Config for Runtime {}

impl public_credentials::Config for Runtime {
type AccessControl = PalletAuthorize<DelegationAc<Runtime>>;
type AttesterId = DidIdentifier;
type AuthorizationId = AuthorizationId<<Runtime as delegation::Config>::DelegationNodeId>;
type CredentialId = Hash;
type CredentialHash = BlakeTwo256;
type Currency = Balances;
type Deposit = runtime_common::constants::public_credentials::Deposit;
type EnsureOrigin = did::EnsureDidOrigin<DidIdentifier, AccountId>;
type MaxEncodedClaimsLength = runtime_common::constants::public_credentials::MaxEncodedClaimsLength;
type MaxSubjectIdLength = runtime_common::constants::public_credentials::MaxSubjectIdLength;
type OriginSuccess = did::DidRawOrigin<AccountId, DidIdentifier>;
type Event = Event;
type SubjectId = runtime_common::assets::AssetDid;
type WeightInfo = weights::public_credentials::WeightInfo<Runtime>;
}

/// The type used to represent the kinds of proxying allowed.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo,
Expand Down Expand Up @@ -717,6 +738,7 @@ impl InstanceFilter<Call> for ProxyType {
// Excludes `ParachainSystem`
| Call::Preimage(..)
| Call::Proxy(..)
| Call::PublicCredentials(..)
| Call::Scheduler(..)
| Call::Session(..)
| Call::System(..)
Expand Down Expand Up @@ -788,6 +810,15 @@ impl InstanceFilter<Call> for ProxyType {
// Excludes `ParachainSystem`
| Call::Preimage(..)
| Call::Proxy(..)
| Call::PublicCredentials(
// Excludes `reclaim_deposit`
public_credentials::Call::add { .. }
| public_credentials::Call::revoke { .. }
| public_credentials::Call::unrevoke { .. }
| public_credentials::Call::remove { .. }
| public_credentials::Call::update_deposit { .. }
| public_credentials::Call::change_deposit_owner { .. }
)
| Call::Scheduler(..)
| Call::Session(..)
// Excludes `Sudo`
Expand Down Expand Up @@ -920,6 +951,7 @@ construct_runtime! {
Inflation: pallet_inflation = 66,
DidLookup: pallet_did_lookup = 67,
Web3Names: pallet_web3_names = 68,
PublicCredentials: public_credentials = 69,

// Parachains pallets. Start indices at 80 to leave room.

Expand Down Expand Up @@ -967,6 +999,7 @@ impl did::DeriveDidCallAuthorizationVerificationKeyRelationship for Call {
Call::Did(did::Call::create { .. }) => Err(did::RelationshipDeriveError::NotCallableByDid),
Call::Did { .. } => Ok(did::DidVerificationKeyRelationship::Authentication),
Call::Web3Names { .. } => Ok(did::DidVerificationKeyRelationship::Authentication),
Call::PublicCredentials { .. } => Ok(did::DidVerificationKeyRelationship::AssertionMethod),
Call::DidLookup { .. } => Ok(did::DidVerificationKeyRelationship::Authentication),
Call::Utility(pallet_utility::Call::batch { calls }) => single_key_relationship(&calls[..]),
Call::Utility(pallet_utility::Call::batch_all { calls }) => single_key_relationship(&calls[..]),
Expand Down Expand Up @@ -1219,6 +1252,23 @@ impl_runtime_apis! {
}
}

impl kilt_runtime_api_public_credentials::PublicCredentials<Block, Vec<u8>, Hash, public_credentials::CredentialEntry<Hash, DidIdentifier, BlockNumber, AccountId, Balance, AuthorizationId<<Runtime as delegation::Config>::DelegationNodeId>>, PublicCredentialsFilter<Hash, AccountId>, PublicCredentialsApiError> for Runtime {
fn get_by_id(credential_id: Hash) -> Option<public_credentials::CredentialEntry<Hash, DidIdentifier, BlockNumber, AccountId, Balance, AuthorizationId<<Runtime as delegation::Config>::DelegationNodeId>>> {
let subject = public_credentials::CredentialSubjects::<Runtime>::get(&credential_id)?;
public_credentials::Credentials::<Runtime>::get(&subject, &credential_id)
}

fn get_by_subject(subject: Vec<u8>, filter: Option<PublicCredentialsFilter<Hash, AccountId>>) -> Result<Vec<(Hash, public_credentials::CredentialEntry<Hash, DidIdentifier, BlockNumber, AccountId, Balance, AuthorizationId<<Runtime as delegation::Config>::DelegationNodeId>>)>, PublicCredentialsApiError> {
let asset_did = AssetDid::try_from(subject).map_err(|_| PublicCredentialsApiError::InvalidSubjectId)?;
let credentials_prefix = public_credentials::Credentials::<Runtime>::iter_prefix(&asset_did);
if let Some(filter) = filter {
Ok(credentials_prefix.filter(|(_, entry)| filter.should_include(entry)).collect())
} else {
Ok(credentials_prefix.collect())
}
}
}

impl kilt_runtime_api_staking::Staking<Block, AccountId, Balance> for Runtime {
fn get_unclaimed_staking_rewards(account: &AccountId) -> Balance {
ParachainStaking::get_unclaimed_staking_rewards(account)
Expand Down Expand Up @@ -1270,6 +1320,7 @@ impl_runtime_apis! {
list_benchmark!(list, extra, pallet_inflation, Inflation);
list_benchmark!(list, extra, parachain_staking, ParachainStaking);
list_benchmark!(list, extra, pallet_web3_names, Web3Names);
list_benchmark!(list, extra, public_credentials, PublicCredentials);

let storage_info = AllPalletsWithSystem::storage_info();

Expand Down Expand Up @@ -1336,6 +1387,7 @@ impl_runtime_apis! {
add_benchmark!(params, batches, pallet_inflation, Inflation);
add_benchmark!(params, batches, parachain_staking, ParachainStaking);
add_benchmark!(params, batches, pallet_web3_names, Web3Names);
add_benchmark!(params, batches, public_credentials, PublicCredentials);

// No benchmarks for these pallets
// add_benchmark!(params, batches, cumulus_pallet_parachain_system, ParachainSystem);
Expand Down
17 changes: 16 additions & 1 deletion runtimes/spiritnet/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ use pallet_web3_names::{Web3NameOf, Web3OwnershipOf};
use runtime_common::{
constants::{
attestation::MAX_ATTESTATION_BYTE_LENGTH, did::MAX_DID_BYTE_LENGTH, did_lookup::MAX_CONNECTION_BYTE_LENGTH,
web3_names::MAX_NAME_BYTE_LENGTH, MAX_INDICES_BYTE_LENGTH,
public_credentials::MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH, web3_names::MAX_NAME_BYTE_LENGTH,
MAX_INDICES_BYTE_LENGTH,
},
AccountId, BlockNumber,
};
Expand Down Expand Up @@ -101,6 +102,20 @@ fn indices_storage_sizes() {
assert_eq!(size, MAX_INDICES_BYTE_LENGTH as usize)
}

#[test]
fn public_credentials_storage_sizes() {
// Stored in Credentials
let credential_entry_max_size = public_credentials::CredentialEntryOf::<Runtime>::max_encoded_len();
// Stored in CredentialsUnicityIndex
let subject_id_max_size = <Runtime as public_credentials::Config>::SubjectId::max_encoded_len();

// Each credential would have a different deposit, so no multiplier here
assert_eq!(
credential_entry_max_size + subject_id_max_size,
MAX_PUBLIC_CREDENTIAL_STORAGE_LENGTH as usize
)
}

#[test]
fn test_derive_did_verification_relation_ctype() {
let c1 = Call::Ctype(ctype::Call::add {
Expand Down
1 change: 1 addition & 0 deletions runtimes/spiritnet/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_web3_names;
pub mod parachain_staking;
pub mod public_credentials;
102 changes: 102 additions & 0 deletions runtimes/spiritnet/src/weights/public_credentials.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// KILT Blockchain – https://botlabs.org
// Copyright (C) 2019-2022 BOTLabs GmbH

// The KILT Blockchain is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// The KILT Blockchain is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// If you feel like getting in touch with us, you can do so at [email protected]

//! Autogenerated weights for public_credentials
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-10-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("spiritnet-dev"), DB CACHE: 1024

// Executed Command:
// ./target/release/kilt-parachain
// benchmark
// pallet
// --chain=spiritnet-dev
// --steps=50
// --repeat=20
// --pallet=public-credentials
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./runtimes/spiritnet/src/weights/public_credentials.rs
// --template=.maintain/runtime-weight-template.hbs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(clippy::unnecessary_cast)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weights for `public_credentials`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> public_credentials::WeightInfo for WeightInfo<T> {
// Storage: Ctype Ctypes (r:1 w:0)
// Storage: PublicCredentials Credentials (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: PublicCredentials CredentialSubjects (r:0 w:1)
fn add(c: u32, ) -> Weight {
Weight::from_ref_time(72_520_000 as u64)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(c as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: PublicCredentials CredentialSubjects (r:1 w:0)
// Storage: PublicCredentials Credentials (r:1 w:1)
fn revoke() -> Weight {
Weight::from_ref_time(44_494_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: PublicCredentials CredentialSubjects (r:1 w:0)
// Storage: PublicCredentials Credentials (r:1 w:1)
fn unrevoke() -> Weight {
Weight::from_ref_time(44_170_000 as u64)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: PublicCredentials CredentialSubjects (r:1 w:1)
// Storage: PublicCredentials Credentials (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn remove() -> Weight {
Weight::from_ref_time(69_989_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: PublicCredentials CredentialSubjects (r:1 w:1)
// Storage: PublicCredentials Credentials (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn reclaim_deposit() -> Weight {
Weight::from_ref_time(69_237_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
fn change_deposit_owner() -> Weight {
Weight::from_ref_time(68_692_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
fn update_deposit() -> Weight {
Weight::from_ref_time(68_692_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
}