Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

upgrade dep v0.9.43 #117

Merged
merged 8 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ members = [
"pallets/acurast/common",
"pallets/marketplace/reputation",
"p256-crypto",
]
]
exclude = ["pallets/proxy"]
12 changes: 6 additions & 6 deletions p256-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ hex = { version = "0.4", default-features = false }
p256 = { git = "https://github.com/Acurast/elliptic-curves", default-features = false, features = ["ecdsa", "sha256"] }

# Substrate
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

[dev-dependencies]
hex-literal = "0.3"
Expand Down
5 changes: 0 additions & 5 deletions p256-crypto/src/application_crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ pub mod p256 {

mod app {
use sp_application_crypto::app_crypto;
use sp_runtime::BoundToRuntimeAppPublic;

use crate::core::p256;

use super::P256;

app_crypto!(p256, P256);

impl BoundToRuntimeAppPublic for Public {
type Public = Self;
}
}

pub use app::{Public as AppPublic, Signature as AppSignature};
Expand Down
51 changes: 4 additions & 47 deletions p256-crypto/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ pub mod p256 {
use sp_runtime::traits::{IdentifyAccount, Lazy, Verify};
use sp_runtime_interface::pass_by::PassByInner;

#[cfg(feature = "std")]
use sp_core::crypto::Ss58Codec;
use sp_core::crypto::{
ByteArray, CryptoType, CryptoTypeId, CryptoTypePublicPair, Derive, Public as TraitPublic,
UncheckedFrom,
ByteArray, CryptoType, CryptoTypeId, Derive, Public as TraitPublic, UncheckedFrom,
};
#[cfg(feature = "std")]
use sp_core::crypto::{DeriveError, Ss58Codec};

#[cfg(feature = "std")]
use sp_core::{
Expand Down Expand Up @@ -83,23 +82,7 @@ pub mod p256 {
}
}

impl TraitPublic for Public {
fn to_public_crypto_pair(&self) -> CryptoTypePublicPair {
CryptoTypePublicPair(CRYPTO_ID, self.to_raw_vec())
}
}

impl From<Public> for CryptoTypePublicPair {
fn from(key: Public) -> Self {
(&key).into()
}
}

impl From<&Public> for CryptoTypePublicPair {
fn from(key: &Public) -> Self {
CryptoTypePublicPair(CRYPTO_ID, key.to_raw_vec())
}
}
gitsimon marked this conversation as resolved.
Show resolved Hide resolved
impl TraitPublic for Public {}

impl ByteArray for Public {
const LEN: usize = 33;
Expand Down Expand Up @@ -340,13 +323,6 @@ pub mod p256 {
type Pair = Pair;
}

/// An error when deriving a key.
#[cfg(feature = "std")]
pub enum DeriveError {
/// A soft key was found in the path (and is unsupported).
SoftKeyInPath,
}

/// Derive a single hard junction.
#[cfg(feature = "std")]
fn derive_hard_junction(secret_seed: &Seed, cc: &[u8; SEED_LENGTH]) -> Seed {
Expand All @@ -370,7 +346,6 @@ pub mod p256 {
type Public = Public;
type Seed = Seed;
type Signature = Signature;
type DeriveError = DeriveError;

// Using default fn generate()

Expand Down Expand Up @@ -455,24 +430,6 @@ pub mod p256 {
sig.verify(message.as_ref(), pubkey)
}

/// Verify a signature on a message. Returns true if the signature is good.
///
/// This doesn't use the type system to ensure that `sig` and `pubkey` are the correct
/// size. Use it only if you're coming from byte buffers and need the speed.
fn verify_weak<P: AsRef<[u8]>, M: AsRef<[u8]>>(sig: &[u8], message: M, pubkey: P) -> bool {
// TODO: weak version, for now use normal verify
let signature = match Self::Signature::try_from(sig) {
Err(_) => return false,
Ok(sign) => sign,
};
let public = match Self::Public::try_from(pubkey.as_ref()) {
Err(_) => return false,
Ok(pk) => pk,
};

Self::verify(&signature, message, &public)
}

/// Return a vec filled with raw data.
fn to_raw_vec(&self) -> Vec<u8> {
self.seed().to_vec()
Expand Down
38 changes: 19 additions & 19 deletions pallets/acurast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ scale-info = { version = "2.3.0", features = ["derive"], default-features = fals
acurast-common = { path = "./common", default-features = false, features = ["attestation"] }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

# benchmarks
hex-literal = { version = "0.3", optional = true }
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
parachains-common = { git = "https://github.com/paritytech/cumulus", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }
parachains-common = { git = "https://github.com/paritytech/cumulus", default-features = false, optional = true, branch = "polkadot-v0.9.43" }

[dev-dependencies]
base64 = { version = "0.13.0", default-features = false, features = ["alloc"] }
hex-literal = "0.3"

sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41" }
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.41" }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }

[features]
default = ["std"]
Expand Down
4 changes: 2 additions & 2 deletions pallets/acurast/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ edition = "2021"
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false }
scale-info = { version = "2.2.0", features = ["derive"], default-features = false }
# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
# Attestation
asn1 = { version = "0.11.0", default-features = false, features = ["derive"], optional = true }
p256 = { git = "https://github.com/Acurast/elliptic-curves", default-features = false, features = ["ecdsa", "sha256"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion pallets/acurast/p384/ecdsa/signature/async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2021"
rust-version = "1.56"

[dependencies]
async-trait = "0.1.9"
async-trait = "0.1.57"
signature = { version = "1.6", path = ".." }

[features]
Expand Down
11 changes: 7 additions & 4 deletions pallets/acurast/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use frame_support::traits::ConstU32;
use frame_support::{pallet_prelude::GenesisBuild, parameter_types, traits::Everything, PalletId};
use hex_literal::hex;
use sp_io;
Expand Down Expand Up @@ -146,6 +147,11 @@ impl pallet_balances::Config for Test {
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = [u8; 8];
type FreezeIdentifier = ();
// Holds are used with COLLATOR_LOCK_ID and DELEGATOR_LOCK_ID
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

impl parachain_info::Config for Test {}
Expand Down Expand Up @@ -179,10 +185,7 @@ where

fn funded_account(index: u32) -> T::AccountId {
let caller: T::AccountId = frame_benchmarking::account("token_account", index, SEED);
<Balances as frame_support::traits::Currency<_>>::make_free_balance_be(
&caller.clone().into(),
u32::MAX.into(),
);
<Balances as fungible::Mutate<_>>::set_balance(&caller.clone().into(), u32::MAX.into());

caller
}
Expand Down
31 changes: 16 additions & 15 deletions pallets/assets-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
] }

# Benchmarks
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", optional = true, default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", optional = true, default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.41" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", optional = true, default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", optional = true, default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.43" }

# Substrate
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
scale-info = { version = "2.2.0", default-features = false, features = [
"derive",
] }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.41" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.41" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43" }

acurast-common = { path = "../acurast/common", default-features = false }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.41" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

[features]
default = ["std"]
Expand All @@ -69,5 +69,6 @@ runtime-benchmarks = [
"sp-io",
"pallet-balances/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
4 changes: 3 additions & 1 deletion pallets/assets-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ pub mod pallet {
#[pallet::genesis_build]
impl<T: Config<I>, I: 'static> GenesisBuild<T, I> for GenesisConfig<T, I> {
fn build(&self) {
for &(internal_asset_id, parachain, pallet_instance, general_index) in &self.assets {
for (internal_asset_id, parachain, pallet_instance, general_index) in
self.assets.clone()
{
let asset_id = AssetId::Concrete(MultiLocation::new(
1,
X3(
Expand Down
5 changes: 5 additions & 0 deletions pallets/assets-manager/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ impl pallet_balances::Config for Test {
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type HoldIdentifier = [u8; 8];
type FreezeIdentifier = ();
// Holds are used with COLLATOR_LOCK_ID and DELEGATOR_LOCK_ID
type MaxHolds = ConstU32<2>;
type MaxFreezes = ConstU32<0>;
}

impl frame_system::Config for Test {
Expand Down
Loading