Skip to content

Commit

Permalink
Updated param type
Browse files Browse the repository at this point in the history
  • Loading branch information
zktony committed Feb 12, 2024
1 parent f8a13a7 commit 39cc1c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pallets/thea/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ impl<T: Config> Pallet<T> {
}
for network in &active_networks {
let network_config = <NetworkConfig<T>>::get(*network);
let message = match network_config.key_type {
let message = match network_config.network_type {
NetworkType::Evm => {
if let Some(payload) = ValidatorSet::new(uncompressed_keys.clone(), new_id)
{
Expand Down
10 changes: 5 additions & 5 deletions pallets/thea/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ fn test_report_misbehaviour_happy_path() {
fork_period: 0,
min_stake: 1_000_000,
fisherman_stake: 1_000_000,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
};
<NetworkConfig<Test>>::insert(network, config);
let relayer = 1u64;
Expand Down Expand Up @@ -343,7 +343,7 @@ fn test_report_misbehaviour_not_enough_stake() {
fork_period: 0,
min_stake: 1_000_000_000_000_000_000_000_000_000,
fisherman_stake: 1_000_000_000_000_000_000_000_000,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
};
<NetworkConfig<Test>>::insert(network, config);
let relayer = 1u64;
Expand Down Expand Up @@ -378,7 +378,7 @@ fn test_handle_misbehaviour_happy_path_valid_proposal() {
fork_period: 0,
min_stake: 1_000_000,
fisherman_stake: 1_000_000,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
};
<NetworkConfig<Test>>::insert(network, config);
let relayer = 1u64;
Expand Down Expand Up @@ -414,7 +414,7 @@ fn test_handle_misbehaviour_happy_path_invalid_proposal() {
fork_period: 0,
min_stake: 1_000_000,
fisherman_stake: 1_000_000,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
};
<NetworkConfig<Test>>::insert(network, config);
let relayer = 1u64;
Expand Down Expand Up @@ -675,7 +675,7 @@ fn test_submit_incoming_message_happy_path_first_message() {
fork_period: 0,
min_stake: 1 * UNIT_BALANCE,
fisherman_stake: 1 * UNIT_BALANCE,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
};
<NetworkConfig<Test>>::insert(network_id, network_config);
<AllowListTestingRelayers<Test>>::insert(network_id, relayer);
Expand Down
6 changes: 3 additions & 3 deletions primitives/thea/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub struct NetworkConfig {
pub fork_period: u32,
pub min_stake: u128,
pub fisherman_stake: u128,
pub key_type: NetworkType,
pub network_type: NetworkType,
}

impl Default for NetworkConfig {
Expand All @@ -145,15 +145,15 @@ impl Default for NetworkConfig {
fork_period: 20,
min_stake: 1000 * UNIT_BALANCE,
fisherman_stake: 100 * UNIT_BALANCE,
key_type: NetworkType::Parachain,
network_type: NetworkType::Parachain,
}
}
}

impl NetworkConfig {
pub fn new(fork_period: u32, min_stake: u128, fisherman_stake: u128, is_evm: bool) -> Self {
let key_type = if is_evm { NetworkType::Evm } else { NetworkType::Parachain };
Self { fork_period, min_stake, fisherman_stake, key_type }
Self { fork_period, min_stake, fisherman_stake, network_type: key_type }
}
}

Expand Down

0 comments on commit 39cc1c8

Please sign in to comment.