Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Jul 31, 2024
1 parent 239fd6b commit e0858e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions crates/shared/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ pub const TOTAL_SIGNERS: u8 = 3;

/// Threshold for those signers
pub const SIGNER_THRESHOLD: u8 = 2;

/// For testing to line up chain mock data and reshare_test
pub const TEST_RESHARE_BLOCK_NUMBER: u32 = 5;
7 changes: 5 additions & 2 deletions crates/threshold-signature-server/src/validator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ use crate::{
validator::{api::validate_new_reshare, errors::ValidatorErr},
};
use entropy_kvdb::clean_tests;
use entropy_shared::{OcwMessageReshare, EVE_VERIFYING_KEY, MIN_BALANCE, NETWORK_PARENT_KEY};
use entropy_shared::{
OcwMessageReshare, EVE_VERIFYING_KEY, MIN_BALANCE, NETWORK_PARENT_KEY,
TEST_RESHARE_BLOCK_NUMBER,
};
use entropy_testing_utils::{
constants::{ALICE_STASH_ADDRESS, RANDOM_ACCOUNT},
substrate_context::{test_node_process_testing_state, testing_context},
Expand Down Expand Up @@ -68,7 +71,7 @@ async fn test_reshare() {

setup_for_reshare(&api, &rpc).await;

let block_number = rpc.chain_get_header(None).await.unwrap().unwrap().number + 1;
let block_number = TEST_RESHARE_BLOCK_NUMBER;
let onchain_reshare_request =
OcwMessageReshare { new_signer: alice.public().encode(), block_number };

Expand Down
7 changes: 5 additions & 2 deletions pallets/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ use sp_staking::SessionIndex;

#[frame_support::pallet]
pub mod pallet {
use entropy_shared::{ValidatorInfo, X25519PublicKey, SIGNING_PARTY_SIZE};
use entropy_shared::{
ValidatorInfo, X25519PublicKey, SIGNING_PARTY_SIZE, TEST_RESHARE_BLOCK_NUMBER,
};
use frame_support::{
dispatch::{DispatchResult, DispatchResultWithPostInfo},
pallet_prelude::*,
Expand Down Expand Up @@ -239,7 +241,8 @@ pub mod pallet {
});

ReshareData::<T>::put(ReshareInfo {
block_number: 4u32.into(),
// To give enough time for test_reshare setup
block_number: TEST_RESHARE_BLOCK_NUMBER.into(),
// Alice signer public key
new_signer: vec![
212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214,
Expand Down

0 comments on commit e0858e6

Please sign in to comment.