From 620c3236ec4e00e14e49e05148e0705aeead5704 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Mon, 28 Mar 2022 11:45:06 -0400 Subject: [PATCH] Add strong guarantee in extendedCommitInfo that the number of votes corresponds Signed-off-by: Thane Thomson --- internal/state/execution.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/state/execution.go b/internal/state/execution.go index ea5061ee9..4f1c5cc47 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -441,6 +441,9 @@ func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) a // precisely to those provided in the list of votes, such that vote extensions // can be correlated with the votes in the commit. func extendedCommitInfo(c abci.CommitInfo, votes []*types.Vote) abci.ExtendedCommitInfo { + if len(c.Votes) != len(votes) { + panic(fmt.Sprintf("extendedCommitInfo: number of votes from commit differ from the number of votes supplied (%d != %d)", len(c.Votes), len(votes))) + } vs := make([]abci.ExtendedVoteInfo, len(c.Votes)) for i := range vs { var ext []byte