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
4 changes: 2 additions & 2 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ func (p *Parlia) assembleVoteAttestation(chain consensus.ChainHeaderReader, head
// Validate vote data consistency
for _, vote := range votes {
if vote.Data.Hash() != attestation.Data.Hash() {
return fmt.Errorf("vote check error, expected: %v, real: %v", attestation.Data, vote)
return fmt.Errorf("vote check error, expected: %v, real: %v", attestation.Data, vote.Data)
}
}
// Prepare aggregated vote signature
Expand Down Expand Up @@ -1754,7 +1754,7 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
if err != nil {
/* If the vote attestation can't be assembled successfully, the blockchain won't get
fast finalized, but it can be tolerated, so just report this error here. */
log.Error("Assemble vote attestation failed when sealing", "err", err)
log.Debug("Assemble vote attestation failed when sealing", "err", err)
}

// Sign all the things!
Expand Down
18 changes: 10 additions & 8 deletions consensus/parlia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,16 @@ func (s *Snapshot) updateAttestation(header *types.Header, chainConfig *params.C
}

// Headers with bad attestation are accepted before Plato upgrade,
// but Attestation of snapshot is only updated when the target block is direct parent of the header
targetNumber := attestation.Data.TargetNumber
targetHash := attestation.Data.TargetHash
if targetHash != header.ParentHash || targetNumber+1 != header.Number.Uint64() {
log.Warn("updateAttestation failed", "error", fmt.Errorf("invalid attestation, target mismatch, expected block: %d, hash: %s; real block: %d, hash: %s",
header.Number.Uint64()-1, header.ParentHash, targetNumber, targetHash))
updateAttestationErrorCounter.Inc(1)
return
// but Attestation of snapshot is only updated when the target block is direct parent of the header before Fermi upgrade
if !chainConfig.IsFermi(header.Number, header.Time) {
targetNumber := attestation.Data.TargetNumber
targetHash := attestation.Data.TargetHash
if targetHash != header.ParentHash || targetNumber+1 != header.Number.Uint64() {
log.Warn("updateAttestation failed", "error", fmt.Errorf("invalid attestation, target mismatch, expected block: %d, hash: %s; real block: %d, hash: %s",
header.Number.Uint64()-1, header.ParentHash, targetNumber, targetHash))
updateAttestationErrorCounter.Inc(1)
return
}
}

// Update attestation
Expand Down