From 555d1b517331c9dedcd74938a1ab085d63b5e8e0 Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Tue, 2 Jan 2024 09:52:41 +0000 Subject: [PATCH 1/7] feat: Unify common runtime configs (#385) --- node/src/eth.rs | 2 +- node/src/rpc/mod.rs | 4 +- node/src/service.rs | 6 +- primitives/src/impls.rs | 65 ++++++++++++++ primitives/src/lib.rs | 133 ++++++++++++++++++++++++++++ runtime/mainnet/src/frontier_evm.rs | 90 ++----------------- runtime/mainnet/src/impls.rs | 39 +------- runtime/mainnet/src/lib.rs | 79 +++++++++-------- runtime/testnet/src/frontier_evm.rs | 88 ++---------------- runtime/testnet/src/impls.rs | 39 +------- runtime/testnet/src/lib.rs | 74 +++++++++------- 11 files changed, 307 insertions(+), 312 deletions(-) create mode 100644 primitives/src/impls.rs diff --git a/node/src/eth.rs b/node/src/eth.rs index 545326224..0a75ee3af 100644 --- a/node/src/eth.rs +++ b/node/src/eth.rs @@ -30,7 +30,7 @@ pub use fc_consensus::FrontierBlockImport; use fc_rpc::{EthTask, OverrideHandle}; pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool}; // Local -use tangle_testnet_runtime::opaque::Block; +use tangle_primitives::Block; use crate::service::{FullBackend, FullClient}; diff --git a/node/src/rpc/mod.rs b/node/src/rpc/mod.rs index 86efa13f4..3ed570aab 100644 --- a/node/src/rpc/mod.rs +++ b/node/src/rpc/mod.rs @@ -36,10 +36,10 @@ use sp_consensus::SelectChain; use sp_consensus_babe::BabeApi; use sp_keystore::KeystorePtr; use sp_runtime::traits::Block as BlockT; +use tangle_primitives::Block; use tangle_runtime::BlockNumber; - // Runtime -use tangle_runtime::{opaque::Block, AccountId, Balance, Hash, Index}; +use tangle_runtime::{AccountId, Balance, Hash, Index}; pub mod eth; pub mod tracing; diff --git a/node/src/service.rs b/node/src/service.rs index 3a7146cd3..f1595500b 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -30,16 +30,16 @@ pub use sc_executor::NativeElseWasmExecutor; use sc_service::{error::Error as ServiceError, Configuration, TaskManager}; use sc_telemetry::{Telemetry, TelemetryWorker}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; - use sp_core::U256; +use tangle_primitives::Block; use std::{path::Path, sync::Arc, time::Duration}; #[cfg(not(feature = "testnet"))] -use tangle_runtime::{self, opaque::Block, RuntimeApi, TransactionConverter}; +use tangle_runtime::{self, RuntimeApi, TransactionConverter}; #[cfg(feature = "testnet")] -use tangle_testnet_runtime::{self, opaque::Block, RuntimeApi, TransactionConverter}; +use tangle_testnet_runtime::{self, RuntimeApi, TransactionConverter}; /// The minimum period of blocks on which justifications will be /// imported and generated. diff --git a/primitives/src/impls.rs b/primitives/src/impls.rs new file mode 100644 index 000000000..39cc643c2 --- /dev/null +++ b/primitives/src/impls.rs @@ -0,0 +1,65 @@ +// This file is part of Tangle. + +// Copyright (C) 2022-2024 Webb Technologies Inc. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Common implementations + +#[macro_export] +macro_rules! impl_to_author { + () => { + /// Logic for the author to get a portion of fees. + pub struct ToAuthor(sp_std::marker::PhantomData); + impl OnUnbalanced> for ToAuthor + where + R: pallet_balances::Config + pallet_authorship::Config, + ::RuntimeEvent: From>, + { + fn on_nonzero_unbalanced(amount: NegativeImbalance) { + if let Some(author) = >::author() { + let _numeric_amount = amount.peek(); + >::resolve_creating(&author, amount); + } + } + } + }; +} + +#[macro_export] +macro_rules! impl_deal_with_fees { + () => { + pub struct DealWithFees(sp_std::marker::PhantomData); + impl OnUnbalanced> for DealWithFees + where + R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config, + pallet_treasury::Pallet: OnUnbalanced>, + ::RuntimeEvent: From>, + { + fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { + if let Some(fees) = fees_then_tips.next() { + // for fees, 80% to treasury, 20% to author + let mut split = fees.ration(80, 20); + if let Some(tips) = fees_then_tips.next() { + // for tips, if any, 100% to author + tips.merge_into(&mut split.1); + } + + as OnUnbalanced<_>>::on_unbalanced(split.0); + as OnUnbalanced<_>>::on_unbalanced(split.1); + } + } + } + }; +} diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 6f88abd38..2e4ef1765 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -29,7 +29,9 @@ use sp_runtime::{ pub mod types; pub use types::*; +pub mod impls; pub mod traits; +pub use impls::*; #[cfg(feature = "verifying")] pub mod verifier; @@ -132,6 +134,137 @@ pub mod fee { } } +pub mod evm { + /// Current approximation of the gas/s consumption considering + /// EVM execution over compiled WASM (on 4.4Ghz CPU). + /// Given the 500ms Weight, from which 75% only are used for transactions, + /// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.75 ~= 15_000_000. + pub const GAS_PER_SECOND: u64 = 40_000_000; + + /// Approximate ratio of the amount of Weight per Gas. + /// u64 works for approximations because Weight is a very small unit compared to gas. + pub const WEIGHT_PER_GAS: u64 = frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND + .saturating_div(GAS_PER_SECOND); + + /// The amount of gas per pov. A ratio of 4 if we convert ref_time to gas and we compare + /// it with the pov_size for a block. E.g. + /// ceil( + /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS + /// ) + pub const GAS_LIMIT_POV_SIZE_RATIO: u64 = 4; + + #[macro_export] + macro_rules! impl_proxy_type { + () => { + #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] + #[derive( + Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, MaxEncodedLen, TypeInfo, + )] + pub enum ProxyType { + /// All calls can be proxied. This is the trivial/most permissive filter. + Any = 0, + /// Only extrinsics related to governance (democracy and collectives). + Governance = 1, + /// Allow to veto an announced proxy call. + CancelProxy = 2, + /// Allow extrinsic related to Balances. + Balances = 3, + } + + impl Default for ProxyType { + fn default() -> Self { + Self::Any + } + } + + fn is_governance_precompile(precompile_name: &precompiles::PrecompileName) -> bool { + matches!( + precompile_name, + PrecompileName::DemocracyPrecompile | PrecompileName::PreimagePrecompile + ) + } + + // Be careful: Each time this filter is modified, the substrate filter must also be modified + // consistently. + impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { + fn is_evm_proxy_call_allowed( + &self, + call: &pallet_evm_precompile_proxy::EvmSubCall, + recipient_has_code: bool, + gas: u64, + ) -> precompile_utils::EvmResult { + Ok(match self { + ProxyType::Any => true, + ProxyType::Governance => + call.value == U256::zero() && + matches!( + PrecompileName::from_address(call.to.0), + Some(ref precompile) if is_governance_precompile(precompile) + ), + // The proxy precompile does not contain method cancel_proxy + ProxyType::CancelProxy => false, + ProxyType::Balances => { + // Allow only "simple" accounts as recipient (no code nor precompile). + // Note: Checking the presence of the code is not enough because some precompiles + // have no code. + !recipient_has_code && + !precompile_utils::precompile_set::is_precompile_or_fail::( + call.to.0, gas, + )? + }, + }) + } + } + } + } +} + +pub mod democracy { + use crate::{currency::UNIT, time::MINUTES, Balance, BlockNumber}; + + pub const LAUNCH_PERIOD: BlockNumber = 28 * 24 * 60 * MINUTES; + pub const VOTING_PERIOD: BlockNumber = 28 * 24 * 60 * MINUTES; + pub const FASTTRACK_VOTING_PERIOD: BlockNumber = 3 * 24 * 60 * MINUTES; + pub const MINIMUM_DEPOSIT: Balance = 100 * UNIT; + pub const ENACTMENT_PERIOD: BlockNumber = 30 * 24 * 60 * MINUTES; + pub const COOLOFF_PERIOD: BlockNumber = 28 * 24 * 60 * MINUTES; + pub const MAX_PROPOSALS: u32 = 100; +} + +pub mod elections { + use crate::{currency::UNIT, time::DAYS, Balance, BlockNumber}; + + pub const CANDIDACY_BOND: Balance = 10 * UNIT; + pub const TERM_DURATION: BlockNumber = 7 * DAYS; + pub const DESIRED_MEMBERS: u32 = 13; + pub const DESIRED_RUNNERS_UP: u32 = 7; + pub const MAX_CANDIDATES: u32 = 10; + pub const MAX_VOTERS: u32 = 5; + pub const ELECTIONS_PHRAGMEN_PALLET_ID: frame_support::traits::LockIdentifier = *b"phrelect"; +} + +pub mod treasury { + use crate::{ + currency::{CENT, UNIT}, + time::DAYS, + Balance, BlockNumber, + }; + use frame_support::PalletId; + use sp_runtime::{Percent, Permill}; + + pub const PROPOSAL_BOND: Permill = Permill::from_percent(5); + pub const PROPOSAL_BOND_MINIMUM: Balance = UNIT; + pub const SPEND_PERIOD: BlockNumber = DAYS; + pub const BURN: Permill = Permill::from_percent(50); + pub const TIP_COUNTDOWN: BlockNumber = DAYS; + pub const TIP_FINDERS_FEE: Percent = Percent::from_percent(20); + pub const TIP_REPORT_DEPOSIT_BASE: Balance = UNIT; + pub const DATA_DEPOSIT_PER_BYTE: Balance = CENT; + pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); + pub const MAXIMUM_REASON_LENGTH: u32 = 300; + pub const MAX_APPROVALS: u32 = 100; +} + /// We assume that ~10% of the block weight is consumed by `on_initialize` handlers. This is /// used to limit the maximal weight of a single extrinsic. pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); diff --git a/runtime/mainnet/src/frontier_evm.rs b/runtime/mainnet/src/frontier_evm.rs index ff2f0d086..867936d24 100644 --- a/runtime/mainnet/src/frontier_evm.rs +++ b/runtime/mainnet/src/frontier_evm.rs @@ -19,18 +19,17 @@ use crate::{ precompiles::{PrecompileName, WebbPrecompiles}, *, }; -use frame_support::{ - pallet_prelude::*, - parameter_types, - traits::FindAuthor, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, -}; +use frame_support::{pallet_prelude::*, parameter_types, traits::FindAuthor, weights::Weight}; use sp_core::{crypto::ByteArray, H160, U256}; use sp_runtime::{traits::BlakeTwo256, ConsensusEngineId, Permill}; use sp_std::{marker::PhantomData, prelude::*}; // Frontier use pallet_ethereum::PostLogContent; use pallet_evm::HashedAddressMapping; +use tangle_primitives::{ + evm::{GAS_LIMIT_POV_SIZE_RATIO, WEIGHT_PER_GAS}, + impl_proxy_type, +}; impl pallet_evm_chain_id::Config for Runtime {} @@ -48,87 +47,12 @@ impl> FindAuthor for FindAuthorTruncated { } } -#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] -#[derive( - Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, MaxEncodedLen, TypeInfo, -)] -pub enum ProxyType { - /// All calls can be proxied. This is the trivial/most permissive filter. - Any = 0, - /// Only extrinsics related to governance (democracy and collectives). - Governance = 1, - /// Allow to veto an announced proxy call. - CancelProxy = 2, - /// Allow extrinsic related to Balances. - Balances = 3, -} - -impl Default for ProxyType { - fn default() -> Self { - Self::Any - } -} - -fn is_governance_precompile(precompile_name: &precompiles::PrecompileName) -> bool { - matches!( - precompile_name, - PrecompileName::DemocracyPrecompile | PrecompileName::PreimagePrecompile - ) -} - -// Be careful: Each time this filter is modified, the substrate filter must also be modified -// consistently. -impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { - fn is_evm_proxy_call_allowed( - &self, - call: &pallet_evm_precompile_proxy::EvmSubCall, - recipient_has_code: bool, - gas: u64, - ) -> precompile_utils::EvmResult { - Ok(match self { - ProxyType::Any => true, - ProxyType::Governance => - call.value == U256::zero() && - matches!( - PrecompileName::from_address(call.to.0), - Some(ref precompile) if is_governance_precompile(precompile) - ), - // The proxy precompile does not contain method cancel_proxy - ProxyType::CancelProxy => false, - ProxyType::Balances => { - // Allow only "simple" accounts as recipient (no code nor precompile). - // Note: Checking the presence of the code is not enough because some precompiles - // have no code. - !recipient_has_code && - !precompile_utils::precompile_set::is_precompile_or_fail::( - call.to.0, gas, - )? - }, - }) - } -} - -/// Current approximation of the gas/s consumption considering -/// EVM execution over compiled WASM (on 4.4Ghz CPU). -/// Given the 500ms Weight, from which 75% only are used for transactions, -/// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.75 ~= 15_000_000. -pub const GAS_PER_SECOND: u64 = 40_000_000; - -/// Approximate ratio of the amount of Weight per Gas. -/// u64 works for approximations because Weight is a very small unit compared to gas. -pub const WEIGHT_PER_GAS: u64 = WEIGHT_REF_TIME_PER_SECOND.saturating_div(GAS_PER_SECOND); - parameter_types! { /// EVM gas limit pub BlockGasLimit: U256 = U256::from( NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS ); - /// The amount of gas per pov. A ratio of 4 if we convert ref_time to gas and we compare - /// it with the pov_size for a block. E.g. - /// ceil( - /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS - /// ) - pub const GasLimitPovSizeRatio: u64 = 4; + pub const GasLimitPovSizeRatio: u64 = GAS_LIMIT_POV_SIZE_RATIO; pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); pub PrecompilesValue: WebbPrecompiles = WebbPrecompiles::<_>::new(); } @@ -168,6 +92,8 @@ impl pallet_ethereum::Config for Runtime { type ExtraDataLength = ConstU32<30>; } +impl_proxy_type!(); + parameter_types! { pub BoundDivision: U256 = U256::from(1024); } diff --git a/runtime/mainnet/src/impls.rs b/runtime/mainnet/src/impls.rs index 75106b488..c06e2bb15 100644 --- a/runtime/mainnet/src/impls.rs +++ b/runtime/mainnet/src/impls.rs @@ -17,40 +17,7 @@ use crate::NegativeImbalance; use frame_support::traits::{Currency, Imbalance, OnUnbalanced}; +use tangle_primitives::{impl_deal_with_fees, impl_to_author}; -/// Logic for the author to get a portion of fees. -pub struct ToAuthor(sp_std::marker::PhantomData); -impl OnUnbalanced> for ToAuthor -where - R: pallet_balances::Config + pallet_authorship::Config, - ::RuntimeEvent: From>, -{ - fn on_nonzero_unbalanced(amount: NegativeImbalance) { - if let Some(author) = >::author() { - let _numeric_amount = amount.peek(); - >::resolve_creating(&author, amount); - } - } -} - -pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced> for DealWithFees -where - R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config, - pallet_treasury::Pallet: OnUnbalanced>, - ::RuntimeEvent: From>, -{ - fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { - if let Some(fees) = fees_then_tips.next() { - // for fees, 80% to treasury, 20% to author - let mut split = fees.ration(80, 20); - if let Some(tips) = fees_then_tips.next() { - // for tips, if any, 100% to author - tips.merge_into(&mut split.1); - } - - as OnUnbalanced<_>>::on_unbalanced(split.0); - as OnUnbalanced<_>>::on_unbalanced(split.1); - } - } -} +impl_to_author!(); +impl_deal_with_fees!(); diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 883ba0f93..8f4877f53 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -96,13 +96,27 @@ use sp_runtime::generic::Era; pub use sp_runtime::BuildStorage; pub use sp_runtime::{MultiAddress, Perbill, Percent, Permill}; +use pallet_airdrop_claims::TestWeightInfo; pub use tangle_primitives::{ currency::*, fee::*, time::*, AccountId, AccountIndex, Address, Balance, BlockNumber, Hash, Header, Index, Moment, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; - -use pallet_airdrop_claims::TestWeightInfo; +use tangle_primitives::{ + democracy::{ + COOLOFF_PERIOD, ENACTMENT_PERIOD, FASTTRACK_VOTING_PERIOD, LAUNCH_PERIOD, MAX_PROPOSALS, + MINIMUM_DEPOSIT, VOTING_PERIOD, + }, + elections::{ + CANDIDACY_BOND, DESIRED_MEMBERS, DESIRED_RUNNERS_UP, ELECTIONS_PHRAGMEN_PALLET_ID, + MAX_CANDIDATES, MAX_VOTERS, TERM_DURATION, + }, + treasury::{ + BURN, DATA_DEPOSIT_PER_BYTE, MAXIMUM_REASON_LENGTH, MAX_APPROVALS, PROPOSAL_BOND, + PROPOSAL_BOND_MINIMUM, SPEND_PERIOD, TIP_COUNTDOWN, TIP_FINDERS_FEE, + TIP_REPORT_DEPOSIT_BASE, TREASURY_PALLET_ID, + }, +}; // Frontier use fp_rpc::TransactionStatus; @@ -130,11 +144,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 0, }; -pub const fn deposit(items: u32, bytes: u32) -> Balance { - // map to 1/10 of what the kusama relay chain charges (v9020) - (items as Balance * 2_000 * CENT + (bytes as Balance) * 100 * MILLIUNIT) / 10 -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -162,10 +171,6 @@ pub mod opaque { pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; - /// Opaque block header type. - pub type Header = generic::Header; - /// Opaque block type. - pub type Block = generic::Block; /// Opaque block identifier type. pub type BlockId = generic::BlockId; @@ -450,13 +455,13 @@ impl pallet_staking::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES; - pub const MinimumDeposit: Balance = 100 * UNIT; - pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES; - pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const MaxProposals: u32 = 100; + pub const LaunchPeriod: BlockNumber = LAUNCH_PERIOD; + pub const VotingPeriod: BlockNumber = VOTING_PERIOD; + pub const FastTrackVotingPeriod: BlockNumber = FASTTRACK_VOTING_PERIOD; + pub const MinimumDeposit: Balance = MINIMUM_DEPOSIT; + pub const EnactmentPeriod: BlockNumber = ENACTMENT_PERIOD; + pub const CooloffPeriod: BlockNumber = COOLOFF_PERIOD; + pub const MaxProposals: u32 = MAX_PROPOSALS; } type EnsureRootOrHalfCouncil = EitherOfDiverse< @@ -822,17 +827,17 @@ impl pallet_offences::Config for Runtime { } parameter_types! { - pub const CandidacyBond: Balance = 10 * UNIT; + pub const CandidacyBond: Balance = CANDIDACY_BOND; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); // additional data per vote is 32 bytes (account id). pub const VotingBondFactor: Balance = deposit(0, 32); - pub const TermDuration: BlockNumber = 7 * DAYS; - pub const DesiredMembers: u32 = 13; - pub const DesiredRunnersUp: u32 = 7; - pub const MaxCandidates: u32 = 10; - pub const MaxVoters: u32 = 5; - pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; + pub const TermDuration: BlockNumber = TERM_DURATION; + pub const DesiredMembers: u32 = DESIRED_MEMBERS; + pub const DesiredRunnersUp: u32 = DESIRED_RUNNERS_UP; + pub const MaxCandidates: u32 = MAX_CANDIDATES; + pub const MaxVoters: u32 = MAX_VOTERS; + pub const ElectionsPhragmenPalletId: LockIdentifier = ELECTIONS_PHRAGMEN_PALLET_ID; } // Make sure that there are no more than `MaxMembers` members elected via @@ -863,17 +868,17 @@ impl pallet_elections_phragmen::Config for Runtime { } parameter_types! { - pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = UNIT; - pub const SpendPeriod: BlockNumber = DAYS; - pub const Burn: Permill = Permill::from_percent(50); - pub const TipCountdown: BlockNumber = DAYS; - pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = UNIT; - pub const DataDepositPerByte: Balance = CENT; - pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const MaximumReasonLength: u32 = 300; - pub const MaxApprovals: u32 = 100; + pub const ProposalBond: Permill = PROPOSAL_BOND; + pub const ProposalBondMinimum: Balance = PROPOSAL_BOND_MINIMUM; + pub const SpendPeriod: BlockNumber = SPEND_PERIOD; + pub const Burn: Permill = BURN; + pub const TipCountdown: BlockNumber = TIP_COUNTDOWN; + pub const TipFindersFee: Percent = TIP_FINDERS_FEE; + pub const TipReportDepositBase: Balance = TIP_REPORT_DEPOSIT_BASE; + pub const DataDepositPerByte: Balance = DATA_DEPOSIT_PER_BYTE; + pub const TreasuryPalletId: PalletId = TREASURY_PALLET_ID; + pub const MaximumReasonLength: u32 = MAXIMUM_REASON_LENGTH; + pub const MaxApprovals: u32 = MAX_APPROVALS; } impl pallet_treasury::Config for Runtime { @@ -1007,7 +1012,7 @@ impl pallet_eth2_light_client::Config for Runtime { parameter_types! { pub Prefix: &'static [u8] = b"Claim TNTs to the account:"; - pub const MaxVestingSchedules: u32 = 28; + pub const MaxVestingSchedules: u32 = 100; } impl pallet_airdrop_claims::Config for Runtime { diff --git a/runtime/testnet/src/frontier_evm.rs b/runtime/testnet/src/frontier_evm.rs index ff2f0d086..c636895e0 100644 --- a/runtime/testnet/src/frontier_evm.rs +++ b/runtime/testnet/src/frontier_evm.rs @@ -19,18 +19,17 @@ use crate::{ precompiles::{PrecompileName, WebbPrecompiles}, *, }; -use frame_support::{ - pallet_prelude::*, - parameter_types, - traits::FindAuthor, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, -}; +use frame_support::{pallet_prelude::*, parameter_types, traits::FindAuthor, weights::Weight}; use sp_core::{crypto::ByteArray, H160, U256}; use sp_runtime::{traits::BlakeTwo256, ConsensusEngineId, Permill}; use sp_std::{marker::PhantomData, prelude::*}; // Frontier use pallet_ethereum::PostLogContent; use pallet_evm::HashedAddressMapping; +use tangle_primitives::{ + evm::{GAS_LIMIT_POV_SIZE_RATIO, WEIGHT_PER_GAS}, + impl_proxy_type, +}; impl pallet_evm_chain_id::Config for Runtime {} @@ -48,87 +47,14 @@ impl> FindAuthor for FindAuthorTruncated { } } -#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] -#[derive( - Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, MaxEncodedLen, TypeInfo, -)] -pub enum ProxyType { - /// All calls can be proxied. This is the trivial/most permissive filter. - Any = 0, - /// Only extrinsics related to governance (democracy and collectives). - Governance = 1, - /// Allow to veto an announced proxy call. - CancelProxy = 2, - /// Allow extrinsic related to Balances. - Balances = 3, -} - -impl Default for ProxyType { - fn default() -> Self { - Self::Any - } -} - -fn is_governance_precompile(precompile_name: &precompiles::PrecompileName) -> bool { - matches!( - precompile_name, - PrecompileName::DemocracyPrecompile | PrecompileName::PreimagePrecompile - ) -} - -// Be careful: Each time this filter is modified, the substrate filter must also be modified -// consistently. -impl pallet_evm_precompile_proxy::EvmProxyCallFilter for ProxyType { - fn is_evm_proxy_call_allowed( - &self, - call: &pallet_evm_precompile_proxy::EvmSubCall, - recipient_has_code: bool, - gas: u64, - ) -> precompile_utils::EvmResult { - Ok(match self { - ProxyType::Any => true, - ProxyType::Governance => - call.value == U256::zero() && - matches!( - PrecompileName::from_address(call.to.0), - Some(ref precompile) if is_governance_precompile(precompile) - ), - // The proxy precompile does not contain method cancel_proxy - ProxyType::CancelProxy => false, - ProxyType::Balances => { - // Allow only "simple" accounts as recipient (no code nor precompile). - // Note: Checking the presence of the code is not enough because some precompiles - // have no code. - !recipient_has_code && - !precompile_utils::precompile_set::is_precompile_or_fail::( - call.to.0, gas, - )? - }, - }) - } -} - -/// Current approximation of the gas/s consumption considering -/// EVM execution over compiled WASM (on 4.4Ghz CPU). -/// Given the 500ms Weight, from which 75% only are used for transactions, -/// the total EVM execution gas limit is: GAS_PER_SECOND * 0.500 * 0.75 ~= 15_000_000. -pub const GAS_PER_SECOND: u64 = 40_000_000; - -/// Approximate ratio of the amount of Weight per Gas. -/// u64 works for approximations because Weight is a very small unit compared to gas. -pub const WEIGHT_PER_GAS: u64 = WEIGHT_REF_TIME_PER_SECOND.saturating_div(GAS_PER_SECOND); +impl_proxy_type!(); parameter_types! { /// EVM gas limit pub BlockGasLimit: U256 = U256::from( NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT.ref_time() / WEIGHT_PER_GAS ); - /// The amount of gas per pov. A ratio of 4 if we convert ref_time to gas and we compare - /// it with the pov_size for a block. E.g. - /// ceil( - /// (max_extrinsic.ref_time() / max_extrinsic.proof_size()) / WEIGHT_PER_GAS - /// ) - pub const GasLimitPovSizeRatio: u64 = 4; + pub const GasLimitPovSizeRatio: u64 = GAS_LIMIT_POV_SIZE_RATIO; pub WeightPerGas: Weight = Weight::from_parts(WEIGHT_PER_GAS, 0); pub PrecompilesValue: WebbPrecompiles = WebbPrecompiles::<_>::new(); } diff --git a/runtime/testnet/src/impls.rs b/runtime/testnet/src/impls.rs index 75106b488..c06e2bb15 100644 --- a/runtime/testnet/src/impls.rs +++ b/runtime/testnet/src/impls.rs @@ -17,40 +17,7 @@ use crate::NegativeImbalance; use frame_support::traits::{Currency, Imbalance, OnUnbalanced}; +use tangle_primitives::{impl_deal_with_fees, impl_to_author}; -/// Logic for the author to get a portion of fees. -pub struct ToAuthor(sp_std::marker::PhantomData); -impl OnUnbalanced> for ToAuthor -where - R: pallet_balances::Config + pallet_authorship::Config, - ::RuntimeEvent: From>, -{ - fn on_nonzero_unbalanced(amount: NegativeImbalance) { - if let Some(author) = >::author() { - let _numeric_amount = amount.peek(); - >::resolve_creating(&author, amount); - } - } -} - -pub struct DealWithFees(sp_std::marker::PhantomData); -impl OnUnbalanced> for DealWithFees -where - R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config, - pallet_treasury::Pallet: OnUnbalanced>, - ::RuntimeEvent: From>, -{ - fn on_unbalanceds(mut fees_then_tips: impl Iterator>) { - if let Some(fees) = fees_then_tips.next() { - // for fees, 80% to treasury, 20% to author - let mut split = fees.ration(80, 20); - if let Some(tips) = fees_then_tips.next() { - // for tips, if any, 100% to author - tips.merge_into(&mut split.1); - } - - as OnUnbalanced<_>>::on_unbalanced(split.0); - as OnUnbalanced<_>>::on_unbalanced(split.1); - } - } -} +impl_to_author!(); +impl_deal_with_fees!(); diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 62c3e4155..833b94774 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -112,6 +112,21 @@ pub use tangle_primitives::{ AccountId, AccountIndex, Address, BabeId, Balance, BlockNumber, Hash, Header, Index, Moment, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; +use tangle_primitives::{ + democracy::{ + COOLOFF_PERIOD, ENACTMENT_PERIOD, FASTTRACK_VOTING_PERIOD, LAUNCH_PERIOD, MAX_PROPOSALS, + MINIMUM_DEPOSIT, VOTING_PERIOD, + }, + elections::{ + CANDIDACY_BOND, DESIRED_MEMBERS, DESIRED_RUNNERS_UP, ELECTIONS_PHRAGMEN_PALLET_ID, + MAX_CANDIDATES, MAX_VOTERS, TERM_DURATION, + }, + treasury::{ + BURN, DATA_DEPOSIT_PER_BYTE, MAXIMUM_REASON_LENGTH, MAX_APPROVALS, PROPOSAL_BOND, + PROPOSAL_BOND_MINIMUM, SPEND_PERIOD, TIP_COUNTDOWN, TIP_FINDERS_FEE, + TIP_REPORT_DEPOSIT_BASE, TREASURY_PALLET_ID, + }, +}; use pallet_airdrop_claims::TestWeightInfo; @@ -141,11 +156,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 0, }; -pub const fn deposit(items: u32, bytes: u32) -> Balance { - // map to 1/10 of what the kusama relay chain charges (v9020) - (items as Balance * 2_000 * CENT + (bytes as Balance) * 100 * MILLIUNIT) / 10 -} - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -173,10 +183,6 @@ pub mod opaque { pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; - /// Opaque block header type. - pub type Header = generic::Header; - /// Opaque block type. - pub type Block = generic::Block; /// Opaque block identifier type. pub type BlockId = generic::BlockId; @@ -462,13 +468,13 @@ impl pallet_staking::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES; - pub const MinimumDeposit: Balance = 100 * UNIT; - pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES; - pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; - pub const MaxProposals: u32 = 100; + pub const LaunchPeriod: BlockNumber = LAUNCH_PERIOD; + pub const VotingPeriod: BlockNumber = VOTING_PERIOD; + pub const FastTrackVotingPeriod: BlockNumber = FASTTRACK_VOTING_PERIOD; + pub const MinimumDeposit: Balance = MINIMUM_DEPOSIT; + pub const EnactmentPeriod: BlockNumber = ENACTMENT_PERIOD; + pub const CooloffPeriod: BlockNumber = COOLOFF_PERIOD; + pub const MaxProposals: u32 = MAX_PROPOSALS; } type EnsureRootOrHalfCouncil = EitherOfDiverse< @@ -834,17 +840,17 @@ impl pallet_offences::Config for Runtime { } parameter_types! { - pub const CandidacyBond: Balance = 10 * UNIT; + pub const CandidacyBond: Balance = CANDIDACY_BOND; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); // additional data per vote is 32 bytes (account id). pub const VotingBondFactor: Balance = deposit(0, 32); - pub const TermDuration: BlockNumber = 7 * DAYS; - pub const DesiredMembers: u32 = 13; - pub const DesiredRunnersUp: u32 = 7; - pub const MaxCandidates: u32 = 10; - pub const MaxVoters: u32 = 5; - pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; + pub const TermDuration: BlockNumber = TERM_DURATION; + pub const DesiredMembers: u32 = DESIRED_MEMBERS; + pub const DesiredRunnersUp: u32 = DESIRED_RUNNERS_UP; + pub const MaxCandidates: u32 = MAX_CANDIDATES; + pub const MaxVoters: u32 = MAX_VOTERS; + pub const ElectionsPhragmenPalletId: LockIdentifier = ELECTIONS_PHRAGMEN_PALLET_ID; } // Make sure that there are no more than `MaxMembers` members elected via @@ -875,17 +881,17 @@ impl pallet_elections_phragmen::Config for Runtime { } parameter_types! { - pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = UNIT; - pub const SpendPeriod: BlockNumber = DAYS; - pub const Burn: Permill = Permill::from_percent(50); - pub const TipCountdown: BlockNumber = DAYS; - pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = UNIT; - pub const DataDepositPerByte: Balance = CENT; - pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const MaximumReasonLength: u32 = 300; - pub const MaxApprovals: u32 = 100; + pub const ProposalBond: Permill = PROPOSAL_BOND; + pub const ProposalBondMinimum: Balance = PROPOSAL_BOND_MINIMUM; + pub const SpendPeriod: BlockNumber = SPEND_PERIOD; + pub const Burn: Permill = BURN; + pub const TipCountdown: BlockNumber = TIP_COUNTDOWN; + pub const TipFindersFee: Percent = TIP_FINDERS_FEE; + pub const TipReportDepositBase: Balance = TIP_REPORT_DEPOSIT_BASE; + pub const DataDepositPerByte: Balance = DATA_DEPOSIT_PER_BYTE; + pub const TreasuryPalletId: PalletId = TREASURY_PALLET_ID; + pub const MaximumReasonLength: u32 = MAXIMUM_REASON_LENGTH; + pub const MaxApprovals: u32 = MAX_APPROVALS; } impl pallet_treasury::Config for Runtime { From fe570f604a7c2e9dec38f51525219e2438bedf5e Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:07:42 +0000 Subject: [PATCH 2/7] fix : update local testnet authorities (#390) --- node/src/chainspec/testnet.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/node/src/chainspec/testnet.rs b/node/src/chainspec/testnet.rs index fbdf9cff8..470188cd7 100644 --- a/node/src/chainspec/testnet.rs +++ b/node/src/chainspec/testnet.rs @@ -106,22 +106,22 @@ pub fn local_testnet_config(chain_id: u64) -> Result { wasm_binary, // Initial PoA authorities vec![ - authority_keys_from_seed("Alice//stash"), - authority_keys_from_seed("Bob//stash"), - authority_keys_from_seed("Charlie//stash"), - authority_keys_from_seed("Dave//stash"), - authority_keys_from_seed("Eve//stash"), + authority_keys_from_seed("Alice"), + authority_keys_from_seed("Bob"), + authority_keys_from_seed("Charlie"), + authority_keys_from_seed("Dave"), + authority_keys_from_seed("Eve"), ], vec![], // Sudo account - get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Alice"), // Pre-funded accounts vec![ - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), ], chain_id, combine_distributions(vec![ From edf4033b3ae8bfb69b8af4aa23f5c987aa24ce8a Mon Sep 17 00:00:00 2001 From: drewstone Date: Tue, 2 Jan 2024 08:59:24 -0600 Subject: [PATCH 3/7] Update primitives and extend roles to many DKG/TSS schemes (#375) * Update primitives and extend roles to many DKG/TSS schemes * Fmt * Remove DkgKeyType, add role type to phase data * Updates * Remove JobKey, DkgKeyType, add RoleType into maps instead * Fixes to tests, wip * Fix tests * Remove clones, clippy fix * Fmt * Fix clippy * clippy fix --------- Co-authored-by: Salman Pathan --- Cargo.lock | 1729 ++++++++++++----- node/src/chainspec/mainnet.rs | 2 +- node/src/chainspec/testnet.rs | 2 +- node/src/command.rs | 2 +- node/src/distributions/mainnet.rs | 5 +- node/src/distributions/mod.rs | 5 +- pallets/dkg/src/functions.rs | 26 +- pallets/dkg/src/tests.rs | 60 +- pallets/jobs/rpc/runtime-api/src/lib.rs | 13 +- pallets/jobs/src/benchmarking.rs | 13 +- pallets/jobs/src/functions.rs | 114 +- pallets/jobs/src/impls.rs | 8 +- pallets/jobs/src/lib.rs | 85 +- pallets/jobs/src/mock.rs | 21 +- pallets/jobs/src/rpc.rs | 6 +- pallets/jobs/src/tests.rs | 56 +- pallets/roles/src/impls.rs | 43 +- pallets/roles/src/lib.rs | 34 +- pallets/roles/src/mock.rs | 12 +- pallets/roles/src/tests.rs | 10 +- pallets/zksaas/src/tests.rs | 4 + precompiles/jobs/Jobs.sol | 4 +- precompiles/jobs/src/lib.rs | 136 +- precompiles/jobs/src/mock.rs | 16 +- precompiles/jobs/src/tests.rs | 1 + precompiles/staking/src/lib.rs | 2 +- primitives/src/{types/jobs.rs => jobs/mod.rs} | 265 +-- .../src/{traits/jobs.rs => jobs/traits.rs} | 13 +- primitives/src/jobs/tss.rs | 126 ++ primitives/src/jobs/zksaas.rs | 140 ++ primitives/src/lib.rs | 9 +- primitives/src/roles/mod.rs | 140 ++ .../src/{traits/roles.rs => roles/traits.rs} | 15 +- primitives/src/roles/tss.rs | 53 + primitives/src/roles/zksaas.rs | 45 + primitives/src/traits.rs | 2 - primitives/src/types.rs | 3 - primitives/src/types/roles.rs | 104 - runtime/mainnet/src/lib.rs | 17 +- runtime/testnet/src/lib.rs | 13 +- types/src/interfaces/lookup.ts | 12 +- types/src/interfaces/registry.ts | 6 +- types/src/interfaces/types-lookup.ts | 12 +- 43 files changed, 2278 insertions(+), 1106 deletions(-) rename primitives/src/{types/jobs.rs => jobs/mod.rs} (53%) rename primitives/src/{traits/jobs.rs => jobs/traits.rs} (92%) create mode 100644 primitives/src/jobs/tss.rs create mode 100644 primitives/src/jobs/zksaas.rs create mode 100644 primitives/src/roles/mod.rs rename primitives/src/{traits/roles.rs => roles/traits.rs} (83%) create mode 100644 primitives/src/roles/tss.rs create mode 100644 primitives/src/roles/zksaas.rs delete mode 100644 primitives/src/traits.rs delete mode 100644 primitives/src/types/roles.rs diff --git a/Cargo.lock b/Cargo.lock index 3d6ca0ee4..3c5ba49a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,6 +36,25 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", +] + [[package]] name = "aead" version = "0.5.2" @@ -46,6 +65,29 @@ dependencies = [ "generic-array 0.14.7", ] +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if", + "cipher 0.3.0", + "cpufeatures", + "opaque-debug 0.3.0", +] + [[package]] name = "aes" version = "0.8.3" @@ -53,24 +95,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures", ] +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead 0.4.3", + "aes 0.7.5", + "cipher 0.3.0", + "ctr 0.8.0", + "ghash 0.4.4", + "subtle", +] + [[package]] name = "aes-gcm" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", + "aead 0.5.2", + "aes 0.8.3", + "cipher 0.4.4", + "ctr 0.9.2", + "ghash 0.5.0", "subtle", ] +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug 0.3.0", +] + [[package]] name = "affix" version = "0.1.2" @@ -154,9 +230,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -174,37 +250,37 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.76" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "approx" @@ -238,6 +314,12 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + [[package]] name = "ark-bls12-381" version = "0.3.0" @@ -782,9 +864,9 @@ checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "array-bytes" -version = "6.2.2" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f840fb7195bcfc5e17ea40c26e5ce6d5b9ce5d584466e17703209657e459ae0" +checksum = "de17a919934ad8c5cc99a1a74de4e2dab95d6121a8f27f94755ff525b630382c" [[package]] name = "arrayref" @@ -822,13 +904,29 @@ dependencies = [ "term", ] +[[package]] +name = "asn1-rs" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" +dependencies = [ + "asn1-rs-derive 0.1.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "asn1-rs" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" dependencies = [ - "asn1-rs-derive", + "asn1-rs-derive 0.4.0", "asn1-rs-impl", "displaydoc", "nom", @@ -838,6 +936,18 @@ dependencies = [ "time", ] +[[package]] +name = "asn1-rs-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + [[package]] name = "asn1-rs-derive" version = "0.4.0" @@ -879,7 +989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" dependencies = [ "concurrent-queue", - "event-listener 4.0.1", + "event-listener 4.0.0", "event-listener-strategy", "futures-core", "pin-project-lite 0.2.13", @@ -891,11 +1001,11 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.1.2", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 2.1.0", + "futures-lite 2.0.1", "slab", ] @@ -933,18 +1043,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.2" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" +checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.1.2", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.0.1", "parking", "polling 3.3.1", - "rustix 0.38.28", + "rustix 0.38.25", "slab", "tracing", "windows-sys 0.52.0", @@ -961,11 +1071,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.2.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" dependencies = [ - "event-listener 4.0.1", + "event-listener 4.0.0", "event-listener-strategy", "pin-project-lite 0.2.13", ] @@ -994,7 +1104,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.28", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -1004,13 +1114,13 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.2", + "async-io 2.2.1", "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.28", + "rustix 0.38.25", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -1018,19 +1128,19 @@ dependencies = [ [[package]] name = "async-task" -version = "4.6.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d90cd0b264dfdd8eb5bad0a2c217c1f88fa96a8573f40e7b12de23fb468f46" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -1039,7 +1149,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "pharos", "rustc_version 0.4.0", ] @@ -1195,7 +1305,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.32.2", + "object 0.32.1", "rustc-demangle", ] @@ -1227,6 +1337,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base16ct" version = "0.2.0" @@ -1308,7 +1424,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -1463,6 +1579,16 @@ dependencies = [ "generic-array 0.14.7", ] +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding 0.2.1", + "cipher 0.2.5", +] + [[package]] name = "block-padding" version = "0.1.5" @@ -1485,11 +1611,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel 2.1.1", - "async-lock 3.2.0", + "async-lock 3.1.2", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.0.1", "piper", "tracing", ] @@ -1752,6 +1878,17 @@ dependencies = [ "libc", ] +[[package]] +name = "ccm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +dependencies = [ + "aead 0.3.2", + "cipher 0.2.5", + "subtle", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -1789,7 +1926,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures", ] @@ -1799,9 +1936,9 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ - "aead", + "aead 0.5.2", "chacha20", - "cipher", + "cipher 0.4.4", "poly1305", "zeroize", ] @@ -1834,6 +1971,24 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "cipher" version = "0.4.4" @@ -1882,9 +2037,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" dependencies = [ "clap_builder", "clap_derive", @@ -1892,9 +2047,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" dependencies = [ "anstream", "anstyle", @@ -1911,7 +2066,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2049,9 +2204,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] @@ -2098,9 +2253,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.6" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const-random" @@ -2148,9 +2303,9 @@ checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ "core-foundation-sys", "libc", @@ -2158,9 +2313,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core2" @@ -2396,20 +2551,21 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.17" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", + "memoffset 0.9.0", ] [[package]] name = "crossbeam-queue" -version = "0.3.10" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc6598521bb5a83d491e8c1fe51db7296019d2ca3cb93cc6c2a20369a4d78a2" +checksum = "b9bcf5bdbfdd6030fb4a1c497b5d5fc5921aa2f60d359a17e249c0e6df3de153" dependencies = [ "cfg-if", "crossbeam-utils", @@ -2417,9 +2573,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if", ] @@ -2430,6 +2586,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-bigint" version = "0.5.5" @@ -2473,13 +2641,22 @@ dependencies = [ "subtle", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher 0.3.0", +] + [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] @@ -2533,7 +2710,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2551,9 +2728,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.111" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9fc0c733f71e58dedf4f034cd2a266f80b94cc9ed512729e1798651b68c2cba" +checksum = "7129e341034ecb940c9072817cd9007974ea696844fc4dd582dc1653a7fbe2e8" dependencies = [ "cc", "cxxbridge-flags", @@ -2563,9 +2740,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.111" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51bc81d2664db24cf1d35405f66e18a85cffd4d49ab930c71a5c6342a410f38c" +checksum = "a2a24f3f5f8eed71936f21e570436f024f5c2e25628f7496aa7ccd03b90109d5" dependencies = [ "cc", "codespan-reporting", @@ -2573,24 +2750,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] name = "cxxbridge-flags" -version = "1.0.111" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8511afbe34ea242697784da5cb2c5d4a0afb224ca8b136bdf93bfe180cbe5884" +checksum = "06fdd177fc61050d63f67f5bd6351fac6ab5526694ea8e359cd9cd3b75857f44" [[package]] name = "cxxbridge-macro" -version = "1.0.111" +version = "1.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6888cd161769d65134846d4d4981d5a6654307cc46ec83fb917e530aea5f84" +checksum = "587663dd5fb3d10932c8aecfe7c844db1bcf0aee93eeab08fac13dc1212c2e7f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2662,7 +2839,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2695,7 +2872,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2724,6 +2901,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "der" version = "0.7.8" @@ -2734,13 +2922,27 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der-parser" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" +dependencies = [ + "asn1-rs 0.3.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "der-parser" version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.2", "displaydoc", "nom", "num-bigint", @@ -2750,9 +2952,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" dependencies = [ "powerfmt", ] @@ -2787,7 +2989,38 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", +] + +[[package]] +name = "derive_builder" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn 1.0.109", ] [[package]] @@ -2925,7 +3158,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -2966,9 +3199,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.43", + "syn 2.0.39", "termcolor", - "toml 0.8.2", + "toml 0.8.8", "walkdir", ] @@ -3035,18 +3268,30 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + [[package]] name = "ecdsa" version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ - "der", + "der 0.7.8", "digest 0.10.7", - "elliptic-curve", - "rfc6979", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", "signature 2.2.0", - "spki", + "spki 0.7.3", ] [[package]] @@ -3064,7 +3309,7 @@ version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ - "pkcs8", + "pkcs8 0.10.2", "signature 2.2.0", ] @@ -3118,21 +3363,43 @@ dependencies = [ "serde", ] +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", + "digest 0.10.7", + "ff 0.12.1", + "generic-array 0.14.7", + "group 0.12.1", + "hkdf", + "pem-rfc7468", + "pkcs8 0.9.0", + "rand_core 0.6.4", + "sec1 0.3.0", + "subtle", + "zeroize", +] + [[package]] name = "elliptic-curve" version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ - "base16ct", - "crypto-bigint", + "base16ct 0.2.0", + "crypto-bigint 0.5.5", "digest 0.10.7", - "ff", + "ff 0.13.0", "generic-array 0.14.7", - "group", - "pkcs8", + "group 0.13.0", + "pkcs8 0.10.2", "rand_core 0.6.4", - "sec1", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -3228,7 +3495,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -3249,7 +3516,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -3293,8 +3560,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "aes", - "ctr", + "aes 0.8.3", + "ctr 0.9.2", "digest 0.10.7", "hex", "hmac 0.12.1", @@ -3558,8 +3825,8 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.43", - "toml 0.8.2", + "syn 2.0.39", + "toml 0.8.8", "walkdir", ] @@ -3576,7 +3843,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -3590,7 +3857,7 @@ dependencies = [ "cargo_metadata 0.18.1", "chrono", "const-hex", - "elliptic-curve", + "elliptic-curve 0.13.8", "ethabi 18.0.0", "generic-array 0.14.7", "k256", @@ -3602,7 +3869,7 @@ dependencies = [ "serde", "serde_json", "strum 0.25.0", - "syn 2.0.43", + "syn 2.0.39", "tempfile", "thiserror", "tiny-keccak", @@ -3699,7 +3966,7 @@ dependencies = [ "coins-bip32", "coins-bip39", "const-hex", - "elliptic-curve", + "elliptic-curve 0.13.8", "eth-keystore", "ethers-core", "rand 0.8.5", @@ -3759,9 +4026,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "4.0.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f2cdcf274580f2d63697192d744727b3198894b1bf02923643bf59e2c26712" +checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" dependencies = [ "concurrent-queue", "parking", @@ -3774,7 +4041,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.1", + "event-listener 4.0.0", "pin-project-lite 0.2.13", ] @@ -3871,7 +4138,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", ] [[package]] @@ -3884,7 +4151,7 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -3953,7 +4220,7 @@ name = "fc-cli" version = "1.0.0-dev" source = "git+https://github.com/paritytech/frontier.git?branch=polkadot-v1.1.0#de5a3df59d3ada67c8cacdb79e607ad0b229ec5b" dependencies = [ - "clap 4.4.11", + "clap 4.4.10", "ethereum-types 0.14.1", "fc-db", "fp-rpc", @@ -3994,7 +4261,7 @@ dependencies = [ "fp-consensus", "fp-rpc", "fp-storage", - "futures 0.3.30", + "futures 0.3.29", "kvdb-rocksdb", "log", "parity-db", @@ -4022,7 +4289,7 @@ dependencies = [ "fc-storage", "fp-consensus", "fp-rpc", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "parking_lot 0.12.1", @@ -4051,7 +4318,7 @@ dependencies = [ "fp-evm", "fp-rpc", "fp-storage", - "futures 0.3.30", + "futures 0.3.29", "hex", "jsonrpsee", "libsecp256k1", @@ -4130,6 +4397,16 @@ dependencies = [ "libc", ] +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "ff" version = "0.13.0" @@ -4171,14 +4448,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", - "windows-sys 0.52.0", + "redox_syscall 0.3.5", + "windows-sys 0.48.0", ] [[package]] @@ -4188,7 +4465,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" dependencies = [ "either", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "num-traits", @@ -4451,9 +4728,9 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "Inflector", - "array-bytes 6.2.2", + "array-bytes 6.2.0", "chrono", - "clap 4.4.11", + "clap 4.4.10", "comfy-table", "frame-benchmarking", "frame-support", @@ -4501,7 +4778,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -4618,7 +4895,7 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -4630,7 +4907,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -4640,7 +4917,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -4723,7 +5000,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.38.28", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -4741,9 +5018,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -4756,9 +5033,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -4766,15 +5043,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -4795,9 +5072,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" @@ -4816,13 +5093,14 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.1.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" dependencies = [ "fastrand 2.0.1", "futures-core", "futures-io", + "memchr", "parking", "pin-project-lite 0.2.13", ] @@ -4839,13 +5117,13 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -4856,20 +5134,20 @@ checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", "rustls 0.20.9", - "webpki", + "webpki 0.22.4", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-timer" @@ -4883,9 +5161,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures 0.1.31", "futures-channel", @@ -4963,6 +5241,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug 0.3.0", + "polyval 0.5.3", +] + [[package]] name = "ghash" version = "0.5.0" @@ -4970,7 +5258,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug 0.3.0", - "polyval", + "polyval 0.6.1", ] [[package]] @@ -5032,13 +5320,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff 0.12.1", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "group" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ - "ff", + "ff 0.13.0", "rand_core 0.6.4", "subtle", ] @@ -5252,11 +5551,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -5283,9 +5582,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", @@ -5318,9 +5617,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -5333,7 +5632,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.13", - "socket2 0.5.5", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -5350,7 +5649,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.10", + "rustls 0.21.9", "rustls-native-certs", "tokio", "tokio-rustls", @@ -5436,10 +5735,10 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" dependencies = [ - "async-io 2.2.2", + "async-io 2.2.1", "core-foundation", "fnv", - "futures 0.3.30", + "futures 0.3.29", "if-addrs", "ipnet", "log", @@ -5574,6 +5873,25 @@ dependencies = [ "num-traits", ] +[[package]] +name = "interceptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand 0.8.5", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", +] + [[package]] name = "intx" version = "0.1.0" @@ -5622,7 +5940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix 0.38.28", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -5644,20 +5962,11 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" -dependencies = [ - "either", -] - [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -5843,8 +6152,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", "once_cell", "sha2 0.10.8", "signature 2.2.0", @@ -5943,9 +6252,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -5965,12 +6274,12 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libp2p" -version = "0.51.4" +version = "0.51.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f35eae38201a993ece6bdc823292d6abd1bffed1c4d0f4a3517d2bd8e1d917fe" +checksum = "f210d259724eae82005b5c48078619b7745edb7b76de370b03f8ba59ea103097" dependencies = [ "bytes", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "getrandom 0.2.11", "instant", @@ -5990,6 +6299,7 @@ dependencies = [ "libp2p-swarm", "libp2p-tcp", "libp2p-wasm-ext", + "libp2p-webrtc", "libp2p-websocket", "libp2p-yamux", "multiaddr", @@ -6028,7 +6338,7 @@ checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" dependencies = [ "either", "fnv", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "instant", "libp2p-identity", @@ -6054,7 +6364,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "libp2p-core", "log", "parking_lot 0.12.1", @@ -6070,7 +6380,7 @@ checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" dependencies = [ "asynchronous-codec", "either", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "libp2p-core", "libp2p-identity", @@ -6113,7 +6423,7 @@ dependencies = [ "bytes", "either", "fnv", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "instant", "libp2p-core", @@ -6137,7 +6447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" dependencies = [ "data-encoding", - "futures 0.3.30", + "futures 0.3.29", "if-watch", "libp2p-core", "libp2p-identity", @@ -6173,7 +6483,7 @@ checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e" dependencies = [ "bytes", "curve25519-dalek 3.2.0", - "futures 0.3.30", + "futures 0.3.29", "libp2p-core", "libp2p-identity", "log", @@ -6195,7 +6505,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e57759c19c28a73ef1eb3585ca410cefb72c1a709fcf6de1612a378e4219202" dependencies = [ "either", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "instant", "libp2p-core", @@ -6212,7 +6522,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" dependencies = [ "bytes", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "if-watch", "libp2p-core", @@ -6234,7 +6544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffdb374267d42dc5ed5bc53f6e601d4a64ac5964779c6e40bb9e4f14c1e30d5" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "instant", "libp2p-core", "libp2p-identity", @@ -6251,7 +6561,7 @@ checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296" dependencies = [ "either", "fnv", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "instant", "libp2p-core", @@ -6281,7 +6591,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "if-watch", "libc", @@ -6297,16 +6607,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "futures-rustls", "libp2p-core", "libp2p-identity", - "rcgen", + "rcgen 0.10.0", "ring 0.16.20", "rustls 0.20.9", "thiserror", - "webpki", - "x509-parser", + "webpki 0.22.4", + "x509-parser 0.14.0", "yasna", ] @@ -6316,7 +6626,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77dff9d32353a5887adb86c8afc1de1a94d9e8c3bc6df8b2201d7cdf5c848f43" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -6324,6 +6634,37 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "libp2p-webrtc" +version = "0.4.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dba48592edbc2f60b4bc7c10d65445b0c3964c07df26fdf493b6880d33be36f8" +dependencies = [ + "async-trait", + "asynchronous-codec", + "bytes", + "futures 0.3.29", + "futures-timer", + "hex", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-noise", + "log", + "multihash", + "quick-protobuf", + "quick-protobuf-codec", + "rand 0.8.5", + "rcgen 0.9.3", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "webrtc", +] + [[package]] name = "libp2p-websocket" version = "0.41.0" @@ -6331,7 +6672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" dependencies = [ "either", - "futures 0.3.30", + "futures 0.3.29", "futures-rustls", "libp2p-core", "log", @@ -6349,7 +6690,7 @@ version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "libp2p-core", "log", "thiserror", @@ -6499,9 +6840,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" @@ -6599,7 +6940,7 @@ dependencies = [ "macro_magic_core", "macro_magic_macros", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -6613,7 +6954,7 @@ dependencies = [ "macro_magic_core_macros", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -6624,7 +6965,7 @@ checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -6635,7 +6976,7 @@ checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" dependencies = [ "macro_magic_core", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -6727,7 +7068,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.28", + "rustix 0.38.25", ] [[package]] @@ -6757,6 +7098,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "memory-db" version = "0.32.0" @@ -6861,9 +7211,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -6993,7 +7343,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ "bytes", - "futures 0.3.30", + "futures 0.3.29", "log", "pin-project", "smallvec", @@ -7099,7 +7449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ "bytes", - "futures 0.3.30", + "futures 0.3.29", "log", "netlink-packet-core", "netlink-sys", @@ -7114,7 +7464,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" dependencies = [ "bytes", - "futures 0.3.30", + "futures 0.3.29", "libc", "log", "tokio", @@ -7135,6 +7485,7 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", + "memoffset 0.6.5", ] [[package]] @@ -7319,10 +7670,10 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -7351,27 +7702,36 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" +dependencies = [ + "asn1-rs 0.3.1", +] + [[package]] name = "oid-registry" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.2", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -7412,9 +7772,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.62" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -7433,7 +7793,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -7444,18 +7804,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.2.1+3.2.0" +version = "300.1.6+3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" +checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", @@ -7476,6 +7836,28 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2 0.10.8", +] + +[[package]] +name = "p384" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +dependencies = [ + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2 0.10.8", +] + [[package]] name = "pallet-airdrop-claims" version = "0.5.0" @@ -8514,7 +8896,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -8731,7 +9113,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -8911,6 +9293,15 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem-rfc7468" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -8948,7 +9339,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -8978,7 +9369,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "rustc_version 0.4.0", ] @@ -9012,7 +9403,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -9050,7 +9441,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -9082,21 +9473,31 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der 0.6.1", + "spki 0.6.0", +] + [[package]] name = "pkcs8" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ - "der", - "spki", + "der 0.7.8", + "spki 0.7.3", ] [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" @@ -9135,7 +9536,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite 0.2.13", - "rustix 0.38.28", + "rustix 0.38.25", "tracing", "windows-sys 0.52.0", ] @@ -9148,7 +9549,19 @@ checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.5.1", +] + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash 0.4.1", ] [[package]] @@ -9160,7 +9573,7 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.5.1", ] [[package]] @@ -9302,7 +9715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -9353,12 +9766,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.7", ] [[package]] @@ -9393,14 +9805,14 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -9439,7 +9851,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -9595,7 +10007,7 @@ dependencies = [ "thiserror", "tinyvec", "tracing", - "webpki", + "webpki 0.22.4", ] [[package]] @@ -9728,6 +10140,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rcgen" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" +dependencies = [ + "pem", + "ring 0.16.20", + "time", + "x509-parser 0.13.2", + "yasna", +] + [[package]] name = "rcgen" version = "0.10.0" @@ -9749,6 +10174,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -9786,7 +10220,7 @@ checksum = "2566c4bf6845f2c2e83b27043c3f5dfcd5ba8f2937d6c00dc009bfb51a079dc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -9885,9 +10319,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.23" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "base64 0.21.5", "bytes", @@ -9908,7 +10342,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite 0.2.13", - "rustls 0.21.10", + "rustls 0.21.9", "rustls-pemfile", "serde", "serde_json", @@ -9936,6 +10370,17 @@ dependencies = [ "quick-error", ] +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac 0.12.1", + "zeroize", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -9978,9 +10423,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" dependencies = [ "cc", "getrandom 0.2.11", @@ -10001,13 +10446,12 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" dependencies = [ "bitvec", "bytecheck", - "bytes", "hashbrown 0.12.3", "ptr_meta", "rend", @@ -10019,9 +10463,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" dependencies = [ "proc-macro2", "quote", @@ -10077,7 +10521,7 @@ version = "0.1.0" dependencies = [ "client-evm-tracing", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "rpc-core-types", "serde", @@ -10091,7 +10535,7 @@ version = "0.6.0" dependencies = [ "client-evm-tracing", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "rpc-core-types", "serde", @@ -10131,7 +10575,7 @@ dependencies = [ "fc-rpc", "fc-storage", "fp-rpc", - "futures 0.3.30", + "futures 0.3.29", "hex-literal", "jsonrpsee", "rpc-core-debug", @@ -10190,7 +10634,7 @@ dependencies = [ "fc-rpc-core", "fc-storage", "fp-rpc", - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "log", "rpc-core-trace", @@ -10235,13 +10679,24 @@ dependencies = [ "sp-std 8.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", ] +[[package]] +name = "rtcp" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + [[package]] name = "rtnetlink" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "log", "netlink-packet-route", "netlink-proto", @@ -10260,6 +10715,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rtp" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" +dependencies = [ + "async-trait", + "bytes", + "rand 0.8.5", + "serde", + "thiserror", + "webrtc-util", +] + [[package]] name = "rusqlite" version = "0.29.0" @@ -10358,15 +10827,28 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.12", - "windows-sys 0.52.0", + "linux-raw-sys 0.4.11", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring 0.16.20", + "sct 0.6.1", + "webpki 0.21.4", ] [[package]] @@ -10377,20 +10859,20 @@ checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", "ring 0.16.20", - "sct", - "webpki", + "sct 0.7.1", + "webpki 0.22.4", ] [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.6", "rustls-webpki", - "sct", + "sct 0.7.1", ] [[package]] @@ -10420,7 +10902,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.7", + "ring 0.17.6", "untrusted 0.9.0", ] @@ -10447,16 +10929,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "pin-project", "static_assertions", ] [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe-lock" @@ -10540,7 +11022,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher", + "cipher 0.4.4", ] [[package]] @@ -10569,7 +11051,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "ip_network", "libp2p", @@ -10596,7 +11078,7 @@ name = "sc-basic-authorship" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "parity-scale-codec", @@ -10656,7 +11138,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -10664,11 +11146,11 @@ name = "sc-cli" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "chrono", - "clap 4.4.11", + "clap 4.4.10", "fdlimit", - "futures 0.3.30", + "futures 0.3.29", "libp2p-identity", "log", "names", @@ -10704,7 +11186,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "fnv", - "futures 0.3.30", + "futures 0.3.29", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -10756,7 +11238,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "libp2p-identity", "log", @@ -10781,7 +11263,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "log", "parity-scale-codec", "sc-block-builder", @@ -10811,7 +11293,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "async-trait", "fork-tree", - "futures 0.3.30", + "futures 0.3.29", "log", "num-bigint", "num-rational", @@ -10845,7 +11327,7 @@ name = "sc-consensus-babe-rpc" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", @@ -10881,12 +11363,12 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "ahash 0.8.6", - "array-bytes 6.2.2", + "array-bytes 6.2.0", "async-trait", "dyn-clone", "finality-grandpa", "fork-tree", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "parity-scale-codec", @@ -10922,7 +11404,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "finality-grandpa", - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "log", "parity-scale-codec", @@ -10942,7 +11424,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "parity-scale-codec", @@ -11016,7 +11498,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "ansi_term", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "log", "sc-client-api", @@ -11031,7 +11513,7 @@ name = "sc-keystore" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "parking_lot 0.12.1", "serde_json", "sp-application-crypto 23.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", @@ -11045,14 +11527,14 @@ name = "sc-network" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "async-channel 1.9.0", "async-trait", "asynchronous-codec", "bytes", "either", "fnv", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "ip_network", "libp2p", @@ -11088,7 +11570,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "async-channel 1.9.0", "cid", - "futures 0.3.30", + "futures 0.3.29", "libp2p-identity", "log", "prost", @@ -11108,7 +11590,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "async-trait", "bitflags 1.3.2", - "futures 0.3.30", + "futures 0.3.29", "libp2p-identity", "parity-scale-codec", "prost-build", @@ -11124,7 +11606,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "ahash 0.8.6", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "libp2p", "log", @@ -11141,9 +11623,9 @@ name = "sc-network-light" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "async-channel 1.9.0", - "futures 0.3.30", + "futures 0.3.29", "libp2p-identity", "log", "parity-scale-codec", @@ -11162,9 +11644,9 @@ name = "sc-network-statement" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "async-channel 1.9.0", - "futures 0.3.30", + "futures 0.3.29", "libp2p", "log", "parity-scale-codec", @@ -11180,11 +11662,11 @@ name = "sc-network-sync" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "async-channel 1.9.0", "async-trait", "fork-tree", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "libp2p", "log", @@ -11214,8 +11696,8 @@ name = "sc-network-transactions" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", - "futures 0.3.30", + "array-bytes 6.2.0", + "futures 0.3.29", "libp2p", "log", "parity-scale-codec", @@ -11232,10 +11714,10 @@ name = "sc-offchain" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "bytes", "fnv", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "hyper", "hyper-rustls", @@ -11275,7 +11757,7 @@ name = "sc-rpc" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "log", "parity-scale-codec", @@ -11340,8 +11822,8 @@ name = "sc-rpc-spec-v2" version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", - "futures 0.3.30", + "array-bytes 6.2.0", + "futures 0.3.29", "futures-util", "hex", "jsonrpsee", @@ -11371,7 +11853,7 @@ dependencies = [ "async-trait", "directories", "exit-future", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "jsonrpsee", "log", @@ -11462,7 +11944,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "clap 4.4.11", + "clap 4.4.10", "fs4", "log", "sc-client-db", @@ -11495,7 +11977,7 @@ name = "sc-sysinfo" version = "6.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "libc", "log", "rand 0.8.5", @@ -11515,7 +11997,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "chrono", - "futures 0.3.30", + "futures 0.3.29", "libp2p", "log", "parking_lot 0.12.1", @@ -11565,7 +12047,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -11574,7 +12056,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "linked-hash-map", "log", @@ -11600,7 +12082,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "log", "parity-scale-codec", "serde", @@ -11616,7 +12098,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-channel 1.9.0", - "futures 0.3.30", + "futures 0.3.29", "futures-timer", "lazy_static", "log", @@ -11904,32 +12386,68 @@ dependencies = [ "sha2 0.10.8", ] +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring 0.16.20", + "untrusted 0.7.1", +] + [[package]] name = "sct" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.6", "untrusted 0.9.0", ] +[[package]] +name = "sdp" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" +dependencies = [ + "rand 0.8.5", + "substring", + "thiserror", + "url", +] + [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct 0.1.1", + "der 0.6.1", + "generic-array 0.14.7", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + [[package]] name = "sec1" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ - "base16ct", - "der", + "base16ct 0.2.0", + "der 0.7.8", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.10.2", "subtle", "zeroize", ] @@ -12091,7 +12609,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -12117,9 +12635,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -12281,6 +12799,10 @@ name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] [[package]] name = "signature" @@ -12504,9 +13026,9 @@ dependencies = [ [[package]] name = "snap" -version = "1.1.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" @@ -12514,12 +13036,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" dependencies = [ - "aes-gcm", + "aes-gcm 0.10.3", "blake2 0.10.6", "chacha20poly1305", "curve25519-dalek 4.1.1", "rand_core 0.6.4", - "ring 0.17.7", + "ring 0.17.6", "rustc_version 0.4.0", "sha2 0.10.8", "subtle", @@ -12554,7 +13076,7 @@ dependencies = [ "base64 0.13.1", "bytes", "flate2", - "futures 0.3.30", + "futures 0.3.29", "http", "httparse", "log", @@ -12608,7 +13130,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -12696,7 +13218,7 @@ name = "sp-blockchain" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -12715,7 +13237,7 @@ version = "0.10.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "async-trait", - "futures 0.3.30", + "futures 0.3.29", "log", "sp-core 21.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", "sp-inherents", @@ -12803,7 +13325,7 @@ dependencies = [ "bs58 0.4.0", "dyn-clonable", "ed25519-zebra", - "futures 0.3.30", + "futures 0.3.29", "hash-db 0.16.0", "hash256-std-hasher", "impl-serde", @@ -12840,7 +13362,7 @@ name = "sp-core" version = "21.0.0" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "array-bytes 6.2.2", + "array-bytes 6.2.0", "arrayvec 0.7.4", "bandersnatch_vrfs", "bitflags 1.3.2", @@ -12849,7 +13371,7 @@ dependencies = [ "bs58 0.5.0", "dyn-clonable", "ed25519-zebra", - "futures 0.3.30", + "futures 0.3.29", "hash-db 0.16.0", "hash256-std-hasher", "impl-serde", @@ -12917,7 +13439,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "quote", "sp-core-hashing 9.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0)", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -12937,7 +13459,7 @@ checksum = "c7f531814d2f16995144c74428830ccf7d94ff4a7749632b83ad8199b181140c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -12947,7 +13469,7 @@ source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -13007,7 +13529,7 @@ dependencies = [ "bytes", "ed25519 1.5.3", "ed25519-dalek 1.0.1", - "futures 0.3.30", + "futures 0.3.29", "libsecp256k1", "log", "parity-scale-codec", @@ -13078,7 +13600,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be3cdd67cc1d9c1db17c5cbc4ec4924054a8437009d167f21f6590797e4aa45" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "parity-scale-codec", "parking_lot 0.12.1", "sp-core 21.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -13283,7 +13805,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -13295,7 +13817,7 @@ dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -13374,7 +13896,7 @@ name = "sp-statement-store" version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ - "aes-gcm", + "aes-gcm 0.10.3", "curve25519-dalek 4.1.1", "ed25519-dalek 2.1.0", "hkdf", @@ -13565,7 +14087,7 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -13641,6 +14163,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der 0.6.1", +] + [[package]] name = "spki" version = "0.7.3" @@ -13648,16 +14180,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", - "der", + "der 0.7.8", ] [[package]] name = "sqlformat" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ - "itertools 0.12.0", + "itertools 0.11.0", "nom", "unicode_categories", ] @@ -13936,7 +14468,26 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.43", + "syn 2.0.39", +] + +[[package]] +name = "stun" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" +dependencies = [ + "base64 0.13.1", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring 0.16.20", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", ] [[package]] @@ -13980,7 +14531,7 @@ version = "4.0.0-dev" source = "git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.1.0#c8d2251cafadc108ba2f1f8a3208dc547ff38901" dependencies = [ "frame-system-rpc-runtime-api", - "futures 0.3.30", + "futures 0.3.29", "jsonrpsee", "log", "parity-scale-codec", @@ -14040,6 +14591,15 @@ dependencies = [ "wasm-opt", ] +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + [[package]] name = "subtle" version = "2.4.1" @@ -14063,7 +14623,7 @@ dependencies = [ "derivative", "either", "frame-metadata 15.1.0", - "futures 0.3.30", + "futures 0.3.29", "getrandom 0.2.11", "hex", "impl-serde", @@ -14097,7 +14657,7 @@ dependencies = [ "derivative", "either", "frame-metadata 16.0.0", - "futures 0.3.30", + "futures 0.3.29", "hex", "impl-serde", "jsonrpsee", @@ -14133,7 +14693,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata 0.29.0", - "syn 2.0.43", + "syn 2.0.39", "thiserror", "tokio", ] @@ -14153,7 +14713,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata 0.31.0", - "syn 2.0.43", + "syn 2.0.39", "thiserror", "tokio", ] @@ -14164,7 +14724,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aa72c1cb7e06772efa1476949c3f0e83718c79c1b2615eb510c076b012e9c84" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "futures-util", "serde", "serde_json", @@ -14184,7 +14744,7 @@ dependencies = [ "darling 0.20.3", "proc-macro-error", "subxt-codegen 0.29.0", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -14196,7 +14756,7 @@ dependencies = [ "darling 0.20.3", "proc-macro-error", "subxt-codegen 0.31.0", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -14303,9 +14863,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -14355,7 +14915,7 @@ dependencies = [ name = "tangle" version = "0.5.0" dependencies = [ - "clap 4.4.11", + "clap 4.4.10", "fc-api", "fc-cli", "fc-consensus", @@ -14372,7 +14932,7 @@ dependencies = [ "frame-benchmarking-cli", "frame-system", "frame-system-rpc-runtime-api", - "futures 0.3.30", + "futures 0.3.29", "hex-literal", "jsonrpsee", "log", @@ -14502,7 +15062,7 @@ dependencies = [ name = "tangle-relayer-gadget-cli" version = "0.0.1" dependencies = [ - "clap 4.4.11", + "clap 4.4.10", ] [[package]] @@ -14711,7 +15271,7 @@ name = "tangle-voter" version = "0.5.0" dependencies = [ "anyhow", - "clap 4.4.11", + "clap 4.4.10", "hex", "serde", "serde_json", @@ -14741,7 +15301,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix 0.38.28", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -14791,9 +15351,9 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] @@ -14815,18 +15375,18 @@ checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -14866,9 +15426,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", @@ -14886,9 +15446,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -14921,6 +15481,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -14938,9 +15508,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -14963,7 +15533,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -14982,7 +15552,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.10", + "rustls 0.21.9", "tokio", ] @@ -15006,7 +15576,7 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls 0.21.10", + "rustls 0.21.9", "tokio", "tokio-rustls", "tungstenite", @@ -15051,21 +15621,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.21.0", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -15085,9 +15655,20 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.1.0", "serde", @@ -15163,7 +15744,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -15362,15 +15943,15 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.5" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trybuild" -version = "1.0.86" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419ecd263363827c5730386f418715766f584e2f874d32c23c5b00bd9727e7e" +checksum = "196a58260a906cedb9bf6d8034b6379d0c11f552416960452f267402ceeddff1" dependencies = [ "basic-toml", "glob", @@ -15400,13 +15981,32 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls 0.21.10", + "rustls 0.21.9", "sha1", "thiserror", "url", "utf-8", ] +[[package]] +name = "turn" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" +dependencies = [ + "async-trait", + "base64 0.13.1", + "futures 0.3.29", + "log", + "md-5", + "rand 0.8.5", + "ring 0.16.20", + "stun", + "thiserror", + "tokio", + "webrtc-util", +] + [[package]] name = "twox-hash" version = "1.6.3" @@ -15456,7 +16056,7 @@ checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -15467,7 +16067,7 @@ checksum = "982ee4197351b5c9782847ef5ec1fdcaf50503fb19d68f9771adae314e72b492" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -15552,9 +16152,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" @@ -15595,6 +16195,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array 0.14.7", + "subtle", +] + [[package]] name = "universal-hash" version = "0.5.1" @@ -15668,6 +16278,9 @@ name = "uuid" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" +dependencies = [ + "getrandom 0.2.11", +] [[package]] name = "valuable" @@ -15699,6 +16312,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waitgroup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" +dependencies = [ + "atomic-waker", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -15757,7 +16379,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -15791,7 +16413,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15866,7 +16488,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "js-sys", "parking_lot 0.11.2", "pin-utils", @@ -16454,7 +17076,7 @@ source = "git+https://github.com/webb-tools/relayer?branch=develop#e71db7888b2ae dependencies = [ "async-trait", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "hex", "hex-literal", "tokio", @@ -16476,7 +17098,7 @@ dependencies = [ "quote", "serde", "serde_json", - "syn 2.0.43", + "syn 2.0.39", "toml 0.7.8", ] @@ -16547,7 +17169,7 @@ source = "git+https://github.com/webb-tools/pallet-eth2-light-client?tag=v0.5.0# dependencies = [ "anyhow", "async-trait", - "clap 4.4.11", + "clap 4.4.10", "dotenvy", "eth-types", "log", @@ -16596,7 +17218,7 @@ source = "git+https://github.com/webb-tools/relayer?branch=develop#e71db7888b2ae dependencies = [ "async-trait", "backoff", - "futures 0.3.30", + "futures 0.3.29", "native-tls", "sled", "subxt-signer", @@ -16709,7 +17331,7 @@ source = "git+https://github.com/webb-tools/relayer?branch=develop#e71db7888b2ae dependencies = [ "async-trait", "chrono", - "futures 0.3.30", + "futures 0.3.29", "reqwest", "serde", "typed-builder 0.16.2", @@ -16726,7 +17348,7 @@ source = "git+https://github.com/webb-tools/webb-rs.git#80a94b3d6ea5b0b60cfc48ff dependencies = [ "ethers-core", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -16736,7 +17358,7 @@ source = "git+https://github.com/webb-tools/relayer?branch=develop#e71db7888b2ae dependencies = [ "async-trait", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "hex", "impl-trait-for-tuples", "parking_lot 0.12.1", @@ -16886,7 +17508,7 @@ dependencies = [ "axum-client-ip", "build-data", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "native-tls", "serde", "serde_json", @@ -16929,7 +17551,7 @@ dependencies = [ "async-trait", "backoff", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "hex", "rand 0.8.5", "sled", @@ -16950,7 +17572,7 @@ source = "git+https://github.com/webb-tools/relayer?branch=develop#e71db7888b2ae dependencies = [ "chrono", "ethereum-types 0.14.1", - "futures 0.3.30", + "futures 0.3.29", "once_cell", "serde", "subxt-signer", @@ -17004,7 +17626,7 @@ dependencies = [ "backoff", "config", "derive_more", - "futures 0.3.30", + "futures 0.3.29", "glob", "hex", "hyper", @@ -17047,13 +17669,23 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring 0.16.20", + "untrusted 0.7.1", +] + [[package]] name = "webpki" version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring 0.17.7", + "ring 0.17.6", "untrusted 0.9.0", ] @@ -17063,7 +17695,7 @@ version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ - "webpki", + "webpki 0.22.4", ] [[package]] @@ -17072,6 +17704,214 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +[[package]] +name = "webrtc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "hex", + "interceptor", + "lazy_static", + "log", + "rand 0.8.5", + "rcgen 0.9.3", + "regex", + "ring 0.16.20", + "rtcp", + "rtp", + "rustls 0.19.1", + "sdp", + "serde", + "serde_json", + "sha2 0.10.8", + "stun", + "thiserror", + "time", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" +dependencies = [ + "bytes", + "derive_builder", + "log", + "thiserror", + "tokio", + "webrtc-sctp", + "webrtc-util", +] + +[[package]] +name = "webrtc-dtls" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a00f4242f2db33307347bd5be53263c52a0331c96c14292118c9a6bb48d267" +dependencies = [ + "aes 0.6.0", + "aes-gcm 0.10.3", + "async-trait", + "bincode", + "block-modes", + "byteorder", + "ccm", + "curve25519-dalek 3.2.0", + "der-parser 8.2.0", + "elliptic-curve 0.12.3", + "hkdf", + "hmac 0.12.1", + "log", + "p256", + "p384", + "rand 0.8.5", + "rand_core 0.6.4", + "rcgen 0.10.0", + "ring 0.16.20", + "rustls 0.19.1", + "sec1 0.3.0", + "serde", + "sha1", + "sha2 0.10.8", + "signature 1.6.4", + "subtle", + "thiserror", + "tokio", + "webpki 0.21.4", + "webrtc-util", + "x25519-dalek 2.0.0", + "x509-parser 0.13.2", +] + +[[package]] +name = "webrtc-ice" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand 0.8.5", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid 1.6.1", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" +dependencies = [ + "log", + "socket2 0.4.10", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f72e1650a8ae006017d1a5280efb49e2610c19ccc3c0905b03b648aee9554991" +dependencies = [ + "byteorder", + "bytes", + "rand 0.8.5", + "rtp", + "thiserror", +] + +[[package]] +name = "webrtc-sctp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand 0.8.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" +dependencies = [ + "aead 0.4.3", + "aes 0.7.5", + "aes-gcm 0.9.4", + "async-trait", + "byteorder", + "bytes", + "ctr 0.8.0", + "hmac 0.11.0", + "log", + "rtcp", + "rtp", + "sha-1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", +] + [[package]] name = "which" version = "4.4.2" @@ -17081,7 +17921,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.28", + "rustix 0.38.25", ] [[package]] @@ -17393,9 +18233,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.30" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] @@ -17417,7 +18257,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" dependencies = [ "async_io_stream", - "futures 0.3.30", + "futures 0.3.29", "js-sys", "log", "pharos", @@ -17461,19 +18301,38 @@ dependencies = [ "zeroize", ] +[[package]] +name = "x509-parser" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +dependencies = [ + "asn1-rs 0.3.1", + "base64 0.13.1", + "data-encoding", + "der-parser 7.0.0", + "lazy_static", + "nom", + "oid-registry 0.4.0", + "ring 0.16.20", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "x509-parser" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.2", "base64 0.13.1", "data-encoding", - "der-parser", + "der-parser 8.2.0", "lazy_static", "nom", - "oid-registry", + "oid-registry 0.6.1", "rusticata-macros", "thiserror", "time", @@ -17494,7 +18353,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" dependencies = [ - "futures 0.3.30", + "futures 0.3.29", "log", "nohash-hasher", "parking_lot 0.12.1", @@ -17531,22 +18390,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -17566,7 +18425,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.39", ] [[package]] @@ -17575,7 +18434,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ - "aes", + "aes 0.8.3", "byteorder", "bzip2", "constant_time_eq 0.1.5", diff --git a/node/src/chainspec/mainnet.rs b/node/src/chainspec/mainnet.rs index 8f6b6506a..babad6510 100644 --- a/node/src/chainspec/mainnet.rs +++ b/node/src/chainspec/mainnet.rs @@ -33,7 +33,7 @@ use sp_runtime::{ traits::{AccountIdConversion, IdentifyAccount, Verify}, BoundedVec, }; -use tangle_primitives::{BlockNumber, Signature}; +use tangle_primitives::types::{BlockNumber, Signature}; use tangle_runtime::{ AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, EVMChainIdConfig, Eth2ClientConfig, ImOnlineConfig, MaxVestingSchedules, Perbill, RuntimeGenesisConfig, diff --git a/node/src/chainspec/testnet.rs b/node/src/chainspec/testnet.rs index 470188cd7..3c8243889 100644 --- a/node/src/chainspec/testnet.rs +++ b/node/src/chainspec/testnet.rs @@ -33,7 +33,7 @@ use sp_runtime::{ }; use std::collections::BTreeMap; use tangle_crypto_primitives::crypto::AuthorityId as RoleKeyId; -use tangle_primitives::BlockNumber; +use tangle_primitives::types::BlockNumber; use tangle_testnet_runtime::{ AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, EVMChainIdConfig, EVMConfig, ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxNominations, MaxVestingSchedules, diff --git a/node/src/command.rs b/node/src/command.rs index 23b9220f7..ebe938651 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -21,7 +21,7 @@ use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use futures::TryFutureExt; use sc_cli::SubstrateCli; use sc_service::PartialComponents; -use tangle_primitives::Block; +use tangle_primitives::types::Block; trait IdentifyChain { fn is_mainnet(&self) -> bool; diff --git a/node/src/distributions/mainnet.rs b/node/src/distributions/mainnet.rs index f9b61c611..2cc3ac94c 100644 --- a/node/src/distributions/mainnet.rs +++ b/node/src/distributions/mainnet.rs @@ -15,7 +15,7 @@ // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . use std::str::FromStr; -use tangle_primitives::BlockNumber; +use tangle_primitives::types::BlockNumber; use tangle_runtime::UNIT; use super::testnet::{get_git_root, read_contents, read_contents_to_evm_accounts}; @@ -231,7 +231,8 @@ pub fn get_investor_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, } pub fn get_team_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, u128)> { - let team_accounts: Vec<(MultiAddress, u128)> = vec![]; + let team_accounts: Vec<(MultiAddress, u128)> = + vec![(MultiAddress::Native(AccountId32::from([0u8; 32])), 15_000_000 * ONE_TOKEN)]; team_accounts .into_iter() .map(|(address, value)| { diff --git a/node/src/distributions/mod.rs b/node/src/distributions/mod.rs index 5dddf6209..ef2a54f61 100644 --- a/node/src/distributions/mod.rs +++ b/node/src/distributions/mod.rs @@ -18,7 +18,10 @@ use self::mainnet::DistributionResult; use pallet_airdrop_claims::{MultiAddress, StatementKind}; -use tangle_primitives::{currency::EXISTENTIAL_DEPOSIT, Balance, BlockNumber}; +use tangle_primitives::{ + currency::EXISTENTIAL_DEPOSIT, + types::{Balance, BlockNumber}, +}; pub mod develop; pub mod mainnet; pub mod testnet; diff --git a/pallets/dkg/src/functions.rs b/pallets/dkg/src/functions.rs index ca4215425..0d9f16884 100644 --- a/pallets/dkg/src/functions.rs +++ b/pallets/dkg/src/functions.rs @@ -91,10 +91,11 @@ impl Pallet { /// /// Returns a `DispatchResult` indicating whether the DKG key verification was successful /// or encountered an error. - fn verify_generated_dkg_key(data: DKGResult) -> DispatchResult { - match data.key_type { - DkgKeyType::Ecdsa => Self::verify_generated_dkg_key_ecdsa(data), - DkgKeyType::Schnorr => Self::verify_generated_dkg_key_schnorr(data), + fn verify_generated_dkg_key(data: DKGTSSKeySubmissionResult) -> DispatchResult { + match data.signature_type { + DigitalSignatureType::Ecdsa => Self::verify_generated_dkg_key_ecdsa(data), + DigitalSignatureType::SchnorrSr25519 => Self::verify_generated_dkg_key_schnorr(data), + _ => Err(Error::::InvalidSignature.into()), // unimplemented } } @@ -111,7 +112,7 @@ impl Pallet { /// /// Returns a `DispatchResult` indicating whether the DKG key verification was successful or /// encountered an error. - fn verify_generated_dkg_key_ecdsa(data: DKGResult) -> DispatchResult { + fn verify_generated_dkg_key_ecdsa(data: DKGTSSKeySubmissionResult) -> DispatchResult { // Ensure participants and signatures are not empty ensure!(!data.participants.is_empty(), Error::::NoParticipantsFound); ensure!(!data.signatures.is_empty(), Error::::NoSignaturesFound); @@ -166,7 +167,7 @@ impl Pallet { /// /// Returns a `DispatchResult` indicating whether the DKG key verification was successful or /// encountered an error. - fn verify_generated_dkg_key_schnorr(data: DKGResult) -> DispatchResult { + fn verify_generated_dkg_key_schnorr(data: DKGTSSKeySubmissionResult) -> DispatchResult { // Ensure participants and signatures are not empty ensure!(!data.participants.is_empty(), Error::::NoParticipantsFound); ensure!(!data.signatures.is_empty(), Error::::NoSignaturesFound); @@ -222,10 +223,11 @@ impl Pallet { /// /// * `data` - The DKG signature result containing the message data, signature, signing key, and /// key type. - fn verify_dkg_signature(data: DKGSignatureResult) -> DispatchResult { - match data.key_type { - DkgKeyType::Ecdsa => Self::verify_dkg_signature_ecdsa(data), - DkgKeyType::Schnorr => Self::verify_dkg_signature_schnorr(data), + fn verify_dkg_signature(data: DKGTSSSignatureResult) -> DispatchResult { + match data.signature_type { + DigitalSignatureType::Ecdsa => Self::verify_dkg_signature_ecdsa(data), + DigitalSignatureType::SchnorrSr25519 => Self::verify_dkg_signature_schnorr(data), + _ => Err(Error::::InvalidSignature.into()), // unimplemented } } @@ -238,7 +240,7 @@ impl Pallet { /// # Arguments /// /// * `data` - The DKG signature result containing the message data and ECDSA signature. - fn verify_dkg_signature_ecdsa(data: DKGSignatureResult) -> DispatchResult { + fn verify_dkg_signature_ecdsa(data: DKGTSSSignatureResult) -> DispatchResult { // Recover the ECDSA public key from the provided data and signature let recovered_key = Self::recover_ecdsa_pub_key(&data.data, &data.signature) .map_err(|_| Error::::InvalidSignature)?; @@ -264,7 +266,7 @@ impl Pallet { /// /// * `data` - The DKG signature result containing the message data, Schnorr signature, and /// signing key. - fn verify_dkg_signature_schnorr(data: DKGSignatureResult) -> DispatchResult { + fn verify_dkg_signature_schnorr(data: DKGTSSSignatureResult) -> DispatchResult { // Convert the signature from bytes to sr25519::Signature let signature: sr25519::Signature = data .signature diff --git a/pallets/dkg/src/tests.rs b/pallets/dkg/src/tests.rs index 50940395a..adc61fca5 100644 --- a/pallets/dkg/src/tests.rs +++ b/pallets/dkg/src/tests.rs @@ -18,7 +18,9 @@ use frame_support::{assert_noop, assert_ok, error::BadOrigin}; use parity_scale_codec::Encode; use sp_core::{crypto::ByteArray, ecdsa, keccak_256, sr25519}; use sp_io::crypto::{ecdsa_generate, ecdsa_sign_prehashed, sr25519_generate, sr25519_sign}; -use tangle_primitives::jobs::{DKGResult, DKGSignatureResult, DkgKeyType, JobResult}; +use tangle_primitives::jobs::{ + DKGTSSKeySubmissionResult, DKGTSSSignatureResult, DigitalSignatureType, JobResult, +}; fn mock_pub_key_ecdsa() -> ecdsa::Public { ecdsa_generate(tangle_crypto_primitives::ROLE_KEY_TYPE, None) @@ -69,8 +71,8 @@ fn set_fees_works() { #[test] fn dkg_key_verifcation_works_for_ecdsa() { new_test_ext().execute_with(|| { - let job_to_verify = DKGResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::Ecdsa, key: vec![], participants: vec![], signatures: vec![], @@ -83,8 +85,8 @@ fn dkg_key_verifcation_works_for_ecdsa() { Error::::NoParticipantsFound ); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::Ecdsa, key: vec![], participants: vec![mock_pub_key_ecdsa().as_mut().to_vec()], signatures: vec![], @@ -101,8 +103,8 @@ fn dkg_key_verifcation_works_for_ecdsa() { let mut pub_key = mock_pub_key_ecdsa(); let signature = mock_signature_ecdsa(pub_key, pub_key); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::Ecdsa, key: vec![], participants: vec![mock_pub_key_ecdsa().as_mut().to_vec()], signatures: vec![signature.clone()], @@ -115,8 +117,8 @@ fn dkg_key_verifcation_works_for_ecdsa() { Error::::NotEnoughSigners ); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::Ecdsa, key: pub_key.0.to_vec(), participants: vec![pub_key.as_mut().to_vec()], signatures: vec![signature.clone(), signature.clone()], @@ -134,8 +136,8 @@ fn dkg_key_verifcation_works_for_ecdsa() { let mut participant_two = mock_pub_key_ecdsa(); let signature_one = mock_signature_ecdsa(participant_one, participant_one); let signature_two = mock_signature_ecdsa(participant_two, participant_one); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::Ecdsa, key: participant_one.to_raw_vec(), participants: vec![ participant_one.as_mut().to_vec(), @@ -153,8 +155,8 @@ fn dkg_key_verifcation_works_for_ecdsa() { #[test] fn dkg_key_verifcation_works_for_schnorr() { new_test_ext().execute_with(|| { - let job_to_verify = DKGResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::SchnorrSr25519, key: mock_pub_key_sr25519().to_vec(), participants: vec![], signatures: vec![], @@ -167,8 +169,8 @@ fn dkg_key_verifcation_works_for_schnorr() { Error::::NoParticipantsFound ); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::SchnorrSr25519, key: vec![], participants: vec![mock_pub_key_sr25519().as_mut().to_vec()], signatures: vec![], @@ -185,8 +187,8 @@ fn dkg_key_verifcation_works_for_schnorr() { let mut pub_key = mock_pub_key_sr25519(); let signature = mock_signature_sr25519(pub_key, pub_key); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::SchnorrSr25519, key: pub_key.to_vec(), participants: vec![mock_pub_key_sr25519().as_mut().to_vec()], signatures: vec![signature.clone()], @@ -199,8 +201,8 @@ fn dkg_key_verifcation_works_for_schnorr() { Error::::NotEnoughSigners ); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::SchnorrSr25519, key: pub_key.to_vec(), participants: vec![pub_key.as_mut().to_vec()], signatures: vec![signature.clone(), signature.clone()], @@ -218,8 +220,8 @@ fn dkg_key_verifcation_works_for_schnorr() { let mut participant_two = mock_pub_key_sr25519(); let signature_one = mock_signature_sr25519(participant_one, participant_one); let signature_two = mock_signature_sr25519(participant_two, participant_one); - let job_to_verify = DKGResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify = DKGTSSKeySubmissionResult { + signature_type: DigitalSignatureType::SchnorrSr25519, key: participant_one.to_raw_vec(), participants: vec![ participant_one.as_mut().to_vec(), @@ -241,8 +243,8 @@ fn dkg_signature_verifcation_works_ecdsa() { let pub_key = mock_pub_key_ecdsa(); let signature = mock_signature_ecdsa(pub_key, mock_pub_key_ecdsa()); - let job_to_verify: DKGSignatureResult = DKGSignatureResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify: DKGTSSSignatureResult = DKGTSSSignatureResult { + signature_type: DigitalSignatureType::Ecdsa, signature, data: pub_key.to_raw_vec(), signing_key: pub_key.to_raw_vec(), @@ -255,8 +257,8 @@ fn dkg_signature_verifcation_works_ecdsa() { ); let signature = mock_signature_ecdsa(pub_key, pub_key); - let job_to_verify: DKGSignatureResult = DKGSignatureResult { - key_type: DkgKeyType::Ecdsa, + let job_to_verify: DKGTSSSignatureResult = DKGTSSSignatureResult { + signature_type: DigitalSignatureType::Ecdsa, signature, data: pub_key.to_raw_vec(), signing_key: pub_key.to_raw_vec(), @@ -274,8 +276,8 @@ fn dkg_signature_verifcation_works_schnorr() { let pub_key = mock_pub_key_sr25519(); let signature = mock_signature_sr25519(pub_key, mock_pub_key_sr25519()); - let job_to_verify: DKGSignatureResult = DKGSignatureResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify: DKGTSSSignatureResult = DKGTSSSignatureResult { + signature_type: DigitalSignatureType::SchnorrSr25519, signature, data: pub_key.to_raw_vec(), signing_key: pub_key.to_raw_vec(), @@ -288,8 +290,8 @@ fn dkg_signature_verifcation_works_schnorr() { ); let signature = mock_signature_sr25519(pub_key, pub_key); - let job_to_verify: DKGSignatureResult = DKGSignatureResult { - key_type: DkgKeyType::Schnorr, + let job_to_verify: DKGTSSSignatureResult = DKGTSSSignatureResult { + signature_type: DigitalSignatureType::SchnorrSr25519, signature, data: pub_key.to_raw_vec(), signing_key: pub_key.to_raw_vec(), diff --git a/pallets/jobs/rpc/runtime-api/src/lib.rs b/pallets/jobs/rpc/runtime-api/src/lib.rs index d723227c6..d2082fc55 100644 --- a/pallets/jobs/rpc/runtime-api/src/lib.rs +++ b/pallets/jobs/rpc/runtime-api/src/lib.rs @@ -20,7 +20,10 @@ use parity_scale_codec::Codec; use sp_runtime::{traits::MaybeDisplay, Serialize}; -use tangle_primitives::jobs::{JobId, JobKey, RpcResponseJobsData, RpcResponsePhaseOneResult}; +use tangle_primitives::{ + jobs::{JobId, RpcResponseJobsData, RpcResponsePhaseOneResult}, + roles::RoleType, +}; sp_api::decl_runtime_apis! { pub trait JobsApi where @@ -46,25 +49,25 @@ sp_api::decl_runtime_apis! { /// /// # Arguments /// - /// * `job_key` - The key of the job. + /// * `role_type` - The role of the job. /// * `job_id` - The ID of the job. /// /// # Returns /// /// An optional `RpcResponseJobsData` containing the account ID of the job. - fn query_job_by_id(job_key: JobKey, job_id: JobId) -> Option>; + fn query_job_by_id(role_type: RoleType, job_id: JobId) -> Option>; /// Queries the phase one result of a job by its key and ID. /// /// # Arguments /// - /// * `job_key` - The key of the job. + /// * `role_type` - The role of the job. /// * `job_id` - The ID of the job. /// /// # Returns /// /// An `Option` containing the phase one result of the job, wrapped in an `RpcResponsePhaseOneResult`. - fn query_phase_one_by_id(job_key: JobKey, job_id: JobId) -> Option>; + fn query_phase_one_by_id(role_type: RoleType, job_id: JobId) -> Option>; /// Queries next job ID. /// diff --git a/pallets/jobs/src/benchmarking.rs b/pallets/jobs/src/benchmarking.rs index ec844fb5f..3489b89b7 100644 --- a/pallets/jobs/src/benchmarking.rs +++ b/pallets/jobs/src/benchmarking.rs @@ -6,7 +6,10 @@ use frame_support::traits::Currency; use frame_system::RawOrigin; use sp_runtime::traits::{Bounded, Zero}; use sp_std::vec; -use tangle_primitives::jobs::{DKGJobType, JobId, JobKey, JobType}; +use tangle_primitives::{ + jobs::{DKGJobType, JobId, JobType}, + roles::RoleType, +}; benchmarks! { // Benchmark submit_job function @@ -30,9 +33,9 @@ benchmarks! { job_type: JobType::DKG(DKGJobType { participants: vec![caller.clone(), validator2], threshold: 1, permitted_caller: None }), }; let _ = Pallet::::submit_job(RawOrigin::Signed(caller.clone()).into(), job); - let job_key: JobKey = JobKey::DKG; + let role_type: RoleType = RoleType::Tss(ThresholdSignatureRoleType::TssGG20); let job_id: JobId = 0; - }: _(RawOrigin::Signed(caller.clone()), job_key.clone(), job_id.clone(), vec![]) + }: _(RawOrigin::Signed(caller.clone()), role_type, job_id.clone(), vec![]) // Benchmark withdraw_rewards function withdraw_rewards { @@ -54,9 +57,9 @@ benchmarks! { job_type: JobType::DKG(DKGJobType { participants: vec![caller.clone(), validator2, validator3], threshold: 2, permitted_caller: None }), }; let _ = Pallet::::submit_job(RawOrigin::Signed(caller.clone()).into(), job); - let job_key: JobKey = JobKey::DKG; + let role_type: RoleType = RoleType::Tss(ThresholdSignatureRoleType::TssGG20); let job_id: JobId = 0; - }: _(RawOrigin::Signed(caller.clone()), job_key.clone(), job_id.clone(), caller.clone(), ValidatorOffenceType::Inactivity, vec![]) + }: _(RawOrigin::Signed(caller.clone()), role_type, job_id.clone(), caller.clone(), ValidatorOffenceType::Inactivity, vec![]) } // Define the module and associated types for the benchmarks diff --git a/pallets/jobs/src/functions.rs b/pallets/jobs/src/functions.rs index 5f88cd420..6d972e59a 100644 --- a/pallets/jobs/src/functions.rs +++ b/pallets/jobs/src/functions.rs @@ -1,8 +1,11 @@ use super::*; use sp_runtime::traits::Zero; -use tangle_primitives::jobs::{ - DKGSignatureResult, DKGTSSPhaseOneJobType, JobKey, JobType, JobWithResult, ZkSaaSCircuitResult, - ZkSaaSPhaseOneJobType, ZkSaaSProofResult, +use tangle_primitives::{ + jobs::{ + DKGTSSPhaseOneJobType, DKGTSSSignatureResult, JobType, JobWithResult, ZkSaaSCircuitResult, + ZkSaaSPhaseOneJobType, ZkSaaSProofResult, + }, + roles::RoleType, }; impl Pallet { @@ -14,19 +17,19 @@ impl Pallet { /// /// - `validator`: The account ID of the validator. /// - `job_id`: The ID of the job to associate with the validator. - /// - `job_key`: The job key of the job + /// - `role_type`: An identifier for the role type of the job. /// /// # Errors /// /// Returns a `DispatchError` if the operation fails. pub(crate) fn add_job_to_validator_lookup( validator: T::AccountId, - job_key: JobKey, + role_type: RoleType, job_id: JobId, ) -> DispatchResult { ValidatorJobIdLookup::::try_mutate(validator, |jobs| -> DispatchResult { let jobs = jobs.get_or_insert_with(Default::default); - jobs.push((job_key, job_id)); + jobs.push((role_type, job_id)); Ok(()) }) } @@ -86,7 +89,7 @@ impl Pallet { /// /// # Parameters /// - /// - `job_key`: A unique identifier for the job category. + /// - `role_type`: An identifier for the role type of the job. /// - `job_id`: A unique identifier for the job within the category. /// - `validator`: The account ID of the validator to be removed. /// @@ -109,16 +112,16 @@ impl Pallet { /// is returned. If the job is in phase two, a new job is generated with updated parameters and /// the fee is charged from validator. The original job's result is removed. pub fn try_validator_removal_from_job( - job_key: JobKey, + role_type: RoleType, job_id: JobId, validator: T::AccountId, ) -> DispatchResult { - SubmittedJobs::::try_mutate(job_key, job_id, |job_info| -> DispatchResult { + SubmittedJobs::::try_mutate(role_type, job_id, |job_info| -> DispatchResult { let job_info = job_info.as_mut().ok_or(Error::::JobNotFound)?; let phase1_result = if !job_info.job_type.is_phase_one() { Some( - KnownResults::::get(job_key, job_id) + KnownResults::::get(role_type, job_id) .ok_or(Error::::PhaseOneResultNotFound)?, ) } else { @@ -141,20 +144,20 @@ impl Pallet { ensure!(!threshold.is_zero(), Error::::NotEnoughValidators); } else { - // this phase1 result cannot be used + // This phase1 result cannot be used let phase1 = phase1_result.as_ref().ok_or(Error::::PhaseOneResultNotFound)?; - // generate a job to generate new key + // Generate a job to generate new key let job_id = Self::get_next_job_id()?; - match job_key { - // Case for JobKey::DKGSignature + match role_type { + // Case for RoleType::Tss // - Extract information from 'phase1' // - Create a new 'job_type' of DKGJobType with adjusted parameters (remove the // reported validator and reduce threshold) // - Charge the validator fee for job submission // - Store information about the submitted job in 'SubmittedJobs' - JobKey::DKGSignature => { + RoleType::Tss(role) => { let new_participants = phase1 .participants() .ok_or(Error::::InvalidJobPhase)? @@ -168,7 +171,7 @@ impl Pallet { ensure!(!new_threshold.is_zero(), Error::::NotEnoughValidators); let job_type = JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { - key_type: phase1.key_type.clone().expect("Checked above"), + role_type: role, participants: new_participants, threshold: new_threshold, permitted_caller: phase1.clone().permitted_caller, @@ -194,15 +197,15 @@ impl Pallet { job_type, fee, }; - SubmittedJobs::::insert(job_key, job_id, job_info); + SubmittedJobs::::insert(role_type, job_id, job_info); }, - // Case for JobKey::ZkSaasProve + // Case for RoleType::ZkSaas // - Extract information from 'phase1' // - Create a new 'job_type' of ZkSaasPhaseOneJobType with adjusted parameters // (remove the reported validator) // - Charge the validator fee for job submission // - Store information about the submitted job in 'SubmittedJobs' - JobKey::ZkSaaSProve => { + RoleType::ZkSaaS(role) => { let new_participants = phase1 .participants() .ok_or(Error::::InvalidJobPhase)? @@ -213,15 +216,15 @@ impl Pallet { .job_type .get_phase_one_id() .ok_or(Error::::PhaseOneResultNotFound)?; - let phase_one = - SubmittedJobs::::get(JobKey::ZkSaaSCircuit, phase_one_id) - .ok_or(Error::::JobNotFound)?; + let phase_one = SubmittedJobs::::get(role_type, phase_one_id) + .ok_or(Error::::JobNotFound)?; let system = match phase_one.job_type { JobType::ZkSaaSPhaseOne(ref info) => info.system.clone(), _ => return Err(Error::::JobNotFound.into()), }; let job_type = JobType::ZkSaaSPhaseOne(ZkSaaSPhaseOneJobType { + role_type: role, participants: new_participants, system, permitted_caller: phase1.clone().permitted_caller, @@ -247,7 +250,7 @@ impl Pallet { job_type, fee, }; - SubmittedJobs::::insert(job_key, job_id, job_info); + SubmittedJobs::::insert(role_type, job_id, job_info); }, _ => { // The phase one cases are handled above @@ -255,19 +258,19 @@ impl Pallet { }; // the old results are not useful since a participant has left, remove from storage - KnownResults::::remove(job_key, job_id); + KnownResults::::remove(role_type, job_id); } Ok(()) }) } pub fn verify_dkg_job_result( - job_key: JobKey, + role_type: RoleType, job_info: &JobInfoOf, - info: DKGResult, + info: DKGTSSKeySubmissionResult, ) -> Result, DispatchError> { // sanity check, does job and result type match - ensure!(job_key == JobKey::DKG, Error::::ResultNotExpectedType); + ensure!(role_type.is_dkg_tss(), Error::::ResultNotExpectedType); // ensure the participants are the expected participants from job let participants = job_info @@ -278,17 +281,17 @@ impl Pallet { let mut participant_keys: Vec> = Default::default(); for participant in participants.clone() { - let key = T::RolesHandler::get_validator_metadata(participant, job_key); + let key = T::RolesHandler::get_validator_metadata(participant, role_type); ensure!(key.is_some(), Error::::ValidatorMetadataNotFound); participant_keys.push(key.expect("checked above").get_authority_key()); } - let job_result = JobResult::DKGPhaseOne(DKGResult { + let job_result = JobResult::DKGPhaseOne(DKGTSSKeySubmissionResult { key: info.key.clone(), signatures: info.signatures, participants: participant_keys, threshold: job_info.job_type.clone().get_threshold().expect("Checked before"), - key_type: info.key_type.clone(), + signature_type: info.signature_type.clone(), }); T::MPCHandler::verify(JobWithResult { @@ -303,19 +306,18 @@ impl Pallet { job_type: job_info.job_type.clone(), permitted_caller: job_info.job_type.clone().get_permitted_caller(), result: info.key, - key_type: Some(info.key_type), }; Ok(result) } pub fn verify_dkg_signature_job_result( - job_key: JobKey, + role_type: RoleType, job_info: &JobInfoOf, - info: DKGSignatureResult, + info: DKGTSSSignatureResult, ) -> DispatchResult { let now = >::block_number(); // sanity check, does job and result type match - ensure!(job_key == JobKey::DKGSignature, Error::::ResultNotExpectedType); + ensure!(role_type.is_dkg_tss(), Error::::ResultNotExpectedType); let existing_result_id = job_info .job_type @@ -323,11 +325,9 @@ impl Pallet { .get_phase_one_id() .ok_or(Error::::InvalidJobPhase)?; // Ensure the result exists - let phase_one_result = KnownResults::::get( - job_info.job_type.clone().get_previous_phase_job_key().unwrap(), - existing_result_id, - ) - .ok_or(Error::::PreviousResultNotFound)?; + let phase_one_result = + KnownResults::::get(job_info.job_type.get_role_type(), existing_result_id) + .ok_or(Error::::PreviousResultNotFound)?; // Validate existing result ensure!(phase_one_result.expiry >= now, Error::::ResultExpired); @@ -337,7 +337,7 @@ impl Pallet { let participants = phase_one_result.participants().ok_or(Error::::InvalidJobPhase)?; for participant in participants { - let key = T::RolesHandler::get_validator_metadata(participant, job_key); + let key = T::RolesHandler::get_validator_metadata(participant, role_type); ensure!(key.is_some(), Error::::ValidatorMetadataNotFound); let pub_key = sp_core::ecdsa::Public::from_slice( &key.expect("checked above").get_authority_key()[0..33], @@ -346,18 +346,15 @@ impl Pallet { participant_keys.push(pub_key); } - let job_result = JobResult::DKGPhaseTwo(DKGSignatureResult { + let job_result = JobResult::DKGPhaseTwo(DKGTSSSignatureResult { signature: info.signature, data: info.data, signing_key: phase_one_result.result, - key_type: info.key_type, + signature_type: info.signature_type, }); let phase_one_job_info = KnownResults::::get( - job_info - .job_type - .get_previous_phase_job_key() - .ok_or(Error::::InvalidJobPhase)?, + job_info.job_type.get_role_type(), job_info.job_type.get_phase_one_id().ok_or(Error::::InvalidJobPhase)?, ) .ok_or(Error::::JobNotFound)?; @@ -370,13 +367,13 @@ impl Pallet { } pub fn verify_zksaas_circuit_job_result( - job_key: JobKey, + role_type: RoleType, job_id: JobId, job_info: &JobInfoOf, _info: ZkSaaSCircuitResult, ) -> Result, DispatchError> { // sanity check, does job and result type match - ensure!(job_key == JobKey::ZkSaaSCircuit, Error::::ResultNotExpectedType); + ensure!(role_type.is_zksaas(), Error::::ResultNotExpectedType); // ensure the participants are the expected participants from job let participants = job_info @@ -387,7 +384,7 @@ impl Pallet { let mut participant_keys: Vec = Default::default(); for participant in participants.clone() { - let key = T::RolesHandler::get_validator_metadata(participant, job_key); + let key = T::RolesHandler::get_validator_metadata(participant, role_type); ensure!(key.is_some(), Error::::ValidatorMetadataNotFound); let pub_key = sp_core::ecdsa::Public::from_slice( &key.expect("checked above").get_authority_key()[0..33], @@ -414,19 +411,19 @@ impl Pallet { // No data in the result result: Vec::new(), permitted_caller: job_info.job_type.clone().get_permitted_caller(), - key_type: None, }; Ok(result) } pub fn verify_zksaas_prove_job_result( - job_key: JobKey, + role_type: RoleType, job_info: &JobInfoOf, info: ZkSaaSProofResult, ) -> DispatchResult { let now = >::block_number(); // sanity check, does job and result type match - ensure!(job_key == JobKey::DKGSignature, Error::::ResultNotExpectedType); + ensure!(role_type.is_zksaas(), Error::::ResultNotExpectedType); + ensure!(role_type == job_info.job_type.get_role_type(), Error::::ResultNotExpectedType); let existing_result_id = job_info .job_type @@ -434,11 +431,9 @@ impl Pallet { .get_phase_one_id() .ok_or(Error::::InvalidJobPhase)?; // Ensure the result exists - let phase_one_result = KnownResults::::get( - job_info.job_type.clone().get_previous_phase_job_key().unwrap(), - existing_result_id, - ) - .ok_or(Error::::PreviousResultNotFound)?; + let phase_one_result = + KnownResults::::get(job_info.job_type.get_role_type(), existing_result_id) + .ok_or(Error::::PreviousResultNotFound)?; // Validate existing result ensure!(phase_one_result.expiry >= now, Error::::ResultExpired); @@ -446,10 +441,7 @@ impl Pallet { let job_result = JobResult::ZkSaaSPhaseTwo(info); let phase_one_job_info = SubmittedJobs::::get( - job_info - .job_type - .get_previous_phase_job_key() - .ok_or(Error::::InvalidJobPhase)?, + role_type, job_info.job_type.get_phase_one_id().ok_or(Error::::InvalidJobPhase)?, ) .ok_or(Error::::JobNotFound)?; diff --git a/pallets/jobs/src/impls.rs b/pallets/jobs/src/impls.rs index 67c4e9102..e17600c2c 100644 --- a/pallets/jobs/src/impls.rs +++ b/pallets/jobs/src/impls.rs @@ -1,5 +1,5 @@ use super::*; -use tangle_primitives::traits::jobs::JobsHandler; +use tangle_primitives::{jobs::traits::JobsHandler, roles::RoleType}; /// A trait that handles various aspects of jobs for a validator. impl JobsHandler for Pallet { @@ -12,7 +12,7 @@ impl JobsHandler for Pallet { /// # Returns /// /// Returns a vector of `JobId` representing the active jobs of the validator. - fn get_active_jobs(validator: T::AccountId) -> Vec<(JobKey, JobId)> { + fn get_active_jobs(validator: T::AccountId) -> Vec<(RoleType, JobId)> { if let Some(jobs) = ValidatorJobIdLookup::::get(validator) { return jobs } @@ -31,9 +31,9 @@ impl JobsHandler for Pallet { /// Returns a `DispatchResult` indicating success or an error if the operation fails. fn exit_from_known_set( validator: T::AccountId, - job_key: JobKey, + role_type: RoleType, job_id: JobId, ) -> DispatchResult { - Self::try_validator_removal_from_job(job_key, job_id, validator) + Self::try_validator_removal_from_job(role_type, job_id, validator) } } diff --git a/pallets/jobs/src/lib.rs b/pallets/jobs/src/lib.rs index bf9b96802..29ddc9353 100644 --- a/pallets/jobs/src/lib.rs +++ b/pallets/jobs/src/lib.rs @@ -31,11 +31,11 @@ use sp_runtime::{ }; use sp_std::{prelude::*, vec::Vec}; use tangle_primitives::{ - jobs::{DKGResult, JobId, JobInfo, JobKey, JobResult, PhaseOneResult, ValidatorOffenceType}, - traits::{ - jobs::{JobToFee, MPCHandler}, - roles::RolesHandler, + jobs::{ + traits::{JobToFee, MPCHandler}, + DKGTSSKeySubmissionResult, JobId, JobInfo, JobResult, PhaseOneResult, ValidatorOffenceType, }, + roles::traits::RolesHandler, }; mod functions; @@ -62,6 +62,7 @@ pub use weights::WeightInfo; #[frame_support::pallet] pub mod module { use super::*; + use tangle_primitives::roles::RoleType; #[pallet::config] pub trait Config: frame_system::Config { @@ -128,9 +129,9 @@ pub mod module { #[pallet::generate_deposit(fn deposit_event)] pub enum Event { /// A new job has been submitted - JobSubmitted { job_id: JobId, job_key: JobKey, details: JobSubmissionOf }, + JobSubmitted { job_id: JobId, role_type: RoleType, details: JobSubmissionOf }, /// A new job result has been submitted - JobResultSubmitted { job_id: JobId, job_key: JobKey }, + JobResultSubmitted { job_id: JobId, role_type: RoleType }, /// validator has earned reward ValidatorRewarded { id: T::AccountId, reward: BalanceOf }, } @@ -139,14 +140,18 @@ pub mod module { #[pallet::storage] #[pallet::getter(fn submitted_jobs)] pub type SubmittedJobs = - StorageDoubleMap<_, Twox64Concat, JobKey, Blake2_128Concat, JobId, JobInfoOf>; + StorageDoubleMap<_, Twox64Concat, RoleType, Blake2_128Concat, JobId, JobInfoOf>; + + #[pallet::storage] + #[pallet::getter(fn submitted_jobs_role)] + pub type SubmittedJobsRole = StorageMap<_, Twox64Concat, JobId, RoleType>; #[pallet::storage] #[pallet::getter(fn known_results)] pub type KnownResults = StorageDoubleMap< _, Twox64Concat, - JobKey, + RoleType, Blake2_128Concat, JobId, PhaseOneResult>, @@ -155,7 +160,7 @@ pub mod module { #[pallet::storage] #[pallet::getter(fn validator_job_id_lookup)] pub type ValidatorJobIdLookup = - StorageMap<_, Twox64Concat, T::AccountId, Vec<(JobKey, JobId)>>; + StorageMap<_, Twox64Concat, T::AccountId, Vec<(RoleType, JobId)>>; #[pallet::storage] #[pallet::getter(fn validator_rewards)] @@ -206,7 +211,7 @@ pub mod module { let now = >::block_number(); let job_id = Self::get_next_job_id()?; - let job_key = job.job_type.get_job_key(); + let role_type = job.job_type.get_role_type(); // Ensure the job can be processed if job.job_type.is_phase_one() { @@ -218,12 +223,12 @@ pub mod module { for participant in participants { ensure!( - T::RolesHandler::is_validator(participant.clone(), job_key), + T::RolesHandler::is_validator(participant.clone(), role_type), Error::::InvalidValidator ); // Add record for easy lookup - Self::add_job_to_validator_lookup(participant, job_key, job_id)?; + Self::add_job_to_validator_lookup(participant, role_type, job_id)?; } // Sanity check ensure threshold is valid @@ -234,11 +239,9 @@ pub mod module { let existing_result_id = job.job_type.clone().get_phase_one_id().ok_or(Error::::InvalidJobPhase)?; // Ensure the result exists - let result = KnownResults::::get( - job.job_type.clone().get_previous_phase_job_key().unwrap(), - existing_result_id, - ) - .ok_or(Error::::PreviousResultNotFound)?; + let result = + KnownResults::::get(job.job_type.get_role_type(), existing_result_id) + .ok_or(Error::::PreviousResultNotFound)?; // Validate existing result ensure!(result.expiry >= now, Error::::ResultExpired); @@ -247,12 +250,12 @@ pub mod module { let participants = result.participants().ok_or(Error::::InvalidJobPhase)?; for participant in participants { ensure!( - T::RolesHandler::is_validator(participant.clone(), job_key), + T::RolesHandler::is_validator(participant.clone(), role_type), Error::::InvalidValidator ); // add record for easy lookup - Self::add_job_to_validator_lookup(participant, job_key, job_id)?; + Self::add_job_to_validator_lookup(participant, role_type, job_id)?; } // ensure the account can use the result @@ -280,9 +283,10 @@ pub mod module { job_type: job.job_type.clone(), fee, }; - SubmittedJobs::::insert(job_key, job_id, job_info); + SubmittedJobs::::insert(role_type, job_id, job_info); + SubmittedJobsRole::::insert(job_id, role_type); - Self::deposit_event(Event::JobSubmitted { job_id, job_key, details: job }); + Self::deposit_event(Event::JobSubmitted { job_id, role_type, details: job }); Ok(()) } @@ -292,7 +296,7 @@ pub mod module { /// # Parameters /// /// - `origin`: The origin of the call (typically a signed account). - /// - `job_key`: A unique identifier for the job category. + /// - `role_type`: An identifier for the role type of the job. /// - `job_id`: A unique identifier for the job within the category. /// - `result`: A vector containing the result of the job. /// @@ -317,7 +321,7 @@ pub mod module { #[pallet::weight(T::WeightInfo::submit_job_result())] pub fn submit_job_result( origin: OriginFor, - job_key: JobKey, + role_type: RoleType, job_id: JobId, result: JobResult, ) -> DispatchResult { @@ -325,7 +329,7 @@ pub mod module { // Ensure the job exists let job_info = - SubmittedJobs::::get(job_key, job_id).ok_or(Error::::JobNotFound)?; + SubmittedJobs::::get(role_type, job_id).ok_or(Error::::JobNotFound)?; let participants = match &result { JobResult::DKGPhaseOne(_) | JobResult::ZkSaaSPhaseOne(_) => job_info .job_type @@ -340,7 +344,7 @@ pub mod module { .ok_or(Error::::InvalidJobPhase)?; // Ensure the result exists let phase_one_result = KnownResults::::get( - job_info.job_type.clone().get_previous_phase_job_key().unwrap(), + job_info.job_type.get_role_type(), existing_result_id, ) .ok_or(Error::::PreviousResultNotFound)?; @@ -351,19 +355,19 @@ pub mod module { // Handle based on job result match result { JobResult::DKGPhaseOne(info) => { - let result = Self::verify_dkg_job_result(job_key, &job_info, info)?; - KnownResults::::insert(job_key, job_id, result); + let result = Self::verify_dkg_job_result(role_type, &job_info, info)?; + KnownResults::::insert(role_type, job_id, result); }, JobResult::DKGPhaseTwo(info) => { - Self::verify_dkg_signature_job_result(job_key, &job_info, info)?; + Self::verify_dkg_signature_job_result(role_type, &job_info, info)?; }, JobResult::ZkSaaSPhaseOne(info) => { let result = - Self::verify_zksaas_circuit_job_result(job_key, job_id, &job_info, info)?; - KnownResults::::insert(job_key, job_id, result); + Self::verify_zksaas_circuit_job_result(role_type, job_id, &job_info, info)?; + KnownResults::::insert(role_type, job_id, result); }, JobResult::ZkSaaSPhaseTwo(info) => { - Self::verify_zksaas_prove_job_result(job_key, &job_info, info)?; + Self::verify_zksaas_prove_job_result(role_type, &job_info, info)?; }, }; @@ -378,9 +382,10 @@ pub mod module { }); } - SubmittedJobs::::remove(job_key, job_id); + SubmittedJobs::::remove(role_type, job_id); + SubmittedJobsRole::::remove(job_id); - Self::deposit_event(Event::JobResultSubmitted { job_id, job_key }); + Self::deposit_event(Event::JobResultSubmitted { job_id, role_type }); Ok(()) } @@ -428,7 +433,7 @@ pub mod module { /// # Parameters /// /// - `origin`: The origin of the call (typically a signed account). - /// - `job_key`: A unique identifier for the job category. + /// - `role_type`: An identifier for the role /// - `job_id`: A unique identifier for the job within the category. /// - `validator`: The account ID of the inactive validator. /// - `offence`: The type of offence committed by the validator. @@ -456,7 +461,7 @@ pub mod module { #[pallet::weight(T::WeightInfo::report_inactive_validator())] pub fn report_inactive_validator( origin: OriginFor, - job_key: JobKey, + role_type: RoleType, job_id: JobId, validator: T::AccountId, offence: ValidatorOffenceType, @@ -466,13 +471,13 @@ pub mod module { // Remove the validator from the job let job_info = - SubmittedJobs::::get(job_key, job_id).ok_or(Error::::JobNotFound)?; + SubmittedJobs::::get(role_type, job_id).ok_or(Error::::JobNotFound)?; let mut phase1_result: Option> = None; // If phase2, fetch phase1 result if !job_info.job_type.is_phase_one() { - let result = KnownResults::::get(job_key, job_id) + let result = KnownResults::::get(role_type, job_id) .ok_or(Error::::PhaseOneResultNotFound)?; phase1_result = Some(result); } @@ -492,7 +497,7 @@ pub mod module { // T::RolesHandler::report_offence(validator.clone(), offence)?; // Trigger validator removal - Self::try_validator_removal_from_job(job_key, job_id, validator)?; + Self::try_validator_removal_from_job(role_type, job_id, validator)?; Ok(()) } @@ -519,13 +524,13 @@ pub mod module { #[pallet::weight(T::WeightInfo::withdraw_rewards())] pub fn set_permitted_caller( origin: OriginFor, - job_key: JobKey, + role_type: RoleType, job_id: JobId, new_permitted_caller: T::AccountId, ) -> DispatchResult { let caller = ensure_signed(origin)?; - KnownResults::::try_mutate(job_key, job_id, |job| -> DispatchResult { + KnownResults::::try_mutate(role_type, job_id, |job| -> DispatchResult { let job = job.as_mut().ok_or(Error::::JobNotFound)?; // ensure the caller is the current permitted caller diff --git a/pallets/jobs/src/mock.rs b/pallets/jobs/src/mock.rs index e70c6a446..04fd28548 100644 --- a/pallets/jobs/src/mock.rs +++ b/pallets/jobs/src/mock.rs @@ -33,7 +33,7 @@ use sp_std::sync::Arc; use tangle_primitives::{ currency::UNIT, jobs::*, - roles::{RoleTypeMetadata, TssRoleMetadata}, + roles::{RoleType, RoleTypeMetadata, TssRoleMetadata}, }; impl frame_system::Config for Runtime { @@ -118,7 +118,7 @@ impl JobToFee for MockJobToFeeHandler { pub struct MockRolesHandler; impl RolesHandler for MockRolesHandler { - fn is_validator(address: AccountId32, _role_type: JobKey) -> bool { + fn is_validator(address: AccountId32, _role_type: RoleType) -> bool { let validators = [ AccountId32::new([1u8; 32]), AccountId32::new([2u8; 32]), @@ -133,15 +133,22 @@ impl RolesHandler for MockRolesHandler { Ok(()) } - fn get_validator_metadata(address: AccountId32, _job_key: JobKey) -> Option { + fn get_validator_metadata( + address: AccountId32, + role_type: RoleType, + ) -> Option { let mock_err_account = AccountId32::new([100u8; 32]); if address == mock_err_account { None } else { - Some(RoleTypeMetadata::Tss(TssRoleMetadata { - key_type: DkgKeyType::Ecdsa, - authority_key: mock_pub_key().to_raw_vec(), - })) + match role_type { + RoleType::Tss(threshold_signature_role) => + Some(RoleTypeMetadata::Tss(TssRoleMetadata { + role_type: threshold_signature_role, + authority_key: mock_pub_key().to_raw_vec(), + })), + _ => None, + } } } } diff --git a/pallets/jobs/src/rpc.rs b/pallets/jobs/src/rpc.rs index e47010832..510bb54c0 100644 --- a/pallets/jobs/src/rpc.rs +++ b/pallets/jobs/src/rpc.rs @@ -24,11 +24,11 @@ impl Pallet { if let Some(jobs_list) = ValidatorJobIdLookup::::get(validator) { let mut jobs: Vec> = vec![]; - for (job_key, job_id) in jobs_list.iter() { - if let Some(job_info) = SubmittedJobs::::get(job_key, job_id) { + for (role_type, job_id) in jobs_list.iter() { + if let Some(job_info) = SubmittedJobs::::get(role_type, job_id) { if !job_info.job_type.is_phase_one() { let result = KnownResults::::get( - job_info.job_type.get_previous_phase_job_key().unwrap(), + job_info.job_type.get_role_type(), job_info.job_type.clone().get_phase_one_id().unwrap(), ) .unwrap(); diff --git a/pallets/jobs/src/tests.rs b/pallets/jobs/src/tests.rs index c4cdc74e1..1a8e5969d 100644 --- a/pallets/jobs/src/tests.rs +++ b/pallets/jobs/src/tests.rs @@ -20,9 +20,12 @@ use mock::*; use sp_runtime::AccountId32; -use tangle_primitives::jobs::{ - DKGSignatureResult, DKGTSSPhaseOneJobType, DKGTSSPhaseTwoJobType, DkgKeyType, JobSubmission, - JobType, +use tangle_primitives::{ + jobs::{ + DKGTSSPhaseOneJobType, DKGTSSPhaseTwoJobType, DKGTSSSignatureResult, DigitalSignatureType, + JobSubmission, JobType, + }, + roles::{RoleType, ThresholdSignatureRoleType}, }; const ALICE: AccountId32 = AccountId32::new([1u8; 32]); @@ -40,13 +43,14 @@ fn jobs_submission_e2e_works_for_dkg() { new_test_ext().execute_with(|| { System::set_block_number(1); + let threshold_signature_role_type = ThresholdSignatureRoleType::TssGG20; let submission = JobSubmission { expiry: 100, job_type: JobType::DKGTSSPhaseOne(DKGTSSPhaseOneJobType { participants: vec![HUNDRED, BOB, CHARLIE, DAVE, EVE], threshold: 3, permitted_caller: None, - key_type: DkgKeyType::Ecdsa, + role_type: threshold_signature_role_type, }), }; @@ -62,7 +66,7 @@ fn jobs_submission_e2e_works_for_dkg() { participants: vec![ALICE, BOB, CHARLIE, DAVE, EVE], threshold: 5, permitted_caller: None, - key_type: DkgKeyType::Ecdsa, + role_type: threshold_signature_role_type, }), }; @@ -79,7 +83,7 @@ fn jobs_submission_e2e_works_for_dkg() { participants: vec![ALICE, BOB, CHARLIE, DAVE, EVE], threshold: 3, permitted_caller: None, - key_type: DkgKeyType::Ecdsa, + role_type: threshold_signature_role_type, }), }; assert_noop!( @@ -93,7 +97,7 @@ fn jobs_submission_e2e_works_for_dkg() { participants: vec![ALICE, BOB, CHARLIE, DAVE, EVE], threshold: 3, permitted_caller: Some(TEN), - key_type: DkgKeyType::Ecdsa, + role_type: threshold_signature_role_type, }), }; assert_ok!(Jobs::submit_job(RuntimeOrigin::signed(TEN), submission)); @@ -103,14 +107,14 @@ fn jobs_submission_e2e_works_for_dkg() { // submit a solution for this job assert_ok!(Jobs::submit_job_result( RuntimeOrigin::signed(TEN), - JobKey::DKG, + RoleType::Tss(ThresholdSignatureRoleType::TssGG20), 0, - JobResult::DKGPhaseOne(DKGResult { + JobResult::DKGPhaseOne(DKGTSSKeySubmissionResult { signatures: vec![], threshold: 3, participants: vec![], key: vec![], - key_type: DkgKeyType::Ecdsa + signature_type: DigitalSignatureType::Ecdsa }) )); @@ -120,8 +124,16 @@ fn jobs_submission_e2e_works_for_dkg() { } // ensure storage is correctly setup - assert!(KnownResults::::get(JobKey::DKG, 0).is_some()); - assert!(SubmittedJobs::::get(JobKey::DKG, 0).is_none()); + assert!(KnownResults::::get( + RoleType::Tss(ThresholdSignatureRoleType::TssGG20), + 0 + ) + .is_some()); + assert!(SubmittedJobs::::get( + RoleType::Tss(ThresholdSignatureRoleType::TssGG20), + 0 + ) + .is_none()); // ---- use phase one solution in phase 2 signinig ------- @@ -131,6 +143,7 @@ fn jobs_submission_e2e_works_for_dkg() { job_type: JobType::DKGTSSPhaseTwo(DKGTSSPhaseTwoJobType { phase_one_id: 0, submission: vec![], + role_type: threshold_signature_role_type, }), }; assert_noop!( @@ -143,6 +156,7 @@ fn jobs_submission_e2e_works_for_dkg() { job_type: JobType::DKGTSSPhaseTwo(DKGTSSPhaseTwoJobType { phase_one_id: 0, submission: vec![], + role_type: threshold_signature_role_type, }), }; assert_ok!(Jobs::submit_job(RuntimeOrigin::signed(TEN), submission)); @@ -152,13 +166,13 @@ fn jobs_submission_e2e_works_for_dkg() { // submit a solution for this job assert_ok!(Jobs::submit_job_result( RuntimeOrigin::signed(TEN), - JobKey::DKGSignature, + RoleType::Tss(threshold_signature_role_type), 1, - JobResult::DKGPhaseTwo(DKGSignatureResult { + JobResult::DKGPhaseTwo(DKGTSSSignatureResult { signing_key: vec![], signature: vec![], data: vec![], - key_type: DkgKeyType::Ecdsa + signature_type: DigitalSignatureType::Ecdsa }) )); @@ -168,8 +182,16 @@ fn jobs_submission_e2e_works_for_dkg() { } // ensure storage is correctly setup - assert!(KnownResults::::get(JobKey::DKG, 0).is_some()); - assert!(SubmittedJobs::::get(JobKey::DKG, 0).is_none()); + assert!(KnownResults::::get( + RoleType::Tss(ThresholdSignatureRoleType::TssGG20), + 0 + ) + .is_some()); + assert!(SubmittedJobs::::get( + RoleType::Tss(ThresholdSignatureRoleType::TssGG20), + 0 + ) + .is_none()); }); } diff --git a/pallets/roles/src/impls.rs b/pallets/roles/src/impls.rs index 282e2dad8..78549db3e 100644 --- a/pallets/roles/src/impls.rs +++ b/pallets/roles/src/impls.rs @@ -28,8 +28,11 @@ use sp_runtime::{ use sp_staking::offence::Offence; use tangle_primitives::{ - jobs::{JobKey, ReportValidatorOffence}, - traits::{jobs::MPCHandler, roles::RolesHandler}, + jobs::{ + traits::{JobsHandler, MPCHandler}, + ReportValidatorOffence, + }, + roles::traits::RolesHandler, }; /// Implements RolesHandler for the pallet. @@ -42,10 +45,9 @@ impl RolesHandler for Pallet { /// /// # Returns /// Returns `true` if the validator is permitted to work with this job type, otherwise `false`. - fn is_validator(address: T::AccountId, job_key: JobKey) -> bool { + fn is_validator(address: T::AccountId, role_type: RoleType) -> bool { let assigned_roles = AccountRolesMapping::::get(address); - let job_role = job_key.get_role_type(); - assigned_roles.contains(&job_role) + assigned_roles.contains(&role_type) } /// Report offence for the given validator. @@ -63,11 +65,14 @@ impl RolesHandler for Pallet { Self::report_offence(offence_report) } - fn get_validator_metadata(address: T::AccountId, job_key: JobKey) -> Option { - if Self::is_validator(address.clone(), job_key.clone()) { + fn get_validator_metadata( + address: T::AccountId, + role_type: RoleType, + ) -> Option { + if Self::is_validator(address.clone(), role_type) { let ledger = Self::ledger(&address); if let Some(ledger) = ledger { - return match ledger.roles.get(&job_key.get_role_type()) { + return match ledger.roles.get(&role_type) { Some(stake) => Some(stake.metadata.clone()), None => None, } @@ -99,8 +104,8 @@ impl Pallet { // Check removed roles has any active jobs. for role in removed_roles { for job in active_jobs.clone() { - let job_key = job.0; - if job_key.get_role_type() == role { + let role_type = job.0; + if role_type == role { return Err(Error::::RoleCannotBeRemoved.into()) } } @@ -242,12 +247,18 @@ impl Pallet { let mut zksaas_validators: Vec = Default::default(); for (acc, role_types) in AccountRolesMapping::::iter() { - if role_types.contains(&RoleType::Tss) { - tss_validators.push(acc.clone()) - } - - if role_types.contains(&RoleType::ZkSaaS) { - zksaas_validators.push(acc) + for role_type in role_types.iter() { + match role_type { + RoleType::Tss(_) => + if !tss_validators.contains(&acc) { + tss_validators.push(acc.clone()); + }, + RoleType::ZkSaaS(_) => + if !zksaas_validators.contains(&acc) { + zksaas_validators.push(acc.clone()); + }, + _ => (), + } } } diff --git a/pallets/roles/src/lib.rs b/pallets/roles/src/lib.rs index b83391ae5..2896de12d 100644 --- a/pallets/roles/src/lib.rs +++ b/pallets/roles/src/lib.rs @@ -32,10 +32,7 @@ use sp_core::ecdsa; use sp_runtime::{traits::Zero, Saturating}; use sp_staking::offence::ReportOffence; use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, prelude::*, vec}; -use tangle_primitives::{ - roles::{RoleType, RoleTypeMetadata}, - traits::jobs::JobsHandler, -}; +use tangle_primitives::roles::{RoleType, RoleTypeMetadata}; mod impls; mod profile; @@ -98,9 +95,9 @@ pub mod pallet { use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - use tangle_primitives::{ - jobs::{JobId, JobKey}, - traits::jobs::MPCHandler, + use tangle_primitives::jobs::{ + traits::{JobsHandler, MPCHandler}, + JobId, }; /// A type for representing the validator id in a session. @@ -190,7 +187,7 @@ pub mod pallet { /// Profile deleted. ProfileDeleted { account: T::AccountId }, /// Pending jobs,that cannot be opted out at the moment. - PendingJobs { pending_jobs: Vec<(JobKey, JobId)> }, + PendingJobs { pending_jobs: Vec<(RoleType, JobId)> }, } #[pallet::error] @@ -417,19 +414,16 @@ pub mod pallet { let active_jobs = T::JobsHandler::get_active_jobs(stash_account.clone()); let mut pending_jobs = Vec::new(); for job in active_jobs { - let job_key = job.0; + let role_type = job.0; // Submit request to exit from the known set. - let res = T::JobsHandler::exit_from_known_set( - stash_account.clone(), - job_key.clone(), - job.1, - ); + let res = + T::JobsHandler::exit_from_known_set(stash_account.clone(), role_type, job.1); if res.is_err() { - pending_jobs.push((job_key.clone(), job.1)); + pending_jobs.push((role_type, job.1)); } else { // Remove role from the profile. - ledger.profile.remove_role_from_profile(job_key.get_role_type()); + ledger.profile.remove_role_from_profile(role_type); } } @@ -493,17 +487,17 @@ pub mod pallet { let mut pending_jobs = Vec::new(); for job in active_jobs { - let job_key = job.0; - if job_key.get_role_type() == role { + let role_type = job.0; + if role_type == role { // Submit request to exit from the known set. let res = T::JobsHandler::exit_from_known_set( stash_account.clone(), - job_key.clone(), + role_type, job.1, ); if res.is_err() { - pending_jobs.push((job_key.clone(), job.1)); + pending_jobs.push((role_type, job.1)); } else { // Remove role from the profile. ledger.profile.remove_role_from_profile(role.clone()); diff --git a/pallets/roles/src/mock.rs b/pallets/roles/src/mock.rs index ce402ba95..72a801135 100644 --- a/pallets/roles/src/mock.rs +++ b/pallets/roles/src/mock.rs @@ -38,7 +38,13 @@ use sp_staking::{ SessionIndex, }; use tangle_crypto_primitives::crypto::AuthorityId as RoleKeyId; -use tangle_primitives::{jobs::*, roles::ValidatorRewardDistribution, traits::jobs::MPCHandler}; +use tangle_primitives::{ + jobs::{ + traits::{JobsHandler, MPCHandler}, + *, + }, + roles::ValidatorRewardDistribution, +}; pub type AccountId = u64; pub type Balance = u128; pub type BlockNumber = u64; @@ -254,13 +260,13 @@ impl pallet_staking::Config for Runtime { pub struct MockJobsHandler; impl JobsHandler for MockJobsHandler { - fn get_active_jobs(_validator: AccountId) -> Vec<(JobKey, JobId)> { + fn get_active_jobs(_validator: AccountId) -> Vec<(RoleType, JobId)> { Default::default() } fn exit_from_known_set( _validator: AccountId, - _job_key: JobKey, + _role_type: RoleType, _job_id: JobId, ) -> sp_runtime::DispatchResult { Ok(()) diff --git a/pallets/roles/src/tests.rs b/pallets/roles/src/tests.rs index f39ab5a90..6ed9f0083 100644 --- a/pallets/roles/src/tests.rs +++ b/pallets/roles/src/tests.rs @@ -249,19 +249,19 @@ fn test_remove_role_from_profile() { let ledger = Roles::ledger(1).unwrap(); assert!(ledger.profile.is_shared()); assert_eq!(ledger.total_restake(), 5000); - assert!(ledger.profile.has_role(RoleType::Tss)); + assert!(ledger.profile.has_role(RoleType::Tss(Default::default()))); // Lets remove Tss role from the profile. - assert_ok!(Roles::remove_role(RuntimeOrigin::signed(1), RoleType::Tss)); + assert_ok!(Roles::remove_role(RuntimeOrigin::signed(1), RoleType::Tss(Default::default()))); assert_events(vec![RuntimeEvent::Roles(crate::Event::RoleRemoved { account: 1, - role: RoleType::Tss, + role: RoleType::Tss(Default::default()), })]); // Get the updated ledger to check if the role is removed. let ledger = Roles::ledger(1).unwrap(); - assert!(!ledger.profile.has_role(RoleType::Tss)); + assert!(!ledger.profile.has_role(RoleType::Tss(Default::default()))); }); } @@ -341,7 +341,7 @@ fn test_report_offence_should_work() { let offence_report = ReportValidatorOffence { session_index, validator_set_count: 4, - role_type: RoleType::Tss, + role_type: RoleType::Tss(Default::default()), offence_type: tangle_primitives::jobs::ValidatorOffenceType::Inactivity, offenders: vec![1], }; diff --git a/pallets/zksaas/src/tests.rs b/pallets/zksaas/src/tests.rs index f41aab9de..9399a6dd4 100644 --- a/pallets/zksaas/src/tests.rs +++ b/pallets/zksaas/src/tests.rs @@ -29,6 +29,7 @@ use tangle_primitives::{ JobResult, JobType, JobWithResult, ZkSaaSPhaseOneJobType, ZkSaaSPhaseTwoJobType, ZkSaaSPhaseTwoRequest, ZkSaaSProofResult, ZkSaaSSystem, }, + roles::ZeroKnowledgeRoleType, verifier::{self, from_field_elements}, }; @@ -99,7 +100,9 @@ fn proof_verification_works() { proof.serialize_compressed(&mut proof_bytes).unwrap(); // Phase1 + let zero_knowledge_role_type = ZeroKnowledgeRoleType::ZkSaaSGroth16; let phase_one = JobType::::ZkSaaSPhaseOne(ZkSaaSPhaseOneJobType { + role_type: zero_knowledge_role_type, participants: vec![1, 2, 3, 4, 5, 6, 7, 8], system: ZkSaaSSystem::Groth16(Groth16System { circuit: HyperData::Raw(vec![]), @@ -113,6 +116,7 @@ fn proof_verification_works() { }); let phase_two = JobType::::ZkSaaSPhaseTwo(ZkSaaSPhaseTwoJobType { + role_type: zero_knowledge_role_type, phase_one_id: 0, request: ZkSaaSPhaseTwoRequest::Groth16(Groth16ProveRequest { public_input: from_field_elements(&[image]).unwrap(), diff --git a/precompiles/jobs/Jobs.sol b/precompiles/jobs/Jobs.sol index 9e94b985f..49a680bf5 100644 --- a/precompiles/jobs/Jobs.sol +++ b/precompiles/jobs/Jobs.sol @@ -69,7 +69,7 @@ interface Jobs { /// /// @notice Sets a new permitted caller for a specific job type identified by the given key and job ID. /// - /// @param job_key An identifier specifying the type of job to update the permitted caller for. + /// @param role_type An identifier specifying the role type to update the permitted caller for. /// @param job_id The unique identifier of the job for which the permitted caller is being updated. /// @param new_permitted_caller The Ethereum address of the new permitted caller. /// @@ -79,7 +79,7 @@ interface Jobs { /// align with the ongoing processes and permissions within the contract. /// function setPermittedCaller( - uint8 job_key, + uint16 role_type, uint32 job_id, address new_permitted_caller ) external; diff --git a/precompiles/jobs/src/lib.rs b/precompiles/jobs/src/lib.rs index 3c9f3c382..acb9bf2d5 100644 --- a/precompiles/jobs/src/lib.rs +++ b/precompiles/jobs/src/lib.rs @@ -29,8 +29,10 @@ use precompile_utils::{prelude::*, solidity::revert::revert_as_bytes}; use sp_core::H256; use sp_runtime::traits::Dispatchable; use sp_std::{marker::PhantomData, vec::Vec}; -use tangle_primitives::jobs::{ - DKGTSSPhaseOneJobType, DKGTSSPhaseTwoJobType, DkgKeyType, JobKey, JobSubmission, JobType, +use tangle_primitives::{ + jobs::{DKGTSSPhaseOneJobType, DKGTSSPhaseTwoJobType, JobId, JobSubmission, JobType}, + roles::{RoleType, ThresholdSignatureRoleType, ZeroKnowledgeRoleType}, + types::BlockNumber, }; #[cfg(test)] @@ -71,12 +73,13 @@ where /// # Returns /// /// Returns an `EvmResult`, indicating the success or failure of the operation. - #[precompile::public("submitDkgPhaseOneJob(uint64,address[],uint8,address)")] + #[precompile::public("submitDkgPhaseOneJob(uint64,address[],uint8,uint16,address)")] fn submit_dkg_phase_one_job( handle: &mut impl PrecompileHandle, expiry: u64, participants: Vec
, threshold: u8, + role_type: u16, permitted_caller: Address, ) -> EvmResult { // Convert Ethereum address to Substrate account ID @@ -88,10 +91,30 @@ where .map(|x| Runtime::AddressMapping::into_account_id(x.0)) .collect(); + // Convert (u16) role type to RoleType + let role_type = Self::convert_role_type(role_type); + + // Check if job key is valid, otherwise return an error + if role_type.is_none() { + return Err(PrecompileFailure::Revert { + exit_status: ExitRevert::Reverted, + output: revert_as_bytes("Invalid role type!"), + }) + } + + let threshold_signature_role = match role_type { + Some(RoleType::Tss(role)) => role, + _ => + return Err(PrecompileFailure::Revert { + exit_status: ExitRevert::Reverted, + output: revert_as_bytes("Invalid role type!"), + }), + }; + // Create DKG job type with the provided parameters let job_type = DKGTSSPhaseOneJobType { + role_type: threshold_signature_role, participants, - key_type: DkgKeyType::Ecdsa, threshold, permitted_caller: Some(permitted_caller), }; @@ -129,11 +152,11 @@ where /// # Returns /// /// Returns an `EvmResult`, indicating the success or failure of the operation. - #[precompile::public("submitDkgPhaseTwoJob(uint64,uint32,bytes)")] + #[precompile::public("submitDkgPhaseTwoJob(uint64,uint64,bytes)")] fn submit_dkg_phase_two_job( handle: &mut impl PrecompileHandle, - expiry: u64, - phase_one_id: u32, + expiry: BlockNumber, + phase_one_id: JobId, submission: BoundedBytes, ) -> EvmResult { // Convert BoundedBytes to Vec @@ -146,19 +169,44 @@ where let expiry_block: BlockNumberFor = expiry.into(); // Create DKG signature job type with the provided parameters - let job_type = DKGTSSPhaseTwoJobType { phase_one_id, submission }; - - // Create job submission object - let job = - JobSubmission { expiry: expiry_block, job_type: JobType::DKGTSSPhaseTwo(job_type) }; - - // Create the call to the Jobs module's submit_job function - let call = JobsCall::::submit_job { job }; - - // Dispatch the call using the RuntimeHelper - >::try_dispatch(handle, Some(origin).into(), call)?; - - Ok(()) + match pallet_jobs::SubmittedJobsRole::::get(phase_one_id) { + Some(role_type) => { + // Parse the inner role type. It should be a TSS role. + let threshold_signature_role = match role_type { + RoleType::Tss(role) => role, + _ => + return Err(PrecompileFailure::Revert { + exit_status: ExitRevert::Reverted, + output: revert_as_bytes("Invalid role type!"), + }), + }; + + // Construct the phase 2 job type. + let job_type = DKGTSSPhaseTwoJobType { + role_type: threshold_signature_role, + phase_one_id, + submission, + }; + + // Create job submission object + let job = JobSubmission { + expiry: expiry_block, + job_type: JobType::DKGTSSPhaseTwo(job_type), + }; + + // Create the call to the Jobs module's submit_job function + let call = JobsCall::::submit_job { job }; + + // Dispatch the call using the RuntimeHelper + >::try_dispatch(handle, Some(origin).into(), call)?; + + Ok(()) + }, + None => Err(PrecompileFailure::Revert { + exit_status: ExitRevert::Reverted, + output: revert_as_bytes("Invalid job ID!"), + }), + } } /// Withdraws accumulated rewards for the caller from the Jobs module. @@ -189,8 +237,9 @@ where /// # Parameters /// /// - `handle`: A mutable reference to the `PrecompileHandle` implementation. - /// - `job_key`: An identifier specifying the type of job to update the permitted caller for - /// (u8). + /// - `role_type`: An identifier specifying the role of the job to update the permitted caller + /// for (u16) - first byte is the top-level role (TSS, ZkSaaS, etc.), second byte is the + /// sub-role. /// - `job_id`: The unique identifier of the job for which the permitted caller is being updated /// (u32). /// - `new_permitted_caller`: The Ethereum address of the new permitted caller. @@ -198,27 +247,21 @@ where /// # Returns /// /// Returns an `EvmResult`, indicating the success or failure of the operation. - #[precompile::public("setPermittedCaller(uint8,uint32,address)")] + #[precompile::public("setPermittedCaller(uint16,uint64,address)")] fn set_permitted_caller( handle: &mut impl PrecompileHandle, - job_key: u8, - job_id: u32, + role_type: u16, + job_id: JobId, new_permitted_caller: Address, ) -> EvmResult { - // Convert job_key to JobKey - let job_key = match job_key { - 0 => Some(JobKey::DKG), - 1 => Some(JobKey::DKGSignature), - 2 => Some(JobKey::ZkSaaSCircuit), - 3 => Some(JobKey::ZkSaaSProve), - _ => None, - }; + // Convert (u16) role_type to RoleType + let role_type = Self::convert_role_type(role_type); - // Check if job key is valid, otherwise return an error - if job_key.is_none() { + // Check if role type is valid, otherwise return an error + if role_type.is_none() { return Err(PrecompileFailure::Revert { exit_status: ExitRevert::Reverted, - output: revert_as_bytes("Invalid job key!"), + output: revert_as_bytes("Invalid role type!"), }) } @@ -230,7 +273,7 @@ where // Create the call to the Jobs module's set_permitted_caller function let call = JobsCall::::set_permitted_caller { - job_key: job_key.unwrap(), + role_type: role_type.unwrap(), job_id, new_permitted_caller, }; @@ -240,4 +283,23 @@ where Ok(()) } + + fn convert_role_type(role_type: u16) -> Option { + match role_type.to_be_bytes() { + [0, 1] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssGG20)), + [0, 2] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssCGGMP)), + [0, 3] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostSr25519)), + [0, 4] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostP256)), + [0, 5] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostSecp256k1)), + [0, 6] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostRistretto255)), + [0, 7] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostBabyJubJub)), + [0, 8] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssFrostEd25519)), + [0, 9] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssEdDSABabyJubJub)), + [0, 10] => Some(RoleType::Tss(ThresholdSignatureRoleType::TssBls381)), + [1, 0] => Some(RoleType::ZkSaaS(ZeroKnowledgeRoleType::ZkSaaSGroth16)), + [1, 1] => Some(RoleType::ZkSaaS(ZeroKnowledgeRoleType::ZkSaaSMarlin)), + [2, 0] => Some(RoleType::LightClientRelaying), + _ => None, + } + } } diff --git a/precompiles/jobs/src/mock.rs b/precompiles/jobs/src/mock.rs index ca0f1b18b..4f3dee4e9 100644 --- a/precompiles/jobs/src/mock.rs +++ b/precompiles/jobs/src/mock.rs @@ -26,12 +26,11 @@ use sp_runtime::{ BuildStorage, DispatchResult, Perbill, }; use tangle_primitives::{ - jobs::*, - roles::RoleTypeMetadata, - traits::{ - jobs::{JobToFee, MPCHandler}, - roles::RolesHandler, + jobs::{ + traits::{JobToFee, MPCHandler}, + *, }, + roles::{traits::RolesHandler, RoleTypeMetadata}, }; pub type AccountId = MockAccount; @@ -193,7 +192,7 @@ impl JobToFee for MockJobToFeeHandler { pub struct MockRolesHandler; impl RolesHandler for MockRolesHandler { - fn is_validator(address: AccountId, _role_type: JobKey) -> bool { + fn is_validator(address: AccountId, _role_type: RoleType) -> bool { let validators = [ AccountId::from_u64(1u64), AccountId::from_u64(2u64), @@ -204,7 +203,10 @@ impl RolesHandler for MockRolesHandler { validators.contains(&address) } - fn get_validator_metadata(_address: AccountId, _job_key: JobKey) -> Option { + fn get_validator_metadata( + _address: AccountId, + _role_type: RoleType, + ) -> Option { None } diff --git a/precompiles/jobs/src/tests.rs b/precompiles/jobs/src/tests.rs index 93c5b7fa3..3a7139aaa 100644 --- a/precompiles/jobs/src/tests.rs +++ b/precompiles/jobs/src/tests.rs @@ -29,6 +29,7 @@ fn submit_dkg_phase_one_job() { Address(CryptoAlith.into()), Precompile1, PCall::submit_dkg_phase_one_job { + role_type: RoleType::Tss(ThresholdSignatureRoleType::TssGG20).to_u16(), expiry: 100, participants: vec![], threshold: 2, diff --git a/precompiles/staking/src/lib.rs b/precompiles/staking/src/lib.rs index edbfc649e..e4e9a597e 100644 --- a/precompiles/staking/src/lib.rs +++ b/precompiles/staking/src/lib.rs @@ -49,7 +49,7 @@ use precompile_utils::prelude::*; use sp_core::{H160, H256, U256}; use sp_runtime::traits::{Dispatchable, StaticLookup}; use sp_std::{convert::TryInto, marker::PhantomData, vec, vec::Vec}; -use tangle_primitives::WrappedAccountId32; +use tangle_primitives::types::WrappedAccountId32; type BalanceOf = <::Currency as Currency< ::AccountId, diff --git a/primitives/src/types/jobs.rs b/primitives/src/jobs/mod.rs similarity index 53% rename from primitives/src/types/jobs.rs rename to primitives/src/jobs/mod.rs index 9ce69e600..05c891aa6 100644 --- a/primitives/src/types/jobs.rs +++ b/primitives/src/jobs/mod.rs @@ -13,19 +13,27 @@ // // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . + use crate::roles::RoleType; use frame_support::pallet_prelude::*; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use sp_core::{ecdsa, RuntimeDebug}; +use sp_core::RuntimeDebug; use sp_std::vec::Vec; -pub type JobId = u32; +pub type JobId = u64; + +pub mod traits; +pub mod tss; +pub mod zksaas; + +pub use tss::*; +pub use zksaas::*; /// Represents a job submission with specified `AccountId` and `BlockNumber`. #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] pub struct JobSubmission { - /// The expiry block number. + /// The time to live for the submitted job. pub expiry: BlockNumber, /// The type of the job submission. @@ -92,66 +100,6 @@ pub enum HyperData { HTTP(Vec), } -/// Enum representing different types of circuits and snark schemes. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub enum ZkSaaSSystem { - Groth16(Groth16System), -} - -/// Represents the Groth16 system for zk-SNARKs. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct Groth16System { - /// R1CS circuit file. - pub circuit: HyperData, - /// Number of inputs - pub num_inputs: u64, - /// Number of constraints - pub num_constraints: u64, - /// Proving key file. - pub proving_key: HyperData, - /// Verifying key bytes - pub verifying_key: Vec, - /// Circom WASM file. - pub wasm: HyperData, -} - -/// Represents ZK-SNARK proving request -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub enum ZkSaaSPhaseTwoRequest { - /// Groth16 proving request - Groth16(Groth16ProveRequest), -} - -/// Represents Groth16 proving request -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct Groth16ProveRequest { - /// Public input that are used during the verification - pub public_input: Vec, - /// `a` is the full assignment (full_assginment[0] is 1) - /// a = full_assginment[1..] - /// Each element contains a PSS of the witness - pub a_shares: Vec, - /// `ax` is the auxiliary input - /// ax = full_assginment[num_inputs..] - /// Each element contains a PSS of the auxiliary input - pub ax_shares: Vec, - /// PSS of the QAP polynomials - pub qap_shares: Vec, -} - -/// Represents QAP share -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct QAPShare { - pub a: HyperData, - pub b: HyperData, - pub c: HyperData, -} - impl JobType { /// Checks if the job type is a phase one job. pub fn is_phase_one(&self) -> bool { @@ -181,22 +129,13 @@ impl JobType { } } - /// Gets the job key associated with the job type. - pub fn get_job_key(&self) -> JobKey { - match self { - JobType::DKGTSSPhaseOne(_) => JobKey::DKG, - JobType::ZkSaaSPhaseOne(_) => JobKey::ZkSaaSCircuit, - JobType::DKGTSSPhaseTwo(_) => JobKey::DKGSignature, - JobType::ZkSaaSPhaseTwo(_) => JobKey::ZkSaaSProve, - } - } - - /// Gets the job key associated with the previous phase job type. - pub fn get_previous_phase_job_key(&self) -> Option { + /// Gets the role associated with the job type. + pub fn get_role_type(&self) -> RoleType { match self { - JobType::DKGTSSPhaseTwo(_) => Some(JobKey::DKG), - JobType::ZkSaaSPhaseTwo(_) => Some(JobKey::ZkSaaSCircuit), - _ => None, + JobType::DKGTSSPhaseOne(job) => RoleType::Tss(job.role_type), + JobType::ZkSaaSPhaseOne(job) => RoleType::ZkSaaS(job.role_type), + JobType::DKGTSSPhaseTwo(job) => RoleType::Tss(job.role_type), + JobType::ZkSaaSPhaseTwo(job) => RoleType::ZkSaaS(job.role_type), } } @@ -212,7 +151,7 @@ impl JobType { } /// Gets the phase one ID for phase two jobs, if applicable. - pub fn get_phase_one_id(&self) -> Option { + pub fn get_phase_one_id(&self) -> Option { use crate::jobs::JobType::*; match self { DKGTSSPhaseTwo(info) => Some(info.phase_one_id), @@ -231,57 +170,6 @@ impl JobType { } } -/// Represents the Distributed Key Generation (DKG) job type. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct DKGTSSPhaseOneJobType { - /// List of participants' account IDs. - pub participants: Vec, - - /// The threshold value for the DKG. - pub threshold: u8, - - /// the caller permitted to use this result later - pub permitted_caller: Option, - - /// the key type to be used - pub key_type: DkgKeyType, -} - -/// Represents the DKG Signature job type. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct DKGTSSPhaseTwoJobType { - /// The phase one ID. - pub phase_one_id: u32, - - /// The submission data as a vector of bytes. - pub submission: Vec, -} - -/// Represents the (zk-SNARK) Phase One job type. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct ZkSaaSPhaseOneJobType { - /// List of participants' account IDs. - pub participants: Vec, - /// the caller permitted to use this result later - pub permitted_caller: Option, - /// ZK-SNARK Proving system - pub system: ZkSaaSSystem, -} - -/// Represents the (zk-SNARK) Phase Two job type. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct ZkSaaSPhaseTwoJobType { - /// The phase one ID. - pub phase_one_id: u32, - - /// ZK-SNARK Proving request - pub request: ZkSaaSPhaseTwoRequest, -} - /// Enum representing different states of a job. #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] @@ -294,44 +182,17 @@ pub enum JobState { Terminated, } -/// Enum representing different types of job keys. -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone, Copy)] -pub enum JobKey { - /// Distributed Key Generation (DKG) job type. - DKG, - /// DKG Signature job type. - DKGSignature, - /// (zk-SNARK) Create Circuit job type. - ZkSaaSCircuit, - /// (zk-SNARK) Create Proof job type. - ZkSaaSProve, -} - -impl JobKey { - /// Returns role assigned with the job. - pub fn get_role_type(&self) -> RoleType { - match self { - JobKey::DKG => RoleType::Tss, - JobKey::DKGSignature => RoleType::Tss, - JobKey::ZkSaaSCircuit => RoleType::ZkSaaS, - JobKey::ZkSaaSProve => RoleType::ZkSaaS, - } - } -} - /// Represents a job submission with specified `AccountId` and `BlockNumber`. #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] pub struct PhaseOneResult { /// The owner's account ID. pub owner: AccountId, - /// The expiry block number. + /// The time to live as a block number. pub expiry: BlockNumber, /// The type of the job submission. pub result: Vec, /// permitted caller to use this result pub permitted_caller: Option, - /// Key type if applicable - pub key_type: Option, /// The type of the job submission. pub job_type: JobType, } @@ -362,8 +223,8 @@ pub enum ValidatorOffence { /// The validator has been inactive. Inactivity, - /// The validator has committed duplicate signing. - Equivocation, + /// The validator has signed an invalid message. + InvalidSignatureSubmitted, } #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] @@ -394,8 +255,6 @@ pub struct RpcResponsePhaseOneResult { pub result: Vec, /// permitted caller to use this result pub permitted_caller: Option, - /// Key type if applicable - pub key_type: Option, /// The type of the job submission. pub job_type: JobType, } @@ -403,81 +262,15 @@ pub struct RpcResponsePhaseOneResult { #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum JobResult { - DKGPhaseOne(DKGResult), + DKGPhaseOne(DKGTSSKeySubmissionResult), - DKGPhaseTwo(DKGSignatureResult), + DKGPhaseTwo(DKGTSSSignatureResult), ZkSaaSPhaseOne(ZkSaaSCircuitResult), ZkSaaSPhaseTwo(ZkSaaSProofResult), } -pub type Signatures = Vec>; - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct DKGResult { - /// Key type to use for DKG - pub key_type: DkgKeyType, - - /// Submitted key - pub key: Vec, - - /// List of participants' public keys - pub participants: Vec>, - - /// List of participants' signatures - pub signatures: Signatures, - - /// threshold needed to confirm the result - pub threshold: u8, -} - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct DKGSignatureResult { - /// Key type to use for DKG - pub key_type: DkgKeyType, - - /// The input data - pub data: Vec, - - /// The signature to verify - pub signature: Vec, - - /// The expected key for the signature - pub signing_key: Vec, -} - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct ZkSaaSCircuitResult { - /// The job id of the job (circuit) - pub job_id: JobId, - - /// List of participants' public keys - pub participants: Vec, -} - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub enum ZkSaaSProofResult { - Arkworks(ArkworksProofResult), - Circom(CircomProofResult), -} - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct CircomProofResult { - pub proof: Vec, -} - -#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub struct ArkworksProofResult { - pub proof: Vec, -} - /// Represents different types of validator offences. #[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] pub enum ValidatorOffenceType { @@ -505,15 +298,3 @@ pub struct ReportValidatorOffence { /// Offenders pub offenders: Vec, } - -/// Possible key types for DKG -#[derive(Clone, RuntimeDebug, TypeInfo, PartialEq, Eq, Encode, Decode, Default)] -#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] -pub enum DkgKeyType { - /// Elliptic Curve Digital Signature Algorithm (ECDSA) key type. - #[default] - Ecdsa, - - /// Schnorr signature key type. - Schnorr, -} diff --git a/primitives/src/traits/jobs.rs b/primitives/src/jobs/traits.rs similarity index 92% rename from primitives/src/traits/jobs.rs rename to primitives/src/jobs/traits.rs index f78daa93e..cee50e306 100644 --- a/primitives/src/traits/jobs.rs +++ b/primitives/src/jobs/traits.rs @@ -14,7 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . -use crate::jobs::{JobId, JobKey, JobSubmission, JobWithResult, ValidatorOffenceType}; +use crate::{ + jobs::{JobId, JobSubmission, JobWithResult, ValidatorOffenceType}, + roles::RoleType, +}; use sp_arithmetic::traits::{BaseArithmetic, Unsigned}; use sp_runtime::DispatchResult; use sp_std::vec::Vec; @@ -89,7 +92,7 @@ pub trait JobsHandler { /// # Returns /// /// Returns a vector of `JobId` representing the active jobs of the validator. - fn get_active_jobs(validator: AccountId) -> Vec<(JobKey, JobId)>; + fn get_active_jobs(validator: AccountId) -> Vec<(RoleType, JobId)>; /// Exits a job from the known set of a validator. /// @@ -101,5 +104,9 @@ pub trait JobsHandler { /// # Errors /// /// Returns a `DispatchResult` indicating success or an error if the operation fails. - fn exit_from_known_set(validator: AccountId, job_key: JobKey, job_id: JobId) -> DispatchResult; + fn exit_from_known_set( + validator: AccountId, + role_type: RoleType, + job_id: JobId, + ) -> DispatchResult; } diff --git a/primitives/src/jobs/tss.rs b/primitives/src/jobs/tss.rs new file mode 100644 index 000000000..9d55b3a5e --- /dev/null +++ b/primitives/src/jobs/tss.rs @@ -0,0 +1,126 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Tangle 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. +// +// Tangle 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 Tangle. If not, see . + +use frame_support::pallet_prelude::*; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_core::RuntimeDebug; +use sp_std::vec::Vec; + +use crate::roles::ThresholdSignatureRoleType; + +use super::JobId; + +/// Represents the Distributed Key Generation (DKG) job type. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct DKGTSSPhaseOneJobType { + /// List of participants' account IDs. + pub participants: Vec, + + /// The threshold value for the DKG. + pub threshold: u8, + + /// The caller permitted to use this result later + pub permitted_caller: Option, + + /// The role type to be used + pub role_type: ThresholdSignatureRoleType, +} + +/// Represents the DKG Signature job type. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct DKGTSSPhaseTwoJobType { + /// The phase one ID. + pub phase_one_id: JobId, + + /// The submission data as a vector of bytes. + pub submission: Vec, + + /// The role type to be used + pub role_type: ThresholdSignatureRoleType, +} + +pub type Signatures = Vec>; + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct DKGTSSKeySubmissionResult { + /// Signature type of the DKG + pub signature_type: DigitalSignatureType, + + /// Submitted key + pub key: Vec, + + /// List of participants' public keys + pub participants: Vec>, + + /// List of participants' signatures + pub signatures: Signatures, + + /// threshold needed to confirm the result + pub threshold: u8, +} + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct DKGTSSSignatureResult { + /// Signature type to use for DKG + pub signature_type: DigitalSignatureType, + + /// The input data + pub data: Vec, + + /// The signature to verify + pub signature: Vec, + + /// The expected key for the signature + pub signing_key: Vec, +} + +/// Possible key types for DKG +#[derive(Clone, RuntimeDebug, TypeInfo, PartialEq, Eq, Encode, Decode, Default)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum DigitalSignatureType { + /// Elliptic Curve Digital Signature Algorithm (ECDSA) key type. + #[default] + Ecdsa, + + /// Schnorr signature type for sr25519. + SchnorrSr25519, + + /// Schnorr signature type over the P256 curve. + SchnorrP256, + + /// Schnorr signature type over the Secp256k1 curve. + SchnorrSecp256k1, + + /// Schnorr signature type over the Ristretto255 curve. + SchnorrRistretto255, + + /// Schnorr signature type over the BabyJubJub curve. + SchnorrBabyJubJub, + + /// Schnorr signature type over the Ed25519 curve. + SchnorrEd25519, + + /// Edwards Digital Signature Algorithm (EdDSA) key type over the BabyJubJub curve. + EdDSABabyJubJub, + + /// BLS 381 signature type. + Bls381, +} diff --git a/primitives/src/jobs/zksaas.rs b/primitives/src/jobs/zksaas.rs new file mode 100644 index 000000000..062651949 --- /dev/null +++ b/primitives/src/jobs/zksaas.rs @@ -0,0 +1,140 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Tangle 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. +// +// Tangle 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 Tangle. If not, see . + +use crate::{ + jobs::{HyperData, JobId}, + roles::ZeroKnowledgeRoleType, +}; +use frame_support::pallet_prelude::*; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_core::{ecdsa, RuntimeDebug}; +use sp_std::vec::Vec; + +/// Enum representing different types of circuits and snark schemes. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum ZkSaaSSystem { + Groth16(Groth16System), +} + +/// Represents the Groth16 system for zk-SNARKs. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct Groth16System { + /// R1CS circuit file. + pub circuit: HyperData, + /// Number of inputs + pub num_inputs: u64, + /// Number of constraints + pub num_constraints: u64, + /// Proving key file. + pub proving_key: HyperData, + /// Verifying key bytes + pub verifying_key: Vec, + /// Circom WASM file. + pub wasm: HyperData, +} + +/// Represents the (zk-SNARK) Phase One job type. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ZkSaaSPhaseOneJobType { + /// List of participants' account IDs. + pub participants: Vec, + /// the caller permitted to use this result later + pub permitted_caller: Option, + /// ZK-SNARK Proving system + pub system: ZkSaaSSystem, + /// The role type of the job + pub role_type: ZeroKnowledgeRoleType, +} + +/// Represents the (zk-SNARK) Phase Two job type. +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ZkSaaSPhaseTwoJobType { + /// The phase one ID. + pub phase_one_id: JobId, + /// ZK-SNARK Proving request + pub request: ZkSaaSPhaseTwoRequest, + /// The role type of the job + pub role_type: ZeroKnowledgeRoleType, +} + +/// Represents ZK-SNARK proving request +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum ZkSaaSPhaseTwoRequest { + /// Groth16 proving request + Groth16(Groth16ProveRequest), +} + +/// Represents Groth16 proving request +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct Groth16ProveRequest { + /// Public input that are used during the verification + pub public_input: Vec, + /// `a` is the full assignment (full_assginment[0] is 1) + /// a = full_assginment[1..] + /// Each element contains a PSS of the witness + pub a_shares: Vec, + /// `ax` is the auxiliary input + /// ax = full_assginment[num_inputs..] + /// Each element contains a PSS of the auxiliary input + pub ax_shares: Vec, + /// PSS of the QAP polynomials + pub qap_shares: Vec, +} + +/// Represents QAP share +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct QAPShare { + pub a: HyperData, + pub b: HyperData, + pub c: HyperData, +} + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ZkSaaSCircuitResult { + /// The job id of the job (circuit) + pub job_id: JobId, + + /// List of participants' public keys + pub participants: Vec, +} + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum ZkSaaSProofResult { + Arkworks(ArkworksProofResult), + Circom(CircomProofResult), +} + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct CircomProofResult { + pub proof: Vec, +} + +#[derive(PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Clone)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ArkworksProofResult { + pub proof: Vec, +} diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 2e4ef1765..5c618977f 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -27,10 +27,11 @@ use sp_runtime::{ MultiAddress, MultiSignature, Perbill, }; +pub mod jobs; +pub mod roles; pub mod types; pub use types::*; pub mod impls; -pub mod traits; pub use impls::*; #[cfg(feature = "verifying")] @@ -70,7 +71,7 @@ pub mod time { /// Money matters. pub mod currency { - use crate::Balance; + use crate::types::Balance; // Supply units // ============= @@ -105,7 +106,7 @@ pub mod currency { /// Fee config for tangle parachain pub mod fee { use super::*; - use crate::currency::*; + use crate::{currency::*, types::Balance}; /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the /// node's balance type. /// @@ -123,7 +124,7 @@ pub mod fee { // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: // in our template, we map to 1/10 of that, or 1/10 MILLIUNIT let p = CENT; - let q = 100 * crate::Balance::from(ExtrinsicBaseWeight::get().ref_time()); + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); smallvec![WeightToFeeCoefficient { degree: 1, negative: false, diff --git a/primitives/src/roles/mod.rs b/primitives/src/roles/mod.rs new file mode 100644 index 000000000..ec316f904 --- /dev/null +++ b/primitives/src/roles/mod.rs @@ -0,0 +1,140 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Tangle 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. +// +// Tangle 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 Tangle. If not, see . + +#![allow(clippy::match_like_matches_macro)] + +use frame_support::pallet_prelude::*; +use parity_scale_codec::alloc::string::ToString; +use scale_info::prelude::string::String; +use sp_arithmetic::Percent; +use sp_std::{ops::Add, vec::Vec}; + +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + +pub mod traits; +pub mod tss; +pub mod zksaas; + +pub use tss::*; +pub use zksaas::*; + +/// Role type to be used in the system. +#[derive(Encode, Decode, Copy, Clone, Debug, PartialEq, Eq, TypeInfo, PartialOrd, Ord)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum RoleType { + /// TSS role type. + Tss(ThresholdSignatureRoleType), + /// Zk-SaaS role type. + ZkSaaS(ZeroKnowledgeRoleType), + /// Light client relaying role type. + LightClientRelaying, +} + +impl RoleType { + pub fn is_dkg_tss(&self) -> bool { + match self { + RoleType::Tss(_) => true, + _ => false, + } + } + + pub fn is_zksaas(&self) -> bool { + match self { + RoleType::ZkSaaS(_) => true, + _ => false, + } + } + + pub fn is_light_client_relaying(&self) -> bool { + match self { + RoleType::LightClientRelaying => true, + _ => false, + } + } + + pub fn to_u16(&self) -> u16 { + let be_bytes: [u8; 2] = match self { + RoleType::Tss(ThresholdSignatureRoleType::TssGG20) => [0, 1], + RoleType::Tss(ThresholdSignatureRoleType::TssCGGMP) => [0, 2], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostSr25519) => [0, 3], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostP256) => [0, 4], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostSecp256k1) => [0, 5], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostRistretto255) => [0, 6], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostBabyJubJub) => [0, 7], + RoleType::Tss(ThresholdSignatureRoleType::TssFrostEd25519) => [0, 8], + RoleType::Tss(ThresholdSignatureRoleType::TssEdDSABabyJubJub) => [0, 9], + RoleType::Tss(ThresholdSignatureRoleType::TssBls381) => [0, 10], + RoleType::ZkSaaS(ZeroKnowledgeRoleType::ZkSaaSGroth16) => [1, 0], + RoleType::ZkSaaS(ZeroKnowledgeRoleType::ZkSaaSMarlin) => [1, 1], + RoleType::LightClientRelaying => [2, 0], + }; + + u16::from_be_bytes(be_bytes) + } +} + +/// Metadata associated with a role type. +#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum RoleTypeMetadata { + Tss(TssRoleMetadata), + ZkSaas(ZkSaasRoleMetadata), + LightClientRelaying, +} + +impl RoleTypeMetadata { + /// Return type of role. + pub fn get_role_type(&self) -> RoleType { + match self { + RoleTypeMetadata::Tss(metadata) => RoleType::Tss(metadata.role_type), + RoleTypeMetadata::ZkSaas(metadata) => RoleType::ZkSaaS(metadata.role_type), + RoleTypeMetadata::LightClientRelaying => RoleType::LightClientRelaying, + } + } + + pub fn get_authority_key(&self) -> Vec { + match self { + RoleTypeMetadata::Tss(metadata) => metadata.authority_key.clone(), + RoleTypeMetadata::ZkSaas(metadata) => metadata.authority_key.clone(), + _ => Vec::new(), + } + } +} + +/// Represents the reward distribution percentages for validators in a key generation process. +#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ValidatorRewardDistribution { + /// The percentage share of the reward allocated for TSS + tss_share: Percent, + /// The percentage share of the reward allocated for the ZK-SaaS + zksaas_share: Percent, +} + +impl ValidatorRewardDistribution { + pub fn try_new(tss_share: Percent, zksaas_share: Percent) -> Result { + if !tss_share.add(zksaas_share).is_one() { + return Err("Shares must add to One".to_string()) + } + + Ok(Self { tss_share, zksaas_share }) + } + + pub fn get_reward_distribution(self) -> (Percent, Percent) { + (self.tss_share, self.zksaas_share) + } +} diff --git a/primitives/src/traits/roles.rs b/primitives/src/roles/traits.rs similarity index 83% rename from primitives/src/traits/roles.rs rename to primitives/src/roles/traits.rs index 5888ea5cc..a2aec4db8 100644 --- a/primitives/src/traits/roles.rs +++ b/primitives/src/roles/traits.rs @@ -14,12 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Tangle. If not, see . -use crate::{ - jobs::{JobKey, ReportValidatorOffence}, - roles::RoleTypeMetadata, -}; +use crate::{jobs::ReportValidatorOffence, roles::RoleTypeMetadata}; use sp_runtime::DispatchResult; +use super::RoleType; + /// A trait that handles roles associated with job types. pub trait RolesHandler { /// Returns true if the validator is permitted to work with this job type. @@ -27,12 +26,12 @@ pub trait RolesHandler { /// # Parameters /// /// - `address`: The account ID of the validator. - /// - `job_key`: The type of job + /// - `role_type`: The type of role. /// /// # Returns /// /// Returns `true` if the validator is permitted to work with this job type, otherwise `false`. - fn is_validator(address: AccountId, job_key: JobKey) -> bool; + fn is_validator(address: AccountId, role_type: RoleType) -> bool; /// Report offence for the given validator. /// This function will report validators for committing offence. @@ -50,11 +49,11 @@ pub trait RolesHandler { /// # Arguments /// /// * `address` - The account ID of the validator for which metadata is to be retrieved. - /// * `job_key` - The unique identifier for the job associated with the validator. + /// * `role_type` - The role data associated with the validator. /// /// # Returns /// /// Returns an `Option` containing metadata information for the specified /// validator, or `None` if no metadata is found. - fn get_validator_metadata(address: AccountId, job_key: JobKey) -> Option; + fn get_validator_metadata(address: AccountId, role_type: RoleType) -> Option; } diff --git a/primitives/src/roles/tss.rs b/primitives/src/roles/tss.rs new file mode 100644 index 000000000..898d8c6a6 --- /dev/null +++ b/primitives/src/roles/tss.rs @@ -0,0 +1,53 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Tangle 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. +// +// Tangle 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 Tangle. If not, see . + +use frame_support::pallet_prelude::*; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_core::RuntimeDebug; +use sp_std::vec::Vec; + +/// Threshold signature role types and their specific elliptic curve. +#[derive( + Encode, Decode, Copy, Clone, RuntimeDebug, PartialEq, Default, Eq, TypeInfo, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum ThresholdSignatureRoleType { + #[default] + TssGG20, + TssCGGMP, + TssFrostSr25519, + TssFrostP256, + TssFrostSecp256k1, + TssFrostRistretto255, + TssFrostBabyJubJub, + TssFrostEd25519, + TssEdDSABabyJubJub, + TssBls381, +} + +/// Associated metadata needed for a DKG/TSS role +#[derive( + Encode, Decode, Clone, RuntimeDebug, PartialEq, Default, Eq, TypeInfo, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct TssRoleMetadata { + /// The threshold role type for the DKG. + pub role_type: ThresholdSignatureRoleType, + + /// The authority key associated with the role. + pub authority_key: Vec, +} diff --git a/primitives/src/roles/zksaas.rs b/primitives/src/roles/zksaas.rs new file mode 100644 index 000000000..39037a8e8 --- /dev/null +++ b/primitives/src/roles/zksaas.rs @@ -0,0 +1,45 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Tangle 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. +// +// Tangle 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 Tangle. If not, see . + +use frame_support::pallet_prelude::*; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; +use sp_core::RuntimeDebug; +use sp_std::vec::Vec; + +#[derive( + Encode, Decode, Copy, Clone, RuntimeDebug, PartialEq, Default, Eq, TypeInfo, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum ZeroKnowledgeRoleType { + #[default] + ZkSaaSGroth16, + ZkSaaSMarlin, +} + +/// Associated metadata needed for a zkSaas role +#[derive( + Encode, Decode, Clone, RuntimeDebug, PartialEq, Default, Eq, TypeInfo, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub struct ZkSaasRoleMetadata { + /// The zkSaaS scheme + pub role_type: ZeroKnowledgeRoleType, + + /// The authority key associated with the role. + // TODO: Expand this + pub authority_key: Vec, +} diff --git a/primitives/src/traits.rs b/primitives/src/traits.rs deleted file mode 100644 index f292db2cf..000000000 --- a/primitives/src/traits.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod jobs; -pub mod roles; diff --git a/primitives/src/types.rs b/primitives/src/types.rs index c556c8f75..dd2d04c17 100644 --- a/primitives/src/types.rs +++ b/primitives/src/types.rs @@ -14,11 +14,8 @@ // limitations under the License. // use super::*; -pub mod jobs; use sp_runtime::{generic, AccountId32, OpaqueExtrinsic}; -pub mod roles; - /// Block header type as expected by this runtime. pub type Header = generic::Header; diff --git a/primitives/src/types/roles.rs b/primitives/src/types/roles.rs deleted file mode 100644 index e1aa2e187..000000000 --- a/primitives/src/types/roles.rs +++ /dev/null @@ -1,104 +0,0 @@ -// This file is part of Webb. -// Copyright (C) 2022 Webb Technologies Inc. -// -// Tangle 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. -// -// Tangle 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 Tangle. If not, see . -use crate::jobs::DkgKeyType; -use frame_support::pallet_prelude::*; -use parity_scale_codec::alloc::string::ToString; -use scale_info::prelude::string::String; -use sp_arithmetic::Percent; -use sp_std::{ops::Add, vec::Vec}; - -/// Role type to be used in the system. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo, PartialOrd, Ord)] -pub enum RoleType { - Tss, - ZkSaaS, -} - -impl RoleType { - /// Checks if the role type is a TSS role. - pub fn is_tss(&self) -> bool { - matches!(self, RoleType::Tss) - } - - /// Checks if the role type is a Zk-Saas role. - pub fn is_zksaas(&self) -> bool { - matches!(self, RoleType::ZkSaaS) - } -} - -/// Metadata associated with a role type. -#[derive(Encode, Decode, Clone, Debug, PartialEq, Eq, TypeInfo)] -pub enum RoleTypeMetadata { - Tss(TssRoleMetadata), - ZkSaas(ZkSaasRoleMetadata), -} - -impl RoleTypeMetadata { - /// Return type of role. - pub fn get_role_type(&self) -> RoleType { - match self { - RoleTypeMetadata::Tss(_) => RoleType::Tss, - RoleTypeMetadata::ZkSaas(_) => RoleType::ZkSaaS, - } - } - - pub fn get_authority_key(&self) -> Vec { - match self { - RoleTypeMetadata::Tss(metadata) => metadata.authority_key.clone(), - RoleTypeMetadata::ZkSaas(metadata) => metadata.authority_key.clone(), - } - } -} - -/// Associated metadata needed for a DKG role -#[derive(Encode, Decode, Clone, Debug, PartialEq, Default, Eq, TypeInfo)] -pub struct TssRoleMetadata { - /// The authority key associated with the role. - pub authority_key: Vec, - - /// The key type of the authority key - pub key_type: DkgKeyType, -} - -/// Associated metadata needed for a zkSaas role -#[derive(Encode, Decode, Clone, Debug, PartialEq, Default, Eq, TypeInfo)] -pub struct ZkSaasRoleMetadata { - /// The authority key associated with the role. - // TODO : Expand this - authority_key: Vec, -} - -/// Represents the reward distribution percentages for validators in a key generation process. -pub struct ValidatorRewardDistribution { - /// The percentage share of the reward allocated for TSS - tss_share: Percent, - /// The percentage share of the reward allocated for the ZK-SaaS - zksaas_share: Percent, -} - -impl ValidatorRewardDistribution { - pub fn try_new(tss_share: Percent, zksaas_share: Percent) -> Result { - if !tss_share.add(zksaas_share).is_one() { - return Err("Shares must add to One".to_string()) - } - - Ok(Self { tss_share, zksaas_share }) - } - - pub fn get_reward_distribution(self) -> (Percent, Percent) { - (self.tss_share, self.zksaas_share) - } -} diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 8f4877f53..50c9e06ab 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -98,9 +98,14 @@ pub use sp_runtime::{MultiAddress, Perbill, Percent, Permill}; use pallet_airdrop_claims::TestWeightInfo; pub use tangle_primitives::{ - currency::*, fee::*, time::*, AccountId, AccountIndex, Address, Balance, BlockNumber, Hash, - Header, Index, Moment, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, - NORMAL_DISPATCH_RATIO, + currency::*, + fee::*, + time::*, + types::{ + AccountId, AccountIndex, Address, Balance, BlockNumber, Hash, Header, Index, Moment, + Signature, + }, + AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; use tangle_primitives::{ democracy::{ @@ -488,7 +493,7 @@ impl pallet_democracy::Config for Runtime { /// (NTB) vote. type ExternalDefaultOrigin = pallet_collective::EnsureProportionAtLeast; - /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote + /// Two thirds of the council can have an ExternalMajority/ExternalDefault vote /// be tabled immediately and with a shorter voting/enactment period. type FastTrackOrigin = pallet_collective::EnsureProportionAtLeast; @@ -499,14 +504,14 @@ impl pallet_democracy::Config for Runtime { // To cancel a proposal which has been passed, 2/3 of the council must agree to it. type CancellationOrigin = pallet_collective::EnsureProportionAtLeast; - // To cancel a proposal before it has been passed, the technical committee must be unanimous or + // To cancel a proposal before it has been passed, the council must be unanimous or // Root must agree. type CancelProposalOrigin = EitherOfDiverse< EnsureRoot, pallet_collective::EnsureProportionAtLeast, >; type BlacklistOrigin = EnsureRoot; - // Any single technical committee member may veto a coming council proposal, however they can + // Any single council member may veto a coming council proposal, however they can // only do it once and it lasts only for the cool-off period. type VetoOrigin = pallet_collective::EnsureMember; type CooloffPeriod = CooloffPeriod; diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 833b94774..f33687380 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -104,13 +104,18 @@ use sp_staking::{ pub use tangle_primitives::{ currency::*, fee::*, - jobs::{JobResult, JobSubmission, JobType, JobWithResult, ValidatorOffenceType}, + jobs::{ + traits::{JobToFee, MPCHandler}, + JobResult, JobSubmission, JobType, JobWithResult, ValidatorOffenceType, + }, roles::ValidatorRewardDistribution, time::*, - traits::jobs::{JobToFee, MPCHandler}, + types::{ + AccountId, AccountIndex, Address, Balance, BlockNumber, Hash, Header, Index, Moment, + Signature, + }, verifier::{arkworks::ArkworksVerifierGroth16Bn254, circom::CircomVerifierGroth16Bn254}, - AccountId, AccountIndex, Address, BabeId, Balance, BlockNumber, Hash, Header, Index, Moment, - Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + BabeId, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, }; use tangle_primitives::{ democracy::{ diff --git a/types/src/interfaces/lookup.ts b/types/src/interfaces/lookup.ts index d5a43e238..0c5d0ff96 100644 --- a/types/src/interfaces/lookup.ts +++ b/types/src/interfaces/lookup.ts @@ -3327,16 +3327,16 @@ export default { **/ TanglePrimitivesJobsJobResult: { _enum: { - DKGPhaseOne: 'TanglePrimitivesJobsDkgResult', - DKGPhaseTwo: 'TanglePrimitivesJobsDkgSignatureResult', + DKGPhaseOne: 'TanglePrimitivesJobsDKGTSSResult', + DKGPhaseTwo: 'TanglePrimitivesJobsDKGTSSSignatureResult', ZkSaaSPhaseOne: 'TanglePrimitivesJobsZkSaaSCircuitResult', ZkSaaSPhaseTwo: 'TanglePrimitivesJobsZkSaaSProofResult' } }, /** - * Lookup411: tangle_primitives::types::jobs::DKGResult + * Lookup411: tangle_primitives::types::jobs::DKGTSSResult **/ - TanglePrimitivesJobsDkgResult: { + TanglePrimitivesJobsDKGTSSResult: { keyType: 'TanglePrimitivesJobsDkgKeyType', key: 'Bytes', participants: 'Vec', @@ -3344,9 +3344,9 @@ export default { threshold: 'u8' }, /** - * Lookup412: tangle_primitives::types::jobs::DKGSignatureResult + * Lookup412: tangle_primitives::types::jobs::DKGTSSSignatureResult **/ - TanglePrimitivesJobsDkgSignatureResult: { + TanglePrimitivesJobsDKGTSSSignatureResult: { keyType: 'TanglePrimitivesJobsDkgKeyType', data: 'Bytes', signature: 'Bytes', diff --git a/types/src/interfaces/registry.ts b/types/src/interfaces/registry.ts index fc2b98cd1..4875590a3 100644 --- a/types/src/interfaces/registry.ts +++ b/types/src/interfaces/registry.ts @@ -5,7 +5,7 @@ // this is required to allow for ambient/previous definitions import '@polkadot/types/types/registry'; -import type { EthTypesBlockHeader, EthTypesBloom, EthTypesClientMode, EthTypesEth2BeaconBlockHeader, EthTypesEth2ExtendedBeaconBlockHeader, EthTypesEth2FinalizedHeaderUpdate, EthTypesEth2HeaderUpdate, EthTypesEth2LightClientUpdate, EthTypesEth2PublicKeyBytes, EthTypesEth2SignatureBytes, EthTypesEth2SyncAggregate, EthTypesEth2SyncCommittee, EthTypesEth2SyncCommitteeBits, EthTypesEth2SyncCommitteePublicKeys, EthTypesEth2SyncCommitteeUpdate, EthTypesExecutionHeaderInfo, EthTypesH64, EthTypesInitInput, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FinalityGrandpaEquivocationPrecommit, FinalityGrandpaEquivocationPrevote, FinalityGrandpaPrecommit, FinalityGrandpaPrevote, FpRpcTransactionStatus, FrameSupportDispatchDispatchClass, FrameSupportDispatchDispatchInfo, FrameSupportDispatchPays, FrameSupportDispatchPerDispatchClassU32, FrameSupportDispatchPerDispatchClassWeight, FrameSupportDispatchPerDispatchClassWeightsPerClass, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportPreimagesBounded, FrameSupportTokensMiscBalanceStatus, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonZeroSender, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, PalletAirdropClaimsCall, PalletAirdropClaimsError, PalletAirdropClaimsEvent, PalletAirdropClaimsStatementKind, PalletAirdropClaimsUtilsEthereumAddress, PalletAirdropClaimsUtilsEthereumAddressEcdsaSignature, PalletAirdropClaimsUtilsMultiAddress, PalletAirdropClaimsUtilsMultiAddressSignature, PalletAirdropClaimsUtilsSr25519Signature, PalletBabeCall, PalletBabeError, PalletBagsListCall, PalletBagsListError, PalletBagsListEvent, PalletBagsListListBag, PalletBagsListListListError, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesIdAmount, PalletBalancesReasons, PalletBalancesReserveData, PalletBaseFeeCall, PalletBaseFeeEvent, PalletBountiesBounty, PalletBountiesBountyStatus, PalletBountiesCall, PalletBountiesError, PalletBountiesEvent, PalletChildBountiesCall, PalletChildBountiesChildBounty, PalletChildBountiesChildBountyStatus, PalletChildBountiesError, PalletChildBountiesEvent, PalletCollectiveCall, PalletCollectiveError, PalletCollectiveEvent, PalletCollectiveRawOrigin, PalletCollectiveVotes, PalletDemocracyCall, PalletDemocracyConviction, PalletDemocracyDelegations, PalletDemocracyError, PalletDemocracyEvent, PalletDemocracyMetadataOwner, PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyTally, PalletDemocracyVoteAccountVote, PalletDemocracyVotePriorLock, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletDkgCall, PalletDkgError, PalletDkgEvent, PalletDkgFeeInfo, PalletDynamicFeeCall, PalletElectionProviderMultiPhaseCall, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhaseError, PalletElectionProviderMultiPhaseEvent, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenCall, PalletElectionsPhragmenError, PalletElectionsPhragmenEvent, PalletElectionsPhragmenRenouncing, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletEth2LightClientCall, PalletEth2LightClientError, PalletEth2LightClientEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumRawOrigin, PalletEvmCall, PalletEvmCodeMetadata, PalletEvmError, PalletEvmEvent, PalletGrandpaCall, PalletGrandpaError, PalletGrandpaEvent, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletHotfixSufficientsCall, PalletHotfixSufficientsError, PalletIdentityBitFlags, PalletIdentityCall, PalletIdentityError, PalletIdentityEvent, PalletIdentityIdentityField, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineCall, PalletImOnlineError, PalletImOnlineEvent, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Public, PalletImOnlineSr25519AppSr25519Signature, PalletIndicesCall, PalletIndicesError, PalletIndicesEvent, PalletJobsModuleCall, PalletJobsModuleError, PalletJobsModuleEvent, PalletNominationPoolsBondExtra, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsCall, PalletNominationPoolsClaimPermission, PalletNominationPoolsCommission, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsConfigOpAccountId32, PalletNominationPoolsConfigOpPerbill, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsDefensiveError, PalletNominationPoolsError, PalletNominationPoolsEvent, PalletNominationPoolsPoolMember, PalletNominationPoolsPoolRoles, PalletNominationPoolsPoolState, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletNominationPoolsUnbondPool, PalletOffencesEvent, PalletPreimageCall, PalletPreimageError, PalletPreimageEvent, PalletPreimageRequestStatus, PalletRolesCall, PalletRolesError, PalletRolesEvent, PalletRolesProfile, PalletRolesProfileIndependentRestakeProfile, PalletRolesProfileRecord, PalletRolesProfileSharedRestakeProfile, PalletRolesRoleStakingLedger, PalletSchedulerCall, PalletSchedulerError, PalletSchedulerEvent, PalletSchedulerScheduled, PalletSessionCall, PalletSessionError, PalletSessionEvent, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingIndividualExposure, PalletStakingNominations, PalletStakingPalletCall, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingPalletError, PalletStakingPalletEvent, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingUnlockChunk, PalletStakingValidatorPrefs, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTimestampCall, PalletTransactionPauseModuleCall, PalletTransactionPauseModuleError, PalletTransactionPauseModuleEvent, PalletTransactionPaymentChargeTransactionPayment, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUtilityCall, PalletUtilityError, PalletUtilityEvent, PalletVestingCall, PalletVestingError, PalletVestingEvent, PalletVestingReleases, PalletVestingVestingInfo, PalletZksaasCall, PalletZksaasError, PalletZksaasEvent, PalletZksaasFeeInfo, SpArithmeticArithmeticError, SpConsensusBabeAllowedSlots, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpConsensusBabeDigestsPrimaryPreDigest, SpConsensusBabeDigestsSecondaryPlainPreDigest, SpConsensusBabeDigestsSecondaryVRFPreDigest, SpConsensusGrandpaAppPublic, SpConsensusGrandpaAppSignature, SpConsensusGrandpaEquivocation, SpConsensusGrandpaEquivocationProof, SpConsensusSlotsEquivocationProof, SpCoreCryptoKeyTypeId, SpCoreEcdsaPublic, SpCoreEcdsaSignature, SpCoreEd25519Public, SpCoreEd25519Signature, SpCoreSr25519Public, SpCoreSr25519Signature, SpCoreSr25519VrfVrfSignature, SpCoreVoid, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeHeader, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpSessionMembershipProof, SpStakingOffenceOffenceDetails, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight, SpWeightsWeightV2Weight, TanglePrimitivesJobsArkworksProofResult, TanglePrimitivesJobsCircomProofResult, TanglePrimitivesJobsDkgKeyType, TanglePrimitivesJobsDkgResult, TanglePrimitivesJobsDkgSignatureResult, TanglePrimitivesJobsDkgtssPhaseOneJobType, TanglePrimitivesJobsDkgtssPhaseTwoJobType, TanglePrimitivesJobsGroth16ProveRequest, TanglePrimitivesJobsGroth16System, TanglePrimitivesJobsHyperData, TanglePrimitivesJobsJobInfo, TanglePrimitivesJobsJobKey, TanglePrimitivesJobsJobResult, TanglePrimitivesJobsJobSubmission, TanglePrimitivesJobsJobType, TanglePrimitivesJobsPhaseOneResult, TanglePrimitivesJobsQapShare, TanglePrimitivesJobsValidatorOffenceType, TanglePrimitivesJobsZkSaaSCircuitResult, TanglePrimitivesJobsZkSaaSPhaseOneJobType, TanglePrimitivesJobsZkSaaSPhaseTwoJobType, TanglePrimitivesJobsZkSaaSPhaseTwoRequest, TanglePrimitivesJobsZkSaaSProofResult, TanglePrimitivesJobsZkSaaSSystem, TanglePrimitivesRolesRoleType, TanglePrimitivesRolesRoleTypeMetadata, TanglePrimitivesRolesTssRoleMetadata, TanglePrimitivesRolesZkSaasRoleMetadata, TangleTestnetRuntimeNposSolution16, TangleTestnetRuntimeOpaqueSessionKeys, TangleTestnetRuntimeOriginCaller, TangleTestnetRuntimeRuntime, TangleTestnetRuntimeRuntimeHoldReason, WebbConsensusTypesNetworkConfig, WebbProposalsHeaderTypedChainId } from '@polkadot/types/lookup'; +import type { EthTypesBlockHeader, EthTypesBloom, EthTypesClientMode, EthTypesEth2BeaconBlockHeader, EthTypesEth2ExtendedBeaconBlockHeader, EthTypesEth2FinalizedHeaderUpdate, EthTypesEth2HeaderUpdate, EthTypesEth2LightClientUpdate, EthTypesEth2PublicKeyBytes, EthTypesEth2SignatureBytes, EthTypesEth2SyncAggregate, EthTypesEth2SyncCommittee, EthTypesEth2SyncCommitteeBits, EthTypesEth2SyncCommitteePublicKeys, EthTypesEth2SyncCommitteeUpdate, EthTypesExecutionHeaderInfo, EthTypesH64, EthTypesInitInput, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FinalityGrandpaEquivocationPrecommit, FinalityGrandpaEquivocationPrevote, FinalityGrandpaPrecommit, FinalityGrandpaPrevote, FpRpcTransactionStatus, FrameSupportDispatchDispatchClass, FrameSupportDispatchDispatchInfo, FrameSupportDispatchPays, FrameSupportDispatchPerDispatchClassU32, FrameSupportDispatchPerDispatchClassWeight, FrameSupportDispatchPerDispatchClassWeightsPerClass, FrameSupportDispatchRawOrigin, FrameSupportPalletId, FrameSupportPreimagesBounded, FrameSupportTokensMiscBalanceStatus, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonZeroSender, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckTxVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, PalletAirdropClaimsCall, PalletAirdropClaimsError, PalletAirdropClaimsEvent, PalletAirdropClaimsStatementKind, PalletAirdropClaimsUtilsEthereumAddress, PalletAirdropClaimsUtilsEthereumAddressEcdsaSignature, PalletAirdropClaimsUtilsMultiAddress, PalletAirdropClaimsUtilsMultiAddressSignature, PalletAirdropClaimsUtilsSr25519Signature, PalletBabeCall, PalletBabeError, PalletBagsListCall, PalletBagsListError, PalletBagsListEvent, PalletBagsListListBag, PalletBagsListListListError, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesIdAmount, PalletBalancesReasons, PalletBalancesReserveData, PalletBaseFeeCall, PalletBaseFeeEvent, PalletBountiesBounty, PalletBountiesBountyStatus, PalletBountiesCall, PalletBountiesError, PalletBountiesEvent, PalletChildBountiesCall, PalletChildBountiesChildBounty, PalletChildBountiesChildBountyStatus, PalletChildBountiesError, PalletChildBountiesEvent, PalletCollectiveCall, PalletCollectiveError, PalletCollectiveEvent, PalletCollectiveRawOrigin, PalletCollectiveVotes, PalletDemocracyCall, PalletDemocracyConviction, PalletDemocracyDelegations, PalletDemocracyError, PalletDemocracyEvent, PalletDemocracyMetadataOwner, PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyTally, PalletDemocracyVoteAccountVote, PalletDemocracyVotePriorLock, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletDkgCall, PalletDkgError, PalletDkgEvent, PalletDkgFeeInfo, PalletDynamicFeeCall, PalletElectionProviderMultiPhaseCall, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhaseError, PalletElectionProviderMultiPhaseEvent, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenCall, PalletElectionsPhragmenError, PalletElectionsPhragmenEvent, PalletElectionsPhragmenRenouncing, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletEth2LightClientCall, PalletEth2LightClientError, PalletEth2LightClientEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEthereumRawOrigin, PalletEvmCall, PalletEvmCodeMetadata, PalletEvmError, PalletEvmEvent, PalletGrandpaCall, PalletGrandpaError, PalletGrandpaEvent, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletHotfixSufficientsCall, PalletHotfixSufficientsError, PalletIdentityBitFlags, PalletIdentityCall, PalletIdentityError, PalletIdentityEvent, PalletIdentityIdentityField, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineCall, PalletImOnlineError, PalletImOnlineEvent, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Public, PalletImOnlineSr25519AppSr25519Signature, PalletIndicesCall, PalletIndicesError, PalletIndicesEvent, PalletJobsModuleCall, PalletJobsModuleError, PalletJobsModuleEvent, PalletNominationPoolsBondExtra, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsCall, PalletNominationPoolsClaimPermission, PalletNominationPoolsCommission, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsConfigOpAccountId32, PalletNominationPoolsConfigOpPerbill, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsDefensiveError, PalletNominationPoolsError, PalletNominationPoolsEvent, PalletNominationPoolsPoolMember, PalletNominationPoolsPoolRoles, PalletNominationPoolsPoolState, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletNominationPoolsUnbondPool, PalletOffencesEvent, PalletPreimageCall, PalletPreimageError, PalletPreimageEvent, PalletPreimageRequestStatus, PalletRolesCall, PalletRolesError, PalletRolesEvent, PalletRolesProfile, PalletRolesProfileIndependentRestakeProfile, PalletRolesProfileRecord, PalletRolesProfileSharedRestakeProfile, PalletRolesRoleStakingLedger, PalletSchedulerCall, PalletSchedulerError, PalletSchedulerEvent, PalletSchedulerScheduled, PalletSessionCall, PalletSessionError, PalletSessionEvent, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingIndividualExposure, PalletStakingNominations, PalletStakingPalletCall, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingPalletError, PalletStakingPalletEvent, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingUnlockChunk, PalletStakingValidatorPrefs, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTimestampCall, PalletTransactionPauseModuleCall, PalletTransactionPauseModuleError, PalletTransactionPauseModuleEvent, PalletTransactionPaymentChargeTransactionPayment, PalletTransactionPaymentEvent, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUtilityCall, PalletUtilityError, PalletUtilityEvent, PalletVestingCall, PalletVestingError, PalletVestingEvent, PalletVestingReleases, PalletVestingVestingInfo, PalletZksaasCall, PalletZksaasError, PalletZksaasEvent, PalletZksaasFeeInfo, SpArithmeticArithmeticError, SpConsensusBabeAllowedSlots, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpConsensusBabeDigestsPrimaryPreDigest, SpConsensusBabeDigestsSecondaryPlainPreDigest, SpConsensusBabeDigestsSecondaryVRFPreDigest, SpConsensusGrandpaAppPublic, SpConsensusGrandpaAppSignature, SpConsensusGrandpaEquivocation, SpConsensusGrandpaEquivocationProof, SpConsensusSlotsEquivocationProof, SpCoreCryptoKeyTypeId, SpCoreEcdsaPublic, SpCoreEcdsaSignature, SpCoreEd25519Public, SpCoreEd25519Signature, SpCoreSr25519Public, SpCoreSr25519Signature, SpCoreSr25519VrfVrfSignature, SpCoreVoid, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeHeader, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpRuntimeTransactionalError, SpSessionMembershipProof, SpStakingOffenceOffenceDetails, SpVersionRuntimeVersion, SpWeightsRuntimeDbWeight, SpWeightsWeightV2Weight, TanglePrimitivesJobsArkworksProofResult, TanglePrimitivesJobsCircomProofResult, TanglePrimitivesJobsDkgKeyType, TanglePrimitivesJobsDKGTSSResult, TanglePrimitivesJobsDKGTSSSignatureResult, TanglePrimitivesJobsDkgtssPhaseOneJobType, TanglePrimitivesJobsDkgtssPhaseTwoJobType, TanglePrimitivesJobsGroth16ProveRequest, TanglePrimitivesJobsGroth16System, TanglePrimitivesJobsHyperData, TanglePrimitivesJobsJobInfo, TanglePrimitivesJobsJobKey, TanglePrimitivesJobsJobResult, TanglePrimitivesJobsJobSubmission, TanglePrimitivesJobsJobType, TanglePrimitivesJobsPhaseOneResult, TanglePrimitivesJobsQapShare, TanglePrimitivesJobsValidatorOffenceType, TanglePrimitivesJobsZkSaaSCircuitResult, TanglePrimitivesJobsZkSaaSPhaseOneJobType, TanglePrimitivesJobsZkSaaSPhaseTwoJobType, TanglePrimitivesJobsZkSaaSPhaseTwoRequest, TanglePrimitivesJobsZkSaaSProofResult, TanglePrimitivesJobsZkSaaSSystem, TanglePrimitivesRolesRoleType, TanglePrimitivesRolesRoleTypeMetadata, TanglePrimitivesRolesTssRoleMetadata, TanglePrimitivesRolesZkSaasRoleMetadata, TangleTestnetRuntimeNposSolution16, TangleTestnetRuntimeOpaqueSessionKeys, TangleTestnetRuntimeOriginCaller, TangleTestnetRuntimeRuntime, TangleTestnetRuntimeRuntimeHoldReason, WebbConsensusTypesNetworkConfig, WebbProposalsHeaderTypedChainId } from '@polkadot/types/lookup'; declare module '@polkadot/types/types/registry' { interface InterfaceTypes { @@ -318,8 +318,8 @@ declare module '@polkadot/types/types/registry' { TanglePrimitivesJobsArkworksProofResult: TanglePrimitivesJobsArkworksProofResult; TanglePrimitivesJobsCircomProofResult: TanglePrimitivesJobsCircomProofResult; TanglePrimitivesJobsDkgKeyType: TanglePrimitivesJobsDkgKeyType; - TanglePrimitivesJobsDkgResult: TanglePrimitivesJobsDkgResult; - TanglePrimitivesJobsDkgSignatureResult: TanglePrimitivesJobsDkgSignatureResult; + TanglePrimitivesJobsDKGTSSResult: TanglePrimitivesJobsDKGTSSResult; + TanglePrimitivesJobsDKGTSSSignatureResult: TanglePrimitivesJobsDKGTSSSignatureResult; TanglePrimitivesJobsDkgtssPhaseOneJobType: TanglePrimitivesJobsDkgtssPhaseOneJobType; TanglePrimitivesJobsDkgtssPhaseTwoJobType: TanglePrimitivesJobsDkgtssPhaseTwoJobType; TanglePrimitivesJobsGroth16ProveRequest: TanglePrimitivesJobsGroth16ProveRequest; diff --git a/types/src/interfaces/types-lookup.ts b/types/src/interfaces/types-lookup.ts index 898b22ae0..bad564e61 100644 --- a/types/src/interfaces/types-lookup.ts +++ b/types/src/interfaces/types-lookup.ts @@ -3422,9 +3422,9 @@ declare module '@polkadot/types/lookup' { /** @name TanglePrimitivesJobsJobResult (410) */ interface TanglePrimitivesJobsJobResult extends Enum { readonly isDkgPhaseOne: boolean; - readonly asDkgPhaseOne: TanglePrimitivesJobsDkgResult; + readonly asDkgPhaseOne: TanglePrimitivesJobsDKGTSSResult; readonly isDkgPhaseTwo: boolean; - readonly asDkgPhaseTwo: TanglePrimitivesJobsDkgSignatureResult; + readonly asDkgPhaseTwo: TanglePrimitivesJobsDKGTSSSignatureResult; readonly isZkSaaSPhaseOne: boolean; readonly asZkSaaSPhaseOne: TanglePrimitivesJobsZkSaaSCircuitResult; readonly isZkSaaSPhaseTwo: boolean; @@ -3432,8 +3432,8 @@ declare module '@polkadot/types/lookup' { readonly type: 'DkgPhaseOne' | 'DkgPhaseTwo' | 'ZkSaaSPhaseOne' | 'ZkSaaSPhaseTwo'; } - /** @name TanglePrimitivesJobsDkgResult (411) */ - interface TanglePrimitivesJobsDkgResult extends Struct { + /** @name TanglePrimitivesJobsDKGTSSResult (411) */ + interface TanglePrimitivesJobsDKGTSSResult extends Struct { readonly keyType: TanglePrimitivesJobsDkgKeyType; readonly key: Bytes; readonly participants: Vec; @@ -3441,8 +3441,8 @@ declare module '@polkadot/types/lookup' { readonly threshold: u8; } - /** @name TanglePrimitivesJobsDkgSignatureResult (412) */ - interface TanglePrimitivesJobsDkgSignatureResult extends Struct { + /** @name TanglePrimitivesJobsDKGTSSSignatureResult (412) */ + interface TanglePrimitivesJobsDKGTSSSignatureResult extends Struct { readonly keyType: TanglePrimitivesJobsDkgKeyType; readonly data: Bytes; readonly signature: Bytes; From 3970abe7d8590b95250177f66665a8e907e14850 Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Tue, 2 Jan 2024 17:00:45 +0000 Subject: [PATCH 4/7] feat: Setup call filters for testnet/mainnet (#386) * feat: Unify common runtime configs * feat: Setup call filters for testnet/mainnet * cleanup --- runtime/mainnet/src/filters.rs | 48 ++++++++++++++++++++++++++++++++++ runtime/mainnet/src/lib.rs | 36 ++----------------------- runtime/testnet/src/filters.rs | 46 ++++++++++++++++++++++++++++++++ runtime/testnet/src/lib.rs | 36 ++----------------------- 4 files changed, 98 insertions(+), 68 deletions(-) create mode 100644 runtime/mainnet/src/filters.rs create mode 100644 runtime/testnet/src/filters.rs diff --git a/runtime/mainnet/src/filters.rs b/runtime/mainnet/src/filters.rs new file mode 100644 index 000000000..0e43f65dd --- /dev/null +++ b/runtime/mainnet/src/filters.rs @@ -0,0 +1,48 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Call filters for testnet + +use super::*; + +pub struct MainnetCallFilter; +impl Contains for MainnetCallFilter { + fn contains(call: &RuntimeCall) -> bool { + let is_core_call = matches!(call, RuntimeCall::System(_) | RuntimeCall::Timestamp(_)); + if is_core_call { + // always allow core call + return true + } + + let is_paused = + pallet_transaction_pause::PausedTransactionFilter::::contains(call); + if is_paused { + // no paused call + return false + } + + match call { + // Filter democracy proposals creation + RuntimeCall::Democracy(_) | + // disallow council + RuntimeCall::Council(_) | + // Filter light client calls + RuntimeCall::Eth2Client(_) => false, + + // al other calls are allowed + _ =>true + + } + } +} diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 50c9e06ab..54e3de93e 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -21,6 +21,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +mod filters; pub mod frontier_evm; pub mod impls; pub mod precompiles; @@ -191,7 +192,7 @@ pub mod opaque { impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = BaseFilter; + type BaseCallFilter = filters::MainnetCallFilter; type BlockHashCount = BlockHashCount; type BlockLength = BlockLength; type Block = Block; @@ -1031,39 +1032,6 @@ impl pallet_airdrop_claims::Config for Runtime { type WeightInfo = TestWeightInfo; } -pub struct BaseFilter; -impl Contains for BaseFilter { - fn contains(call: &RuntimeCall) -> bool { - let is_core_call = matches!(call, RuntimeCall::System(_) | RuntimeCall::Timestamp(_)); - if is_core_call { - // always allow core call - return true - } - - let is_paused = - pallet_transaction_pause::PausedTransactionFilter::::contains(call); - if is_paused { - // no paused call - return false - } - - let democracy_related = matches!( - call, - // Filter democracy proposals creation - RuntimeCall::Democracy(_) | - // disallow council - RuntimeCall::Council(_) - ); - - if democracy_related { - // no democracy call - return false - } - - true - } -} - // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime { diff --git a/runtime/testnet/src/filters.rs b/runtime/testnet/src/filters.rs new file mode 100644 index 000000000..9424a6f09 --- /dev/null +++ b/runtime/testnet/src/filters.rs @@ -0,0 +1,46 @@ +// This file is part of Tangle. +// Copyright (C) 2022-2024 Webb Technologies Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//! Call filters for testnet + +use super::*; + +pub struct TestnetCallFilter; +impl Contains for TestnetCallFilter { + fn contains(call: &RuntimeCall) -> bool { + let is_core_call = matches!(call, RuntimeCall::System(_) | RuntimeCall::Timestamp(_)); + if is_core_call { + // always allow core call + return true + } + + let is_paused = + pallet_transaction_pause::PausedTransactionFilter::::contains(call); + if is_paused { + // no paused call + return false + } + + match call { + // Filter democracy proposals creation + RuntimeCall::Democracy(_) | + // disallow council + RuntimeCall::Council(_) => false, + + // al other calls are allowed + _ => true + + } + } +} diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index f33687380..7609d5ff0 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -21,6 +21,7 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +mod filters; pub mod frontier_evm; pub mod impls; pub mod precompiles; @@ -204,7 +205,7 @@ pub mod opaque { impl frame_system::Config for Runtime { type AccountData = pallet_balances::AccountData; type AccountId = AccountId; - type BaseCallFilter = BaseFilter; + type BaseCallFilter = filters::TestnetCallFilter; type BlockHashCount = BlockHashCount; type BlockLength = BlockLength; type Block = Block; @@ -1146,39 +1147,6 @@ impl pallet_zksaas::Config for Runtime { type WeightInfo = (); } -pub struct BaseFilter; -impl Contains for BaseFilter { - fn contains(call: &RuntimeCall) -> bool { - let is_core_call = matches!(call, RuntimeCall::System(_) | RuntimeCall::Timestamp(_)); - if is_core_call { - // always allow core call - return true - } - - let is_paused = - pallet_transaction_pause::PausedTransactionFilter::::contains(call); - if is_paused { - // no paused call - return false - } - - let democracy_related = matches!( - call, - // Filter democracy proposals creation - RuntimeCall::Democracy(_) | - // disallow council - RuntimeCall::Council(_) - ); - - if democracy_related { - // no democracy call - return false - } - - true - } -} - // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime { From 541ae696acc18a5a8c983be5e84943f7a747141c Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Tue, 2 Jan 2024 22:55:51 +0000 Subject: [PATCH 5/7] feat: Add tests for distribution logic (#387) * feat: Add tests for distribution logic * cleanup * Update node/src/distributions/mainnet.rs --------- Co-authored-by: drewstone --- node/src/distributions/mainnet.rs | 102 +++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 15 deletions(-) diff --git a/node/src/distributions/mainnet.rs b/node/src/distributions/mainnet.rs index 2cc3ac94c..dd76bcf64 100644 --- a/node/src/distributions/mainnet.rs +++ b/node/src/distributions/mainnet.rs @@ -82,6 +82,7 @@ pub const TWO_YEARS_BLOCKS: u64 = (2 * 365 * 24 * 60 * 60 / BLOCK_TIME) as u64; pub const ONE_HUNDRED_POINTS: u64 = 100; +#[derive(PartialEq, Eq, Debug)] pub struct DistributionResult { pub claims: Vec<(MultiAddress, Balance, Option)>, pub vesting: Vec<(MultiAddress, Vec<(Balance, Balance, BlockNumber)>)>, @@ -98,6 +99,7 @@ fn one_percent_endowment(endowment: u128) -> u128 { } fn vesting_per_block(endowment: u128, blocks: u64) -> u128 { + print!("Endowment {:?} Blocks {:?} ", endowment, blocks); endowment / blocks as u128 } @@ -215,25 +217,21 @@ pub fn get_substrate_balance_distribution() -> DistributionResult { } pub fn get_investor_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, u128)> { + // TODO : Read from actual investor file let investor_accounts: Vec<(MultiAddress, u128)> = vec![]; - investor_accounts - .into_iter() - .map(|(address, value)| { - ( - address, - value, - ONE_YEAR_BLOCKS, - TWO_YEARS_BLOCKS - ONE_YEAR_BLOCKS, - one_percent_endowment(value), - ) - }) - .collect() + compute_balance_distribution_with_cliff_and_vesting(investor_accounts) } pub fn get_team_balance_distribution() -> Vec<(MultiAddress, u128, u64, u64, u128)> { - let team_accounts: Vec<(MultiAddress, u128)> = - vec![(MultiAddress::Native(AccountId32::from([0u8; 32])), 15_000_000 * ONE_TOKEN)]; - team_accounts + // TODO : Read from actual team file + let team_accounts: Vec<(MultiAddress, u128)> = vec![]; + compute_balance_distribution_with_cliff_and_vesting(team_accounts) +} + +pub fn compute_balance_distribution_with_cliff_and_vesting( + investor_accounts: Vec<(MultiAddress, u128)>, +) -> Vec<(MultiAddress, u128, u64, u64, u128)> { + investor_accounts .into_iter() .map(|(address, value)| { ( @@ -284,3 +282,77 @@ pub fn get_distribution_for( DistributionResult { claims, vesting, vesting_length: total_vesting_schedule, vesting_cliff } } + +#[test] +fn test_compute_investor_balance_distribution() { + let alice = MultiAddress::Native(AccountId32::new([0; 32])); + let bob = MultiAddress::Native(AccountId32::new([1; 32])); + + let amount_per_investor = 100; + + // let compute the expected output + // the expected output is that + // 1% is immedately release + // 1 year cliff (vesting starts after year 1) + // Vesting finishes 1 year after cliff + let alice_expected_response: (MultiAddress, u128, u64, u64, u128) = ( + alice.clone(), + amount_per_investor, + tangle_primitives::time::DAYS * 365, // begins at one year after block 0 + tangle_primitives::time::DAYS * 365, // num of blocks from beginning till fully vested + 1, // 1% of 100 + ); + let bob_expected_response: (MultiAddress, u128, u64, u64, u128) = ( + bob.clone(), + amount_per_investor, + tangle_primitives::time::DAYS * 365, // begins at one year after block 0 + tangle_primitives::time::DAYS * 365, // num of blocks from beging till fully vested + 1, // 1% of 100 + ); + + assert_eq!( + compute_balance_distribution_with_cliff_and_vesting(vec![ + (alice, amount_per_investor), + (bob, amount_per_investor), + ]), + vec![alice_expected_response, bob_expected_response] + ); +} + +#[test] +fn test_get_distribution_for() { + let alice = MultiAddress::Native(AccountId32::new([0; 32])); + let bob = MultiAddress::Native(AccountId32::new([1; 32])); + + let amount_per_investor = 100; + + // let compute the expected output + // the expected output is that + // 1% is immedately claimable + // 1 month cliff (vesting starts after 1 month) (use 1 for easier calculation) + // at 1 month cliff, release 1/24th rewards + // Vesting finishes after 2 years (use 24 for easier calculation) + // 1/24th claimable at every month + let expected_distibution_result = DistributionResult { + claims: vec![ + (alice.clone(), 1, Some(StatementKind::Regular)), + (bob.clone(), 1, Some(StatementKind::Regular)), + ], + vesting: vec![ + (alice.clone(), vec![(4, 4, 1), (94, 4, 1)]), + (bob.clone(), vec![(4, 4, 1), (94, 4, 1)]), + ], + vesting_length: 24, + vesting_cliff: 1, + }; + + assert_eq!( + get_distribution_for( + vec![(alice, amount_per_investor), (bob, amount_per_investor),], + Some(StatementKind::Regular), + 1, + 24, + ), + expected_distibution_result + ); +} From a89445d82e92b9413ad5bec646c321293b4f61cf Mon Sep 17 00:00:00 2001 From: shekohex Date: Wed, 3 Jan 2024 14:09:02 +0000 Subject: [PATCH 6/7] Allocate 4007 for Tangle EVM testnet (#395) --- node/src/command.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index ebe938651..c258ef35e 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -73,9 +73,9 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { - "" | "dev" | "local" => Box::new(chainspec::testnet::local_testnet_config(4006)?), + "" | "dev" | "local" => Box::new(chainspec::testnet::local_testnet_config(4007)?), // generates the spec for testnet - "testnet" => Box::new(chainspec::testnet::tangle_testnet_config(4006)?), + "testnet" => Box::new(chainspec::testnet::tangle_testnet_config(4007)?), "tangle-testnet" => Box::new(chainspec::testnet::ChainSpec::from_json_bytes( &include_bytes!("../../chainspecs/testnet/tangle-standalone.json")[..], )?), From a2acee02dad9295cb8e5c3689d16304a50735184 Mon Sep 17 00:00:00 2001 From: 1xstj <106580853+1xstj@users.noreply.github.com> Date: Thu, 4 Jan 2024 04:31:10 +0000 Subject: [PATCH 7/7] feat: set address prefixes (#398) --- node/Cargo.toml | 2 +- node/src/chainspec/mainnet.rs | 7 ++++-- node/src/chainspec/testnet.rs | 41 ++++++++++++----------------------- primitives/src/lib.rs | 8 +++++++ runtime/mainnet/src/lib.rs | 2 +- runtime/testnet/src/lib.rs | 2 +- 6 files changed, 30 insertions(+), 32 deletions(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index fc7bb4a71..4ca585e7f 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tangle" build = "build.rs" -description = "Tangle Standalone chain node" +description = "Tangle chain node" version = { workspace = true } authors = { workspace = true } edition = { workspace = true } diff --git a/node/src/chainspec/mainnet.rs b/node/src/chainspec/mainnet.rs index babad6510..b7c2e43d9 100644 --- a/node/src/chainspec/mainnet.rs +++ b/node/src/chainspec/mainnet.rs @@ -92,7 +92,7 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "TNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 4006.into()); + properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( "Local Tangle Mainnet", @@ -112,6 +112,9 @@ pub fn local_mainnet_config(chain_id: u64) -> Result { get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), ], // Sudo account get_account_id_from_seed::("Alice"), @@ -151,7 +154,7 @@ pub fn tangle_mainnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "TNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 4006.into()); + properties.insert("ss58Format".into(), tangle_primitives::MAINNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( "Tangle Mainnet", diff --git a/node/src/chainspec/testnet.rs b/node/src/chainspec/testnet.rs index 3c8243889..68dd4dfc2 100644 --- a/node/src/chainspec/testnet.rs +++ b/node/src/chainspec/testnet.rs @@ -36,9 +36,9 @@ use tangle_crypto_primitives::crypto::AuthorityId as RoleKeyId; use tangle_primitives::types::BlockNumber; use tangle_testnet_runtime::{ AccountId, BabeConfig, Balance, BalancesConfig, ClaimsConfig, EVMChainIdConfig, EVMConfig, - ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxNominations, MaxVestingSchedules, - Perbill, RuntimeGenesisConfig, SessionConfig, Signature, StakerStatus, StakingConfig, - SudoConfig, SystemConfig, TreasuryPalletId, UNIT, WASM_BINARY, + ElectionsConfig, Eth2ClientConfig, ImOnlineConfig, MaxVestingSchedules, Perbill, + RuntimeGenesisConfig, SessionConfig, Signature, StakerStatus, StakingConfig, SudoConfig, + SystemConfig, TreasuryPalletId, UNIT, WASM_BINARY, }; use webb_consensus_types::network_config::{Network, NetworkConfig}; @@ -93,7 +93,7 @@ pub fn local_testnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "tTNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 42.into()); + properties.insert("ss58Format".into(), tangle_primitives::TESTNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( // Name @@ -124,11 +124,8 @@ pub fn local_testnet_config(chain_id: u64) -> Result { get_account_id_from_seed::("Eve"), ], chain_id, - combine_distributions(vec![ - develop::get_evm_balance_distribution(), - testnet::get_evm_balance_distribution(), - ]), - testnet::get_substrate_balance_distribution(), + vec![], + vec![], true, ) }, @@ -153,12 +150,12 @@ pub fn tangle_testnet_config(chain_id: u64) -> Result { let mut properties = sc_chain_spec::Properties::new(); properties.insert("tokenSymbol".into(), "tTNT".into()); properties.insert("tokenDecimals".into(), 18u32.into()); - properties.insert("ss58Format".into(), 42.into()); + properties.insert("ss58Format".into(), tangle_primitives::TESTNET_SS58_PREFIX.into()); Ok(ChainSpec::from_genesis( - "Tangle Standalone Testnet", + "Tangle Testnet", "tangle-testnet", - ChainType::Development, + ChainType::Live, move || { testnet_genesis( wasm_binary, @@ -225,7 +222,7 @@ pub fn tangle_testnet_config(chain_id: u64) -> Result { fn testnet_genesis( wasm_binary: &[u8], initial_authorities: Vec<(AccountId, BabeId, GrandpaId, ImOnlineId, RoleKeyId)>, - initial_nominators: Vec, + _initial_nominators: Vec, root_key: AccountId, endowed_accounts: Vec, chain_id: u64, @@ -237,22 +234,12 @@ fn testnet_genesis( const STASH: Balance = ENDOWMENT / 100; // stakers: all validators and nominators. - let mut rng = rand::thread_rng(); + let _rng = rand::thread_rng(); + // stakers: all validators and nominators. let stakers = initial_authorities .iter() - .map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::Validator)) - .chain(initial_nominators.iter().map(|x| { - use rand::{seq::SliceRandom, Rng}; - let limit = (MaxNominations::get() as usize).min(initial_authorities.len()); - let count = rng.gen::() % limit; - let nominations = initial_authorities - .as_slice() - .choose_multiple(&mut rng, count) - .map(|choice| choice.0.clone()) - .collect::>(); - (x.clone(), x.clone(), STASH, StakerStatus::Nominator(nominations)) - })) - .collect::>(); + .map(|x| (x.0.clone(), x.0.clone(), UNIT, StakerStatus::Validator)) + .collect(); let num_endowed_accounts = endowed_accounts.len(); let claims: Vec<(MultiAddress, Balance, Option)> = endowed_accounts diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 5c618977f..5ba8ba461 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -288,3 +288,11 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND, MAX_POV_SIZE as u64); pub use sp_consensus_babe::AuthorityId as BabeId; + +// 5845 this would give us addresses with tg prefix for mainnet like +// tgGmBRR5yM53bvq8tTzgsUirpPtfCXngYYU7uiihmWFJhmYGM +pub const MAINNET_SS58_PREFIX: u16 = 5845; + +// 3799 this would give us addresses with tt prefix for testnet like +// ttFELSU4MTyzpfsgZ9tFinrmox7pV7nF1BLbfYjsu4rfDYM74 +pub const TESTNET_SS58_PREFIX: u16 = 3799; diff --git a/runtime/mainnet/src/lib.rs b/runtime/mainnet/src/lib.rs index 54e3de93e..688d9d21c 100644 --- a/runtime/mainnet/src/lib.rs +++ b/runtime/mainnet/src/lib.rs @@ -165,7 +165,7 @@ parameter_types! { ::with_sensible_defaults(MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(MAXIMUM_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u8 = 42; + pub const SS58Prefix: u16 = tangle_primitives::MAINNET_SS58_PREFIX; } /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know diff --git a/runtime/testnet/src/lib.rs b/runtime/testnet/src/lib.rs index 7609d5ff0..b3c0fb466 100644 --- a/runtime/testnet/src/lib.rs +++ b/runtime/testnet/src/lib.rs @@ -177,7 +177,7 @@ parameter_types! { ::with_sensible_defaults(MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO); pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength ::max_with_normal_ratio(MAXIMUM_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); - pub const SS58Prefix: u8 = 42; + pub const SS58Prefix: u16 = tangle_primitives::TESTNET_SS58_PREFIX; } /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know