Skip to content

Commit

Permalink
Revert balances recalculations commits + moving t2 balance from old t…
Browse files Browse the repository at this point in the history
…minus1 to new tminus1 (#39)
  • Loading branch information
ice-myles authored Dec 15, 2023
1 parent 5dfad04 commit d4d0b2e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 810 deletions.
38 changes: 0 additions & 38 deletions bookkeeper/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package storage

import (
"context"
"fmt"
"sort"
"testing"
stdlibtime "time"
Expand Down Expand Up @@ -116,40 +115,3 @@ func TestStorage(t *testing.T) {
sort.SliceStable(h2, func(ii, jj int) bool { return h2[ii].CreatedAt.Before(*h2[jj].CreatedAt.Time) })
assert.EqualValues(t, []*BalanceHistory{}, h2)
}

func TestStorage_SelectAdjustUserInformation_NoError_On_LongValues(t *testing.T) {
cl := MustConnect(context.Background(), "self")
defer func() {
if err := recover(); err != nil {
cl.Close()
panic(err)
}
cl.Close()
}()
require.NoError(t, cl.Ping(context.Background()))

limit := int64(1000)
offset := int64(0)
userIDs := make([]string, 0, 1_000_000)
for ix := 1_000_000; ix < 2_000_000; ix++ {
userIDs = append(userIDs, fmt.Sprint(ix))
}
_, err := cl.GetAdjustUserInformation(context.Background(), userIDs, limit, offset)
require.NoError(t, err)

userIDs = nil
userIDs = make([]string, 0, 1_000_000)
for ix := 10_000_000; ix < 11_000_000; ix++ {
userIDs = append(userIDs, fmt.Sprint(ix))
}
_, err = cl.GetAdjustUserInformation(context.Background(), userIDs, limit, offset)
require.NoError(t, err)

userIDs = nil
userIDs = make([]string, 0, 1_000_000)
for ix := 54_000_000; ix < 55_000_000; ix++ {
userIDs = append(userIDs, fmt.Sprint(ix))
}
_, err = cl.GetAdjustUserInformation(context.Background(), userIDs, limit, offset)
require.NoError(t, err)
}
30 changes: 0 additions & 30 deletions miner/.testdata/DDL.sql

This file was deleted.

24 changes: 0 additions & 24 deletions miner/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package miner

import (
"context"
_ "embed"
"io"
"sync"
"sync/atomic"
Expand All @@ -14,7 +13,6 @@ import (
"github.com/ice-blockchain/freezer/model"
"github.com/ice-blockchain/freezer/tokenomics"
messagebroker "github.com/ice-blockchain/wintr/connectors/message_broker"
storagePG "github.com/ice-blockchain/wintr/connectors/storage/v2"
"github.com/ice-blockchain/wintr/connectors/storage/v3"
"github.com/ice-blockchain/wintr/time"
)
Expand Down Expand Up @@ -49,9 +47,6 @@ const (
var (
//nolint:gochecknoglobals // Singleton & global config mounted only during bootstrap.
cfg config

//go:embed .testdata/DDL.sql
eskimoDDL string
)

type (
Expand All @@ -63,7 +58,6 @@ type (
model.ExtraBonusStartedAtField
model.LatestDeviceField
model.UserIDField
model.UsernameField
UpdatedUser
model.BalanceSoloPendingField
model.BalanceT1PendingField
Expand Down Expand Up @@ -114,22 +108,6 @@ type (
model.IDTMinus1Field
}

backupUserUpdated struct {
model.BalancesBackupUsedAtField
model.UserIDField
model.BalanceT1Field
model.BalanceT2Field
model.SlashingRateT1Field
model.SlashingRateT2Field
model.FirstRecalculatedBalanceT1Field
model.FirstRecalculatedBalanceT2Field
model.DeserializedBackupUsersKey
model.ActiveT1ReferralsField
model.ActiveT2ReferralsField
model.FirstRecalculatedActiveT1ReferralsField
model.FirstRecalculatedActiveT2ReferralsField
}

referral struct {
model.MiningSessionSoloStartedAtField
model.MiningSessionSoloEndedAtField
Expand Down Expand Up @@ -160,14 +138,12 @@ type (
miner struct {
mb messagebroker.Client
db storage.DB
dbPG *storagePG.DB
dwhClient dwh.Client
cancel context.CancelFunc
telemetry *telemetry
wg *sync.WaitGroup
extraBonusStartDate *time.Time
extraBonusIndicesDistribution map[uint16]map[uint16]uint16
recalculationBalanceStartDate *time.Time
}
config struct {
disableAdvancedTeam *atomic.Pointer[[]string]
Expand Down
Loading

0 comments on commit d4d0b2e

Please sign in to comment.