Skip to content

Commit a374f2d

Browse files
add more logging
1 parent 2bb32a8 commit a374f2d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

vm/verify_context.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package vm
66
import (
77
"context"
88
"errors"
9+
"fmt"
910

1011
"github.com/ava-labs/avalanchego/ids"
1112
"github.com/ava-labs/avalanchego/utils/set"
@@ -86,7 +87,7 @@ func (a *AcceptedVerifyContext) View(ctx context.Context, blockRoot *ids.ID, _ b
8687
// This should never happen but we check
8788
// this to check subtle state handling bugs
8889
// in the [chain] package.
89-
return nil, ErrUnexpectedStateRoot
90+
return nil, fmt.Errorf("%w: state=%s wanted=%s", ErrUnexpectedStateRoot, root, *blockRoot)
9091
}
9192
}
9293
return state, nil

vm/vm.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ func (vm *VM) Initialize(
346346
if err := sps.Commit(ctx); err != nil {
347347
return err
348348
}
349-
if _, err := vm.stateDB.GetMerkleRoot(ctx); err != nil {
349+
genesisRoot, err := vm.stateDB.GetMerkleRoot(ctx)
350+
if err != nil {
350351
snowCtx.Log.Error("could not get merkle root", zap.Error(err))
351352
return err
352353
}
@@ -359,7 +360,11 @@ func (vm *VM) Initialize(
359360
}
360361
gBlkID := genesisBlk.ID()
361362
vm.preferred, vm.lastAccepted = gBlkID, genesisBlk
362-
snowCtx.Log.Info("initialized vm from genesis", zap.Stringer("block", gBlkID))
363+
snowCtx.Log.Info("initialized vm from genesis",
364+
zap.Stringer("block", gBlkID),
365+
zap.Stringer("pre-execution root", genesisBlk.StateRoot),
366+
zap.Stringer("post-execution root", genesisRoot),
367+
)
363368
}
364369
go vm.processAcceptedBlocks()
365370

0 commit comments

Comments
 (0)