Skip to content

Commit

Permalink
add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-ogrady committed Oct 6, 2023
1 parent 2bb32a8 commit a374f2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion vm/verify_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package vm
import (
"context"
"errors"
"fmt"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/set"
Expand Down Expand Up @@ -86,7 +87,7 @@ func (a *AcceptedVerifyContext) View(ctx context.Context, blockRoot *ids.ID, _ b
// This should never happen but we check
// this to check subtle state handling bugs
// in the [chain] package.
return nil, ErrUnexpectedStateRoot
return nil, fmt.Errorf("%w: state=%s wanted=%s", ErrUnexpectedStateRoot, root, *blockRoot)
}
}
return state, nil
Expand Down
9 changes: 7 additions & 2 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ func (vm *VM) Initialize(
if err := sps.Commit(ctx); err != nil {
return err
}
if _, err := vm.stateDB.GetMerkleRoot(ctx); err != nil {
genesisRoot, err := vm.stateDB.GetMerkleRoot(ctx)
if err != nil {
snowCtx.Log.Error("could not get merkle root", zap.Error(err))
return err
}
Expand All @@ -359,7 +360,11 @@ func (vm *VM) Initialize(
}
gBlkID := genesisBlk.ID()
vm.preferred, vm.lastAccepted = gBlkID, genesisBlk
snowCtx.Log.Info("initialized vm from genesis", zap.Stringer("block", gBlkID))
snowCtx.Log.Info("initialized vm from genesis",
zap.Stringer("block", gBlkID),
zap.Stringer("pre-execution root", genesisBlk.StateRoot),
zap.Stringer("post-execution root", genesisRoot),
)
}
go vm.processAcceptedBlocks()

Expand Down

0 comments on commit a374f2d

Please sign in to comment.