From 93ea3d0b7d4da40193d208641182c4082bafd48e Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 16 May 2022 19:20:08 -0400 Subject: [PATCH] strip extensions in blocksync --- internal/blocksync/reactor.go | 2 ++ internal/blocksync/reactor_test.go | 2 +- internal/consensus/replay_test.go | 4 ++-- internal/evidence/pool_test.go | 4 ++-- internal/evidence/verify_test.go | 12 ++++++------ internal/state/execution.go | 2 +- internal/state/execution_test.go | 2 +- internal/state/validation_test.go | 6 +++--- internal/statesync/reactor_test.go | 2 +- internal/store/store.go | 2 +- internal/store/store_test.go | 8 ++++---- test/e2e/runner/evidence.go | 2 +- types/block.go | 15 ++++++++++++--- types/block_test.go | 12 ++++++------ types/evidence_test.go | 6 +++--- types/validation_test.go | 10 +++++----- types/validator_set_test.go | 6 +++--- types/vote_test.go | 2 +- 18 files changed, 55 insertions(+), 44 deletions(-) diff --git a/internal/blocksync/reactor.go b/internal/blocksync/reactor.go index dda48fb5b..a53ff9836 100644 --- a/internal/blocksync/reactor.go +++ b/internal/blocksync/reactor.go @@ -560,6 +560,8 @@ func (r *Reactor) poolRoutine(ctx context.Context, stateSynced bool, blockSyncCh if err == nil && state.ConsensusParams.ABCI.VoteExtensionsEnabled(extCommit.Height) { // if vote extensions were required at this height, ensure they exist. err = extCommit.EnsureExtensions() + } else if err == nil && !state.ConsensusParams.ABCI.VoteExtensionsEnabled(extCommit.Height) { + extCommit.StripExtensions() } // If either of the checks failed we log the error and request for a new block // at that height diff --git a/internal/blocksync/reactor_test.go b/internal/blocksync/reactor_test.go index 1d4d7d4d6..fa5dc6b3b 100644 --- a/internal/blocksync/reactor_test.go +++ b/internal/blocksync/reactor_test.go @@ -155,7 +155,7 @@ func (rts *reactorTestSuite) addNode( for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ { lastExtCommit = seenExtCommit.Clone() - thisBlock := sf.MakeBlock(state, blockHeight, lastExtCommit.StripExtensions()) + thisBlock := sf.MakeBlock(state, blockHeight, lastExtCommit.ToCommit()) thisParts, err := thisBlock.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) blockID := types.BlockID{Hash: thisBlock.Hash(), PartSetHeader: thisParts.Header()} diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index c8f04655b..be770327a 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -1208,10 +1208,10 @@ func (bs *mockBlockStore) SaveBlock(block *types.Block, blockParts *types.PartSe } func (bs *mockBlockStore) LoadBlockCommit(height int64) *types.Commit { - return bs.extCommits[height-1].StripExtensions() + return bs.extCommits[height-1].ToCommit() } func (bs *mockBlockStore) LoadSeenCommit() *types.Commit { - return bs.extCommits[len(bs.extCommits)-1].StripExtensions() + return bs.extCommits[len(bs.extCommits)-1].ToCommit() } func (bs *mockBlockStore) LoadBlockExtendedCommit(height int64) *types.ExtendedCommit { return bs.extCommits[height-1] diff --git a/internal/evidence/pool_test.go b/internal/evidence/pool_test.go index 4047d3e7f..dbf7d3862 100644 --- a/internal/evidence/pool_test.go +++ b/internal/evidence/pool_test.go @@ -250,7 +250,7 @@ func TestEvidencePoolUpdate(t *testing.T) { ) require.NoError(t, err) lastExtCommit := makeExtCommit(height, val.PrivKey.PubKey().Address()) - block := types.MakeBlock(height+1, []types.Tx{}, lastExtCommit.StripExtensions(), []types.Evidence{ev}) + block := types.MakeBlock(height+1, []types.Tx{}, lastExtCommit.ToCommit(), []types.Evidence{ev}) // update state (partially) state.LastBlockHeight = height + 1 @@ -569,7 +569,7 @@ func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) (*store.Blo for i := int64(1); i <= state.LastBlockHeight; i++ { lastCommit := makeExtCommit(i-1, valAddr) - block := sf.MakeBlock(state, i, lastCommit.StripExtensions()) + block := sf.MakeBlock(state, i, lastCommit.ToCommit()) block.Header.Time = defaultEvidenceTime.Add(time.Duration(i) * time.Minute) block.Header.Version = version.Consensus{Block: version.BlockProtocol, App: 1} diff --git a/internal/evidence/verify_test.go b/internal/evidence/verify_test.go index 2ed84fa69..96cc5aee9 100644 --- a/internal/evidence/verify_test.go +++ b/internal/evidence/verify_test.go @@ -236,7 +236,7 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { voteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), conflictingVals) extCommit, err := factory.MakeExtendedCommit(ctx, blockID, 10, 1, voteSet, conflictingPrivVals[:4], defaultEvidenceTime) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -257,7 +257,7 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { trustedExtCommit, err := factory.MakeExtendedCommit(ctx, trustedBlockID, 10, 1, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) - trustedCommit := trustedExtCommit.StripExtensions() + trustedCommit := trustedExtCommit.ToCommit() trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -339,7 +339,7 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { voteSet := types.NewVoteSet(evidenceChainID, height, 0, tmproto.SignedMsgType(2), conflictingVals) extCommit, err := factory.MakeExtendedCommit(ctx, blockID, height, 0, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -360,7 +360,7 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { trustedExtCommit, err := factory.MakeExtendedCommit(ctx, trustedBlockID, height, 1, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) - trustedCommit := trustedExtCommit.StripExtensions() + trustedCommit := trustedExtCommit.ToCommit() trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -556,7 +556,7 @@ func makeLunaticEvidence( voteSet := types.NewVoteSet(evidenceChainID, height, 1, tmproto.SignedMsgType(2), conflictingVals) extCommit, err := factory.MakeExtendedCommit(ctx, blockID, height, 1, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() ev = &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -585,7 +585,7 @@ func makeLunaticEvidence( trustedVoteSet := types.NewVoteSet(evidenceChainID, height, 1, tmproto.SignedMsgType(2), trustedVals) trustedExtCommit, err := factory.MakeExtendedCommit(ctx, trustedBlockID, height, 1, trustedVoteSet, privVals, defaultEvidenceTime) require.NoError(t, err) - trustedCommit := trustedExtCommit.StripExtensions() + trustedCommit := trustedExtCommit.ToCommit() trusted = &types.LightBlock{ SignedHeader: &types.SignedHeader{ diff --git a/internal/state/execution.go b/internal/state/execution.go index c8ec1f2bb..45489a354 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -101,7 +101,7 @@ func (blockExec *BlockExecutor) CreateProposalBlock( maxDataBytes := types.MaxDataBytes(maxBytes, evSize, state.Validators.Size()) txs := blockExec.mempool.ReapMaxBytesMaxGas(maxDataBytes, maxGas) - commit := lastExtCommit.StripExtensions() + commit := lastExtCommit.ToCommit() block := state.MakeBlock(height, txs, commit, evidence, proposerAddr) rpp, err := blockExec.appClient.PrepareProposal( ctx, diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index 6ba138820..0df621887 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -140,7 +140,7 @@ func TestFinalizeBlockDecidedLastCommit(t *testing.T) { } // block for height 2 - block := sf.MakeBlock(state, 2, lastCommit.StripExtensions()) + block := sf.MakeBlock(state, 2, lastCommit.ToCommit()) bps, err := block.MakePartSet(testPartSize) require.NoError(t, err) blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: bps.Header()} diff --git a/internal/state/validation_test.go b/internal/state/validation_test.go index b29cfd0f9..0f43db5eb 100644 --- a/internal/state/validation_test.go +++ b/internal/state/validation_test.go @@ -124,7 +124,7 @@ func TestValidateBlockHeader(t *testing.T) { */ state, _, lastExtCommit = makeAndCommitGoodBlock(ctx, t, state, height, lastCommit, state.Validators.GetProposer().Address, blockExec, privVals, nil) - lastCommit = lastExtCommit.StripExtensions() + lastCommit = lastExtCommit.ToCommit() } nextHeight := validationTestsStopHeight @@ -234,7 +234,7 @@ func TestValidateBlockCommit(t *testing.T) { privVals, nil, ) - lastCommit = lastExtCommit.StripExtensions() + lastCommit = lastExtCommit.ToCommit() /* wrongSigsCommit is fine except for the extra bad precommit @@ -384,7 +384,7 @@ func TestValidateBlockEvidence(t *testing.T) { privVals, evidence, ) - lastCommit = lastExtCommit.StripExtensions() + lastCommit = lastExtCommit.ToCommit() } } diff --git a/internal/statesync/reactor_test.go b/internal/statesync/reactor_test.go index 904fb2b74..1f2b6f66a 100644 --- a/internal/statesync/reactor_test.go +++ b/internal/statesync/reactor_test.go @@ -861,7 +861,7 @@ func mockLB(ctx context.Context, t *testing.T, height int64, time time.Time, las return nextVals, nextPrivVals, &types.LightBlock{ SignedHeader: &types.SignedHeader{ Header: header, - Commit: extCommit.StripExtensions(), + Commit: extCommit.ToCommit(), }, ValidatorSet: currentVals, } diff --git a/internal/store/store.go b/internal/store/store.go index 5617674a2..81d79f8b7 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -518,7 +518,7 @@ func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, s } // Save seen commit (seen +2/3 precommits for block) - pbsc := seenCommit.StripExtensions().ToProto() + pbsc := seenCommit.ToCommit().ToProto() seenCommitBytes := mustEncode(pbsc) if err := batch.Set(seenCommitKey(), seenCommitBytes); err != nil { panic(err) diff --git a/internal/store/store_test.go b/internal/store/store_test.go index 9df3eed9f..9c34a603a 100644 --- a/internal/store/store_test.go +++ b/internal/store/store_test.go @@ -107,7 +107,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { } // End of setup, test data - commitAtH10 := makeTestExtCommit(10, tmtime.Now()).StripExtensions() + commitAtH10 := makeTestExtCommit(10, tmtime.Now()).ToCommit() tuples := []struct { block *types.Block parts *types.PartSet @@ -140,7 +140,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { ChainID: "block_test", Time: tmtime.Now(), ProposerAddress: tmrand.Bytes(crypto.AddressSize)}, - makeTestExtCommit(5, tmtime.Now()).StripExtensions(), + makeTestExtCommit(5, tmtime.Now()).ToCommit(), ), parts: validPartSet, seenCommit: makeTestExtCommit(5, tmtime.Now()), @@ -518,7 +518,7 @@ func TestSeenAndCanonicalCommit(t *testing.T) { // produce a few blocks and check that the correct seen and cannoncial commits // are persisted. for h := int64(3); h <= 5; h++ { - blockCommit := makeTestExtCommit(h-1, tmtime.Now()).StripExtensions() + blockCommit := makeTestExtCommit(h-1, tmtime.Now()).ToCommit() block := factory.MakeBlock(state, h, blockCommit) partSet, err := block.MakePartSet(2) require.NoError(t, err) @@ -527,7 +527,7 @@ func TestSeenAndCanonicalCommit(t *testing.T) { c3 := store.LoadSeenCommit() require.NotNil(t, c3) require.Equal(t, h, c3.Height) - require.Equal(t, seenCommit.StripExtensions().Hash(), c3.Hash()) + require.Equal(t, seenCommit.ToCommit().Hash(), c3.Hash()) c5 := store.LoadBlockCommit(h) require.Nil(t, c5) c6 := store.LoadBlockCommit(h - 1) diff --git a/test/e2e/runner/evidence.go b/test/e2e/runner/evidence.go index a71ea14fb..368507e0b 100644 --- a/test/e2e/runner/evidence.go +++ b/test/e2e/runner/evidence.go @@ -176,7 +176,7 @@ func generateLightClientAttackEvidence( ConflictingBlock: &types.LightBlock{ SignedHeader: &types.SignedHeader{ Header: header, - Commit: commit.StripExtensions(), + Commit: commit.ToCommit(), }, ValidatorSet: conflictingVals, }, diff --git a/types/block.go b/types/block.go index 3c42fbafe..133401576 100644 --- a/types/block.go +++ b/types/block.go @@ -1026,7 +1026,6 @@ func (ec *ExtendedCommit) ToExtendedVoteSet(chainID string, vals *ValidatorSet) // ToVoteSet constructs a VoteSet from the Commit and validator set. // Panics if signatures from the ExtendedCommit can't be added to the voteset. -// Panics if any of the votes have extension data. // Inverse of VoteSet.MakeExtendedCommit(). func (ec *ExtendedCommit) ToVoteSet(chainID string, vals *ValidatorSet) *VoteSet { voteSet := NewVoteSet(chainID, ec.Height, ec.Round, tmproto.PrecommitType, vals) @@ -1083,9 +1082,19 @@ func (ec *ExtendedCommit) EnsureExtensions() error { return nil } -// StripExtensions converts an ExtendedCommit to a Commit by removing all vote +// StripExtensions removes all VoteExtension data from an ExtendedCommit. This +// is useful when dealing with an ExendedCommit but vote extension data is +// expected to be absent. +func (ec *ExtendedCommit) StripExtensions() { + for idx := range ec.ExtendedSignatures { + ec.ExtendedSignatures[idx].Extension = nil + ec.ExtendedSignatures[idx].ExtensionSignature = nil + } +} + +// ToCommit converts an ExtendedCommit to a Commit by removing all vote // extension-related fields. -func (ec *ExtendedCommit) StripExtensions() *Commit { +func (ec *ExtendedCommit) ToCommit() *Commit { cs := make([]CommitSig, len(ec.ExtendedSignatures)) for idx, ecs := range ec.ExtendedSignatures { cs[idx] = ecs.CommitSig diff --git a/types/block_test.go b/types/block_test.go index 86ee90c27..4c3a74d8f 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -49,7 +49,7 @@ func TestBlockAddEvidence(t *testing.T) { require.NoError(t, err) evList := []Evidence{ev} - block := MakeBlock(h, txs, extCommit.StripExtensions(), evList) + block := MakeBlock(h, txs, extCommit.ToCommit(), evList) require.NotNil(t, block) require.Equal(t, 1, len(block.Evidence)) require.NotNil(t, block.EvidenceHash) @@ -68,7 +68,7 @@ func TestBlockValidateBasic(t *testing.T) { voteSet, valSet, vals := randVoteSet(ctx, t, h-1, 1, tmproto.PrecommitType, 10, 1) extCommit, err := makeExtCommit(ctx, lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() ev, err := NewMockDuplicateVoteEvidenceWithValidator(ctx, h, time.Now(), vals[0], "block-test-chain") require.NoError(t, err) @@ -163,7 +163,7 @@ func TestBlockMakePartSetWithEvidence(t *testing.T) { require.NoError(t, err) evList := []Evidence{ev} - partSet, err := MakeBlock(h, []Tx{Tx("Hello World")}, extCommit.StripExtensions(), evList).MakePartSet(512) + partSet, err := MakeBlock(h, []Tx{Tx("Hello World")}, extCommit.ToCommit(), evList).MakePartSet(512) require.NoError(t, err) assert.NotNil(t, partSet) @@ -187,7 +187,7 @@ func TestBlockHashesTo(t *testing.T) { require.NoError(t, err) evList := []Evidence{ev} - block := MakeBlock(h, []Tx{Tx("Hello World")}, extCommit.StripExtensions(), evList) + block := MakeBlock(h, []Tx{Tx("Hello World")}, extCommit.ToCommit(), evList) block.ValidatorsHash = valSet.Hash() assert.False(t, block.HashesTo([]byte{})) assert.False(t, block.HashesTo([]byte("something else"))) @@ -483,7 +483,7 @@ func randCommit(ctx context.Context, t *testing.T, now time.Time) *Commit { require.NoError(t, err) - return commit.StripExtensions() + return commit.ToCommit() } func hexBytesFromString(t *testing.T, s string) bytes.HexBytes { @@ -742,7 +742,7 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { if tc.valid { extCommit := voteSet.MakeExtendedCommit() // panics without > 2/3 valid votes assert.NotNil(t, extCommit) - err := valSet.VerifyCommit(voteSet.ChainID(), blockID, height-1, extCommit.StripExtensions()) + err := valSet.VerifyCommit(voteSet.ChainID(), blockID, height-1, extCommit.ToCommit()) assert.NoError(t, err) } else { assert.Panics(t, func() { voteSet.MakeExtendedCommit() }) diff --git a/types/evidence_test.go b/types/evidence_test.go index 8b06a6218..d014a3ecc 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -155,7 +155,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { blockID := makeBlockID(crypto.Checksum([]byte("blockhash")), math.MaxInt32, crypto.Checksum([]byte("partshash"))) extCommit, err := makeExtCommit(ctx, blockID, height, 1, voteSet, privVals, defaultVoteTime) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() lcae := &LightClientAttackEvidence{ ConflictingBlock: &LightBlock{ @@ -221,7 +221,7 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { blockID := makeBlockID(header.Hash(), math.MaxInt32, crypto.Checksum([]byte("partshash"))) extCommit, err := makeExtCommit(ctx, blockID, height, 1, voteSet, privVals, time.Now()) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() lcae := &LightClientAttackEvidence{ ConflictingBlock: &LightBlock{ @@ -434,7 +434,7 @@ func TestEvidenceVectors(t *testing.T) { ConflictingBlock: &LightBlock{ SignedHeader: &SignedHeader{ Header: header, - Commit: extCommit.StripExtensions(), + Commit: extCommit.ToCommit(), }, ValidatorSet: valSet, }, diff --git a/types/validation_test.go b/types/validation_test.go index f63c34450..c28f63000 100644 --- a/types/validation_test.go +++ b/types/validation_test.go @@ -153,7 +153,7 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) { voteSet, valSet, vals := randVoteSet(ctx, t, h, 0, tmproto.PrecommitType, 4, 10) extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit)) @@ -184,7 +184,7 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSign voteSet, valSet, vals := randVoteSet(ctx, t, h, 0, tmproto.PrecommitType, 4, 10) extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit)) @@ -212,7 +212,7 @@ func TestValidatorSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfVotin voteSet, valSet, vals := randVoteSet(ctx, t, h, 0, tmproto.PrecommitType, 4, 10) extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() require.NoError(t, valSet.VerifyCommit(chainID, blockID, h, commit)) @@ -239,7 +239,7 @@ func TestValidatorSet_VerifyCommitLightTrusting(t *testing.T) { newValSet, _ = randValidatorPrivValSet(ctx, t, 2, 1) ) require.NoError(t, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() testCases := []struct { valSet *ValidatorSet @@ -284,7 +284,7 @@ func TestValidatorSet_VerifyCommitLightTrustingErrorsOnOverflow(t *testing.T) { ) require.NoError(t, err) - err = valSet.VerifyCommitLightTrusting("test_chain_id", extCommit.StripExtensions(), + err = valSet.VerifyCommitLightTrusting("test_chain_id", extCommit.ToCommit(), tmmath.Fraction{Numerator: 25, Denominator: 55}) if assert.Error(t, err) { assert.Contains(t, err.Error(), "int64 overflow") diff --git a/types/validator_set_test.go b/types/validator_set_test.go index 8b5846da9..81e81919d 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -1541,7 +1541,7 @@ func BenchmarkValidatorSet_VerifyCommit_Ed25519(b *testing.B) { // nolint // create a commit with n validators extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(b, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() for i := 0; i < b.N/n; i++ { err = valSet.VerifyCommit(chainID, blockID, h, commit) @@ -1570,7 +1570,7 @@ func BenchmarkValidatorSet_VerifyCommitLight_Ed25519(b *testing.B) { // nolint // create a commit with n validators extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(b, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() for i := 0; i < b.N/n; i++ { err = valSet.VerifyCommitLight(chainID, blockID, h, commit) @@ -1598,7 +1598,7 @@ func BenchmarkValidatorSet_VerifyCommitLightTrusting_Ed25519(b *testing.B) { // create a commit with n validators extCommit, err := makeExtCommit(ctx, blockID, h, 0, voteSet, vals, time.Now()) require.NoError(b, err) - commit := extCommit.StripExtensions() + commit := extCommit.ToCommit() for i := 0; i < b.N/n; i++ { err = valSet.VerifyCommitLightTrusting(chainID, commit, tmmath.Fraction{Numerator: 1, Denominator: 3}) diff --git a/types/vote_test.go b/types/vote_test.go index 1b7bb3f4f..d0819d7c4 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -523,7 +523,7 @@ func getSampleCommit(ctx context.Context, t testing.TB) *Commit { require.NoError(t, err) - return commit.StripExtensions() + return commit.ToCommit() } func BenchmarkVoteSignBytes(b *testing.B) {