-
Notifications
You must be signed in to change notification settings - Fork 47
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
chore: upgrade to polkadot 0.9.11 #272
Conversation
@@ -315,25 +316,33 @@ pub(crate) fn get_attestation_key_test_input() -> Vec<u8> { | |||
[0u8; 32].to_vec() | |||
} | |||
pub(crate) fn get_attestation_key_call() -> Call { | |||
Call::Ctype(ctype::Call::add(get_attestation_key_test_input())) | |||
Call::Ctype(ctype::Call::add { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: All calls had to be converted to named structs, see migration guide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually amazing!
@@ -220,7 +221,9 @@ impl DidVerifiableIdentifier for kilt_primitives::DidIdentifier { | |||
/// | |||
/// It is currently used to keep track of all the past and current | |||
/// attestation keys a DID might control. | |||
#[derive(Clone, Debug, Decode, Encode, PartialEq, Ord, PartialOrd, Eq)] | |||
#[derive(Clone, Debug, Decode, Encode, PartialEq, Ord, PartialOrd, Eq, TypeInfo)] | |||
#[scale_info(skip_type_params(T))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: If we don't skip T, then T needs to implement TypeInfo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this helpful comment https://gist.github.com/ascjones/0d81a4c44e84cacd9f714cd34a6de823#gistcomment-3931135
I noticed you described it as structs which lazily use the pallet's Config as generic
. Do you mean that the less lazy fix would be
pub struct DidPublicKeyDetails<DidPublicKey> {
/// A public key the DID controls.
pub key: DidPublicKey,
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. Though PublicKey might be restricted to traits in our case. There are lots or examples in Substrates (eg with Balance and AccountId) like your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the lazy is the correct technical term but it meant to reflect that instead of specifying the different Generics, the Config trait is provider instead.
source_vesting | ||
}; | ||
Vesting::<T>::insert(target, vesting); | ||
VestingInfo::<BalanceOf<T>, T::BlockNumber>::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Ideally, we should just try to push the vesting info onto the StorageMap. However, we know all genesis accounts started at genesis and if we increased the length of our vesting vector, we could run into trouble. This solution here should cause the least code changes and potential trouble.
type WeightToFee = fee::WeightToFee; | ||
type FeeMultiplierUpdate = TargetedFeeAdjustment<Runtime, TargetBlockFullness, Variability, Minimum>; | ||
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Inspired by Polkadot: https://github.com/paritytech/polkadot/blob/master/runtime/kusama/src/lib.rs#L288
@@ -822,7 +797,7 @@ impl_runtime_apis! { | |||
|
|||
impl sp_api::Metadata<Block> for Runtime { | |||
fn metadata() -> OpaqueMetadata { | |||
Runtime::metadata().into() | |||
OpaqueMetadata::new(Runtime::metadata().into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: See migration guide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM a few style things...
pallets/ctype/src/mock.rs
Outdated
use crate as ctype; | ||
use crate::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: I would keep them in a separate group. In my mind imports are sorted like that:
- external crates
- crate from the same git
- same crate
- re-exports
- mod
Also this is out of scope. Had a discussion with Antonio about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[derive(Clone, Encode, Decode, PartialEq)] | ||
#[derive(Clone, Encode, Decode, PartialEq, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: why a new line here? Feels like it's not the rust style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Substrate does it that way 🤷
#[derive(Clone, Debug, Encode, Decode, PartialEq)] | ||
#[derive(Clone, Debug, Encode, Decode, PartialEq, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: why a new line here? Feels like it's not the rust style?
#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd)] | ||
#[derive(Clone, Debug, Encode, Decode, Eq, PartialEq, Ord, PartialOrd, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: why a new line here? Feels like it's not the rust style?
#[derive(Clone, Decode, Encode, PartialEq)] | ||
#[derive(Clone, Decode, Encode, PartialEq, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: why a new line here? Feels like it's not the rust style?
#[derive(Clone, Debug, Decode, Encode, PartialEq, Ord, PartialOrd, Eq)] | ||
#[derive(Clone, Debug, Decode, Encode, PartialEq, Ord, PartialOrd, Eq, TypeInfo)] | ||
#[scale_info(skip_type_params(T))] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: why a new line here? Feels like it's not the rust style?
Benchmark Runtime Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-balances --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_balances.rs --template=.maintain/runtime-weight-template.hbs Results
|
…hmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_balances.rs --template=.maintain/runtime-weight-template.hbs
/bench runtime spiritnet-runtime pallet-democracy |
Benchmark Runtime Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-democracy --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_democracy.rs --template=.maintain/runtime-weight-template.hbs Results
ERROR: Unable to commit file ./runtimes/spiritnet/src/weights/pallet_democracy.rs |
/bench runtime spiritnet-runtime kilt-launch |
Benchmark Runtime Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/kilt_launch.rs --template=.maintain/runtime-weight-template.hbs Results
|
…hmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/kilt_launch.rs --template=.maintain/runtime-weight-template.hbs
/bench pallet spiritnet-runtime kilt-launch |
Error running benchmark: wf-0.9.11-clean stdoutBench configuration for "pallet" was not found |
/bench runtime peregrine-runtime kilt-launch |
Error running benchmark: wf-0.9.11-clean stdoutCaught exception in benchmarkRuntime: TypeError: Cannot read properties of undefined (reading 'benchCommand') |
@@ -315,25 +316,33 @@ pub(crate) fn get_attestation_key_test_input() -> Vec<u8> { | |||
[0u8; 32].to_vec() | |||
} | |||
pub(crate) fn get_attestation_key_call() -> Call { | |||
Call::Ctype(ctype::Call::add(get_attestation_key_test_input())) | |||
Call::Ctype(ctype::Call::add { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually amazing!
starting_block: T::BlockNumber::zero(), | ||
}), "Vesting schedule not migrated"); | ||
assert_eq!(Vesting::<T>::get(&target).expect("Missing vesting info").into_inner().get(0), Some(&VestingInfo::<BalanceOf<T>, T::BlockNumber>::new( | ||
AMOUNT.into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is indentation off here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah will fix.
@@ -198,11 +195,11 @@ benchmarks! { | |||
verify { | |||
assert!(UnownedAccount::<T>::get(&source).is_none()); | |||
assert!(!Vesting::<T>::contains_key(source), "Vesting schedule not removed"); | |||
assert_eq!(Vesting::<T>::get(&target), Some(VestingInfo::<BalanceOf<T>, T::BlockNumber> { | |||
locked: AMOUNT.into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also here...
@@ -102,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { | |||
spec_name: create_runtime_str!("mashnet-node"), | |||
impl_name: create_runtime_str!("mashnet-node"), | |||
authoring_version: 4, | |||
spec_version: 2701, | |||
spec_version: 2800, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have made all pallets version 1.0. Should this also be version 10000
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to do such a big jump but it would be more straight forward. I suppose we could do this later depending on Albis take on this.
/bench runtime peregrine kilt-launch |
Benchmark Runtime Substrate Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/kilt_launch.rs --template=.maintain/runtime-weight-template.hbs Results
|
…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/kilt_launch.rs --template=.maintain/runtime-weight-template.hbs
/bench runtime spiritnet-pallet kilt-launch |
Benchmark Runtime Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/kilt-launch/src/default_weights.rs --template=.maintain/weight-template.hbs Results
|
…hmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=kilt-launch --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/kilt-launch/src/default_weights.rs --template=.maintain/weight-template.hbs
/bench runtime spiritnet-runtime pallet-democracy |
Benchmark Runtime Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-democracy --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_democracy.rs --template=.maintain/runtime-weight-template.hbs Results
ERROR: Unable to commit file ./runtimes/spiritnet/src/weights/pallet_democracy.rs |
/bench runtime peregrine pallet-balances |
Benchmark Runtime Substrate Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-balances --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_balances.rs --template=.maintain/runtime-weight-template.hbs Results
|
…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_balances.rs --template=.maintain/runtime-weight-template.hbs
/bench runtime peregrine pallet-vesting |
Benchmark Runtime Substrate Pallet for branch "wf-0.9.11-clean" with command cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-vesting --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_vesting.rs --template=.maintain/runtime-weight-template.hbs Results
|
…hmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-vesting --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_vesting.rs --template=.maintain/runtime-weight-template.hbs
fixes KILTProtocol/ticket#1630
TypeInfo
to on chain data structs which automatically adds it to the metadata and removes the necessity of providing type data separatelyChanges for
TypeInfo
and metadata where inspired by the corresponding migration guide.Note: We need to merge this ASAP and update our clients before 0.9.12 goes live on Kusama. Else we cannot sync anymore.
TODO
Checklist:
array[3]
useget(3)
, ...)^