You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A small bug was discovered while researching the upgrade process.
TL;DR
If someone is stacking and their stacking cycles end in the current cycle when the core contract is shut down, they can successfully send a claim-mining-reward transaction, but need to wait until after the cycle completes in order to receive both CityCoins and uSTX.
If called during the current cycle, only the CityCoins will be returned.
Description
After the shutdown-contract function is successfully called, the contract then allows users to claim their rewards for any cycle by setting the is-shutdown variable true.
;; set variables to disable mining/stacking in CORE
(var-setactivationReachedfalse)
(var-setshutdownHeight stacksHeight)
;; set variable to allow for all stacking claims
(var-setisShutdowntrue)
(oktrue)
)
)
This variable is used to bypass the assert in claim-stacking-reward-at-cycle that verifies the user is claiming in a previous cycle, which allows claims to process for the current and future cycles.
However, before that happens the function get-entitled-stacking-reward is called on line 770 to determine the amount of uSTX entitled to the caller. That function checks if the target cycle is before the current cycle and returns u0by default.
During the claim process the entry for the stacker in the StackerAtCycle map is reset to 0 for CityCoins and uSTX to prevent the stacker from claiming again.
A small bug was discovered while researching the upgrade process.
TL;DR
If someone is stacking and their stacking cycles end in the current cycle when the core contract is shut down, they can successfully send a
claim-mining-reward
transaction, but need to wait until after the cycle completes in order to receive both CityCoins and uSTX.If called during the current cycle, only the CityCoins will be returned.
Description
After the
shutdown-contract
function is successfully called, the contract then allows users to claim their rewards for any cycle by setting theis-shutdown
variable true.contracts/contracts/MiamiCoin/core-v1.clar
Lines 880 to 895 in ebdef00
This variable is used to bypass the assert in
claim-stacking-reward-at-cycle
that verifies the user is claiming in a previous cycle, which allows claims to process for the current and future cycles.contracts/contracts/MiamiCoin/core-v1.clar
Lines 770 to 777 in ebdef00
However, before that happens the function
get-entitled-stacking-reward
is called on line 770 to determine the amount of uSTX entitled to the caller. That function checks if the target cycle is before the current cycle and returnsu0
by default.During the claim process the entry for the stacker in the
StackerAtCycle
map is reset to 0 for CityCoins and uSTX to prevent the stacker from claiming again.contracts/contracts/MiamiCoin/core-v1.clar
Lines 636 to 643 in ebdef00
This means that if a stacker has stacked CityCoins they can claim after the current cycle finishes:
shutdown-contract
call will allow the stacker to claim the CityCoinsThe text was updated successfully, but these errors were encountered: