diff --git a/go.mod b/go.mod index 86c8701f2..0eda5c326 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/tendermint/btcd v0.1.1 github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/go-amino v0.16.0 - github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84 + github.com/tendermint/tendermint v0.34.0-rc3.0.20200922082254-ed002cea7e4a github.com/tendermint/tm-db v0.6.2 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 diff --git a/go.sum b/go.sum index 31cba49e2..c0e5c6b85 100644 --- a/go.sum +++ b/go.sum @@ -381,6 +381,8 @@ github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2BA= github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -580,10 +582,11 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RM github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= +github.com/tendermint/tendermint v0.33.8 h1:Xxu4QhpqcomSE0iQDw1MqLgfsa8fqtPtWFJK6zZOVso= github.com/tendermint/tendermint v0.34.0-rc3 h1:d7Fsd5rdbxq4GmJ0kRfx7l7LesQM7e70f0ytWLTQ/Go= github.com/tendermint/tendermint v0.34.0-rc3/go.mod h1:BoHcEpjfpBHc1Be7RQz3AHaXFNObcDG7SNHCev6Or4g= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84 h1:BI/EhLLh6SAlOtMaHePo8BNFLsNRiFNCtJ8cMBX+OE8= -github.com/tendermint/tendermint v0.34.0-rc3.0.20200907055413-3359e0bf2f84/go.mod h1:ZgOz3PoriH5yHRJmUmhDTVX8ps4+hzFvhmDq6MDUHxU= +github.com/tendermint/tendermint v0.34.0-rc3.0.20200922082254-ed002cea7e4a h1:5dw+rRXNj23q8eW++U5uXE8t/K5mLWK8EobqR3wDD0s= +github.com/tendermint/tendermint v0.34.0-rc3.0.20200922082254-ed002cea7e4a/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= github.com/tendermint/tm-db v0.6.1 h1:w3X87itMPXopcRPlFiqspEKhw4FXihPk2rnFFkP0zGk= github.com/tendermint/tm-db v0.6.1/go.mod h1:m3x9kRP4UFd7JODJL0yBAZqE7wTw+S37uAE90cTx7OA= github.com/tendermint/tm-db v0.6.2 h1:DOn8jwCdjJblrCFJbtonEIPD1IuJWpbRUUdR8GWE4RM= diff --git a/x/ibc/07-tendermint/types/test_utils.go b/x/ibc/07-tendermint/types/test_utils.go index 523327549..5c5da8607 100644 --- a/x/ibc/07-tendermint/types/test_utils.go +++ b/x/ibc/07-tendermint/types/test_utils.go @@ -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, diff --git a/x/ibc/07-tendermint/types/update.go b/x/ibc/07-tendermint/types/update.go index f8c9482e3..c67f026a6 100644 --- a/x/ibc/07-tendermint/types/update.go +++ b/x/ibc/07-tendermint/types/update.go @@ -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(), ) diff --git a/x/ibc/testing/chain.go b/x/ibc/testing/chain.go index 508924907..5ec64cb8a 100644 --- a/x/ibc/testing/chain.go +++ b/x/ibc/testing/chain.go @@ -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,