Skip to content

Commit

Permalink
tests compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Supremesource committed Nov 21, 2024
1 parent 2093f07 commit c117071
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ impl pallet_subnet_emission::Config for Test {
// setting high value because of testing (this should never be reached in practice)
type MissedPingsForInactivity = ConstU8<{ u8::MAX }>;
type PingInterval = ConstU64<50>;
type EncryptionPeriodBuffer = ConstU64<100>;
}

impl pallet_governance::Config for Test {
Expand Down
2 changes: 1 addition & 1 deletion tests/src/offworker/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn initialize_authorities(
node_id: acc_id,
node_public_key: public_key,
last_keep_alive: first_block,
block_assigned: None,
activation_block: None,
};
let decryption_nodes = vec![decryption_info.clone()];
DecryptionNodes::<Test>::set(decryption_nodes);
Expand Down
17 changes: 8 additions & 9 deletions tests/src/subnet_emission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ fn yuma_change_permits() {
// let key = (key.n().to_bytes_be(), key.e().to_bytes_be());

// let subnet_decryption_data = SubnetDecryptionInfo {
// block_assigned: 0,
// activation_block: 0,
// node_id: 1001,
// node_public_key: key.clone(),
// last_keep_alive: pallet_subspace::Tempo::<Test>::get(netuid) as u64,
Expand Down Expand Up @@ -1427,7 +1427,7 @@ fn decrypted_weight_run_result_is_applied_and_cleaned_up() {
let key = (key.n().to_bytes_be(), key.e().to_bytes_be());

let subnet_decryption_data = SubnetDecryptionInfo {
block_assigned: 0,
activation_block: Some(0),
node_id: 1001,
node_public_key: key.clone(),
last_keep_alive: pallet_subspace::Tempo::<Test>::get(netuid) as u64,
Expand Down Expand Up @@ -1533,7 +1533,7 @@ fn rotate_decryption_node() {
pallet_subnet_emission::SubnetDecryptionData::<Test>::set(
netuid,
Some(SubnetDecryptionInfo {
block_assigned: 0,
activation_block: Some(0),
node_id: dn_1,
node_public_key: key_1,
last_keep_alive: decryption_node_interval,
Expand All @@ -1543,7 +1543,7 @@ fn rotate_decryption_node() {
pallet_subnet_emission::SubnetDecryptionData::<Test>::set(
netuid,
Some(SubnetDecryptionInfo {
block_assigned: 0,
activation_block: Some(0),
node_id: dn_2,
node_public_key: key_2,
last_keep_alive: decryption_node_interval,
Expand All @@ -1565,7 +1565,6 @@ fn rotate_decryption_node() {

#[test]
fn ban_decryption_node() {
use sp_core::Get;
new_test_ext().execute_with(|| {
let netuid = 0;

Expand All @@ -1579,7 +1578,7 @@ fn ban_decryption_node() {
pallet_subnet_emission::SubnetDecryptionData::<Test>::set(
netuid,
Some(SubnetDecryptionInfo {
block_assigned: 0,
activation_block: Some(0),
node_id: dn_1,
node_public_key: key_1,
last_keep_alive: 0,
Expand All @@ -1599,9 +1598,9 @@ fn ban_decryption_node() {
decrypted_hashes: vec![123],
}),
);

let ping_interval: u64 = <Test as pallet_subnet_emission::Config>::PingInterval::get();
step_block((ping_interval * max_failed_pings as u64 + 1) as u16);
let max_encryption_inteval =
pallet_subnet_emission::Pallet::<Test>::get_max_encryption_interval(&netuid);
step_block((max_encryption_inteval + 1) as u16);

// one subnet with decryption node set
pallet_subnet_emission::DecryptionNodeCursor::<Test>::set(1);
Expand Down

0 comments on commit c117071

Please sign in to comment.