Skip to content

Commit bd39f30

Browse files
docs: comments on update_rewards assertions (#96)
1 parent 53bea2b commit bd39f30

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/staking/staking.cairo

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,12 @@ pub mod Staking {
14041404
Error::REWARDS_ALREADY_UPDATED,
14051405
);
14061406

1407-
// Assert staker exists.
1407+
// Assert staker exists and active.
1408+
// Staker is considered to exist from the moment of `stake` (when `InternalStakerInfo`
1409+
// struct is created) until the calling to `unstake_action` (when `InternalStakerInfo`
1410+
// struct is deleted).
1411+
// Staker remains active until the intent period begins, i.e. K epochs after
1412+
// `unstake_intent` is called.
14081413
let staker_info = self.internal_staker_info(:staker_address);
14091414
let curr_epoch = self.get_current_epoch();
14101415
assert!(
@@ -1418,7 +1423,9 @@ pub mod Staking {
14181423
.get_staker_total_strk_btc_balance_at_epoch(
14191424
:staker_address, :staker_pool_info, epoch_id: curr_epoch,
14201425
);
1421-
// Assert staker has balance.
1426+
// Assert staker has non-zero balance.
1427+
// Staker exists with zero balance for the first K epochs after `stake`, then the stake
1428+
// becomes effective.
14221429
assert!(staker_total_strk_balance.is_non_zero(), "{}", Error::INVALID_STAKER);
14231430

14241431
// Update last block rewards.

0 commit comments

Comments
 (0)