Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: nits
  • Loading branch information
RodrigoVillar committed Dec 3, 2025
commit fa99ce5c1d7f29f3094fbf8bd0cfd2aadd1f5232
9 changes: 8 additions & 1 deletion tests/reexecute/blockexport/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ func main() {
defer tc.RecoverAndExit()

r := require.New(tc)
blockChan, err := reexecute.CreateBlockChanFromLevelDB(blockDirSrcArg, startBlockArg, endBlockArg, chanSizeArg, tc.DeferCleanup)
blockChan, err := reexecute.CreateBlockChanFromLevelDB(
tc,
blockDirSrcArg,
startBlockArg,
endBlockArg,
chanSizeArg,
tc.DeferCleanup,
)
r.NoError(err)

db, err := leveldb.New(blockDirDstArg, nil, logging.NoLog{}, prometheus.NewRegistry())
Expand Down
2 changes: 1 addition & 1 deletion tests/reexecute/c/vm_reexecute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func benchmarkReexecuteRange(
zap.Int("chan-size", chanSize),
)

blockChan, err := reexecute.CreateBlockChanFromLevelDB(blockDir, startBlock, endBlock, chanSize, b.Cleanup)
blockChan, err := reexecute.CreateBlockChanFromLevelDB(b, blockDir, startBlock, endBlock, chanSize, b.Cleanup)
r.NoError(err)

dbLogger := tests.NewDefaultLogger("db")
Expand Down
6 changes: 4 additions & 2 deletions tests/reexecute/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"

"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/leveldb"
Expand All @@ -27,15 +28,16 @@ type BlockResult struct {
// Blocks are read sequentially and sent to the returned channel as BlockResult values.
//
// Any validation errors or iteration errors are sent as BlockResult with Err set, then the channel is closed.
func CreateBlockChanFromLevelDB(sourceDir string, startBlock, endBlock uint64, chanSize int, cleanup func(func())) (<-chan BlockResult, error) {
func CreateBlockChanFromLevelDB(t require.TestingT, sourceDir string, startBlock, endBlock uint64, chanSize int, cleanup func(func())) (<-chan BlockResult, error) {
r := require.New(t)
ch := make(chan BlockResult, chanSize)

db, err := leveldb.New(sourceDir, nil, logging.NoLog{}, prometheus.NewRegistry())
if err != nil {
return nil, fmt.Errorf("failed to create leveldb database from %q: %w", sourceDir, err)
}
cleanup(func() {
db.Close()
r.NoError(db.Close())
})

go func() {
Expand Down