Skip to content

Commit 9b4d63f

Browse files
constconst
authored andcommitted
Merge branch 'arbitrage_coldkeys' of github.com:opentensor/subtensor into arbitrage_coldkeys
2 parents d1ee744 + 2891d62 commit 9b4d63f

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

pallets/subtensor/src/swap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<T: Config> Pallet<T> {
305305
#[allow(clippy::arithmetic_side_effects)]
306306
pub fn calculate_pow_difficulty(swap_attempts: u32) -> U256 {
307307
let base_difficulty: U256 = U256::from(10_000_000); // Base difficulty
308-
base_difficulty * U256::from(2).pow(U256::from(swap_attempts))
308+
base_difficulty.saturating_mul(U256::from(2).pow(U256::from(swap_attempts)))
309309
}
310310

311311
/// Arbitrates coldkeys that are scheduled to be swapped on this block.
@@ -317,7 +317,7 @@ impl<T: Config> Pallet<T> {
317317
/// # Returns
318318
///
319319
/// * `Weight` - The total weight consumed by this operation
320-
pub fn swap_coldkeys_this_block(weight_limit: &Weight) -> Result<Weight, &'static str> {
320+
pub fn swap_coldkeys_this_block(_weight_limit: &Weight) -> Result<Weight, &'static str> {
321321
let mut weight_used = frame_support::weights::Weight::from_parts(0, 0);
322322

323323
let current_block: u64 = Self::get_current_block_as_u64();

pallets/subtensor/tests/staking.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,16 +3638,13 @@ fn test_arbitrated_coldkey_swap_existing_destination() {
36383638
let (work3, nonce3) = generate_valid_pow(&current_coldkey, current_block, difficulty3);
36393639

36403640
// Attempt to schedule a third swap
3641-
assert_noop!(
3642-
SubtensorModule::do_schedule_coldkey_swap(
3643-
&current_coldkey.clone(),
3644-
&third_coldkey,
3645-
work3.to_fixed_bytes().to_vec(),
3646-
current_block,
3647-
nonce3
3648-
),
3649-
Error::<Test>::ColdkeyIsInArbitration
3650-
);
3641+
assert_ok!(SubtensorModule::do_schedule_coldkey_swap(
3642+
&current_coldkey.clone(),
3643+
&third_coldkey,
3644+
work3.to_fixed_bytes().to_vec(),
3645+
current_block,
3646+
nonce3
3647+
));
36513648
});
36523649
}
36533650

0 commit comments

Comments
 (0)