Skip to content

Commit

Permalink
fix remaining compilation errors from interface change
Browse files Browse the repository at this point in the history
  • Loading branch information
cce committed Jan 3, 2025
1 parent a12b359 commit ef0ae38
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions cmd/catchpointdump/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ func printOnlineAccounts(databaseName string, stagingTables bool, outFile *os.Fi
}

return dbAccessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
rows, err := sqlitedriver.MakeOnlineAccountsIter(ctx, tx, stagingTables)
rows, err := sqlitedriver.MakeOnlineAccountsIter(ctx, tx, stagingTables, 0)
if err != nil {
return err
}
Expand Down Expand Up @@ -627,7 +627,7 @@ func printOnlineRoundParams(databaseName string, stagingTables bool, outFile *os
}

return dbAccessor.Atomic(func(ctx context.Context, tx *sql.Tx) error {
rows, err := sqlitedriver.MakeOnlineRoundParamsIter(ctx, tx, stagingTables)
rows, err := sqlitedriver.MakeOnlineRoundParamsIter(ctx, tx, stagingTables, 0)
if err != nil {
return err
}
Expand Down
22 changes: 11 additions & 11 deletions ledger/catchpointfilewriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func verifyStateProofVerificationContextWrite(t *testing.T, data []ledgercore.St
require.NoError(t, err)

err = ml.trackerDB().Transaction(func(ctx context.Context, tx trackerdb.TransactionScope) (err error) {
writer, err := makeCatchpointFileWriter(context.Background(), protoParams, fileName, tx, ResourcesPerCatchpointFileChunk)
writer, err := makeCatchpointFileWriter(context.Background(), protoParams, fileName, tx, ResourcesPerCatchpointFileChunk, 0)
if err != nil {
return err
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestBasicCatchpointWriter(t *testing.T) {
fileName := filepath.Join(temporaryDirectory, "15.data")

err = ml.trackerDB().Transaction(func(ctx context.Context, tx trackerdb.TransactionScope) (err error) {
writer, err := makeCatchpointFileWriter(context.Background(), protoParams, fileName, tx, ResourcesPerCatchpointFileChunk)
writer, err := makeCatchpointFileWriter(context.Background(), protoParams, fileName, tx, ResourcesPerCatchpointFileChunk, 0)
if err != nil {
return err
}
Expand Down Expand Up @@ -307,7 +307,7 @@ func testWriteCatchpoint(t *testing.T, params config.ConsensusParams, rdb tracke
}

err := rdb.Transaction(func(ctx context.Context, tx trackerdb.TransactionScope) (err error) {
writer, err := makeCatchpointFileWriter(context.Background(), params, datapath, tx, maxResourcesPerChunk)
writer, err := makeCatchpointFileWriter(context.Background(), params, datapath, tx, maxResourcesPerChunk, 0)
if err != nil {
return err
}
Expand Down Expand Up @@ -440,7 +440,7 @@ func TestCatchpointReadDatabaseOverflowSingleAccount(t *testing.T) {
totalAccountsWritten := uint64(0)
totalResources := 0
totalChunks := 0
cw, err := makeCatchpointFileWriter(context.Background(), protoParams, catchpointDataFilePath, tx, maxResourcesPerChunk)
cw, err := makeCatchpointFileWriter(context.Background(), protoParams, catchpointDataFilePath, tx, maxResourcesPerChunk, 0)
require.NoError(t, err)

ar, err := tx.MakeAccountsReader()
Expand Down Expand Up @@ -546,7 +546,7 @@ func TestCatchpointReadDatabaseOverflowAccounts(t *testing.T) {

totalAccountsWritten := uint64(0)
totalResources := 0
cw, err := makeCatchpointFileWriter(context.Background(), protoParams, catchpointDataFilePath, tx, maxResourcesPerChunk)
cw, err := makeCatchpointFileWriter(context.Background(), protoParams, catchpointDataFilePath, tx, maxResourcesPerChunk, 0)
require.NoError(t, err)

// repeat this until read all accts
Expand Down Expand Up @@ -1113,18 +1113,18 @@ assert
t.Log("DB round generator", genDBRound, "validator", valDBRound)
t.Log("Latest round generator", genLatestRound, "validator", valLatestRound)

genOAHash, genOARows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOnlineAccountsIter, false)
genOAHash, genOARows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOnlineAccountsIter, 0, false)
require.NoError(t, err)
valOAHash, valOARows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOnlineAccountsIter, false)
valOAHash, valOARows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOnlineAccountsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genOAHash, valOAHash)
require.NotZero(t, genOAHash)
require.Equal(t, genOARows, valOARows)
require.NotZero(t, genOARows)

genORPHash, genORPRows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOnlineRoundParamsIter, false)
genORPHash, genORPRows, err := calculateVerificationHash(context.Background(), dl.generator.trackerDB().MakeOnlineRoundParamsIter, 0, false)
require.NoError(t, err)
valORPHash, valORPRows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOnlineRoundParamsIter, false)
valORPHash, valORPRows, err := calculateVerificationHash(context.Background(), dl.validator.trackerDB().MakeOnlineRoundParamsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genORPHash, valORPHash)
require.NotZero(t, genORPHash)
Expand All @@ -1141,13 +1141,13 @@ assert
l := testNewLedgerFromCatchpoint(t, dl.generator.trackerDB(), catchpointFilePath)
defer l.Close()

catchpointOAHash, catchpointOARows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOnlineAccountsIter, false)
catchpointOAHash, catchpointOARows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOnlineAccountsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genOAHash, catchpointOAHash)
t.Log("catchpoint onlineaccounts hash", catchpointOAHash, "matches")
require.Equal(t, genOARows, catchpointOARows)

catchpointORPHash, catchpointORPRows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOnlineRoundParamsIter, false)
catchpointORPHash, catchpointORPRows, err := calculateVerificationHash(context.Background(), l.trackerDBs.MakeOnlineRoundParamsIter, 0, false)
require.NoError(t, err)
require.Equal(t, genORPHash, catchpointORPHash)
t.Log("catchpoint onlineroundparams hash", catchpointORPHash, "matches")
Expand Down
4 changes: 2 additions & 2 deletions ledger/catchpointtracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func createCatchpoint(t *testing.T, ct *catchpointTracker, accountsRound basics.
proto := protocol.ConsensusCurrentVersion
var catchpointGenerationStats telemetryspec.CatchpointGenerationEventDetails
_, _, _, _, _, biggestChunkLen, err := ct.generateCatchpointData(
context.Background(), config.Consensus[proto], accountsRound, &catchpointGenerationStats, spVerificationEncodedData)
context.Background(), config.Consensus[proto], accountsRound, 0, &catchpointGenerationStats, spVerificationEncodedData)
require.NoError(t, err)

require.Equal(t, calculateStateProofVerificationHash(t, ml), stateProofVerificationHash)
Expand Down Expand Up @@ -606,7 +606,7 @@ func BenchmarkLargeCatchpointDataWriting(b *testing.B) {
encodedSPData, _, err := ct.getSPVerificationData()
require.NoError(b, err)
b.ResetTimer()
ct.generateCatchpointData(context.Background(), proto, basics.Round(0), &catchpointGenerationStats, encodedSPData)
ct.generateCatchpointData(context.Background(), proto, 0, 0, &catchpointGenerationStats, encodedSPData)
b.StopTimer()
b.ReportMetric(float64(accountsNumber), "accounts")
}
Expand Down
5 changes: 3 additions & 2 deletions ledger/store/trackerdb/dualdriver/dualdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sync"
"time"

"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/ledger/encoded"
"github.com/algorand/go-algorand/ledger/store/trackerdb"
"github.com/algorand/go-algorand/logging"
Expand Down Expand Up @@ -278,13 +279,13 @@ func (*reader) MakeKVsIter(ctx context.Context) (trackerdb.KVsIter, error) {
}

// MakeOnlineAccountsIter implements trackerdb.Reader
func (*reader) MakeOnlineAccountsIter(context.Context, bool) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
func (*reader) MakeOnlineAccountsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineAccountRecordV6], error) {
// TODO: catchpoint
return nil, nil
}

// MakeOnlineRoundParamsIter implements trackerdb.Reader
func (*reader) MakeOnlineRoundParamsIter(context.Context, bool) (trackerdb.TableIterator[*encoded.OnlineRoundParamsRecordV6], error) {
func (*reader) MakeOnlineRoundParamsIter(context.Context, bool, basics.Round) (trackerdb.TableIterator[*encoded.OnlineRoundParamsRecordV6], error) {
// TODO: catchpoint
return nil, nil
}
Expand Down

0 comments on commit ef0ae38

Please sign in to comment.