Add test utils and module fixes for dependents #24

Merged
roysc merged 12 commits from update-czkg4844 into main 2024-05-29 09:47:10 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 353d0ce688 - Show all commits

View File

@ -168,6 +168,7 @@ func (sdb *builder) WriteStateDiff(
// WriteStateDiff writes a statediff object to output sinks // WriteStateDiff writes a statediff object to output sinks
func (sdb *builder) WriteStateSnapshot( func (sdb *builder) WriteStateSnapshot(
ctx context.Context,
stateRoot common.Hash, params Params, stateRoot common.Hash, params Params,
nodeSink sdtypes.StateNodeSink, nodeSink sdtypes.StateNodeSink,
ipldSink sdtypes.IPLDSink, ipldSink sdtypes.IPLDSink,
@ -200,7 +201,7 @@ func (sdb *builder) WriteStateSnapshot(
} }
} }
// errgroup will cancel if any group fails // errgroup will cancel if any group fails
g, ctx := errgroup.WithContext(context.Background()) g, ctx := errgroup.WithContext(ctx)
for i := range subiters { for i := range subiters {
func(subdiv uint) { func(subdiv uint) {
g.Go(func() error { g.Go(func() error {

View File

@ -2,6 +2,7 @@ package test_helpers
import ( import (
"bytes" "bytes"
"context"
"fmt" "fmt"
"math/big" "math/big"
"math/rand" "math/rand"
@ -93,6 +94,7 @@ func RunStateSnapshot(
tr := tracker.New(recoveryFile, subtries) tr := tracker.New(recoveryFile, subtries)
defer tr.CloseAndSave() defer tr.CloseAndSave()
return builder.WriteStateSnapshot( return builder.WriteStateSnapshot(
context.Background(),
test.StateRoot, params, stateAppender, ipldAppender, tr, test.StateRoot, params, stateAppender, ipldAppender, tr,
) )
} }