Skip to content

Commit

Permalink
Merge pull request #6120 from onflow/bastian/add-always-diff-values-flag
Browse files Browse the repository at this point in the history
Improve diff tool: Add a flag which forces value comparison
  • Loading branch information
turbolent authored Jun 19, 2024
2 parents d820f91 + 114eb00 commit 3a86c0a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/util/cmd/diff-states/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var (
flagStateCommitment1 string
flagStateCommitment2 string
flagRaw bool
flagAlwaysDiffValues bool
flagNWorker int
flagChain string
)
Expand Down Expand Up @@ -113,6 +114,13 @@ func init() {
"Raw or value",
)

Cmd.Flags().BoolVar(
&flagAlwaysDiffValues,
"always-diff-values",
false,
"always diff on value level. useful when trying to test iteration, by diffing same state.",
)

Cmd.Flags().IntVar(
&flagNWorker,
"n-worker",
Expand Down Expand Up @@ -294,6 +302,8 @@ func diffAccount(
})
}

diffValues := flagAlwaysDiffValues

err = accountRegisters1.ForEach(func(owner, key string, value1 []byte) error {
var value2 []byte
value2, err = accountRegisters2.Get(owner, key)
Expand Down Expand Up @@ -323,6 +333,10 @@ func diffAccount(
return err
}

diffValues = true
}

if diffValues {
address, err := common.BytesToAddress([]byte(owner))
if err != nil {
return err
Expand Down

0 comments on commit 3a86c0a

Please sign in to comment.