From 135ac0400e6ea81162a4281b34ec2cbd038494c5 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 25 Aug 2020 09:07:19 +0200 Subject: [PATCH] blockchain: verify +2/3 (#5278) ## Description Verify only +2/3 of the commit. Closes: #5259 --- CHANGELOG_PENDING.md | 4 +++- blockchain/v0/reactor.go | 2 +- blockchain/v1/reactor.go | 2 +- blockchain/v2/processor_context.go | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 71b7c4b99..aea26c316 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -10,10 +10,12 @@ Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermi ## FEATURES -- [privval] \#5239 Add `chainID` to requests from client. +- [privval] \#5239 Add `chainID` to requests from client. (@marbar3778) ## IMPROVEMENTS +- [blockchain] \#5278 Verify only +2/3 of the signatures in a block when fast syncing. (@marbar3778) + ## BUG FIXES - [blockchain] \#5249 Fix fast sync halt with initial height > 1 (@erikgrinaker) diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index 05f9c191e..40caf4a5e 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -358,7 +358,7 @@ FOR_LOOP: // NOTE: we can probably make this more efficient, but note that calling // first.Hash() doesn't verify the tx contents, so MakePartSet() is // currently necessary. - err := state.Validators.VerifyCommit( + err := state.Validators.VerifyCommitLight( chainID, firstID, first.Height, second.LastCommit) if err != nil { bcR.Logger.Error("Error in validation", "err", err) diff --git a/blockchain/v1/reactor.go b/blockchain/v1/reactor.go index e8b750c1b..7eb4ae67d 100644 --- a/blockchain/v1/reactor.go +++ b/blockchain/v1/reactor.go @@ -463,7 +463,7 @@ func (bcR *BlockchainReactor) processBlock() error { // NOTE: we can probably make this more efficient, but note that calling // first.Hash() doesn't verify the tx contents, so MakePartSet() is // currently necessary. - err = bcR.state.Validators.VerifyCommit(chainID, firstID, first.Height, second.LastCommit) + err = bcR.state.Validators.VerifyCommitLight(chainID, firstID, first.Height, second.LastCommit) if err != nil { bcR.Logger.Error("error during commit verification", "err", err, "first", first.Height, "second", second.Height) diff --git a/blockchain/v2/processor_context.go b/blockchain/v2/processor_context.go index a429411da..6a0466550 100644 --- a/blockchain/v2/processor_context.go +++ b/blockchain/v2/processor_context.go @@ -44,7 +44,7 @@ func (pc *pContext) setState(state state.State) { } func (pc pContext) verifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error { - return pc.state.Validators.VerifyCommit(chainID, blockID, height, commit) + return pc.state.Validators.VerifyCommitLight(chainID, blockID, height, commit) } func (pc *pContext) saveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) {