diff --git a/cmd/freezer-refrigerant/tokenomics.go b/cmd/freezer-refrigerant/tokenomics.go index 78ceaf9..bcc34a6 100644 --- a/cmd/freezer-refrigerant/tokenomics.go +++ b/cmd/freezer-refrigerant/tokenomics.go @@ -161,10 +161,6 @@ func (s *service) StartOrUpdatePreStaking( //nolint:gocritic // False negative. Allocation: float64(req.Data.Allocation), }, } - if true { - return nil, server.ForbiddenWithCode(errors.Errorf("Endpoint disabled due to reset"), decreasingPreStakingAllocationOrYearsNotAllowedErrorCode) - } - if err := s.tokenomicsProcessor.StartOrUpdatePreStaking(contextWithHashCode(ctx, req), st); err != nil { err = errors.Wrapf(err, "failed to StartOrUpdatePreStaking for %#v", req.Data) switch { diff --git a/miner/contract.go b/miner/contract.go index 30c28ac..a335a42 100644 --- a/miner/contract.go +++ b/miner/contract.go @@ -141,12 +141,6 @@ type ( model.DeserializedUsersKey } - prestakingResettableUpdatedUser struct { - model.PreStakingBonusField - model.PreStakingAllocationField - model.DeserializedUsersKey - } - referralCountGuardUpdatedUser struct { model.ReferralsCountChangeGuardUpdatedAtField model.DeserializedUsersKey diff --git a/miner/miner.go b/miner/miner.go index e11ad8e..058beec 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -184,7 +184,6 @@ func (m *miner) mine(ctx context.Context, workerNumber int64) { backupedUsers = make(map[int64]*backupUserUpdated, batchSize) backupUsersUpdated = make([]*backupUserUpdated, 0, batchSize) recalculatedTiersBalancesUsers = make(map[int64]*user, batchSize) - prestakingResettableUsers = make([]*prestakingResettableUpdatedUser, 0, batchSize) historyColumns, historyInsertMetadata = dwh.InsertDDL(int(batchSize)) shouldSynchronizeBalanceFunc = func(batchNumberArg uint64) bool { return false } recalculationHistory *historyData @@ -237,7 +236,6 @@ func (m *miner) mine(ctx context.Context, workerNumber int64) { referralsThatStoppedMining = referralsThatStoppedMining[:0] allAdoptions = allAdoptions[:0] backupUsersUpdated = backupUsersUpdated[:0] - prestakingResettableUsers = prestakingResettableUsers[:0] for k := range t0Referrals { delete(t0Referrals, k) } @@ -503,18 +501,10 @@ func (m *miner) mine(ctx context.Context, workerNumber int64) { if isAdvancedTeamDisabled(usr.LatestDevice) { usr.ActiveT2Referrals = 0 } - usr.PreStakingAllocation = 0 - usr.PreStakingBonus = 0 - updatedUser, shouldGenerateHistory, IDT0Changed := mine(currentAdoption.BaseMiningRate, now, usr, t0Ref, tMinus1Ref) if shouldGenerateHistory { userHistoryKeys = append(userHistoryKeys, usr.Key()) } - prestakingResettableUsers = append(prestakingResettableUsers, &prestakingResettableUpdatedUser{ - PreStakingBonusField: model.PreStakingBonusField{PreStakingBonus: 0}, - PreStakingAllocationField: model.PreStakingAllocationField{PreStakingAllocation: 0}, - DeserializedUsersKey: usr.DeserializedUsersKey, - }) if updatedUser != nil { var extraBonusIndex uint16 if isAvailable, _ := extrabonusnotifier.IsExtraBonusAvailable(now, m.extraBonusStartDate, updatedUser.ExtraBonusStartedAt, m.extraBonusIndicesDistribution, updatedUser.ID, int16(updatedUser.UTCOffset), &extraBonusIndex, &updatedUser.ExtraBonusDaysClaimNotAvailable, &updatedUser.ExtraBonusLastClaimAvailableAt); isAvailable { @@ -657,7 +647,7 @@ func (m *miner) mine(ctx context.Context, workerNumber int64) { } var pipeliner redis.Pipeliner - if len(t1ReferralsToIncrementActiveValue)+len(t2ReferralsToIncrementActiveValue)+len(referralsCountGuardOnlyUpdatedUsers)+len(t1ReferralsThatStoppedMining)+len(t2ReferralsThatStoppedMining)+len(extraBonusOnlyUpdatedUsers)+len(referralsUpdated)+len(userGlobalRanks)+len(backupUsersUpdated)+len(prestakingResettableUsers) > 0 { + if len(t1ReferralsToIncrementActiveValue)+len(t2ReferralsToIncrementActiveValue)+len(referralsCountGuardOnlyUpdatedUsers)+len(t1ReferralsThatStoppedMining)+len(t2ReferralsThatStoppedMining)+len(extraBonusOnlyUpdatedUsers)+len(referralsUpdated)+len(userGlobalRanks)+len(backupUsersUpdated) > 0 { pipeliner = m.db.TxPipeline() } else { pipeliner = m.db.Pipeline() @@ -712,11 +702,6 @@ func (m *miner) mine(ctx context.Context, workerNumber int64) { } } } - for _, value := range prestakingResettableUsers { - if err := pipeliner.HSet(reqCtx, value.Key(), storage.SerializeValue(value)...).Err(); err != nil { - return err - } - } if len(userGlobalRanks) > 0 { if err := pipeliner.ZAdd(reqCtx, "top_miners", userGlobalRanks...).Err(); err != nil { return err diff --git a/model/model.go b/model/model.go index 12fb86e..d0e2544 100644 --- a/model/model.go +++ b/model/model.go @@ -205,10 +205,10 @@ type ( SlashingRateForTMinus1 float64 `redis:"slashing_rate_for_tminus1"` } PreStakingBonusField struct { - PreStakingBonus float64 `redis:"pre_staking_bonus"` + PreStakingBonus float64 `redis:"pre_staking_bonus,omitempty"` } PreStakingAllocationField struct { - PreStakingAllocation float64 `redis:"pre_staking_allocation"` + PreStakingAllocation float64 `redis:"pre_staking_allocation,omitempty"` } ExtraBonusField struct { ExtraBonus float64 `redis:"extra_bonus,omitempty"`