Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ func (state State) MakeBlock(
panic("Failed to validate generated random")
}

implicitHash, err := tmenclave.GetImplicitHash()
if err != nil {
panic("Failed to get implicit hash")
}
// implicitHash, err := tmenclave.GetImplicitHash()
// if err != nil {
// panic("Failed to get implicit hash")
// }
// ScrtLabs changes out <-

// Fill rest of header with state data.
Expand All @@ -292,7 +292,7 @@ func (state State) MakeBlock(
timestamp, state.LastBlockID,
state.Validators.Hash(), state.NextValidators.Hash(),
state.ConsensusParams.Hash(), state.AppHash, state.LastResultsHash,
proposerAddress, &encryptedRandom, implicitHash,
proposerAddress, &encryptedRandom, nil,
)

return block
Expand Down
15 changes: 8 additions & 7 deletions state/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ func validateBlock(state State, block *types.Block) error {
}
}

expectedImplicitHash, err := tmenclave.GetImplicitHash() // hash from last block's scheduling
if err != nil {
return fmt.Errorf("failed to get implicit hash: %w", err)
}
if !bytes.Equal(block.Header.ImplicitHash, expectedImplicitHash) {
// expectedImplicitHash, err := tmenclave.GetImplicitHash() // hash from last block's scheduling
// if err != nil {
// return fmt.Errorf("failed to get implicit hash: %w", err)
// }
if len(block.Header.ImplicitHash) > 0 {
emptySha256 := sha256.Sum256([]byte{})
if !(bytes.Equal(block.Header.ImplicitHash, []byte{}) && bytes.Equal(expectedImplicitHash, emptySha256[:])) {
return fmt.Errorf("implicit_hash mismatch: expected %X, got %X", hex.EncodeToString(expectedImplicitHash), hex.EncodeToString(block.Header.ImplicitHash))
if !bytes.Equal(block.Header.ImplicitHash, emptySha256[:]) {
return fmt.Errorf("implicit_hash mismatch: expected nil or empty hash, got %s",
block.Header.ImplicitHash.String())
}
}

Expand Down
4 changes: 2 additions & 2 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
cdcEncode(h.LastResultsHash),
cdcEncode(h.EvidenceHash),
cdcEncode(h.ProposerAddress),
cdcEncode(h.ImplicitHash),
// cdcEncode(h.ImplicitHash),
})
}

Expand All @@ -498,7 +498,7 @@
if h == nil {
return "nil-Header"
}
return fmt.Sprintf(`Header{

Check failure on line 501 in types/block.go

View workflow job for this annotation

GitHub Actions / tests (05)

fmt.Sprintf format %s reads arg #31, but call has 30 args
%s Version: %v
%s ChainID: %v
%s Height: %v
Expand Down Expand Up @@ -529,7 +529,7 @@
indent, h.LastResultsHash,
indent, h.EvidenceHash,
indent, h.ProposerAddress,
indent, h.ImplicitHash,
// indent, h.ImplicitHash,
indent, h.Hash(),
)
}
Expand Down
Loading