-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ledger: use single SP verification hash/data query for catchpoint tracking & generation #5579
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,9 +328,12 @@ func TestRecordCatchpointFile(t *testing.T) { | |
} | ||
|
||
func createCatchpoint(t *testing.T, ct *catchpointTracker, accountsRound basics.Round, ml *mockLedgerForTracker, round basics.Round) { | ||
spVerificationEncodedData, stateProofVerificationHash, err := ct.getSPVerificationData() | ||
require.NoError(t, err) | ||
|
||
var catchpointGenerationStats telemetryspec.CatchpointGenerationEventDetails | ||
_, _, _, biggestChunkLen, stateProofVerificationHash, err := ct.generateCatchpointData( | ||
context.Background(), accountsRound, &catchpointGenerationStats) | ||
_, _, _, biggestChunkLen, err := ct.generateCatchpointData( | ||
context.Background(), accountsRound, &catchpointGenerationStats, spVerificationEncodedData) | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, calculateStateProofVerificationHash(t, ml), stateProofVerificationHash) | ||
|
@@ -460,16 +463,18 @@ func BenchmarkLargeCatchpointDataWriting(b *testing.B) { | |
require.NoError(b, err) | ||
|
||
var catchpointGenerationStats telemetryspec.CatchpointGenerationEventDetails | ||
encodedSPData, _, err := ct.getSPVerificationData() | ||
require.NoError(b, err) | ||
b.ResetTimer() | ||
ct.generateCatchpointData(context.Background(), basics.Round(0), &catchpointGenerationStats) | ||
ct.generateCatchpointData(context.Background(), basics.Round(0), &catchpointGenerationStats, encodedSPData) | ||
b.StopTimer() | ||
b.ReportMetric(float64(accountsNumber), "accounts") | ||
} | ||
|
||
func TestCatchpointReproducibleLabels(t *testing.T) { | ||
partitiontest.PartitionTest(t) | ||
|
||
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems not related to the PR so just curious what the purpose of the chang eis. |
||
if runtime.GOARCH == "arm" { | ||
t.Skip("This test is too slow on ARM and causes CI builds to time out") | ||
} | ||
|
||
|
@@ -592,7 +597,12 @@ func TestCatchpointReproducibleLabels(t *testing.T) { | |
ml2 := ledgerHistory[rnd] | ||
require.NotNil(t, ml2) | ||
|
||
ct2 := newCatchpointTracker(t, ml2, cfg, ".") | ||
cfg2 := cfg | ||
// every other iteration modify CatchpointTracking to ensure labels generation does not depends on catchpoint file creation | ||
if rnd%2 == 0 { | ||
cfg2.CatchpointTracking = int64(crypto.RandUint63())%2 + 1 //values 1 or 2 | ||
} | ||
Comment on lines
+601
to
+604
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not guaranteed to modify the tracking value, for what looks like 2 reasons:
why not just unconditionally set |
||
ct2 := newCatchpointTracker(t, ml2, cfg2, ".") | ||
defer ct2.close() | ||
for i := rnd + 1; i <= lastRound; i++ { | ||
blk := bookkeeping.Block{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need a Transaction scope if you're just reading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point, the place I pulled this out of was inside a
Transaction
, but now it is read onlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #5592