Skip to content
Open
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
58 changes: 21 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 = { path = "../qp-poseidon/core", 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
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: 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
7 changes: 3 additions & 4 deletions pallets/wormhole/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use frame_support::{
traits::{ConstU128, ConstU32, Everything},
};
use frame_system::mocking::MockUncheckedExtrinsic;
use qp_poseidon::PoseidonHasher;
use sp_core::H256;
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
Expand All @@ -28,7 +27,7 @@ pub type Balance = u128;
pub const UNIT: Balance = 1_000_000_000_000;
pub type AccountId = sp_core::crypto::AccountId32;
pub type Block<T> = sp_runtime::generic::Block<
qp_header::Header<u64, PoseidonHasher, sp_runtime::traits::BlakeTwo256>,
qp_header::Header<u64, BlakeTwo256>,
MockUncheckedExtrinsic<T, qp_dilithium_crypto::DilithiumSignatureScheme>,
>;

Expand Down Expand Up @@ -143,7 +142,7 @@ impl pallet_wormhole::Config for Test {
}

// Helper function to build a genesis configuration
pub fn new_test_ext() -> sp_state_machine::TestExternalities<PoseidonHasher> {
pub fn new_test_ext() -> sp_state_machine::TestExternalities<BlakeTwo256> {
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
t.into()
}
Expand All @@ -157,7 +156,7 @@ pub fn new_test_ext() -> sp_state_machine::TestExternalities<PoseidonHasher> {
/// `Wormhole::on_initialize(1)` to process the endowments.
pub fn new_test_ext_with_endowments(
endowments: Vec<(AccountId, Balance)>,
) -> sp_state_machine::TestExternalities<PoseidonHasher> {
) -> sp_state_machine::TestExternalities<BlakeTwo256> {
use sp_runtime::BuildStorage;

let mut t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
Expand Down
4 changes: 1 addition & 3 deletions primitives/dilithium-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ version = "0.3.1"
[dependencies]
codec = { workspace = true, default-features = false }
log = { workspace = true }
qp-poseidon = { workspace = true }
qp-poseidon-core = { workspace = true }
qp-rusty-crystals-dilithium = { workspace = true, default-features = false }
qp-rusty-crystals-hdwallet = { workspace = true, optional = true }
Expand All @@ -40,13 +39,12 @@ full_crypto = [
"sp-core/full_crypto",
]
serde = [
"qp-poseidon/serde",
"sp-core/serde",
]
std = [
"codec/std",
"full_crypto",
"qp-poseidon/std",
"qp-poseidon-core/std",
"qp-rusty-crystals-hdwallet",
"scale-info/std",
"sp-core/std",
Expand Down
3 changes: 1 addition & 2 deletions primitives/header/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ codec = { features = ["derive"], workspace = true }
log.workspace = true
p3-field = { workspace = true }
p3-goldilocks = { workspace = true }
qp-poseidon = { workspace = true, features = ["serde"] }
qp-poseidon-core = { workspace = true }
scale-info = { features = ["derive", "serde"], workspace = true }
serde = { workspace = true, features = ["derive"], optional = true }
Expand All @@ -33,7 +32,7 @@ serde_json = { workspace = true, default-features = false, features = [
default = ["serde", "std"]
std = [
"codec/std",
"qp-poseidon/std",
"qp-poseidon-core/std",
"scale-info/std",
"sp-core/std",
"sp-runtime/std",
Expand Down
Loading
Loading