From bb2f1db0b9b78ec6d1d0b1f6d79b400e9dd0fb13 Mon Sep 17 00:00:00 2001 From: olegnn Date: Tue, 26 Sep 2023 17:20:39 +0200 Subject: [PATCH 1/5] Metadata tweaks --- pallets/core/src/modules/did/base/mod.rs | 2 +- pallets/core/src/modules/did/base/offchain.rs | 2 +- pallets/core/src/modules/did/details_aggregator.rs | 6 ++++-- pallets/core/src/modules/did/mod.rs | 8 ++++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pallets/core/src/modules/did/base/mod.rs b/pallets/core/src/modules/did/base/mod.rs index f12793349..f4bb8bb30 100644 --- a/pallets/core/src/modules/did/base/mod.rs +++ b/pallets/core/src/modules/did/base/mod.rs @@ -41,7 +41,7 @@ impl Index for Did { } /// Contains underlying DID describing its storage type. -#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq, MaxEncodedLen)] +#[derive(Encode, Decode, DebugNoBound, Clone, PartialEq, Eq, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", diff --git a/pallets/core/src/modules/did/base/offchain.rs b/pallets/core/src/modules/did/base/offchain.rs index ff6cbb5e7..75ef3d073 100644 --- a/pallets/core/src/modules/did/base/offchain.rs +++ b/pallets/core/src/modules/did/base/offchain.rs @@ -5,7 +5,7 @@ use crate::{common::TypesAndLimits, deposit_indexed_event}; /// Off-chain DID has no need of nonce as the signature is made on the whole transaction by /// the caller account and Substrate takes care of replay protection. Thus it stores the data /// about off-chain DID Doc (hash, URI or any other reference) and the account that owns it. -#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq, MaxEncodedLen)] +#[derive(Encode, Decode, DebugNoBound, Clone, PartialEq, Eq, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( diff --git a/pallets/core/src/modules/did/details_aggregator.rs b/pallets/core/src/modules/did/details_aggregator.rs index 917d3e111..4c2df705b 100644 --- a/pallets/core/src/modules/did/details_aggregator.rs +++ b/pallets/core/src/modules/did/details_aggregator.rs @@ -6,7 +6,7 @@ use crate::{ }; /// Aggregated details for the given DID. -#[derive(Encode, Decode, Debug, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, DebugNoBound, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( @@ -14,6 +14,7 @@ use crate::{ serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) )] #[derive(scale_info_derive::TypeInfo)] +#[scale_info(skip_type_params(T))] #[scale_info(omit_prefix)] pub struct AggregatedDidDetailsResponse { did: Did, @@ -39,13 +40,14 @@ pub struct DidKeyWithId { } /// `ServiceEndpoint` with its identifier. -#[derive(Encode, Decode, scale_info_derive::TypeInfo, Debug, Clone, PartialEq, Eq)] +#[derive(Encode, Decode, scale_info_derive::TypeInfo, DebugNoBound, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) )] +#[scale_info(skip_type_params(T))] #[scale_info(omit_prefix)] pub struct ServiceEndpointWithId { id: ServiceEndpointId, diff --git a/pallets/core/src/modules/did/mod.rs b/pallets/core/src/modules/did/mod.rs index 1cc8fa89d..c3df4e97f 100644 --- a/pallets/core/src/modules/did/mod.rs +++ b/pallets/core/src/modules/did/mod.rs @@ -358,10 +358,14 @@ pub mod pallet { ) } - /// Adds `StateChange` to the metadata. + /// Adds `StateChange` and `AggregatedDidDetailsResponse` to the metadata. #[doc(hidden)] #[pallet::weight(::DbWeight::get().writes(10))] - pub fn noop(_o: OriginFor, _s: common::StateChange<'static, T>) -> DispatchResult { + pub fn noop( + _o: OriginFor, + _s: common::StateChange<'static, T>, + _d: AggregatedDidDetailsResponse, + ) -> DispatchResult { Err(DispatchError::BadOrigin) } } From 175652eca6ecdac98df3218ab6da9370b65eecc7 Mon Sep 17 00:00:00 2001 From: olegnn Date: Tue, 26 Sep 2023 19:24:01 +0200 Subject: [PATCH 2/5] A bunch of minor improvements --- pallets/core/src/common/policy.rs | 2 +- pallets/core/src/modules/accumulator/types.rs | 8 +++++++- pallets/core/src/modules/attest/mod.rs | 2 ++ pallets/core/src/modules/blob/mod.rs | 2 ++ pallets/core/src/modules/did/base/mod.rs | 4 ++-- pallets/core/src/modules/did/base/offchain.rs | 8 ++++---- pallets/core/src/modules/did/base/onchain.rs | 10 +++++++--- pallets/core/src/modules/did/base/signature.rs | 2 +- pallets/core/src/modules/did/service_endpoints.rs | 2 +- pallets/core/src/modules/master/mod.rs | 2 ++ .../core/src/modules/offchain_signatures/actions.rs | 4 ++++ .../core/src/modules/offchain_signatures/schemes.rs | 2 ++ pallets/core/src/util/with_nonce.rs | 1 + pallets/core/src/util/wrapped_action_with_nonce.rs | 11 ++++++----- pallets/token-migration/src/lib.rs | 1 + 15 files changed, 43 insertions(+), 18 deletions(-) diff --git a/pallets/core/src/common/policy.rs b/pallets/core/src/common/policy.rs index 9ea229161..6a040bb10 100644 --- a/pallets/core/src/common/policy.rs +++ b/pallets/core/src/common/policy.rs @@ -205,7 +205,7 @@ pub struct DidSignatureWithNonce where T: Types, { - /// Signature by DID + /// `DID`'s signature pub sig: DidSignature, /// Nonce used to make the above signature pub nonce: T::BlockNumber, diff --git a/pallets/core/src/modules/accumulator/types.rs b/pallets/core/src/modules/accumulator/types.rs index d4bfee28a..74e730e53 100644 --- a/pallets/core/src/modules/accumulator/types.rs +++ b/pallets/core/src/modules/accumulator/types.rs @@ -25,7 +25,6 @@ crate::impl_wrapper!(AccumulatorId([u8; 32]), with tests as acc_tests); /// Accumulator owner - DID with the ability to control given accumulator keys, params, etc. #[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, Copy, Ord, PartialOrd, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[derive(scale_info_derive::TypeInfo)] #[scale_info(omit_prefix)] pub struct AccumulatorOwner(pub Did); @@ -43,6 +42,7 @@ crate::impl_wrapper!(AccumulatorOwner(Did), for rand use Did(rand::random()), wi MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -67,6 +67,7 @@ pub struct AccumulatorParameters { MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -84,6 +85,7 @@ pub struct AccumulatorPublicKey { Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound, MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -106,6 +108,7 @@ pub enum Accumulator { MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -128,6 +131,7 @@ pub struct AccumulatorCommon { MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -181,6 +185,7 @@ impl Accumulator { scale_info_derive::TypeInfo, Encode, Decode, Clone, PartialEq, Eq, Debug, Default, MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[scale_info(omit_prefix)] pub struct StoredAccumulatorOwnerCounters { pub params_counter: IncId, @@ -191,6 +196,7 @@ pub struct StoredAccumulatorOwnerCounters { scale_info_derive::TypeInfo, Encode, Decode, Clone, PartialEq, Eq, Debug, MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/modules/attest/mod.rs b/pallets/core/src/modules/attest/mod.rs index f54aa9045..519db227a 100644 --- a/pallets/core/src/modules/attest/mod.rs +++ b/pallets/core/src/modules/attest/mod.rs @@ -47,6 +47,7 @@ crate::impl_wrapper!(Attester(Did), for rand use Did(rand::random()), with tests MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -64,6 +65,7 @@ pub struct Attestation { Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound, Default, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/modules/blob/mod.rs b/pallets/core/src/modules/blob/mod.rs index d2ce07c46..8eba2c72c 100644 --- a/pallets/core/src/modules/blob/mod.rs +++ b/pallets/core/src/modules/blob/mod.rs @@ -43,6 +43,7 @@ pub type BlobId = [u8; ID_BYTE_SIZE]; /// When a new blob is being registered, the following object is sent. #[derive(Encode, Decode, CloneNoBound, PartialEqNoBound, DebugNoBound, EqNoBound)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -57,6 +58,7 @@ pub struct Blob { #[derive(Encode, Decode, scale_info_derive::TypeInfo, DebugNoBound, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/modules/did/base/mod.rs b/pallets/core/src/modules/did/base/mod.rs index f4bb8bb30..fe96072e1 100644 --- a/pallets/core/src/modules/did/base/mod.rs +++ b/pallets/core/src/modules/did/base/mod.rs @@ -15,7 +15,7 @@ pub use offchain::*; pub use onchain::*; pub use signature::DidSignature; -/// The type of the Dock DID. +/// The type of the Dock `DID`. #[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, Copy, Ord, PartialOrd, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(scale_info_derive::TypeInfo)] @@ -57,7 +57,7 @@ pub enum StoredDidDetails { OnChain(StoredOnChainDidDetails), } -impl StoredDidDetails { +impl StoredDidDetails { pub fn is_onchain(&self) -> bool { matches!(self, StoredDidDetails::OnChain(_)) } diff --git a/pallets/core/src/modules/did/base/offchain.rs b/pallets/core/src/modules/did/base/offchain.rs index 75ef3d073..f36fc9ac1 100644 --- a/pallets/core/src/modules/did/base/offchain.rs +++ b/pallets/core/src/modules/did/base/offchain.rs @@ -20,13 +20,13 @@ pub struct OffChainDidDetails { pub doc_ref: OffChainDidDocRef, } -impl From> for StoredDidDetails { +impl From> for StoredDidDetails { fn from(details: OffChainDidDetails) -> Self { Self::OffChain(details) } } -impl TryFrom> for OffChainDidDetails { +impl TryFrom> for OffChainDidDetails { type Error = Error; fn try_from(details: StoredDidDetails) -> Result { @@ -36,7 +36,7 @@ impl TryFrom> for OffChainDidDetails { } } -impl OffChainDidDetails { +impl OffChainDidDetails { /// Constructs new off-chain DID details using supplied params. pub fn new(account_id: T::AccountId, doc_ref: OffChainDidDocRef) -> Self { Self { @@ -71,7 +71,7 @@ pub enum OffChainDidDocRef { Custom(BoundedBytes), } -impl OffChainDidDocRef { +impl OffChainDidDocRef { pub fn len(&self) -> u32 { match self { OffChainDidDocRef::CID(v) => v.len() as u32, diff --git a/pallets/core/src/modules/did/base/onchain.rs b/pallets/core/src/modules/did/base/onchain.rs index a23268dee..2a666ff4a 100644 --- a/pallets/core/src/modules/did/base/onchain.rs +++ b/pallets/core/src/modules/did/base/onchain.rs @@ -1,5 +1,9 @@ use super::super::*; -use crate::{common::ToStateChange, deposit_indexed_event, util::WrappedActionWithNonce}; +use crate::{ + common::{ToStateChange, TypesAndLimits}, + deposit_indexed_event, + util::WrappedActionWithNonce, +}; /// Each on-chain DID is associated with a nonce that is incremented each time the DID does a /// write (through an extrinsic). The nonce starts from the block number when the DID was created to avoid @@ -22,13 +26,13 @@ pub struct OnChainDidDetails { pub active_controllers: u32, } -impl From> for StoredDidDetails { +impl From> for StoredDidDetails { fn from(details: StoredOnChainDidDetails) -> Self { Self::OnChain(details) } } -impl TryFrom> for StoredOnChainDidDetails { +impl TryFrom> for StoredOnChainDidDetails { type Error = Error; fn try_from(details: StoredDidDetails) -> Result { diff --git a/pallets/core/src/modules/did/base/signature.rs b/pallets/core/src/modules/did/base/signature.rs index 0156132fc..78fe5cd9e 100644 --- a/pallets/core/src/modules/did/base/signature.rs +++ b/pallets/core/src/modules/did/base/signature.rs @@ -1,11 +1,11 @@ use super::super::*; use crate::common::{SigValue, ToStateChange, VerificationError}; +/// `DID`'s signature along with the used `DID`s key reference. #[derive(Encode, Decode, Debug, Clone, PartialEq, Eq, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[derive(scale_info_derive::TypeInfo)] -#[scale_info(skip_type_params(D))] #[codec(encode_bound(D: Encode + MaxEncodedLen + Into))] #[scale_info(omit_prefix)] pub struct DidSignature> { diff --git a/pallets/core/src/modules/did/service_endpoints.rs b/pallets/core/src/modules/did/service_endpoints.rs index c74043532..0fcbb9c27 100644 --- a/pallets/core/src/modules/did/service_endpoints.rs +++ b/pallets/core/src/modules/did/service_endpoints.rs @@ -72,7 +72,7 @@ bitflags::bitflags! { impl_bits_conversion! { ServiceEndpointType from u16 } impl_wrapper_type_info! { ServiceEndpointType(u16) } -impl ServiceEndpoint { +impl ServiceEndpoint { pub fn is_valid(&self) -> bool { !self.types.is_empty() && !self.origins.is_empty() diff --git a/pallets/core/src/modules/master/mod.rs b/pallets/core/src/modules/master/mod.rs index 185a832aa..18ce60ac2 100644 --- a/pallets/core/src/modules/master/mod.rs +++ b/pallets/core/src/modules/master/mod.rs @@ -92,6 +92,7 @@ mod tests; Encode, Decode, CloneNoBound, PartialEqNoBound, EqNoBound, DebugNoBound, MaxEncodedLen, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -118,6 +119,7 @@ impl Default for Membership { Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound, Default, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/modules/offchain_signatures/actions.rs b/pallets/core/src/modules/offchain_signatures/actions.rs index e8f3b162c..0c8eabb0c 100644 --- a/pallets/core/src/modules/offchain_signatures/actions.rs +++ b/pallets/core/src/modules/offchain_signatures/actions.rs @@ -5,6 +5,7 @@ use super::*; #[derive(Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -18,6 +19,7 @@ pub struct AddOffchainSignatureParams { #[derive(Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -32,6 +34,7 @@ pub struct AddOffchainSignaturePublicKey { #[derive(Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -45,6 +48,7 @@ pub struct RemoveOffchainSignatureParams { #[derive(Encode, Decode, scale_info_derive::TypeInfo, Clone, PartialEq, Eq, DebugNoBound)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/modules/offchain_signatures/schemes.rs b/pallets/core/src/modules/offchain_signatures/schemes.rs index b20a7ae52..835ebda05 100644 --- a/pallets/core/src/modules/offchain_signatures/schemes.rs +++ b/pallets/core/src/modules/offchain_signatures/schemes.rs @@ -19,6 +19,7 @@ macro_rules! def_signature_scheme_key_and_params { $(#[$key_meta])* #[derive(scale_info_derive::TypeInfo, Encode, Decode, CloneNoBound, PartialEqNoBound, EqNoBound, DebugNoBound, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) @@ -116,6 +117,7 @@ macro_rules! def_signature_scheme_key_and_params { $(#[$params_meta])* #[derive(scale_info_derive::TypeInfo, Encode, Decode, CloneNoBound, PartialEqNoBound, EqNoBound, DebugNoBound, MaxEncodedLen)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] + #[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) diff --git a/pallets/core/src/util/with_nonce.rs b/pallets/core/src/util/with_nonce.rs index d370bb163..3a1bc96da 100644 --- a/pallets/core/src/util/with_nonce.rs +++ b/pallets/core/src/util/with_nonce.rs @@ -9,6 +9,7 @@ use crate::common::Types; /// Initial nonce will be equal to the current block number provided by the system. #[derive(Encode, Decode, scale_info_derive::TypeInfo, Clone, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound( diff --git a/pallets/core/src/util/wrapped_action_with_nonce.rs b/pallets/core/src/util/wrapped_action_with_nonce.rs index d09bee5c8..1e0485eeb 100644 --- a/pallets/core/src/util/wrapped_action_with_nonce.rs +++ b/pallets/core/src/util/wrapped_action_with_nonce.rs @@ -1,17 +1,18 @@ +use crate::common::Types; + use super::{Action, ActionWithNonce}; use codec::{Decode, Encode}; -use frame_system::Config; /// Wraps any value in an action with the supplied nonce and given target. #[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, scale_info_derive::TypeInfo)] #[scale_info(omit_prefix)] -pub struct WrappedActionWithNonce { +pub struct WrappedActionWithNonce { pub nonce: T::BlockNumber, pub target: Ta, pub action: A, } -impl WrappedActionWithNonce { +impl WrappedActionWithNonce { /// Wraps any value in an action with the supplied nonce and given target. pub fn new(nonce: T::BlockNumber, target: Ta, action: A) -> Self { Self { @@ -22,7 +23,7 @@ impl WrappedActionWithNonce { } } -impl Action for WrappedActionWithNonce { +impl Action for WrappedActionWithNonce { type Target = Ta; fn target(&self) -> Self::Target { @@ -34,7 +35,7 @@ impl Action for WrappedActionWithNonce ActionWithNonce for WrappedActionWithNonce { +impl ActionWithNonce for WrappedActionWithNonce { fn nonce(&self) -> T::BlockNumber { self.nonce } diff --git a/pallets/token-migration/src/lib.rs b/pallets/token-migration/src/lib.rs index 7180e3f2f..56fadf7e5 100644 --- a/pallets/token-migration/src/lib.rs +++ b/pallets/token-migration/src/lib.rs @@ -58,6 +58,7 @@ mod tests; DefaultNoBound, )] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "serde", serde(bound(serialize = "T: Sized", deserialize = "T: Sized")) From 1ecb69ea7cb490e415671a4f0453f1a1463533f6 Mon Sep 17 00:00:00 2001 From: olegnn Date: Tue, 3 Oct 2023 15:49:42 +0200 Subject: [PATCH 3/5] Bump up deps --- Cargo.lock | 8 ++++---- Dockerfile | 10 +++++----- node/Cargo.toml | 4 ++-- runtime/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 626eed067..40118a506 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1488,7 +1488,7 @@ dependencies = [ [[package]] name = "dock-node" -version = "0.23.0" +version = "0.24.0" dependencies = [ "async-trait", "beefy-gadget", @@ -1646,7 +1646,7 @@ dependencies = [ [[package]] name = "dock-runtime" -version = "0.23.0" +version = "0.24.0" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -10001,9 +10001,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.0" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "07ecc0cd7cac091bf682ec5efa18b1cff79d617b84181f38b3951dbe135f607f" dependencies = [ "ring", "untrusted", diff --git a/Dockerfile b/Dockerfile index 55079cecd..de29bbb61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,13 +15,13 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y # rustup directory ENV PATH /root/.cargo/bin:$PATH +ARG stable='stable-2023-03-09' ARG nightly='nightly-2023-03-09' -# setup rust nightly channel, pinning specific version as newer versions have a regression +# setup rust stable and nightly channels, pinning specific version as newer versions have a regression +RUN rustup install $stable RUN rustup install $nightly -RUN rustup install stable - # install wasm toolchain for substrate RUN rustup target add wasm32-unknown-unknown --toolchain $nightly @@ -45,11 +45,11 @@ ARG release RUN if [ "$release" = "Y" ] ; then \ echo 'Building in release mode.' ; \ - cargo +$nightly build --profile=release $features ; \ + WASM_BUILD_TOOLCHAIN=$nightly cargo +$stable build --profile=release $features ; \ mv /dock-node/target/release/dock-node /dock-node/target/; \ else \ echo 'Building in production mode.' ; \ - cargo +$nightly build --profile=production $features ; \ + WASM_BUILD_TOOLCHAIN=$nightly cargo +$stable build --profile=production $features ; \ mv /dock-node/target/production/dock-node /dock-node/target/; \ fi diff --git a/node/Cargo.toml b/node/Cargo.toml index acb04f003..d80e5da46 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Dock.io"] build = "build.rs" edition = "2021" name = "dock-node" -version = "0.23.0" +version = "0.24.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -28,7 +28,7 @@ optional = true [dependencies.dock-runtime] path = "../runtime" -version = "0.23.0" +version = "0.24.0" [dependencies.beefy-primitives] git = "https://github.com/paritytech/substrate.git" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index b3072e09f..6232f2393 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Dock.io"] edition = "2021" name = "dock-runtime" -version = "0.23.0" +version = "0.24.0" license = "Apache-2.0" [package.metadata.docs.rs] From d94824465387036e21aa9574c3954894f9bfc6af Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 4 Oct 2023 12:00:06 +0200 Subject: [PATCH 4/5] Script tweak --- scripts/ansible/aws/ec2-set-volume-size.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ansible/aws/ec2-set-volume-size.yml b/scripts/ansible/aws/ec2-set-volume-size.yml index 5d9b930ed..a0588ce96 100644 --- a/scripts/ansible/aws/ec2-set-volume-size.yml +++ b/scripts/ansible/aws/ec2-set-volume-size.yml @@ -3,6 +3,7 @@ gather_facts: False vars: instance_name: "{{ name }} (created by ansible)" + volume_type_default: "{{ volume_type | default('io1') }}" tasks: - name: Get EC2 instance state @@ -23,6 +24,8 @@ instance: "{{ instances['instances'][0].instance_id }}" id: "{{ instances['instances'][0].block_device_mappings[0].ebs.volume_id }}" volume_size: "{{ volume_size }}" + volume_type: "{{ volume_type_default }}" + iops: "{{ iops | default(1300) if volume_type_default is regex('^io*') else omit }}" modify_volume: true - name: Add a host From ebb264b4073e7946bcf4e84890e2a3b0c8468742 Mon Sep 17 00:00:00 2001 From: olegnn Date: Wed, 4 Oct 2023 13:20:13 +0200 Subject: [PATCH 5/5] Bump up master versions --- Cargo.lock | 6 +++--- node/Cargo.toml | 4 ++-- runtime/Cargo.toml | 2 +- runtime/src/lib.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 02efc69c9..965641612 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1491,7 +1491,7 @@ dependencies = [ [[package]] name = "dock-node" -version = "0.24.0" +version = "0.25.0" dependencies = [ "async-trait", "beefy-gadget", @@ -1717,7 +1717,7 @@ dependencies = [ [[package]] name = "dock-runtime" -version = "0.24.0" +version = "0.25.0" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -10274,4 +10274,4 @@ checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" dependencies = [ "cc", "libc", -] \ No newline at end of file +] diff --git a/node/Cargo.toml b/node/Cargo.toml index d0b65ee5c..8cb2a132c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Dock.io"] build = "build.rs" edition = "2021" name = "dock-node" -version = "0.24.0" +version = "0.25.0" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -28,7 +28,7 @@ optional = true [dependencies.dock-runtime] path = "../runtime" -version = "0.24.0" +version = "0.25.0" [dependencies.beefy-primitives] git = "https://github.com/paritytech/substrate.git" diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 08245b42e..362d03b6e 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Dock.io"] edition = "2021" name = "dock-runtime" -version = "0.24.0" +version = "0.25.0" license = "Apache-2.0" [package.metadata.docs.rs] diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index c0e5b308e..62fc12459 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -203,7 +203,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("dock-pos-dev-runtime"), impl_name: create_runtime_str!("Dock"), authoring_version: 1, - spec_version: 47, + spec_version: 48, impl_version: 2, transaction_version: 2, apis: RUNTIME_API_VERSIONS,