diff options
author | Pavel Zbitskiy <65323360+algorandskiy@users.noreply.github.com> | 2022-07-06 16:55:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-06 16:55:17 -0400 |
commit | c52a5b43af450e4bfc2764a6e230b718f7e63685 (patch) | |
tree | 613ac5ad0d38bf95c5f8e5cc8dfdf5e4feb772c0 | |
parent | a568d3ddf40b9bf66ecf658191ca8ed518e6166f (diff) |
320 rounds: fix linter complains (#4235)feature/320-rounds
-rw-r--r-- | ledger/accountdb_test.go | 6 | ||||
-rw-r--r-- | ledger/acctonline_test.go | 20 | ||||
-rw-r--r-- | ledger/archival_test.go | 4 | ||||
-rw-r--r-- | ledger/catchpointtracker_test.go | 2 | ||||
-rw-r--r-- | ledger/catchupaccessor.go | 4 | ||||
-rw-r--r-- | ledger/evalbench_test.go | 3 | ||||
-rw-r--r-- | ledger/onlineaccountscache_test.go | 2 | ||||
-rw-r--r-- | ledger/voters.go | 1 |
8 files changed, 15 insertions, 27 deletions
diff --git a/ledger/accountdb_test.go b/ledger/accountdb_test.go index f03d7d5a0..5971e95af 100644 --- a/ledger/accountdb_test.go +++ b/ledger/accountdb_test.go @@ -3258,6 +3258,8 @@ func (w *mockOnlineAccountsWriter) insertOnlineAccount(addr basics.Address, norm func (w *mockOnlineAccountsWriter) close() {} func TestAccountOnlineAccountsNewRound(t *testing.T) { + partitiontest.PartitionTest(t) + proto := config.Consensus[protocol.ConsensusCurrentVersion] writer := &mockOnlineAccountsWriter{rowid: 100} @@ -3360,6 +3362,8 @@ func TestAccountOnlineAccountsNewRound(t *testing.T) { } func TestAccountOnlineAccountsNewRoundFlip(t *testing.T) { + partitiontest.PartitionTest(t) + proto := config.Consensus[protocol.ConsensusCurrentVersion] writer := &mockOnlineAccountsWriter{rowid: 100} @@ -3718,6 +3722,8 @@ func TestOnlineAccountsDeletion(t *testing.T) { // Test functions operating on catchpointfirststageinfo table. func TestCatchpointFirstStageInfoTable(t *testing.T) { + partitiontest.PartitionTest(t) + dbs, _ := dbOpenTest(t, true) defer dbs.Close() diff --git a/ledger/acctonline_test.go b/ledger/acctonline_test.go index dd36f653a..d0155b16f 100644 --- a/ledger/acctonline_test.go +++ b/ledger/acctonline_test.go @@ -1213,22 +1213,6 @@ func TestAcctOnlineVotersLongerHistory(t *testing.T) { require.Equal(t, maxBalLookback+1, oa.onlineAccountsCache.accounts[addrA].Len()) } -func addBlockToAccountsUpdate(blk bookkeeping.Block, ao *onlineAccounts) { - updates := ledgercore.MakeAccountDeltas(1) - delta := ledgercore.MakeStateDelta(&blk.BlockHeader, 0, updates.Len(), 0) - ao.newBlock(blk, delta) -} - -func onlineAccountDataWithWeight(weight uint64) basics.AccountData { - var data basics.AccountData - data.MicroAlgos.Raw = weight + 1 - data.Status = basics.Online - data.VoteLastValid = 1000 - data.VoteFirstValid = 0 - data.RewardsBase = 0 - return data -} - // compareTopAccounts makes sure that accounts returned from OnlineTop function are sorted and contains the online accounts on the test func compareTopAccounts(a *require.Assertions, testingResult []*ledgercore.OnlineAccount, expectedAccountsBalances []basics.BalanceRecord) { isSorted := sort.SliceIsSorted(testingResult, func(i, j int) bool { @@ -1274,8 +1258,6 @@ func addSinkAndPoolAccounts(genesisAccts []map[basics.Address]basics.AccountData func newBlockWithUpdates(genesisAccts []map[basics.Address]basics.AccountData, updates ledgercore.AccountDeltas, totals ledgercore.AccountTotals, t *testing.T, ml *mockLedgerForTracker, round int, oa *onlineAccounts) { base := genesisAccts[0] - newAccts := applyPartialDeltas(base, updates) - genesisAccts = append(genesisAccts, newAccts) totals = newBlock(t, ml, totals, protocol.ConsensusCurrentVersion, config.Consensus[protocol.ConsensusCurrentVersion], basics.Round(round), base, updates, totals) commitSync(t, oa, ml, basics.Round(round)) } @@ -1599,7 +1581,7 @@ func TestAcctOnlineTopDBBehindMemRound(t *testing.T) { }) stallingTracker.postCommitReleaseLock <- struct{}{} }() - top, err = oa.onlineTop(2, 2, 5) + _, err = oa.onlineTop(2, 2, 5) a.Error(err) a.Contains(err.Error(), "is behind in-memory round") diff --git a/ledger/archival_test.go b/ledger/archival_test.go index 2d6091476..b16193a6a 100644 --- a/ledger/archival_test.go +++ b/ledger/archival_test.go @@ -805,7 +805,7 @@ func checkTrackers(t *testing.T, wl *wrappedLedger, rnd basics.Round) (basics.Ro wl.l.trackerMu.RLock() defer wl.l.trackerMu.RUnlock() for _, trk := range wl.l.trackers.trackers { - if au, ok := trk.(*accountUpdates); ok { + if _, ok := trk.(*accountUpdates); ok { wl.l.trackers.waitAccountsWriting() minSave, _ = trk.committedUpTo(rnd) wl.l.trackers.committedUpTo(rnd) @@ -818,7 +818,7 @@ func checkTrackers(t *testing.T, wl *wrappedLedger, rnd basics.Round) (basics.Ro trackerType = reflect.TypeOf(trk).Elem() cleanTracker = reflect.New(trackerType).Interface().(ledgerTracker) - au = cleanTracker.(*accountUpdates) + au := cleanTracker.(*accountUpdates) cfg := config.GetDefaultLocal() cfg.Archival = true au.initialize(cfg) diff --git a/ledger/catchpointtracker_test.go b/ledger/catchpointtracker_test.go index d58385a1a..06c52b0ff 100644 --- a/ledger/catchpointtracker_test.go +++ b/ledger/catchpointtracker_test.go @@ -826,6 +826,8 @@ func TestCalculateFirstStageRounds(t *testing.T) { } func TestCalculateCatchpointRounds(t *testing.T) { + partitiontest.PartitionTest(t) + type TestCase struct { // input min basics.Round diff --git a/ledger/catchupaccessor.go b/ledger/catchupaccessor.go index 2ef5661a3..ec05c86af 100644 --- a/ledger/catchupaccessor.go +++ b/ledger/catchupaccessor.go @@ -220,8 +220,7 @@ type CatchpointCatchupAccessorProgress struct { // Having the cachedTrie here would help to accelerate the catchup process since the trie maintain an internal cache of nodes. // While rebuilding the trie, we don't want to force and reload (some) of these nodes into the cache for each catchpoint file chunk. - cachedTrie *merkletrie.Trie - evictFrequency uint64 + cachedTrie *merkletrie.Trie BalancesWriteDuration time.Duration CreatablesWriteDuration time.Duration @@ -601,7 +600,6 @@ func (c *CatchpointCatchupAccessorImpl) BuildMerkleTrie(ctx context.Context, pro if err != nil { errChan <- err } - return }() wg.Wait() diff --git a/ledger/evalbench_test.go b/ledger/evalbench_test.go index e80aa9147..265579cf3 100644 --- a/ledger/evalbench_test.go +++ b/ledger/evalbench_test.go @@ -163,8 +163,7 @@ func (g *benchAppOptInsTxnGenerator) Prepare(tb testing.TB, addrs []basics.Addre appIdxPerm := rand.Perm(g.NumApps) for j := 0; j < rand.Int()%(maxAppsOptedIn+1); j++ { - var appIdx basics.AppIndex - appIdx = basics.AppIndex(appIdxPerm[j] + 1) + appIdx := basics.AppIndex(appIdxPerm[j] + 1) acctOptIns[appIdx] = struct{}{} txn := transactions.Transaction{ diff --git a/ledger/onlineaccountscache_test.go b/ledger/onlineaccountscache_test.go index 0b68dd3c2..42a94bb42 100644 --- a/ledger/onlineaccountscache_test.go +++ b/ledger/onlineaccountscache_test.go @@ -129,6 +129,8 @@ func TestOnlineAccountsCachePruneOffline(t *testing.T) { } func TestOnlineAccountsCacheMaxEntries(t *testing.T) { + partitiontest.PartitionTest(t) + var oac onlineAccountsCache const maxCacheSize = 10 oac.init(nil, maxCacheSize) diff --git a/ledger/voters.go b/ledger/voters.go index f2168a78e..9e44f6640 100644 --- a/ledger/voters.go +++ b/ledger/voters.go @@ -147,7 +147,6 @@ func (vt *votersTracker) loadTree(hdr bookkeeping.BlockHeader) { tr.BroadcastError(err) } }() - return } // close waits until all the internal spawned go-routines are done before returning, allowing clean |