Update tendermint version (#7366)

* Update tendermint version

* update testing pkg to use latest versioned block protocol for tendermint headers

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Colin Axner <colinaxner@berkeley.edu>
This commit is contained in:
Jack Zampolin
2020-09-23 09:12:24 +00:00
committed by GitHub
co-authored by colin axnér mergify[bot] Colin Axner
parent 4f1f106804
commit 0dfe7ad6a0
5 changed files with 25 additions and 19 deletions
+3 -2
View File
@@ -6,8 +6,9 @@ import (
"github.com/tendermint/tendermint/crypto/tmhash"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proto/tendermint/version"
tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version"
tmtypes "github.com/tendermint/tendermint/types"
tmversion "github.com/tendermint/tendermint/version"
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
)
@@ -32,7 +33,7 @@ func CreateTestHeader(chainID string, height, trustedHeight clienttypes.Height,
vsetHash := tmValSet.Hash()
blockHeight := int64(height.EpochHeight)
tmHeader := tmtypes.Header{
Version: version.Consensus{Block: 2, App: 2},
Version: tmprotoversion.Consensus{Block: tmversion.BlockProtocol, App: 2},
ChainID: chainID,
Height: blockHeight,
Time: timestamp,
+13 -12
View File
@@ -127,17 +127,6 @@ func checkValidity(
)
}
// Construct a trusted header using the fields in consensus state
// Only Height, Time, and NextValidatorsHash are necessary for verification
trustedHeader := tmtypes.Header{
Height: int64(header.TrustedHeight.EpochHeight),
Time: consState.Timestamp,
NextValidatorsHash: consState.NextValidatorsHash,
}
signedHeader := tmtypes.SignedHeader{
Header: &trustedHeader,
}
chainID := clientState.GetChainID()
// If chainID is in epoch format, then set epoch number of chainID with the epoch number
// of the header we are verifying
@@ -149,13 +138,25 @@ func checkValidity(
chainID, _ = clienttypes.SetEpochNumber(chainID, header.GetHeight().GetEpochNumber())
}
// Construct a trusted header using the fields in consensus state
// Only Height, Time, and NextValidatorsHash are necessary for verification
trustedHeader := tmtypes.Header{
ChainID: chainID,
Height: int64(header.TrustedHeight.EpochHeight),
Time: consState.Timestamp,
NextValidatorsHash: consState.NextValidatorsHash,
}
signedHeader := tmtypes.SignedHeader{
Header: &trustedHeader,
}
// Verify next header with the passed-in trustedVals
// - asserts trusting period not passed
// - assert header timestamp is not past the trusting period
// - assert header timestamp is past latest stored consensus state timestamp
// - assert that a TrustLevel proportion of TrustedValidators signed new Commit
err = light.Verify(
chainID, &signedHeader,
&signedHeader,
tmTrustedValidators, tmSignedHeader, tmValidatorSet,
clientState.TrustingPeriod, currentTimestamp, clientState.MaxClockDrift, clientState.TrustLevel.ToTendermint(),
)
+3 -2
View File
@@ -11,8 +11,9 @@ import (
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/tmhash"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/proto/tendermint/version"
tmprotoversion "github.com/tendermint/tendermint/proto/tendermint/version"
tmtypes "github.com/tendermint/tendermint/types"
tmversion "github.com/tendermint/tendermint/version"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
@@ -481,7 +482,7 @@ func (chain *TestChain) ExpireClient(amount time.Duration) {
func (chain *TestChain) CreateTMClientHeader() *ibctmtypes.Header {
vsetHash := chain.Vals.Hash()
tmHeader := tmtypes.Header{
Version: version.Consensus{Block: 2, App: 2},
Version: tmprotoversion.Consensus{Block: tmversion.BlockProtocol, App: 2},
ChainID: chain.ChainID,
Height: chain.CurrentHeader.Height,
Time: chain.CurrentHeader.Time,