Skip to content

Commit 1f63274

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

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-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
}

state/execution.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ func (blockExec *BlockExecutor) applyBlock(state State, blockID types.BlockID, b
240240
return state, fmt.Errorf("error submitting validator set to enclave: %v", err)
241241
}
242242
// todo: change to log level debug later
243+
fmt.Printf("block.Header %+v\n", block.Header)
243244
blockExec.logger.Info(fmt.Sprintf("Submitted validator set to enclave for height %d, val set hash: %s", block.Height, hex.EncodeToString(block.ValidatorsHash)))
244245

245246
fmt.Printf("tendermint implicithash: %+v\n", block.ImplicitHash)

types/block.go

Lines changed: 10 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"
@@ -457,25 +456,31 @@ func (h Header) ValidateBasic() error {
457456
// since a Header is not valid unless there is
458457
// a ValidatorsHash (corresponding to the validator set).
459458
func (h *Header) Hash() cmtbytes.HexBytes {
459+
fmt.Printf("tendermint.Header(): %v\n", h)
460460
if h == nil || len(h.ValidatorsHash) == 0 {
461+
fmt.Printf("h == nil || len(h.ValidatorsHash) == 0")
461462
return nil
462463
}
463464
hbz, err := h.Version.Marshal()
464465
if err != nil {
466+
fmt.Printf("err1: %v\n", err)
465467
return nil
466468
}
467469

468470
pbt, err := gogotypes.StdTimeMarshal(h.Time)
469471
if err != nil {
472+
fmt.Printf("err2: %v\n", err)
470473
return nil
471474
}
472475

473476
pbbi := h.LastBlockID.ToProto()
474477
bzbi, err := pbbi.Marshal()
475478
if err != nil {
479+
fmt.Printf("err3: %v\n", err)
476480
return nil
477481
}
478-
fmt.Printf("h.ImplicitHash: %X\n", hex.EncodeToString(h.ImplicitHash))
482+
// fmt.Printf("h.ImplicitHash: %X\n", h.ImplicitHash)
483+
// debug.PrintStack()
479484

480485
merkleHash1 := merkle.HashFromByteSlices([][]byte{
481486
hbz,
@@ -510,8 +515,8 @@ func (h *Header) Hash() cmtbytes.HexBytes {
510515
cdcEncode(h.EvidenceHash),
511516
cdcEncode(h.ProposerAddress),
512517
})
513-
fmt.Printf("merkleHash1: %X\n", hex.EncodeToString(merkleHash1))
514-
fmt.Printf("merkleHash2: %X\n", hex.EncodeToString(merkleHash2))
518+
fmt.Printf("merkleHash1: %X\n", merkleHash1)
519+
fmt.Printf("merkleHash2: %X\n", merkleHash2)
515520
return merkleHash1
516521
}
517522

@@ -623,6 +628,7 @@ func HeaderFromProto(ph *cmtproto.Header) (Header, error) {
623628
// ScrtLabs -> change in
624629
h.EncryptedRandom = encRandom
625630
h.ImplicitHash = ph.ImplicitHash
631+
fmt.Printf("h.ImplicitHash: %X\n", h.ImplicitHash)
626632
// ScrtLabs <- change out
627633
return *h, h.ValidateBasic()
628634
}

types/vote.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ func (vote *Vote) ExtendedCommitSig() ExtendedCommitSig {
146146
//
147147
// See CanonicalizeVote
148148
func VoteSignBytes(chainID string, vote *cmtproto.Vote) []byte {
149+
fmt.Printf("----------------debugStack for VoteSignBytes ---------------\n")
150+
// debug.PrintStack()
151+
fmt.Printf("VoteSignBytes: %v\n", vote)
152+
fmt.Printf("vote.BlockID: %v\n", vote.BlockID)
149153
pb := CanonicalizeVote(chainID, vote)
150154
bz, err := protoio.MarshalDelimited(&pb)
151155
if err != nil {

0 commit comments

Comments
 (0)