Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 23 additions & 37 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ sp-consensus-qpow = { path = "./primitives/consensus/qpow", default-features = f

# Quantus network dependencies
qp-plonky2 = { version = "1.4.1", default-features = false }
qp-poseidon = { version = "1.4.0", default-features = false }
qp-poseidon-core = { version = "1.4.0", default-features = false }
qp-poseidon-core = { version = "2.0.2", default-features = false }
qp-rusty-crystals-dilithium = { version = "2.4.0", default-features = false }
qp-rusty-crystals-hdwallet = { version = "2.3.1" }
qp-wormhole-circuit = { version = "2.0.1", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pallet-zk-tree.default-features = true
pallet-zk-tree.workspace = true
prometheus.workspace = true
qp-dilithium-crypto = { workspace = true }
qp-poseidon.workspace = true
qp-rusty-crystals-dilithium.workspace = true
qp-rusty-crystals-hdwallet.workspace = true
qp-wormhole.workspace = true
Expand Down
3 changes: 1 addition & 2 deletions pallets/frame-system/src/extensions/authorize_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ mod tests {

pub type TransactionExtension = (frame_system::AuthorizeCall<Runtime>,);

pub type Header =
qp_header::Header<u32, sp_runtime::traits::BlakeTwo256, sp_runtime::traits::BlakeTwo256>;
pub type Header = qp_header::Header<u32, sp_runtime::traits::BlakeTwo256>;
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic<
u64,
Expand Down
6 changes: 3 additions & 3 deletions pallets/frame-system/src/mocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ pub type MockUncheckedExtrinsic<T, Signature = (), Extra = ()> = generic::Unchec
>;

pub type MockBlock<T> = generic::Block<
qp_header::Header<u64, sp_runtime::traits::BlakeTwo256, sp_runtime::traits::BlakeTwo256>,
qp_header::Header<u64, sp_runtime::traits::BlakeTwo256>,
MockUncheckedExtrinsic<T>,
>;

pub type MockBlockU32<T> = generic::Block<
qp_header::Header<u32, sp_runtime::traits::BlakeTwo256, sp_runtime::traits::BlakeTwo256>,
qp_header::Header<u32, sp_runtime::traits::BlakeTwo256>,
MockUncheckedExtrinsic<T>,
>;

pub type MockBlockU128<T> = generic::Block<
qp_header::Header<u128, sp_runtime::traits::BlakeTwo256, sp_runtime::traits::BlakeTwo256>,
qp_header::Header<u128, sp_runtime::traits::BlakeTwo256>,
MockUncheckedExtrinsic<T>,
>;
3 changes: 0 additions & 3 deletions pallets/mining-rewards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ frame-support.workspace = true
frame-system.workspace = true
log.workspace = true
pallet-treasury = { path = "../treasury", default-features = false }
qp-poseidon.workspace = true
qp-wormhole.workspace = true
scale-info = { workspace = true, default-features = false, features = ["derive"] }
sp-consensus-qpow.workspace = true
Expand All @@ -32,7 +31,6 @@ sp-runtime.workspace = true
[dev-dependencies]
pallet-balances.features = ["std"]
pallet-balances.workspace = true
qp-poseidon.workspace = true
sp-core.workspace = true
sp-io.workspace = true

Expand All @@ -49,7 +47,6 @@ std = [
"frame-support/std",
"frame-system/std",
"pallet-treasury/std",
"qp-poseidon/std",
"qp-wormhole/std",
"scale-info/std",
"sp-consensus-qpow/std",
Expand Down
2 changes: 1 addition & 1 deletion pallets/reversible-transfers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ pub mod pallet {
// Release succeeded - now remove metadata and cancel scheduler
PendingTransfers::<T>::remove(tx_id);

if let Some(id) = Self::make_schedule_id(tx_id).ok() {
if let Ok(id) = Self::make_schedule_id(tx_id) {
if let Err(e) = T::Scheduler::cancel_named(id) {
log::warn!(
"Failed to cancel scheduled task for tx {:?}: {:?} (funds already released)",
Expand Down
16 changes: 7 additions & 9 deletions pallets/scheduler/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type SystemOrigin<T> = <T as frame_system::Config>::RuntimeOrigin;

fn assert_last_event<T: Config>(generic_event: <T as frame_system::Config>::RuntimeEvent) {
let events = frame_system::Pallet::<T>::events();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event.into();
let system_event: <T as frame_system::Config>::RuntimeEvent = generic_event;
// compare to the last event record
let EventRecord { event, .. } = &events[events.len() - 1];
assert_eq!(event, &system_event);
Expand Down Expand Up @@ -115,12 +115,10 @@ fn make_call<T: Config>(maybe_lookup_len: Option<u32>) -> BoundedCallOf<T> {
}
if maybe_lookup_len.is_some() {
len += 1;
} else if len > 0 {
len -= 1;
} else {
if len > 0 {
len -= 1;
} else {
break c;
}
break c;
}
}
}
Expand Down Expand Up @@ -258,7 +256,7 @@ benchmarks! {
"didn't remove from schedule if more than 1 task scheduled for `when`"
);
ensure!(
s > 1 || Agenda::<T>::get(BlockNumberOrTimestamp::BlockNumber(when)).len() == 0,
s > 1 || Agenda::<T>::get(BlockNumberOrTimestamp::BlockNumber(when)).is_empty(),
"remove from schedule if only 1 task scheduled for `when`"
);
}
Expand Down Expand Up @@ -296,7 +294,7 @@ benchmarks! {
"didn't remove from schedule if more than 1 task scheduled for `when`"
);
ensure!(
s > 1 || Agenda::<T>::get(BlockNumberOrTimestamp::BlockNumber(when)).len() == 0,
s > 1 || Agenda::<T>::get(BlockNumberOrTimestamp::BlockNumber(when)).is_empty(),
"remove from schedule if only 1 task scheduled for `when`"
);
}
Expand All @@ -311,7 +309,7 @@ benchmarks! {
let period: BlockNumberOrTimestampOf<T> = BlockNumberOrTimestamp::BlockNumber(1u32.into());
let root: <T as Config>::PalletsOrigin = frame_system::RawOrigin::Root.into();
let retry_config = RetryConfig { total_retries: 10, remaining: 10, period };
Retries::<T>::insert(address, retry_config.clone());
Retries::<T>::insert(address, retry_config);
let (when, index) = address;
let task = Agenda::<T>::get(when)[index as usize].clone().unwrap();
let mut weight_counter = WeightMeter::with_limit(T::MaximumWeight::get());
Expand Down
2 changes: 0 additions & 2 deletions pallets/wormhole/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ log.workspace = true
pallet-balances.workspace = true
pallet-zk-tree.workspace = true
qp-header = { workspace = true, features = ["serde"] }
qp-poseidon.workspace = true
qp-wormhole.workspace = true
qp-wormhole-verifier = { workspace = true, default-features = false }
scale-info = { workspace = true, default-features = false, features = [
Expand Down Expand Up @@ -68,7 +67,6 @@ std = [
"pallet-balances/std",
"pallet-zk-tree/std",
"qp-header/std",
"qp-poseidon/std",
"qp-wormhole-verifier/std",
"qp-wormhole/std",
"scale-info/std",
Expand Down
16 changes: 6 additions & 10 deletions pallets/wormhole/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ extern crate alloc;

use lazy_static::lazy_static;
pub use pallet::*;
pub use qp_poseidon::ToFelts;
use qp_wormhole_verifier::WormholeVerifier;

#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -37,7 +36,7 @@ pub const SCALE_DOWN_FACTOR: u128 = 10_000_000_000;

#[frame_support::pallet]
pub mod pallet {
use crate::{ToFelts, WeightInfo};
use crate::WeightInfo;
use alloc::vec::Vec;
use codec::Decode;
use frame_support::{
Expand Down Expand Up @@ -119,12 +118,11 @@ pub mod pallet {

#[pallet::config]
pub trait Config: frame_system::Config {
/// Native balance type with ToFelts bound for Poseidon hashing in transfer proofs.
/// Native balance type for transfer proofs.
type NativeBalance: Parameter
+ Member
+ Default
+ Copy
+ ToFelts
+ MaxEncodedLen
+ sp_runtime::traits::AtLeast32BitUnsigned
+ sp_runtime::traits::CheckedAdd
Expand All @@ -146,8 +144,8 @@ pub mod pallet {
> + fungibles::Mutate<<Self as frame_system::Config>::AccountId>
+ fungibles::Create<<Self as frame_system::Config>::AccountId>;

/// Asset ID type with bounds needed for Poseidon hashing in transfer proofs.
type AssetId: Parameter + Member + Default + From<u32> + Clone + ToFelts + MaxEncodedLen;
/// Asset ID type for transfer proofs.
type AssetId: Parameter + Member + Default + From<u32> + Clone + MaxEncodedLen;

/// Asset balance type that can convert to/from native balance.
type AssetBalance: Parameter
Expand All @@ -163,8 +161,7 @@ pub mod pallet {
+ Saturating
+ Copy
+ sp_runtime::traits::One
+ Into<u64>
+ ToFelts;
+ Into<u64>;

/// Account ID used as the "from" account when creating transfer proofs for minted tokens
#[pallet::constant]
Expand All @@ -188,15 +185,14 @@ pub mod pallet {
/// Weight information for pallet operations.
type WeightInfo: WeightInfo;

/// Override system AccountId to make it felts encodable
/// Override system AccountId for wormhole operations
type WormholeAccountId: Parameter
+ Member
+ MaybeSerializeDeserialize
+ core::fmt::Debug
+ MaybeDisplay
+ Ord
+ MaxEncodedLen
+ ToFelts
+ Into<<Self as frame_system::Config>::AccountId>
+ From<<Self as frame_system::Config>::AccountId>;

Expand Down
Loading
Loading