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

Commit

Permalink
create phase will all data
Browse files Browse the repository at this point in the history
  • Loading branch information
amiyatulu committed Jan 21, 2024
1 parent 2c439f9 commit 70da7d4
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pallets/profile-validation/src/extras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<T: Config> ChallengeEvidencePost<T> {

impl<T: Config> Pallet<T> {
pub(super) fn get_phase_data() -> PhaseData<T> {
T::SchellingGameSharedSource::create_phase_with_all_data(10, 100, 100, 100, 100, 100, 100, 5, 3, 100, (100, 100))
T::SchellingGameSharedSource::create_phase_with_all_data(10, 100, 100, 100, 100, 100, 100, 5, 5, 100, (100, 100))
// T::SchellingGameSharedSource::create_phase_data(100, 5, 3, 100, (100, 100))
}

Expand Down
46 changes: 46 additions & 0 deletions pallets/profile-validation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,49 @@ fn schelling_game_test() {
assert_eq!(300025, balance);
})
}

#[test]
fn test_draw_juror() {
new_test_ext().execute_with(|| {
System::set_block_number(1);
let content: Content = Content::IPFS(
"bafkreiaiq24be2iioasr6ftyaum3icmj7amtjkom2jeokov5k5ojwzhvqy"
.as_bytes()
.to_vec(),
);
assert_ok!(ProfileValidation::add_citizen(RuntimeOrigin::signed(1), content.clone()));

assert_ok!(ProfileValidation::add_profile_stake(RuntimeOrigin::signed(3), 1, 1000));
let challenge_content: Content = Content::IPFS(
"bafkreiaiq24be2iioasr6ftyaum3icmj7amtjkom2jeokov5k5ojwzhabc"
.as_bytes()
.to_vec(),
);
let phase_data = ProfileValidation::get_phase_data();
System::set_block_number(phase_data.evidence_length + 1);
assert_ok!(ProfileValidation::challenge_profile(
RuntimeOrigin::signed(4),
1,
challenge_content.clone()
));


assert_ok!(ProfileValidation::apply_jurors(RuntimeOrigin::signed(5), 1, 100));
assert_ok!(ProfileValidation::apply_jurors(RuntimeOrigin::signed(6), 1, 500));
assert_ok!(ProfileValidation::apply_jurors(RuntimeOrigin::signed(7), 1, 1000));
assert_ok!(ProfileValidation::apply_jurors(RuntimeOrigin::signed(8), 1, 1500));
assert_ok!(ProfileValidation::apply_jurors(RuntimeOrigin::signed(9), 1, 2000));

System::set_block_number(phase_data.evidence_length + 1 + phase_data.staking_length);

assert_ok!(ProfileValidation::pass_period(RuntimeOrigin::signed(5), 1));

assert_ok!(ProfileValidation::draw_jurors(RuntimeOrigin::signed(5), 1, 6));

// assert_ok!(ProfileValidation::draw_jurors(RuntimeOrigin::signed(5), 1, 5));




})
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml.bak
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "stable-2023-04-20" # stable|beta|nightly
channel = "stable-2023-12-21" # stable|beta|nightly
targets = [ "wasm32-unknown-unknown"]

0 comments on commit 70da7d4

Please sign in to comment.