Skip to content
Open
Changes from 1 commit
Commits
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
27 changes: 27 additions & 0 deletions cmd/util/cmd/compare-cadence-vm/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"strings"
"sync/atomic"
"time"

"github.com/kr/pretty"
sdk "github.com/onflow/flow-go-sdk"
Expand All @@ -21,6 +22,7 @@ import (
"github.com/onflow/flow-go/fvm"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/grpcclient"
"github.com/onflow/flow-go/module/util"
"github.com/onflow/flow-go/utils/debug"
)

Expand Down Expand Up @@ -124,6 +126,16 @@ func run(_ *cobra.Command, args []string) {
log.Fatal().Msg("either provide a single block ID and use --block-count, or provide multiple block IDs and do not use --block-count")
}

blockHeaderProgress := util.LogProgress(
log.Logger,
util.NewLogProgressConfig(
"fetching block headers",
flagBlockCount,
1*time.Second,
100/5, // log every 5%
),
)

blockID := blockIDs[0]
for i := 0; i < flagBlockCount; i++ {
header := debug_tx.FetchBlockHeader(blockID, flowClient)
Expand All @@ -133,8 +145,11 @@ func run(_ *cobra.Command, args []string) {
header: header,
})

blockHeaderProgress(1)

blockID = header.ParentID
}

} else {
for _, blockID := range blockIDs {
header := debug_tx.FetchBlockHeader(blockID, flowClient)
Expand All @@ -146,6 +161,16 @@ func run(_ *cobra.Command, args []string) {
}
}

blockProgress := util.LogProgress(
log.Logger,
util.NewLogProgressConfig(
"executing blocks",
flagBlockCount,
1*time.Second,
100/5, // log every 5%
),
)

var (
blocksMismatched int64
blocksMatched int64
Expand Down Expand Up @@ -175,6 +200,8 @@ func run(_ *cobra.Command, args []string) {
atomic.AddInt64(&blocksMatched, 1)
}

blockProgress(1)

return nil
})
}
Expand Down
Loading