Skip to content

Commit b145518

Browse files
committed
print dbg stack
1 parent 27865d0 commit b145518

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

consensus/state.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package consensus
33
import (
44
"bytes"
55
"context"
6+
"encoding/hex"
67
"errors"
78
"fmt"
89
"io"
@@ -2368,6 +2369,7 @@ func (cs *State) signVote(
23682369
) (*types.Vote, error) {
23692370
// Flush the WAL. Otherwise, we may not recompute the same vote to sign,
23702371
// and the privValidator will refuse to sign anything.
2372+
fmt.Printf("signVote: hash: %v\n", hex.EncodeToString(hash))
23712373
if err := cs.wal.FlushAndSync(); err != nil {
23722374
return nil, err
23732375
}

types/block.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package types
22

33
import (
44
"bytes"
5-
"encoding/hex"
65
"errors"
76
"fmt"
87
"strings"
@@ -458,24 +457,29 @@ func (h Header) ValidateBasic() error {
458457
// a ValidatorsHash (corresponding to the validator set).
459458
func (h *Header) Hash() cmtbytes.HexBytes {
460459
if h == nil || len(h.ValidatorsHash) == 0 {
460+
fmt.Printf("h == nil || len(h.ValidatorsHash) == 0")
461461
return nil
462462
}
463463
hbz, err := h.Version.Marshal()
464464
if err != nil {
465+
fmt.Printf("err1: %v\n", err)
465466
return nil
466467
}
467468

468469
pbt, err := gogotypes.StdTimeMarshal(h.Time)
469470
if err != nil {
471+
fmt.Printf("err2: %v\n", err)
470472
return nil
471473
}
472474

473475
pbbi := h.LastBlockID.ToProto()
474476
bzbi, err := pbbi.Marshal()
475477
if err != nil {
478+
fmt.Printf("err3: %v\n", err)
476479
return nil
477480
}
478-
fmt.Printf("h.ImplicitHash: %X\n", hex.EncodeToString(h.ImplicitHash))
481+
fmt.Printf("h.ImplicitHash: %X\n", h.ImplicitHash)
482+
// debug.PrintStack()
479483

480484
merkleHash1 := merkle.HashFromByteSlices([][]byte{
481485
hbz,
@@ -510,8 +514,8 @@ func (h *Header) Hash() cmtbytes.HexBytes {
510514
cdcEncode(h.EvidenceHash),
511515
cdcEncode(h.ProposerAddress),
512516
})
513-
fmt.Printf("merkleHash1: %X\n", hex.EncodeToString(merkleHash1))
514-
fmt.Printf("merkleHash2: %X\n", hex.EncodeToString(merkleHash2))
517+
fmt.Printf("merkleHash1: %X\n", merkleHash1)
518+
fmt.Printf("merkleHash2: %X\n", merkleHash2)
515519
return merkleHash1
516520
}
517521

@@ -623,6 +627,7 @@ func HeaderFromProto(ph *cmtproto.Header) (Header, error) {
623627
// ScrtLabs -> change in
624628
h.EncryptedRandom = encRandom
625629
h.ImplicitHash = ph.ImplicitHash
630+
fmt.Printf("h.ImplicitHash: %X\n", h.ImplicitHash)
626631
// ScrtLabs <- change out
627632
return *h, h.ValidateBasic()
628633
}

types/vote.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"errors"
66
"fmt"
7+
"runtime/debug"
78
"time"
89

910
"github.com/cometbft/cometbft/crypto"
@@ -146,6 +147,10 @@ func (vote *Vote) ExtendedCommitSig() ExtendedCommitSig {
146147
//
147148
// See CanonicalizeVote
148149
func VoteSignBytes(chainID string, vote *cmtproto.Vote) []byte {
150+
fmt.Printf("----------------debugStack for VoteSignBytes ---------------\n")
151+
debug.PrintStack()
152+
fmt.Printf("VoteSignBytes: %v\n", vote)
153+
fmt.Printf("vote.BlockID: %v\n", vote.BlockID)
149154
pb := CanonicalizeVote(chainID, vote)
150155
bz, err := protoio.MarshalDelimited(&pb)
151156
if err != nil {

0 commit comments

Comments
 (0)