diff --git a/Cargo.lock b/Cargo.lock index c8c6e17..72574a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,14 +160,15 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "getrandom 0.2.11", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -1219,16 +1220,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.3" @@ -1843,9 +1834,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -2773,7 +2764,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", ] [[package]] @@ -4106,7 +4097,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -4136,9 +4127,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memfd" @@ -5898,9 +5889,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -5908,14 +5899,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -6006,13 +5995,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick 1.0.1", "memchr", - "regex-syntax 0.7.1", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -6024,6 +6014,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick 1.0.1", + "memchr", + "regex-syntax 0.8.2", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -6032,9 +6033,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "region" @@ -6578,7 +6579,7 @@ name = "sc-consensus-grandpa" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", "array-bytes", "async-trait", "dyn-clone", @@ -6833,7 +6834,7 @@ name = "sc-network-gossip" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", "futures", "futures-timer", "libp2p", @@ -7364,7 +7365,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", "cfg-if", "hashbrown 0.13.2", ] @@ -8410,7 +8411,7 @@ name = "sp-trie" version = "7.0.0" source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.42#ff24c60ac7d9f87727ecdd0ded9a80c56e4f4b65" dependencies = [ - "ahash 0.8.3", + "ahash 0.8.7", "hash-db", "hashbrown 0.13.2", "lazy_static", @@ -10525,6 +10526,26 @@ dependencies = [ "time", ] +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/pallets/posts/Cargo.toml b/pallets/posts/Cargo.toml index a637583..dc0172b 100644 --- a/pallets/posts/Cargo.toml +++ b/pallets/posts/Cargo.toml @@ -21,6 +21,7 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } sp-runtime = { version = "7.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42" } +# polars = {version = "0.36.2", default-features = false} # Substrate dependencies pallet-support = { default-features = false, path = '../support' } diff --git a/pallets/profile-validation/src/extras.rs b/pallets/profile-validation/src/extras.rs index 2014b12..6fd6319 100644 --- a/pallets/profile-validation/src/extras.rs +++ b/pallets/profile-validation/src/extras.rs @@ -53,7 +53,8 @@ impl ChallengeEvidencePost { impl Pallet { pub(super) fn get_phase_data() -> PhaseData { - T::SchellingGameSharedSource::create_phase_data(50, 5, 3, 100, (100, 100)) + T::SchellingGameSharedSource::create_phase_with_all_data(10, 100, 100, 100, 100, 100, 100, 5, 3, 100, (100, 100)) + // T::SchellingGameSharedSource::create_phase_data(100, 5, 3, 100, (100, 100)) } // pub(super) fn get_citizen_accountid( diff --git a/pallets/profile-validation/src/lib.rs b/pallets/profile-validation/src/lib.rs index d2dbc08..720eca4 100644 --- a/pallets/profile-validation/src/lib.rs +++ b/pallets/profile-validation/src/lib.rs @@ -330,7 +330,7 @@ pub mod pallet { /// than required. If the funded amount matches the required amount, the profile validation is marked /// as completed, and a link is set to the evidence period in the Schelling Game. /// - /// ``` + /// ```rust,ignore /// #[pallet::call] /// fn add_profile_stake( /// origin: OriginFor, diff --git a/pallets/schelling-game-shared/src/extras.rs b/pallets/schelling-game-shared/src/extras.rs index 833f757..d4b7466 100644 --- a/pallets/schelling-game-shared/src/extras.rs +++ b/pallets/schelling-game-shared/src/extras.rs @@ -1,6 +1,33 @@ use crate::*; impl Pallet { + pub(super) fn create_phase_with_all_data( + evidence_length: u64, + end_of_staking_time: u64, + staking_length: u64, + drawing_length: u64, + commit_length: u64, + vote_length: u64, + appeal_length: u64, + max_draws: u64, + min_number_juror_staked: u64, + min_juror_stake: u64, + juror_incentives: (u64, u64), + ) -> PhaseDataOf { + PhaseData::create_phase_with_all_data( + evidence_length, + end_of_staking_time, + staking_length, + drawing_length, + commit_length, + vote_length, + appeal_length, + max_draws, + min_number_juror_staked, + min_juror_stake, + juror_incentives, + ) + } pub(super) fn create_phase_data( block_length: u64, max_draws: u64, diff --git a/pallets/schelling-game-shared/src/functions.rs b/pallets/schelling-game-shared/src/functions.rs index 43d43f7..359381a 100644 --- a/pallets/schelling-game-shared/src/functions.rs +++ b/pallets/schelling-game-shared/src/functions.rs @@ -74,4 +74,41 @@ impl PhaseData { juror_incentives, } } + + pub fn create_phase_with_all_data( + evidence_length: u64, + end_of_staking_time: u64, + staking_length: u64, + drawing_length: u64, + commit_length: u64, + vote_length: u64, + appeal_length: u64, + max_draws: u64, + min_number_juror_staked: u64, + min_juror_stake: u64, + juror_incentives: (u64, u64), + ) -> Self { + let evidence_length = evidence_length.saturated_into::>(); + let end_of_staking_time = end_of_staking_time.saturated_into::>(); + let staking_length = staking_length.saturated_into::>(); + let drawing_length = drawing_length.saturated_into::>(); + let commit_length = commit_length.saturated_into::>(); + let vote_length = vote_length.saturated_into::>(); + let appeal_length = appeal_length.saturated_into::>(); + + let min_juror_stake = min_juror_stake.saturated_into::>(); + PhaseData { + evidence_length, + end_of_staking_time, + staking_length, + drawing_length, + commit_length, + vote_length, + appeal_length, + max_draws, + min_number_juror_staked, + min_juror_stake, + juror_incentives, + } + } } diff --git a/pallets/schelling-game-shared/src/share_link.rs b/pallets/schelling-game-shared/src/share_link.rs index 658f86a..e2ac668 100644 --- a/pallets/schelling-game-shared/src/share_link.rs +++ b/pallets/schelling-game-shared/src/share_link.rs @@ -29,6 +29,34 @@ impl SchellingGameSharedLink for Pallet { ) } + fn create_phase_with_all_data( + evidence_length: u64, + end_of_staking_time: u64, + staking_length: u64, + drawing_length: u64, + commit_length: u64, + vote_length: u64, + appeal_length: u64, + max_draws: u64, + min_number_juror_staked: u64, + min_juror_stake: u64, + juror_incentives: (u64, u64), + ) -> Self::PhaseData { + Self::create_phase_with_all_data( + evidence_length, + end_of_staking_time, + staking_length, + drawing_length, + commit_length, + vote_length, + appeal_length, + max_draws, + min_number_juror_staked, + min_juror_stake, + juror_incentives, + ) + } + /// Get the Period fn get_period_link(key: Self::SumTreeName) -> Option { Self::get_period(key) diff --git a/rust-toolchain.toml b/rust-toolchain.toml.bak similarity index 100% rename from rust-toolchain.toml rename to rust-toolchain.toml.bak diff --git a/traits/schelling-game-shared-link/src/lib.rs b/traits/schelling-game-shared-link/src/lib.rs index 14838ac..e9e8f1e 100644 --- a/traits/schelling-game-shared-link/src/lib.rs +++ b/traits/schelling-game-shared-link/src/lib.rs @@ -20,6 +20,20 @@ pub trait SchellingGameSharedLink { min_juror_stake: u64, juror_incentives: (u64, u64), ) -> Self::PhaseData; + + fn create_phase_with_all_data( + evidence_length: u64, + end_of_staking_time: u64, + staking_length: u64, + drawing_length: u64, + commit_length: u64, + vote_length: u64, + appeal_length: u64, + max_draws: u64, + min_number_juror_staked: u64, + min_juror_stake: u64, + juror_incentives: (u64, u64), + ) -> Self::PhaseData; fn get_period_link(key: Self::SumTreeName) -> Option; fn set_to_evidence_period_link( @@ -130,6 +144,4 @@ pub trait SchellingGameSharedLink { fn get_drawn_jurors(key: Self::SumTreeName) -> Vec<(Self::AccountId, u64)>; fn get_winning_decision_value_link(key: Self::SumTreeName) -> Self::WinningDecision; - - }