Skip to content

Commit

Permalink
compare performance
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Jun 18, 2024
1 parent 00a37c3 commit f9e9e0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/util/cmd/find-trie-root/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func searchRootHashInSegments(

for reader.Next() {
record := reader.Record()
operation, _, update, err := wal.Decode(record)
operation, rootHash, _, err := wal.Decode(record)
if err != nil {
return 0, 0, fmt.Errorf("cannot decode LedgerWAL record: %w", err)
}
Expand All @@ -201,7 +201,7 @@ func searchRootHashInSegments(

switch operation {
case wal.WALUpdate:
rootHash := update.RootHash
// rootHash := update.RootHash

lg.Debug().
Str("root-hash", rootHash.String()).
Expand Down
1 change: 1 addition & 0 deletions ledger/complete/wal/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func Decode(data []byte) (operation WALOperation, rootHash ledger.RootHash, upda
switch operation {
case WALUpdate:
update, err = ledger.DecodeTrieUpdate(data[1:])
rootHash = update.RootHash
return
case WALDelete:
var rootHashBytes []byte
Expand Down
4 changes: 2 additions & 2 deletions ledger/complete/wal/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/onflow/flow-go/ledger"
"github.com/onflow/flow-go/ledger/common/hash"
"github.com/onflow/flow-go/ledger/common/testutils"
realWAL "github.com/onflow/flow-go/ledger/complete/wal"
)
Expand Down Expand Up @@ -44,7 +43,8 @@ func TestUpdate(t *testing.T) {
operation, stateCommitment, up, err := realWAL.Decode(data)
require.NoError(t, err)
assert.Equal(t, realWAL.WALUpdate, operation)
assert.Equal(t, stateCommitment, ledger.RootHash(hash.DummyHash))
// assert.Equal(t, stateCommitment, ledger.RootHash(hash.DummyHash))
assert.Equal(t, stateCommitment, rootHash)
assert.Equal(t, update, up)
})
}
Expand Down

0 comments on commit f9e9e0b

Please sign in to comment.