-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Gno LC with diff from 07-tendermint #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Added app wiring and re-added / adjusted tests. Not all tests work/pass as we need to implement https://github.com/cosmos/ibc-go/tree/main/testing for Gno. @tbruyelle ? |
|
I am still trying to play with 07-tendermint and this, review still coming. |
|
For other reviewers, it is way easier to review like this: diff -bur ibc-go/modules/light-clients/07-tendermint/ 10-gno/ BIG DIFFdiff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/client_state.go 10-gno/client_state.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/client_state.go 2025-12-08 12:36:25.318394518 +0100
+++ 10-gno/client_state.go 2025-12-08 12:35:52.098576068 +0100
@@ -1,25 +1,25 @@
-package tendermint
+package gno
import (
"strings"
"time"
- ics23 "github.com/cosmos/ics23/go"
-
- errorsmod "cosmossdk.io/errors"
- storetypes "cosmossdk.io/store/types"
-
- "github.com/cosmos/cosmos-sdk/codec"
- sdk "github.com/cosmos/cosmos-sdk/types"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/cometbft/cometbft/light"
- cmttypes "github.com/cometbft/cometbft/types"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
commitmenttypesv2 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2"
ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+ ics23 "github.com/cosmos/ics23/go"
+
+ errorsmod "cosmossdk.io/errors"
+ storetypes "cosmossdk.io/store/types"
+
+ "github.com/cosmos/cosmos-sdk/codec"
+ sdk "github.com/cosmos/cosmos-sdk/types"
)
var _ exported.ClientState = (*ClientState)(nil)
@@ -49,9 +49,9 @@
return cs.ChainId
}
-// ClientType is tendermint.
+// ClientType is gno.
func (ClientState) ClientType() string {
- return exported.Tendermint
+ return Gno
}
// getTimestampAtHeight returns the timestamp in nanoseconds of the consensus state at the given height.
@@ -68,7 +68,7 @@
return consState.GetTimestamp(), nil
}
-// status returns the status of the tendermint client.
+// status returns the status of the gno client.
// The client may be:
// - Active: FrozenHeight is zero and client is not expired
// - Frozen: Frozen Height is not zero
@@ -113,13 +113,13 @@
return errorsmod.Wrap(ErrInvalidChainID, "chain id cannot be empty string")
}
- // NOTE: the value of cmttypes.MaxChainIDLen may change in the future.
+ // NOTE: the value of bfttypes.MaxChainIDLen may change in the future.
// If this occurs, the code here must account for potential difference
- // between the tendermint version being run by the counterparty chain
- // and the tendermint version used by this light client.
+ // between the gno/tm2 version being run by the counterparty chain
+ // and the gno/tm2 version used by this light client.
// https://github.com/cosmos/ibc-go/issues/177
- if len(cs.ChainId) > cmttypes.MaxChainIDLen {
- return errorsmod.Wrapf(ErrInvalidChainID, "chainID is too long; got: %d, max: %d", len(cs.ChainId), cmttypes.MaxChainIDLen)
+ if len(cs.ChainId) > bfttypes.MaxChainIDLen {
+ return errorsmod.Wrapf(ErrInvalidChainID, "chainID is too long; got: %d, max: %d", len(cs.ChainId), bfttypes.MaxChainIDLen)
}
if err := light.ValidateTrustLevel(cs.TrustLevel.ToTendermint()); err != nil {
@@ -141,7 +141,7 @@
"latest height revision number must match chain id revision number (%d != %d)", cs.LatestHeight.RevisionNumber, clienttypes.ParseChainID(cs.ChainId))
}
if cs.LatestHeight.RevisionHeight == 0 {
- return errorsmod.Wrap(ErrInvalidHeaderHeight, "tendermint client's latest height revision height cannot be zero")
+ return errorsmod.Wrap(ErrInvalidHeaderHeight, "gno client's latest height revision height cannot be zero")
}
if cs.TrustingPeriod >= cs.UnbondingPeriod {
return errorsmod.Wrapf(
@@ -151,7 +151,7 @@
}
if cs.ProofSpecs == nil {
- return errorsmod.Wrap(ErrInvalidProofSpecs, "proof specs cannot be nil for tm client")
+ return errorsmod.Wrap(ErrInvalidProofSpecs, "proof specs cannot be nil for gno client")
}
for i, spec := range cs.ProofSpecs {
if spec == nil {
@@ -184,7 +184,7 @@
}
}
-// initialize checks that the initial consensus state is an 07-tendermint consensus state and
+// initialize checks that the initial consensus state is an 10-gno consensus state and
// sets the client state, consensus state and associated metadata in the provided client store.
func (cs ClientState) initialize(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, consState exported.ConsensusState) error {
consensusState, ok := consState.(*ConsensusState)
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/client_state_test.go 10-gno/client_state_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/client_state_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/client_state_test.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,11 +1,11 @@
-package tendermint_test
+package gno_test
import (
ics23 "github.com/cosmos/ics23/go"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
)
const (
@@ -16,33 +16,33 @@
var invalidProof = []byte("invalid proof")
-func (suite *TendermintTestSuite) TestValidate() {
+func (suite *GnoTestSuite) TestValidate() {
testCases := []struct {
name string
- clientState *ibctm.ClientState
+ clientState *ibcgno.ClientState
expErr error
}{
{
name: "valid client",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
expErr: nil,
},
{
name: "valid client with nil upgrade path",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), nil),
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), nil),
expErr: nil,
},
{
name: "invalid chainID",
- clientState: ibctm.NewClientState(" ", ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidChainID,
+ clientState: ibcgno.NewClientState(" ", ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidChainID,
},
{
// NOTE: if this test fails, the code must account for the change in chainID length across tendermint versions!
// Do not only fix the test, fix the code!
// https://github.com/cosmos/ibc-go/issues/177
name: "valid chainID - chainID validation did not fail for chainID of length 50! ",
- clientState: ibctm.NewClientState(fiftyCharChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ clientState: ibcgno.NewClientState(fiftyCharChainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
expErr: nil,
},
{
@@ -50,72 +50,72 @@
// Do not only fix the test, fix the code!
// https://github.com/cosmos/ibc-go/issues/177
name: "invalid chainID - chainID validation failed for chainID of length 51! ",
- clientState: ibctm.NewClientState(fiftyOneCharChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidChainID,
+ clientState: ibcgno.NewClientState(fiftyOneCharChainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidChainID,
},
{
name: "invalid trust level",
- clientState: ibctm.NewClientState(chainID, ibctm.Fraction{Numerator: 0, Denominator: 1}, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidTrustLevel,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.Fraction{Numerator: 0, Denominator: 1}, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidTrustLevel,
},
{
name: "invalid zero trusting period",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, 0, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidTrustingPeriod,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, 0, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidTrustingPeriod,
},
{
name: "invalid negative trusting period",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, -1, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidTrustingPeriod,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, -1, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidTrustingPeriod,
},
{
name: "invalid zero unbonding period",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, 0, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidUnbondingPeriod,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, 0, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidUnbondingPeriod,
},
{
name: "invalid negative unbonding period",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, -1, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidUnbondingPeriod,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, -1, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidUnbondingPeriod,
},
{
name: "invalid zero max clock drift",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, 0, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidMaxClockDrift,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, 0, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidMaxClockDrift,
},
{
name: "invalid negative max clock drift",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, -1, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidMaxClockDrift,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, -1, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidMaxClockDrift,
},
{
name: "invalid revision number",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidHeaderHeight,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.NewHeight(1, 1), commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidHeaderHeight,
},
{
name: "invalid revision height",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidHeaderHeight,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, clienttypes.ZeroHeight(), commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidHeaderHeight,
},
{
name: "trusting period not less than unbonding period",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
- expErr: ibctm.ErrInvalidTrustingPeriod,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, ubdPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), upgradePath),
+ expErr: ibcgno.ErrInvalidTrustingPeriod,
},
{
name: "proof specs is nil",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, nil, upgradePath),
- expErr: ibctm.ErrInvalidProofSpecs,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, nil, upgradePath),
+ expErr: ibcgno.ErrInvalidProofSpecs,
},
{
name: "proof specs contains nil",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, []*ics23.ProofSpec{ics23.TendermintSpec, nil}, upgradePath),
- expErr: ibctm.ErrInvalidProofSpecs,
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, []*ics23.ProofSpec{ics23.TendermintSpec, nil}, upgradePath),
+ expErr: ibcgno.ErrInvalidProofSpecs,
},
{
name: "invalid upgrade path",
- clientState: ibctm.NewClientState(chainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), invalidUpgradePath),
+ clientState: ibcgno.NewClientState(chainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, height, commitmenttypes.GetSDKSpecs(), invalidUpgradePath),
expErr: clienttypes.ErrInvalidClient,
},
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/codec.go 10-gno/codec.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/codec.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/codec.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,12 +1,12 @@
-package tendermint
+package gno
import (
- codectypes "github.com/cosmos/cosmos-sdk/codec/types"
-
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
)
-// RegisterInterfaces registers the tendermint concrete client-related
+// RegisterInterfaces registers the gno concrete client-related
// implementations and interfaces.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations(
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/codec_test.go 10-gno/codec_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/codec_test.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/codec_test.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"errors"
@@ -9,7 +9,7 @@
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
- tendermint "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
+ gno "github.com/atomone-hub/atomone/modules/10-gno"
)
func TestCodecTypeRegistration(t *testing.T) {
@@ -20,22 +20,22 @@
}{
{
"success: ClientState",
- sdk.MsgTypeURL(&tendermint.ClientState{}),
+ sdk.MsgTypeURL(&gno.ClientState{}),
nil,
},
{
"success: ConsensusState",
- sdk.MsgTypeURL(&tendermint.ConsensusState{}),
+ sdk.MsgTypeURL(&gno.ConsensusState{}),
nil,
},
{
"success: Header",
- sdk.MsgTypeURL(&tendermint.Header{}),
+ sdk.MsgTypeURL(&gno.Header{}),
nil,
},
{
"success: Misbehaviour",
- sdk.MsgTypeURL(&tendermint.Misbehaviour{}),
+ sdk.MsgTypeURL(&gno.Misbehaviour{}),
nil,
},
{
@@ -47,7 +47,7 @@
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
- encodingCfg := moduletestutil.MakeTestEncodingConfig(tendermint.AppModuleBasic{})
+ encodingCfg := moduletestutil.MakeTestEncodingConfig(gno.AppModuleBasic{})
msg, err := encodingCfg.Codec.InterfaceRegistry().Resolve(tc.typeURL)
if tc.expError == nil {
Only in 10-gno/: config_test.go
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/consensus_state.go 10-gno/consensus_state.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/consensus_state.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/consensus_state.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,16 +1,16 @@
-package tendermint
+package gno
import (
"time"
- errorsmod "cosmossdk.io/errors"
-
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
cmttypes "github.com/cometbft/cometbft/types"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+
+ errorsmod "cosmossdk.io/errors"
)
var _ exported.ConsensusState = (*ConsensusState)(nil)
@@ -26,12 +26,13 @@
Timestamp: timestamp,
Root: root,
NextValidatorsHash: nextValsHash,
+ LcType: Gno,
}
}
-// ClientType returns Tendermint
+// ClientType returns Gno
func (ConsensusState) ClientType() string {
- return exported.Tendermint
+ return Gno
}
// GetRoot returns the commitment Root for the specific
@@ -44,7 +45,7 @@
return uint64(cs.Timestamp.UnixNano())
}
-// ValidateBasic defines a basic validation for the tendermint consensus state.
+// ValidateBasic defines a basic validation for the gno consensus state.
// NOTE: ProcessedTimestamp may be zero if this is an initial consensus state passed in by relayer
// as opposed to a consensus state constructed by the chain.
func (cs ConsensusState) ValidateBasic() error {
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/consensus_state_test.go 10-gno/consensus_state_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/consensus_state_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/consensus_state_test.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,22 +1,21 @@
-package tendermint_test
+package gno_test
import (
"time"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
)
-func (suite *TendermintTestSuite) TestConsensusStateValidateBasic() {
+func (suite *GnoTestSuite) TestConsensusStateValidateBasic() {
testCases := []struct {
msg string
- consensusState *ibctm.ConsensusState
+ consensusState *ibcgno.ConsensusState
expectPass bool
}{
{
"success",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
NextValidatorsHash: suite.valsHash,
@@ -25,16 +24,16 @@
},
{
"success with sentinel",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: suite.now,
- Root: commitmenttypes.NewMerkleRoot([]byte(ibctm.SentinelRoot)),
+ Root: commitmenttypes.NewMerkleRoot([]byte(ibcgno.SentinelRoot)),
NextValidatorsHash: suite.valsHash,
},
true,
},
{
"root is nil",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.MerkleRoot{},
NextValidatorsHash: suite.valsHash,
@@ -43,7 +42,7 @@
},
{
"root is empty",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.MerkleRoot{},
NextValidatorsHash: suite.valsHash,
@@ -52,7 +51,7 @@
},
{
"nextvalshash is invalid",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: suite.now,
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
NextValidatorsHash: []byte("hi"),
@@ -62,7 +61,7 @@
{
"timestamp is zero",
- &ibctm.ConsensusState{
+ &ibcgno.ConsensusState{
Timestamp: time.Time{},
Root: commitmenttypes.NewMerkleRoot([]byte("app_hash")),
NextValidatorsHash: suite.valsHash,
@@ -74,7 +73,7 @@
for i, tc := range testCases {
suite.Run(tc.msg, func() {
// check just to increase coverage
- suite.Require().Equal(exported.Tendermint, tc.consensusState.ClientType())
+ suite.Require().Equal(ibcgno.Gno, tc.consensusState.ClientType())
suite.Require().Equal(tc.consensusState.GetRoot(), tc.consensusState.Root)
err := tc.consensusState.ValidateBasic()
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/doc.go 10-gno/doc.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/doc.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/doc.go 2025-12-08 12:35:52.098644796 +0100
@@ -1,10 +1,11 @@
/*
-Package tendermint implements a concrete LightClientModule, ClientState, ConsensusState,
-Header, Misbehaviour and types for the Tendermint consensus light client.
-This implementation is based off the ICS 07 specification
+DONE
+package gno implements a concrete LightClientModule, ClientState, ConsensusState,
+Header, Misbehaviour and types for the Tendermint 2 / GNO consensus light client.
+This implementation is based off the ICS 07 specification for Tendermint consensus
(https://github.com/cosmos/ibc/tree/main/spec/client/ics-007-tendermint-client)
-Note that client identifiers are expected to be in the form: 07-tendermint-{N}.
+Note that client identifiers are expected to be in the form: 10-gno-{N}.
Client identifiers are generated and validated by core IBC, unexpected client identifiers will result in errors.
*/
-package tendermint
+package gno
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/errors.go 10-gno/errors.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/errors.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/errors.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,10 +1,10 @@
-package tendermint
+package gno
import (
errorsmod "cosmossdk.io/errors"
)
-// IBC tendermint client sentinel errors
+// IBC gno client sentinel errors
var (
ErrInvalidChainID = errorsmod.Register(ModuleName, 2, "invalid chain-id")
ErrInvalidTrustingPeriod = errorsmod.Register(ModuleName, 3, "invalid trusting period")
@@ -20,4 +20,6 @@
ErrInvalidProofSpecs = errorsmod.Register(ModuleName, 13, "invalid proof specs")
ErrInvalidValidatorSet = errorsmod.Register(ModuleName, 14, "invalid validator set")
ErrInvalidTrustLevel = errorsmod.Register(ModuleName, 15, "invalid trust level")
+ ErrOldHeaderExpired = errorsmod.Register(ModuleName, 16, "old header has expired")
+ ErrNewValSetCantBeTrusted = errorsmod.Register(ModuleName, 17, "new val set cannot be trusted")
)
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/fraction.go 10-gno/fraction.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/fraction.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/fraction.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,12 +1,11 @@
-package tendermint
+package gno
import (
cmtmath "github.com/cometbft/cometbft/libs/math"
- "github.com/cometbft/cometbft/light"
)
-// DefaultTrustLevel is the tendermint light client default trust level
-var DefaultTrustLevel = NewFractionFromTm(light.DefaultTrustLevel)
+// DefaultTrustLevel is the Gno light client default trust level
+var DefaultTrustLevel = NewFractionFromTm(LCDefaultTrustLevel)
// NewFractionFromTm returns a new Fraction instance from a tmmath.Fraction
func NewFractionFromTm(f cmtmath.Fraction) Fraction {
Only in 10-gno/: gno.pb.go
Only in 10-gno/: gno_test.go
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/header.go 10-gno/header.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/header.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/header.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,47 +1,58 @@
-package tendermint
+package gno
import (
"bytes"
+ "encoding/hex"
+ "errors"
"time"
- errorsmod "cosmossdk.io/errors"
-
- cmttypes "github.com/cometbft/cometbft/types"
-
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
+ "github.com/gnolang/gno/tm2/pkg/crypto"
+ "github.com/gnolang/gno/tm2/pkg/crypto/ed25519"
+
+ errorsmod "cosmossdk.io/errors"
)
var _ exported.ClientMessage = (*Header)(nil)
+func hexDec(s string) []byte {
+ b, err := hex.DecodeString(s)
+ if err != nil {
+ panic(err)
+ }
+ return b
+}
+
// ConsensusState returns the updated consensus state associated with the header
func (h Header) ConsensusState() *ConsensusState {
return &ConsensusState{
Timestamp: h.GetTime(),
- Root: commitmenttypes.NewMerkleRoot(h.Header.GetAppHash()),
- NextValidatorsHash: h.Header.NextValidatorsHash,
+ Root: commitmenttypes.NewMerkleRoot(h.SignedHeader.Header.AppHash),
+ NextValidatorsHash: h.SignedHeader.Header.NextValidatorsHash,
}
}
-// ClientType defines that the Header is a Tendermint consensus algorithm
+// ClientType defines that the Header is a Gno consensus algorithm
func (Header) ClientType() string {
- return exported.Tendermint
+ return Gno
}
-// GetHeight returns the current height. It returns 0 if the tendermint
+// GetHeight returns the current height. It returns 0 if the gno
// header is nil.
// NOTE: the header.Header is checked to be non nil in ValidateBasic.
func (h Header) GetHeight() exported.Height {
- revision := clienttypes.ParseChainID(h.Header.ChainID)
- return clienttypes.NewHeight(revision, uint64(h.Header.Height))
+ revision := clienttypes.ParseChainID(h.SignedHeader.Header.ChainId)
+ return clienttypes.NewHeight(revision, uint64(h.SignedHeader.Header.Height))
}
// GetTime returns the current block timestamp. It returns a zero time if
-// the tendermint header is nil.
+// the gno header is nil.
// NOTE: the header.Header is checked to be non nil in ValidateBasic.
func (h Header) GetTime() time.Time {
- return h.Header.Time
+ return h.SignedHeader.Header.Time
}
// ValidateBasic calls the SignedHeader ValidateBasic function and checks
@@ -50,16 +61,58 @@
// with MsgCreateClient
func (h Header) ValidateBasic() error {
if h.SignedHeader == nil {
- return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "tendermint signed header cannot be nil")
- }
- if h.Header == nil {
- return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "tendermint header cannot be nil")
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "gno signed header cannot be nil")
}
- tmSignedHeader, err := cmttypes.SignedHeaderFromProto(h.SignedHeader)
- if err != nil {
- return errorsmod.Wrap(err, "header is not a tendermint header")
+ // SignedHeader ValidateBasic() checks that Header and Commit are not nil
+ if h.SignedHeader.Header == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "gno header cannot be nil")
+ }
+ if h.SignedHeader.Commit == nil {
+ return errorsmod.Wrap(errors.New("missing commit"), "gno commit cannot be nil")
+ }
+ // GnoHeader ValidateBasic()
+ gnoHeader := bfttypes.Header{
+ Version: h.SignedHeader.Header.Version,
+ ChainID: h.SignedHeader.Header.ChainId,
+ Height: h.SignedHeader.Header.Height,
+ Time: h.SignedHeader.Header.Time,
+ NumTxs: h.SignedHeader.Header.NumTxs,
+ TotalTxs: h.SignedHeader.Header.TotalTxs,
+ LastBlockID: bfttypes.BlockID{Hash: h.SignedHeader.Header.LastBlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(h.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: h.SignedHeader.Header.LastBlockId.PartsHeader.Hash}},
+ LastCommitHash: h.SignedHeader.Header.LastCommitHash,
+ DataHash: h.SignedHeader.Header.DataHash,
+ ValidatorsHash: h.SignedHeader.Header.ValidatorsHash,
+ NextValidatorsHash: h.SignedHeader.Header.NextValidatorsHash,
+ ConsensusHash: h.SignedHeader.Header.ConsensusHash,
+ AppHash: h.SignedHeader.Header.AppHash,
+ LastResultsHash: h.SignedHeader.Header.LastResultsHash,
+ ProposerAddress: crypto.MustAddressFromString(h.SignedHeader.Header.ProposerAddress),
+ }
+ gnoCommit := bfttypes.Commit{
+ BlockID: bfttypes.BlockID{Hash: h.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(h.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: h.SignedHeader.Commit.BlockId.PartsHeader.Hash}},
+ Precommits: make([]*bfttypes.CommitSig, len(h.SignedHeader.Commit.Precommits)),
+ }
+ for i, sig := range h.SignedHeader.Commit.Precommits {
+ if sig == nil {
+ continue
+ }
+ gnoCommit.Precommits[i] = &bfttypes.CommitSig{
+ ValidatorIndex: int(sig.ValidatorIndex),
+ Signature: sig.Signature,
+ BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}},
+ Type: bfttypes.SignedMsgType(sig.Type),
+ Height: sig.Height,
+ Round: int(sig.Round),
+ Timestamp: sig.Timestamp,
+ ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress),
+ }
+ }
+ gnoSignedHeader := bfttypes.SignedHeader{
+ Header: &gnoHeader,
+ Commit: &gnoCommit,
}
- if err := tmSignedHeader.ValidateBasic(h.Header.GetChainID()); err != nil {
+ // NOTE: SignedHeader ValidateBasic checks
+ if err := gnoSignedHeader.ValidateBasic(h.SignedHeader.Header.ChainId); err != nil {
return errorsmod.Wrap(err, "header failed basic validation")
}
@@ -72,11 +125,25 @@
if h.ValidatorSet == nil {
return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator set is nil")
}
- tmValset, err := cmttypes.ValidatorSetFromProto(h.ValidatorSet)
- if err != nil {
- return errorsmod.Wrap(err, "validator set is not tendermint validator set")
+ gnoValset := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(h.ValidatorSet.Validators)),
+ Proposer: nil,
}
- if !bytes.Equal(h.Header.ValidatorsHash, tmValset.Hash()) {
+ for i, val := range h.ValidatorSet.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ gnoValset.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoValset.TotalVotingPower() // ensure TotalVotingPower is set
+
+ if !bytes.Equal(h.SignedHeader.Header.ValidatorsHash, gnoValset.Hash()) {
return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator set does not match hash")
}
return nil
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/header_test.go 10-gno/header_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/header_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/header_test.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,28 +1,23 @@
-package tendermint_test
+package gno_test
import (
- "errors"
"time"
-
- cmtprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
)
-func (suite *TendermintTestSuite) TestGetHeight() {
+func (suite *GnoTestSuite) TestGetHeight() {
header := suite.chainA.LatestCommittedHeader
suite.Require().NotEqual(uint64(0), header.GetHeight())
}
-func (suite *TendermintTestSuite) TestGetTime() {
+func (suite *GnoTestSuite) TestGetTime() {
header := suite.chainA.LatestCommittedHeader
suite.Require().NotEqual(time.Time{}, header.GetTime())
}
-func (suite *TendermintTestSuite) TestHeaderValidateBasic() {
- var header *ibctm.Header
+/*
+TODO: Fix gno specific tests
+func (suite *GnoTestSuite) TestHeaderValidateBasic() {
+ var header *ibcgno.Header
testCases := []struct {
name string
malleate func()
@@ -30,17 +25,14 @@
}{
{"valid header", func() {}, nil},
{"header is nil", func() {
- header.Header = nil
- }, errors.New("tendermint header cannot be nil")},
+ header.SignedHeader.Header = nil
+ }, errors.New("gno header cannot be nil")},
{"signed header is nil", func() {
header.SignedHeader = nil
- }, errors.New("tendermint signed header cannot be nil")},
- {"SignedHeaderFromProto failed", func() {
- header.Commit.Height = -1
- }, errors.New("header is not a tendermint header")},
- {"signed header failed tendermint ValidateBasic", func() {
+ }, errors.New("gno signed header cannot be nil")},
+ {"signed header failed gno ValidateBasic", func() {
header = suite.chainA.LatestCommittedHeader
- header.Commit = nil
+ header.SignedHeader.Commit = nil
}, errors.New("header failed basic validation")},
{"trusted height is equal to header height", func() {
var ok bool
@@ -80,3 +72,4 @@
})
}
}
+*/
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/keys.go 10-gno/keys.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/keys.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/keys.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,5 +1,6 @@
-package tendermint
+/* DONE */
+package gno
const (
- ModuleName = "07-tendermint"
+ ModuleName = "10-gno"
)
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/light_client_module.go 10-gno/light_client_module.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/light_client_module.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/light_client_module.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,16 +1,16 @@
-package tendermint
+package gno
import (
"fmt"
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
var _ exported.LightClientModule = (*LightClientModule)(nil)
@@ -21,7 +21,7 @@
storeProvider clienttypes.StoreProvider
}
-// NewLightClientModule creates and returns a new 07-tendermint LightClientModule.
+// NewLightClientModule creates and returns a new 10-gno LightClientModule.
func NewLightClientModule(cdc codec.BinaryCodec, storeProvider clienttypes.StoreProvider) LightClientModule {
return LightClientModule{
cdc: cdc,
@@ -176,7 +176,7 @@
return clientState.getTimestampAtHeight(clientStore, l.cdc, height)
}
-// RecoverClient asserts that the substitute client is a tendermint client. It obtains the client state associated with the
+// RecoverClient asserts that the substitute client is a gno client. It obtains the client state associated with the
// subject client and calls into the subjectClientState.CheckSubstituteAndUpdateState method.
func (l LightClientModule) RecoverClient(ctx sdk.Context, clientID, substituteClientID string) error {
substituteClientType, _, err := clienttypes.ParseClientIdentifier(substituteClientID)
@@ -184,8 +184,8 @@
return err
}
- if substituteClientType != exported.Tendermint {
- return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "expected: %s, got: %s", exported.Tendermint, substituteClientType)
+ if substituteClientType != Gno {
+ return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "expected: %s, got: %s", Gno, substituteClientType)
}
clientStore := l.storeProvider.ClientStore(ctx, clientID)
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/light_client_module_test.go 10-gno/light_client_module_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/light_client_module_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/light_client_module_test.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"crypto/sha256"
@@ -11,6 +11,7 @@
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v10/modules/core/04-channel/types"
@@ -18,17 +19,16 @@
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
ibcerrors "github.com/cosmos/ibc-go/v10/modules/core/errors"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
ibcmock "github.com/cosmos/ibc-go/v10/testing/mock"
)
var (
- tmClientID = clienttypes.FormatClientIdentifier(exported.Tendermint, 100)
+ tmClientID = clienttypes.FormatClientIdentifier(ibcgno.Gno, 100)
solomachineClientID = clienttypes.FormatClientIdentifier(exported.Solomachine, 0)
)
-func (suite *TendermintTestSuite) TestInitialize() {
+func (suite *GnoTestSuite) TestInitialize() {
var consensusState exported.ConsensusState
var clientState exported.ClientState
@@ -45,9 +45,9 @@
{
"invalid client state",
func() {
- clientState.(*ibctm.ClientState).ChainId = ""
+ clientState.(*ibcgno.ClientState).ChainId = ""
},
- ibctm.ErrInvalidChainID,
+ ibcgno.ErrInvalidChainID,
},
{
"invalid client state: solomachine client state",
@@ -66,7 +66,7 @@
{
"invalid consensus state",
func() {
- consensusState = ibctm.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte(ibctm.SentinelRoot)), []byte("invalidNextValsHash"))
+ consensusState = ibcgno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte(ibcgno.SentinelRoot)), []byte("invalidNextValsHash"))
},
errors.New("next validators hash is invalid"),
},
@@ -77,16 +77,16 @@
suite.SetupTest()
path := ibctesting.NewPath(suite.chainA, suite.chainB)
- tmConfig, ok := path.EndpointA.ClientConfig.(*ibctesting.TendermintConfig)
+ gnoConfig, ok := path.EndpointA.ClientConfig.(*GnoConfig)
suite.Require().True(ok)
- clientState = ibctm.NewClientState(
+ clientState = ibcgno.NewClientState(
path.EndpointA.Chain.ChainID,
- tmConfig.TrustLevel, tmConfig.TrustingPeriod, tmConfig.UnbondingPeriod, tmConfig.MaxClockDrift,
+ gnoConfig.TrustLevel, gnoConfig.TrustingPeriod, gnoConfig.UnbondingPeriod, gnoConfig.MaxClockDrift,
suite.chainA.LatestCommittedHeader.GetHeight().(clienttypes.Height), commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath,
)
- consensusState = ibctm.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte(ibctm.SentinelRoot)), suite.chainA.ProposedHeader.ValidatorsHash)
+ consensusState = ibcgno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte(ibcgno.SentinelRoot)), suite.chainA.ProposedHeader.ValidatorsHash)
clientID := suite.chainA.App.GetIBCKeeper().ClientKeeper.GenerateClientIdentifier(suite.chainA.GetContext(), clientState.ClientType())
@@ -115,7 +115,7 @@
}
}
-func (suite *TendermintTestSuite) TestVerifyClientMessage() {
+func (suite *GnoTestSuite) TestVerifyClientMessage() {
var path *ibctesting.Path
testCases := []struct {
@@ -168,7 +168,7 @@
}
}
-func (suite *TendermintTestSuite) TestCheckForMisbehaviourPanicsOnClientStateNotFound() {
+func (suite *GnoTestSuite) TestCheckForMisbehaviourPanicsOnClientStateNotFound() {
suite.SetupTest()
path := ibctesting.NewPath(suite.chainA, suite.chainB)
@@ -195,7 +195,7 @@
)
}
-func (suite *TendermintTestSuite) TestUpdateStateOnMisbehaviourPanicsOnClientStateNotFound() {
+func (suite *GnoTestSuite) TestUpdateStateOnMisbehaviourPanicsOnClientStateNotFound() {
suite.SetupTest()
path := ibctesting.NewPath(suite.chainA, suite.chainB)
@@ -223,7 +223,7 @@
)
}
-func (suite *TendermintTestSuite) TestUpdateStatePanicsOnClientStateNotFound() {
+func (suite *GnoTestSuite) TestUpdateStatePanicsOnClientStateNotFound() {
suite.SetupTest()
path := ibctesting.NewPath(suite.chainA, suite.chainB)
@@ -251,7 +251,7 @@
)
}
-func (suite *TendermintTestSuite) TestVerifyMembership() {
+func (suite *GnoTestSuite) TestVerifyMembership() {
var (
testingpath *ibctesting.Path
delayTimePeriod uint64
@@ -286,7 +286,7 @@
proof, proofHeight = suite.chainB.QueryProof(key)
- consensusState, ok := testingpath.EndpointB.GetConsensusState(latestHeight).(*ibctm.ConsensusState)
+ consensusState, ok := testingpath.EndpointB.GetConsensusState(latestHeight).(*ibcgno.ConsensusState)
suite.Require().True(ok)
value, err = suite.chainB.Codec.MarshalInterface(consensusState)
suite.Require().NoError(err)
@@ -412,7 +412,7 @@
"delay time period has not passed", func() {
delayTimePeriod = uint64(time.Hour.Nanoseconds())
},
- ibctm.ErrDelayPeriodNotPassed,
+ ibcgno.ErrDelayPeriodNotPassed,
},
{
"delay block period has passed", func() {
@@ -424,7 +424,7 @@
"delay block period has not passed", func() {
delayBlockPeriod = 1000
},
- ibctm.ErrDelayPeriodNotPassed,
+ ibcgno.ErrDelayPeriodNotPassed,
},
{
"latest client height < height", func() {
@@ -495,7 +495,7 @@
proof, proofHeight = suite.chainB.QueryProof(key)
- clientState, ok := testingpath.EndpointB.GetClientState().(*ibctm.ClientState)
+ clientState, ok := testingpath.EndpointB.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
value, err = suite.chainB.Codec.MarshalInterface(clientState)
suite.Require().NoError(err)
@@ -518,7 +518,7 @@
}
}
-func (suite *TendermintTestSuite) TestVerifyNonMembership() {
+func (suite *GnoTestSuite) TestVerifyNonMembership() {
var (
testingpath *ibctesting.Path
delayTimePeriod uint64
@@ -633,7 +633,7 @@
"delay time period has not passed", func() {
delayTimePeriod = uint64(time.Hour.Nanoseconds())
},
- ibctm.ErrDelayPeriodNotPassed,
+ ibcgno.ErrDelayPeriodNotPassed,
},
{
"delay block period has passed", func() {
@@ -645,7 +645,7 @@
"delay block period has not passed", func() {
delayBlockPeriod = 1000
},
- ibctm.ErrDelayPeriodNotPassed,
+ ibcgno.ErrDelayPeriodNotPassed,
},
{
"latest client height < height", func() {
@@ -741,10 +741,10 @@
}
}
-func (suite *TendermintTestSuite) TestStatus() {
+func (suite *GnoTestSuite) TestStatus() {
var (
path *ibctesting.Path
- clientState *ibctm.ClientState
+ clientState *ibcgno.ClientState
)
testCases := []struct {
@@ -803,7 +803,7 @@
suite.Require().NoError(err)
var ok bool
- clientState, ok = path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok = path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
tc.malleate()
@@ -814,7 +814,7 @@
}
}
-func (suite *TendermintTestSuite) TestLatestHeight() {
+func (suite *GnoTestSuite) TestLatestHeight() {
var (
path *ibctesting.Path
height exported.Height
@@ -858,7 +858,7 @@
}
}
-func (suite *TendermintTestSuite) TestGetTimestampAtHeight() {
+func (suite *GnoTestSuite) TestGetTimestampAtHeight() {
var (
path *ibctesting.Path
height exported.Height
@@ -886,7 +886,7 @@
{
"failure: consensus state not found for height",
func() {
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
height = clientState.LatestHeight.Increment()
},
@@ -901,13 +901,13 @@
path = ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupClients()
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
height = clientState.LatestHeight
// grab consensusState from store and update with a predefined timestamp
consensusState := path.EndpointA.GetConsensusState(height)
- tmConsensusState, ok := consensusState.(*ibctm.ConsensusState)
+ tmConsensusState, ok := consensusState.(*ibcgno.ConsensusState)
suite.Require().True(ok)
tmConsensusState.Timestamp = expectedTimestamp
@@ -932,7 +932,7 @@
}
}
-func (suite *TendermintTestSuite) TestRecoverClient() {
+func (suite *GnoTestSuite) TestRecoverClient() {
var (
subjectClientID, substituteClientID string
subjectClientState exported.ClientState
@@ -993,7 +993,7 @@
substitutePath.SetupClients()
substituteClientID = substitutePath.EndpointA.ClientID
- tmClientState, ok := subjectClientState.(*ibctm.ClientState)
+ tmClientState, ok := subjectClientState.(*ibcgno.ClientState)
suite.Require().True(ok)
tmClientState.FrozenHeight = tmClientState.LatestHeight
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(ctx, subjectPath.EndpointA.ClientID, tmClientState)
@@ -1020,7 +1020,7 @@
}
}
-func (suite *TendermintTestSuite) TestVerifyUpgradeAndUpdateState() {
+func (suite *GnoTestSuite) TestVerifyUpgradeAndUpdateState() {
var (
clientID string
path *ibctesting.Path
@@ -1041,7 +1041,7 @@
upgradeHeight := clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
// zero custom fields and store in upgrade store
- zeroedUpgradedClient := upgradedClientState.(*ibctm.ClientState).ZeroCustomFields()
+ zeroedUpgradedClient := upgradedClientState.(*ibcgno.ClientState).ZeroCustomFields()
zeroedUpgradedClientAny, err := codectypes.NewAnyWithValue(zeroedUpgradedClient)
suite.Require().NoError(err)
@@ -1093,7 +1093,7 @@
upgradeHeight := clienttypes.NewHeight(1, uint64(suite.chainB.GetContext().BlockHeight()+1))
// zero custom fields and store in upgrade store
- zeroedUpgradedClient := upgradedClientState.(*ibctm.ClientState).ZeroCustomFields()
+ zeroedUpgradedClient := upgradedClientState.(*ibcgno.ClientState).ZeroCustomFields()
zeroedUpgradedClientAny, err := codectypes.NewAnyWithValue(zeroedUpgradedClient)
suite.Require().NoError(err)
@@ -1104,7 +1104,7 @@
suite.Require().NoError(err)
// change upgraded client state height to be lower than current client state height
- tmClient, ok := upgradedClientState.(*ibctm.ClientState)
+ tmClient, ok := upgradedClientState.(*ibcgno.ClientState)
suite.Require().True(ok)
newLatestheight, ok := path.EndpointA.GetClientLatestHeight().Decrement()
@@ -1134,7 +1134,7 @@
path.SetupClients()
clientID = path.EndpointA.ClientID
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
revisionNumber := clienttypes.ParseChainID(clientState.ChainId)
@@ -1142,12 +1142,12 @@
newChainID, err := clienttypes.SetRevisionNumber(clientState.ChainId, revisionNumber+1)
suite.Require().NoError(err)
- upgradedClientState = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, newUnbondindPeriod, maxClockDrift, clienttypes.NewHeight(revisionNumber+1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClientState = ibcgno.NewClientState(newChainID, ibcgno.DefaultTrustLevel, trustingPeriod, newUnbondindPeriod, maxClockDrift, clienttypes.NewHeight(revisionNumber+1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
upgradedClientStateAny, err = codectypes.NewAnyWithValue(upgradedClientState)
suite.Require().NoError(err)
nextValsHash := sha256.Sum256([]byte("new-nextValsHash"))
- upgradedConsensusState := ibctm.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("new-hash")), nextValsHash[:])
+ upgradedConsensusState := ibcgno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("new-hash")), nextValsHash[:])
upgradedConsensusStateAny, err = codectypes.NewAnyWithValue(upgradedConsensusState)
suite.Require().NoError(err)
@@ -1173,7 +1173,7 @@
expClientStateBz := suite.chainA.Codec.MustMarshal(expClientState)
suite.Require().Equal(upgradedClientStateAny.Value, expClientStateBz)
- expConsensusState := ibctm.NewConsensusState(upgradedConsensusState.Timestamp, commitmenttypes.NewMerkleRoot([]byte(ibctm.SentinelRoot)), upgradedConsensusState.NextValidatorsHash)
+ expConsensusState := ibcgno.NewConsensusState(upgradedConsensusState.Timestamp, commitmenttypes.NewMerkleRoot([]byte(ibcgno.SentinelRoot)), upgradedConsensusState.NextValidatorsHash)
expConsensusStateBz := suite.chainA.Codec.MustMarshal(expConsensusState)
consensusStateBz := suite.chainA.Codec.MustMarshal(path.EndpointA.GetConsensusState(path.EndpointA.GetClientLatestHeight()))
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/expected_keepers.go 10-gno/migrations/expected_keepers.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/expected_keepers.go 2025-12-08 12:36:25.319014665 +0100
+++ 10-gno/migrations/expected_keepers.go 2025-12-08 12:35:52.098698472 +0100
@@ -1,12 +1,12 @@
package migrations
import (
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
// ClientKeeper expected account IBC client keeper
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/migrations.go 10-gno/migrations/migrations.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/migrations.go 2025-12-08 12:36:25.319216672 +0100
+++ 10-gno/migrations/migrations.go 2025-12-08 12:35:52.099693633 +0100
@@ -1,21 +1,22 @@
package migrations
import (
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
)
-// PruneExpiredConsensusStates prunes all expired tendermint consensus states. This function
+// PruneExpiredConsensusStates prunes all expired GNO consensus states. This function
// may optionally be called during in-place store migrations. The ibc store key must be provided.
func PruneExpiredConsensusStates(ctx sdk.Context, cdc codec.BinaryCodec, clientKeeper ClientKeeper) (int, error) {
var clientIDs []string
- clientKeeper.IterateClientStates(ctx, []byte(exported.Tendermint), func(clientID string, _ exported.ClientState) bool {
+ clientKeeper.IterateClientStates(ctx, []byte(ibcgno.Gno), func(clientID string, _ exported.ClientState) bool {
clientIDs = append(clientIDs, clientID)
return false
})
@@ -32,15 +33,15 @@
return 0, errorsmod.Wrapf(clienttypes.ErrClientNotFound, "clientID %s", clientID)
}
- tmClientState, ok := clientState.(*ibctm.ClientState)
+ gnoClientState, ok := clientState.(*ibcgno.ClientState)
if !ok {
- return 0, errorsmod.Wrap(clienttypes.ErrInvalidClient, "client state is not tendermint even though client id contains 07-tendermint")
+ return 0, errorsmod.Wrap(clienttypes.ErrInvalidClient, "client state is not GNO even though client id contains 10-gno")
}
- totalPruned += ibctm.PruneAllExpiredConsensusStates(ctx, clientStore, cdc, tmClientState)
+ totalPruned += ibcgno.PruneAllExpiredConsensusStates(ctx, clientStore, cdc, gnoClientState)
}
- clientKeeper.Logger(ctx).Info("pruned expired tendermint consensus states", "total", totalPruned)
+ clientKeeper.Logger(ctx).Info("pruned expired gno consensus states", "total", totalPruned)
return totalPruned, nil
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/migrations_test.go 10-gno/migrations/migrations_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/migrations/migrations_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/migrations/migrations_test.go 2025-12-08 12:35:52.099693633 +0100
@@ -6,11 +6,11 @@
testifysuite "github.com/stretchr/testify/suite"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
+ ibcgnomigrations "github.com/atomone-hub/atomone/modules/10-gno/migrations"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
- ibctmmigrations "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint/migrations"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
@@ -30,15 +30,15 @@
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2))
}
-func TestTendermintTestSuite(t *testing.T) {
+func TestGnoTestSuite(t *testing.T) {
testifysuite.Run(t, new(MigrationsTestSuite))
}
-// test pruning of multiple expired tendermint consensus states
+// test pruning of multiple expired gno consensus states
func (suite *MigrationsTestSuite) TestPruneExpiredConsensusStates() {
- // create multiple tendermint clients and a solo machine client
+ // create multiple gno clients and a solo machine client
// the solo machine is used to verify this pruning function only modifies
- // the tendermint store.
+ // the gno store.
numTMClients := 3
paths := make([]*ibctesting.Path, numTMClients)
@@ -88,15 +88,15 @@
ctx := suite.chainA.GetContext()
clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID)
- processedTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight)
+ processedTime, ok := ibcgno.GetProcessedTime(clientStore, pruneHeight)
suite.Require().True(ok)
suite.Require().NotNil(processedTime)
- processedHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight)
+ processedHeight, ok := ibcgno.GetProcessedHeight(clientStore, pruneHeight)
suite.Require().True(ok)
suite.Require().NotNil(processedHeight)
- expectedConsKey := ibctm.GetIterationKey(clientStore, pruneHeight)
+ expectedConsKey := ibcgno.GetIterationKey(clientStore, pruneHeight)
suite.Require().NotNil(expectedConsKey)
}
pruneHeightMap[path] = pruneHeights
@@ -123,7 +123,7 @@
// This will cause the consensus states created before the first time increment
// to be expired
suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour)
- totalPruned, err := ibctmmigrations.PruneExpiredConsensusStates(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper)
+ totalPruned, err := ibcgnomigrations.PruneExpiredConsensusStates(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), suite.chainA.GetSimApp().IBCKeeper.ClientKeeper)
suite.Require().NoError(err)
suite.Require().NotZero(totalPruned)
@@ -137,15 +137,15 @@
suite.Require().False(ok, i)
suite.Require().Nil(consState, i)
- processedTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight)
+ processedTime, ok := ibcgno.GetProcessedTime(clientStore, pruneHeight)
suite.Require().False(ok, i)
suite.Require().Equal(uint64(0), processedTime, i)
- processedHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight)
+ processedHeight, ok := ibcgno.GetProcessedHeight(clientStore, pruneHeight)
suite.Require().False(ok, i)
suite.Require().Nil(processedHeight, i)
- expectedConsKey := ibctm.GetIterationKey(clientStore, pruneHeight)
+ expectedConsKey := ibcgno.GetIterationKey(clientStore, pruneHeight)
suite.Require().Nil(expectedConsKey, i)
}
@@ -155,15 +155,15 @@
suite.Require().True(ok)
suite.Require().NotNil(consState)
- processedTime, ok := ibctm.GetProcessedTime(clientStore, height)
+ processedTime, ok := ibcgno.GetProcessedTime(clientStore, height)
suite.Require().True(ok)
suite.Require().NotEqual(uint64(0), processedTime)
- processedHeight, ok := ibctm.GetProcessedHeight(clientStore, height)
+ processedHeight, ok := ibcgno.GetProcessedHeight(clientStore, height)
suite.Require().True(ok)
suite.Require().NotEqual(clienttypes.ZeroHeight(), processedHeight)
- consKey := ibctm.GetIterationKey(clientStore, height)
+ consKey := ibcgno.GetIterationKey(clientStore, height)
suite.Require().Equal(host.ConsensusStateKey(height), consKey)
}
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour.go 10-gno/misbehaviour.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/misbehaviour.go 2025-12-08 12:35:52.099693633 +0100
@@ -1,16 +1,17 @@
-package tendermint
+package gno
import (
"time"
- errorsmod "cosmossdk.io/errors"
-
- cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
- cmttypes "github.com/cometbft/cometbft/types"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
+ "github.com/gnolang/gno/tm2/pkg/crypto"
+ "github.com/gnolang/gno/tm2/pkg/crypto/ed25519"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+
+ errorsmod "cosmossdk.io/errors"
)
var _ exported.ClientMessage = (*Misbehaviour)(nil)
@@ -27,9 +28,9 @@
}
}
-// ClientType is Tendermint light client
+// ClientType is Gno light client
func (Misbehaviour) ClientType() string {
- return exported.Tendermint
+ return Gno
}
// GetTime returns the timestamp at which misbehaviour occurred. It uses the
@@ -63,7 +64,7 @@
if misbehaviour.Header2.TrustedValidators == nil {
return errorsmod.Wrap(ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty")
}
- if misbehaviour.Header1.Header.ChainID != misbehaviour.Header2.Header.ChainID {
+ if misbehaviour.Header1.SignedHeader.Header.ChainId != misbehaviour.Header2.SignedHeader.Header.ChainId {
return errorsmod.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs")
}
@@ -89,35 +90,84 @@
return errorsmod.Wrapf(clienttypes.ErrInvalidMisbehaviour, "Header1 height is less than Header2 height (%s < %s)", misbehaviour.Header1.GetHeight(), misbehaviour.Header2.GetHeight())
}
- blockID1, err := cmttypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID)
+ blockId1 := bfttypes.BlockID{
+ Hash: misbehaviour.Header1.SignedHeader.Header.LastBlockId.Hash,
+ PartsHeader: bfttypes.PartSetHeader{Total: int(misbehaviour.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: misbehaviour.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Hash},
+ }
+ err := blockId1.ValidateBasic()
if err != nil {
return errorsmod.Wrap(err, "invalid block ID from header 1 in misbehaviour")
}
- blockID2, err := cmttypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID)
+ blockId2 := bfttypes.BlockID{
+ Hash: misbehaviour.Header2.SignedHeader.Header.LastBlockId.Hash,
+ PartsHeader: bfttypes.PartSetHeader{Total: int(misbehaviour.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: misbehaviour.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Hash},
+ }
+ err = blockId2.ValidateBasic()
if err != nil {
return errorsmod.Wrap(err, "invalid block ID from header 2 in misbehaviour")
}
- if err := validCommit(misbehaviour.Header1.Header.ChainID, *blockID1,
- misbehaviour.Header1.Commit, misbehaviour.Header1.ValidatorSet); err != nil {
+ if err := validCommit(misbehaviour.Header1.SignedHeader.Header.ChainId, blockId1,
+ *misbehaviour.Header1.SignedHeader.Commit, misbehaviour.Header1.ValidatorSet); err != nil {
return err
}
- return validCommit(misbehaviour.Header2.Header.ChainID, *blockID2,
- misbehaviour.Header2.Commit, misbehaviour.Header2.ValidatorSet)
+ return validCommit(misbehaviour.Header2.SignedHeader.Header.ChainId, blockId2,
+ *misbehaviour.Header2.SignedHeader.Commit, misbehaviour.Header2.ValidatorSet)
}
// validCommit checks if the given commit is a valid commit from the passed-in validatorset
-func validCommit(chainID string, blockID cmttypes.BlockID, commit *cmtproto.Commit, valSet *cmtproto.ValidatorSet) (err error) {
- tmCommit, err := cmttypes.CommitFromProto(commit)
+func validCommit(chainID string, blockID bfttypes.BlockID, commit Commit, valSet *ValidatorSet) (err error) {
+ err = blockID.ValidateBasic()
if err != nil {
- return errorsmod.Wrap(err, "commit is not tendermint commit type")
+ return errorsmod.Wrap(err, "block ID is not gno block ID type")
+ }
+ gnoCommit := bfttypes.Commit{
+ BlockID: bfttypes.BlockID{Hash: commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(commit.BlockId.PartsHeader.Total), Hash: commit.BlockId.PartsHeader.Hash}},
+ Precommits: make([]*bfttypes.CommitSig, len(commit.Precommits)),
+ }
+ for i, sig := range commit.Precommits {
+ if sig == nil {
+ continue
+ }
+ gnoCommit.Precommits[i] = &bfttypes.CommitSig{
+ ValidatorIndex: int(sig.ValidatorIndex),
+ Signature: sig.Signature,
+ BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}},
+ Type: bfttypes.SignedMsgType(sig.Type),
+ Height: sig.Height,
+ Round: int(sig.Round),
+ Timestamp: sig.Timestamp,
+ ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress),
}
- tmValset, err := cmttypes.ValidatorSetFromProto(valSet)
+ }
+ err = gnoCommit.ValidateBasic()
if err != nil {
- return errorsmod.Wrap(err, "validator set is not tendermint validator set type")
+ return errorsmod.Wrap(err, "commit is not gno commit type")
+ }
+
+ gnoValset := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(valSet.Validators)),
+ Proposer: nil,
+ }
+ for i, val := range valSet.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ gnoValset.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoValset.TotalVotingPower() // ensure TotalVotingPower is set
+ empty := gnoValset.IsNilOrEmpty()
+ if empty {
+ return errorsmod.Wrap(err, "validator set is not gno validator set type")
}
- if err := tmValset.VerifyCommitLight(chainID, blockID, tmCommit.Height, tmCommit); err != nil {
+ if err := gnoValset.VerifyCommit(chainID, blockID, gnoCommit.Height(), &gnoCommit); err != nil {
return errorsmod.Wrap(clienttypes.ErrInvalidMisbehaviour, "validator set did not commit to header")
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_handle.go 10-gno/misbehaviour_handle.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_handle.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/misbehaviour_handle.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,20 +1,23 @@
-package tendermint
+package gno
import (
"bytes"
+ "errors"
"reflect"
"time"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
+ "github.com/gnolang/gno/tm2/pkg/crypto"
+ "github.com/gnolang/gno/tm2/pkg/crypto/ed25519"
+
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- cmttypes "github.com/cometbft/cometbft/types"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
// CheckForMisbehaviour detects duplicate height misbehaviour and BFT time violation misbehaviour
@@ -22,16 +25,16 @@
func (ClientState) CheckForMisbehaviour(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, msg exported.ClientMessage) bool {
switch msg := msg.(type) {
case *Header:
- tmHeader := msg
- consState := tmHeader.ConsensusState()
+ header := msg
+ consState := header.ConsensusState()
// Check if the Client store already has a consensus state for the header's height
// If the consensus state exists, and it matches the header then we return early
// since header has already been submitted in a previous UpdateClient.
- if existingConsState, found := GetConsensusState(clientStore, cdc, tmHeader.GetHeight()); found {
+ if existingConsState, found := GetConsensusState(clientStore, cdc, header.GetHeight()); found {
// This header has already been submitted and the necessary state is already stored
// in client store, thus we can return early without further validation.
- if reflect.DeepEqual(existingConsState, tmHeader.ConsensusState()) { //nolint:gosimple
+ if reflect.DeepEqual(existingConsState, header.ConsensusState()) {
return false
}
@@ -41,8 +44,8 @@
}
// Check that consensus state timestamps are monotonic
- prevCons, prevOk := GetPreviousConsensusState(clientStore, cdc, tmHeader.GetHeight())
- nextCons, nextOk := GetNextConsensusState(clientStore, cdc, tmHeader.GetHeight())
+ prevCons, prevOk := GetPreviousConsensusState(clientStore, cdc, header.GetHeight())
+ nextCons, nextOk := GetNextConsensusState(clientStore, cdc, header.GetHeight())
// if previous consensus state exists, check consensus state time is greater than previous consensus state time
// if previous consensus state is not before current consensus state return true
if prevOk && !prevCons.Timestamp.Before(consState.Timestamp) {
@@ -57,13 +60,19 @@
// if heights are equal check that this is valid misbehaviour of a fork
// otherwise if heights are unequal check that this is valid misbehavior of BFT time violation
if msg.Header1.GetHeight().EQ(msg.Header2.GetHeight()) {
- blockID1, err := cmttypes.BlockIDFromProto(&msg.Header1.Commit.BlockID)
- if err != nil {
+
+ blockID1 := bfttypes.BlockID{
+ Hash: msg.Header1.SignedHeader.Header.LastBlockId.Hash,
+ PartsHeader: bfttypes.PartSetHeader{Total: int(msg.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: msg.Header1.SignedHeader.Header.LastBlockId.PartsHeader.Hash},
+ }
+ if blockID1.ValidateBasic() != nil {
return false
}
-
- blockID2, err := cmttypes.BlockIDFromProto(&msg.Header2.Commit.BlockID)
- if err != nil {
+ blockID2 := bfttypes.BlockID{
+ Hash: msg.Header2.SignedHeader.Header.LastBlockId.Hash,
+ PartsHeader: bfttypes.PartSetHeader{Total: int(msg.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: msg.Header2.SignedHeader.Header.LastBlockId.PartsHeader.Hash},
+ }
+ if blockID2.ValidateBasic() != nil {
return false
}
@@ -72,7 +81,7 @@
return true
}
- } else if !msg.Header1.Header.Time.After(msg.Header2.Header.Time) {
+ } else if !msg.Header1.SignedHeader.Header.Time.After(msg.Header2.SignedHeader.Header.Time) {
// Header1 is at greater height than Header2, therefore Header1 time must be less than or equal to
// Header2 time in order to be valid misbehaviour (violation of monotonic time).
return true
@@ -128,14 +137,49 @@
func checkMisbehaviourHeader(
clientState *ClientState, consState *ConsensusState, header *Header, currentTimestamp time.Time,
) error {
- tmTrustedValset, err := cmttypes.ValidatorSetFromProto(header.TrustedValidators)
- if err != nil {
- return errorsmod.Wrap(err, "trusted validator set is not tendermint validator set type")
+ gnoTrustedValset := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)),
+ Proposer: nil,
+ }
+ for i, val := range header.TrustedValidators.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ gnoTrustedValset.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoTrustedValset.TotalVotingPower() // ensure TotalVotingPower is set
+ if gnoTrustedValset.IsNilOrEmpty() {
+ return errorsmod.Wrap(errors.New("empty trusted validator set"), "trusted validator set is not gno validator set type")
+ }
+
+ gnoCommit := bfttypes.Commit{
+ BlockID: bfttypes.BlockID{Hash: header.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: header.SignedHeader.Commit.BlockId.PartsHeader.Hash}},
+ Precommits: make([]*bfttypes.CommitSig, len(header.SignedHeader.Commit.Precommits)),
+ }
+ for i, sig := range header.SignedHeader.Commit.Precommits {
+ if sig == nil {
+ continue
+ }
+ gnoCommit.Precommits[i] = &bfttypes.CommitSig{
+ ValidatorIndex: int(sig.ValidatorIndex),
+ Signature: sig.Signature,
+ BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}},
+ Type: bfttypes.SignedMsgType(sig.Type),
+ Height: sig.Height,
+ Round: int(sig.Round),
+ Timestamp: sig.Timestamp,
+ ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress),
}
-
- tmCommit, err := cmttypes.CommitFromProto(header.Commit)
+ }
+ err := gnoCommit.ValidateBasic()
if err != nil {
- return errorsmod.Wrap(err, "commit is not tendermint commit type")
+ return errorsmod.Wrap(err, "commit is not gno commit type")
}
// check the trusted fields for the header against ConsensusState
@@ -161,11 +205,10 @@
chainID, _ = clienttypes.SetRevisionNumber(chainID, header.GetHeight().GetRevisionNumber())
}
- // - ValidatorSet must have TrustLevel similarity with trusted FromValidatorSet
- // - ValidatorSets on both headers are valid given the last trusted ValidatorSet
- if err := tmTrustedValset.VerifyCommitLightTrusting(
- chainID, tmCommit, clientState.TrustLevel.ToTendermint(),
- ); err != nil {
+ // - ValidatorSet must have TrustLevel similarity with trusted ValidatorSet
+ // - TODO: re-check
+ err = VerifyLightCommit(&gnoTrustedValset, chainID, gnoCommit.BlockID, header.SignedHeader.Header.Height, &gnoCommit, LCDefaultTrustLevel)
+ if err != nil {
return errorsmod.Wrapf(clienttypes.ErrInvalidMisbehaviour, "validator set in header has too much change from trusted validator set: %v", err)
}
return nil
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_handle_test.go 10-gno/misbehaviour_handle_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_handle_test.go 2025-12-08 12:37:51.565995256 +0100
+++ 10-gno/misbehaviour_handle_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"errors"
@@ -6,26 +6,25 @@
"strings"
"time"
- cmttypes "github.com/cometbft/cometbft/types"
-
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
solomachine "github.com/cosmos/ibc-go/v10/modules/light-clients/06-solomachine"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
)
-func (suite *TendermintTestSuite) TestVerifyMisbehaviour() {
+func (suite *GnoTestSuite) TestVerifyMisbehaviour() {
// Setup different validators and signers for testing different types of updates
- altPrivVal := cmttypes.NewMockPV()
- altPubKey, err := altPrivVal.GetPubKey()
- suite.Require().NoError(err)
+ altPrivVal := bfttypes.NewMockPV()
+ altPubKey := altPrivVal.PubKey()
+ suite.Require().NotNil(altPubKey)
// create modified heights to use for test-cases
- altVal := cmttypes.NewValidator(altPubKey, 100)
+ altVal := bfttypes.NewValidator(altPubKey, 100)
// Create alternative validator set with only altVal, invalid update (too much change in valSet)
- altValSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{altVal})
+ altValSet := bfttypes.NewValidatorSet([]*bfttypes.Validator{altVal})
altSigners := getAltSigners(altVal, altPrivVal)
var (
@@ -52,7 +51,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -67,7 +66,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -82,7 +81,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Hour), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -97,7 +96,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+1, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+1, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -120,7 +119,7 @@
trustedVals2, ok := suite.chainB.TrustedValidators[trustedHeight2.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight1, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals1, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight2, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals2, suite.chainB.Signers),
}
@@ -141,7 +140,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -165,7 +164,7 @@
futureRevision := fmt.Sprintf("%s-%d", strings.TrimSuffix(suite.chainB.ChainID, fmt.Sprintf("-%d", clienttypes.ParseChainID(suite.chainB.ChainID))), height.GetRevisionNumber()+1)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(futureRevision, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(futureRevision, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -187,7 +186,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -209,11 +208,11 @@
suite.Require().True(ok)
// Create bothValSet with both suite validator and altVal
- bothValSet := cmttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altValSet.Proposer))
+ bothValSet := bfttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altValSet.Proposer))
bothSigners := suite.chainB.Signers
bothSigners[altValSet.Proposer.Address.String()] = altPrivVal
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), bothValSet, suite.chainB.NextVals, trustedVals, bothSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, bothValSet, suite.chainB.NextVals, trustedVals, bothSigners),
}
@@ -233,7 +232,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -250,7 +249,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers),
}
@@ -264,7 +263,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight.Increment().(clienttypes.Height), suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -291,7 +290,7 @@
suite.chainA.ExpireClient(path.EndpointA.ClientConfig.(*ibctesting.TendermintConfig).TrustingPeriod)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -311,7 +310,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -331,7 +330,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners),
}
@@ -351,7 +350,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners),
}
@@ -387,20 +386,20 @@
// test both fork and time misbehaviour for chainIDs not in the revision format
// this function is separate as it must use a global variable in the testing package
// to initialize chains not in the revision format
-func (suite *TendermintTestSuite) TestVerifyMisbehaviourNonRevisionChainID() {
+func (suite *GnoTestSuite) TestVerifyMisbehaviourNonRevisionChainID() {
// NOTE: chains set to non revision format
ibctesting.ChainIDSuffix = ""
// Setup different validators and signers for testing different types of updates
- altPrivVal := cmttypes.NewMockPV()
- altPubKey, err := altPrivVal.GetPubKey()
- suite.Require().NoError(err)
+ altPrivVal := bfttypes.NewMockPV()
+ altPubKey := altPrivVal.PubKey()
+ suite.Require().NotNil(altPubKey)
// create modified heights to use for test-cases
- altVal := cmttypes.NewValidator(altPubKey, 100)
+ altVal := bfttypes.NewValidator(altPubKey, 100)
// Create alternative validator set with only altVal, invalid update (too much change in valSet)
- altValSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{altVal})
+ altValSet := bfttypes.NewValidatorSet([]*bfttypes.Validator{altVal})
altSigners := getAltSigners(altVal, altPrivVal)
var (
@@ -427,7 +426,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -442,7 +441,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -457,7 +456,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Hour), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -472,7 +471,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+1, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+1, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -495,7 +494,7 @@
trustedVals2, ok := suite.chainB.TrustedValidators[trustedHeight2.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight1, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals1, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight2, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals2, suite.chainB.Signers),
}
@@ -517,11 +516,11 @@
suite.Require().True(ok)
// Create bothValSet with both suite validator and altVal
- bothValSet := cmttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altValSet.Proposer))
+ bothValSet := bfttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altValSet.Proposer))
bothSigners := suite.chainB.Signers
bothSigners[altValSet.Proposer.Address.String()] = altPrivVal
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), bothValSet, suite.chainB.NextVals, trustedVals, bothSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, bothValSet, suite.chainB.NextVals, trustedVals, bothSigners),
}
@@ -541,7 +540,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader("evmos", int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -558,7 +557,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, altValSet, suite.chainB.Signers),
}
@@ -572,7 +571,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight]
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight.Increment().(clienttypes.Height), suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -599,7 +598,7 @@
suite.chainA.ExpireClient(path.EndpointA.ClientConfig.(*ibctesting.TendermintConfig).TrustingPeriod)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -619,7 +618,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -639,7 +638,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners),
}
@@ -659,7 +658,7 @@
height, ok := path.EndpointA.GetClientLatestHeight().(clienttypes.Height)
suite.Require().True(ok)
- misbehaviour = &ibctm.Misbehaviour{
+ misbehaviour = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), altValSet, suite.chainB.NextVals, trustedVals, altSigners),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time, altValSet, suite.chainB.NextVals, trustedVals, altSigners),
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_test.go 10-gno/misbehaviour_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/misbehaviour_test.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/misbehaviour_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"errors"
@@ -10,16 +10,16 @@
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmttypes "github.com/cometbft/cometbft/types"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
-func (suite *TendermintTestSuite) TestMisbehaviour() {
+func (suite *GnoTestSuite) TestMisbehaviour() {
heightMinus1 := clienttypes.NewHeight(0, height.RevisionHeight-1)
- misbehaviour := &ibctm.Misbehaviour{
+ misbehaviour := &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: clientID,
@@ -28,7 +28,7 @@
suite.Require().Equal(exported.Tendermint, misbehaviour.ClientType())
}
-func (suite *TendermintTestSuite) TestMisbehaviourValidateBasic() {
+func (suite *GnoTestSuite) TestMisbehaviourValidateBasic() {
altPrivVal := cmttypes.NewMockPV()
altPubKey, err := altPrivVal.GetPubKey()
suite.Require().NoError(err)
@@ -49,130 +49,130 @@
testCases := []struct {
name string
- misbehaviour *ibctm.Misbehaviour
- malleateMisbehaviour func(misbehaviour *ibctm.Misbehaviour) error
+ misbehaviour *ibcgno.Misbehaviour
+ malleateMisbehaviour func(misbehaviour *ibcgno.Misbehaviour) error
expErr error
}{
{
"valid fork misbehaviour, two headers at same height have different time",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
nil,
},
{
"valid time misbehaviour, both headers at different heights are at same time",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight+5), heightMinus1, suite.now, suite.valSet, suite.valSet, suite.valSet, suite.signers),
Header2: suite.header,
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
nil,
},
{
"misbehaviour Header1 is nil",
- ibctm.NewMisbehaviour(clientID, nil, suite.header),
- func(m *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidHeader, "misbehaviour Header1 cannot be nil"),
+ ibcgno.NewMisbehaviour(clientID, nil, suite.header),
+ func(m *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidHeader, "misbehaviour Header1 cannot be nil"),
},
{
"misbehaviour Header2 is nil",
- ibctm.NewMisbehaviour(clientID, suite.header, nil),
- func(m *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidHeader, "misbehaviour Header2 cannot be nil"),
+ ibcgno.NewMisbehaviour(clientID, suite.header, nil),
+ func(m *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidHeader, "misbehaviour Header2 cannot be nil"),
},
{
"valid misbehaviour with different trusted headers",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.NewHeight(0, height.RevisionHeight-3), suite.now.Add(time.Minute), suite.valSet, suite.valSet, bothValSet, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
nil,
},
{
"trusted height is 0 in Header1",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, suite.valSet, suite.signers),
Header2: suite.header,
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero revision height"),
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidHeaderHeight, "misbehaviour Header1 cannot have zero revision height"),
},
{
"trusted height is 0 in Header2",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), clienttypes.ZeroHeight(), suite.now.Add(time.Minute), suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero revision height"),
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidHeaderHeight, "misbehaviour Header2 cannot have zero revision height"),
},
{
"trusted valset is nil in Header1",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, nil, suite.signers),
Header2: suite.header,
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty"),
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidValidatorSet, "trusted validator set in Header1 cannot be empty"),
},
{
"trusted valset is nil in Header2",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now.Add(time.Minute), suite.valSet, suite.valSet, nil, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
- errorsmod.Wrap(ibctm.ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty"),
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
+ errorsmod.Wrap(ibcgno.ErrInvalidValidatorSet, "trusted validator set in Header2 cannot be empty"),
},
{
"invalid client ID ",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: "GAI",
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
errors.New("identifier GAI has invalid length"),
},
{
"chainIDs do not match",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader("ethermint", int64(height.RevisionHeight), heightMinus1, suite.now, suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
errorsmod.Wrap(clienttypes.ErrInvalidMisbehaviour, "headers must have identical chainIDs"),
},
{
"header2 height is greater",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, 6, clienttypes.NewHeight(0, height.RevisionHeight+1), suite.now, suite.valSet, suite.valSet, suite.valSet, suite.signers),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error { return nil },
+ func(misbehaviour *ibcgno.Misbehaviour) error { return nil },
errors.New("Header1 height is less than Header2 height"),
},
{
"header 1 doesn't have 2/3 majority",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, suite.valSet, bothSigners),
Header2: suite.header,
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error {
+ func(misbehaviour *ibcgno.Misbehaviour) error {
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
wrongVoteSet := cmttypes.NewVoteSet(chainID, int64(misbehaviour.Header1.GetHeight().GetRevisionHeight()), 1, cmtproto.PrecommitType, altValSet)
blockID, err := cmttypes.BlockIDFromProto(&misbehaviour.Header1.Commit.BlockID)
@@ -188,12 +188,12 @@
},
{
"header 2 doesn't have 2/3 majority",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, suite.valSet, bothSigners),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error {
+ func(misbehaviour *ibcgno.Misbehaviour) error {
// voteSet contains only altVal which is less than 2/3 of total power (height/1height)
wrongVoteSet := cmttypes.NewVoteSet(chainID, int64(misbehaviour.Header2.GetHeight().GetRevisionHeight()), 1, cmtproto.PrecommitType, altValSet)
blockID, err := cmttypes.BlockIDFromProto(&misbehaviour.Header2.Commit.BlockID)
@@ -209,12 +209,12 @@
},
{
"validators sign off on wrong commit",
- &ibctm.Misbehaviour{
+ &ibcgno.Misbehaviour{
Header1: suite.header,
Header2: suite.chainA.CreateTMClientHeader(chainID, int64(height.RevisionHeight), heightMinus1, suite.now, bothValSet, bothValSet, suite.valSet, bothSigners),
ClientId: clientID,
},
- func(misbehaviour *ibctm.Misbehaviour) error {
+ func(misbehaviour *ibcgno.Misbehaviour) error {
tmBlockID := ibctesting.MakeBlockID(tmhash.Sum([]byte("other_hash")), 3, tmhash.Sum([]byte("other_partset")))
misbehaviour.Header2.Commit.BlockID = tmBlockID.ToProto()
return nil
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/module.go 10-gno/module.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/module.go 2025-12-08 12:36:25.319216672 +0100
+++ 10-gno/module.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,4 +1,4 @@
-package tendermint
+package gno
import (
"encoding/json"
@@ -19,18 +19,20 @@
_ appmodule.AppModule = (*AppModule)(nil)
)
-// AppModuleBasic defines the basic application module used by the tendermint light client.
+// AppModuleBasic defines the basic application module used by the GNO light client.
// Only the RegisterInterfaces function needs to be implemented. All other function perform
// a no-op.
type AppModuleBasic struct{}
+const Gno string = "10-gno"
+
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (AppModuleBasic) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (AppModuleBasic) IsAppModule() {}
-// Name returns the tendermint module name.
+// Name returns the gno module name.
func (AppModuleBasic) Name() string {
return ModuleName
}
@@ -41,21 +43,21 @@
// IsAppModule implements the appmodule.AppModule interface.
func (AppModule) IsAppModule() {}
-// RegisterLegacyAminoCodec performs a no-op. The Tendermint client does not support amino.
+// RegisterLegacyAminoCodec performs a no-op. The gno client does not support amino.
func (AppModuleBasic) RegisterLegacyAminoCodec(*codec.LegacyAmino) {}
// RegisterInterfaces registers module concrete types into protobuf Any. This allows core IBC
-// to unmarshal tendermint light client types.
+// to unmarshal gno light client types.
func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
RegisterInterfaces(registry)
}
-// DefaultGenesis performs a no-op. Genesis is not supported for the tendermint light client.
+// DefaultGenesis performs a no-op. Genesis is not supported for the gno light client.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return nil
}
-// ValidateGenesis performs a no-op. Genesis is not supported for the tendermint light client.
+// ValidateGenesis performs a no-op. Genesis is not supported for the gno light client.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error {
return nil
}
@@ -73,13 +75,13 @@
return nil
}
-// AppModule is the application module for the Tendermint client module
+// AppModule is the application module for the GNO client module
type AppModule struct {
AppModuleBasic
lightClientModule LightClientModule
}
-// NewAppModule creates a new Tendermint client module
+// NewAppModule creates a new GNO client module
func NewAppModule(lightClientModule LightClientModule) AppModule {
return AppModule{
lightClientModule: lightClientModule,
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/proposal_handle.go 10-gno/proposal_handle.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/proposal_handle.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/proposal_handle.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,17 +1,17 @@
-package tendermint
+package gno
import (
"reflect"
"time"
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
// CheckSubstituteAndUpdateState will try to update the client with the state of the
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/proposal_handle_test.go 10-gno/proposal_handle_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/proposal_handle_test.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/proposal_handle_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,17 +1,17 @@
-package tendermint_test
+package gno_test
import (
"time"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
var frozenHeight = clienttypes.NewHeight(0, 1)
-func (suite *TendermintTestSuite) TestCheckSubstituteUpdateStateBasic() {
+func (suite *GnoTestSuite) TestCheckSubstituteUpdateStateBasic() {
var (
substituteClientState exported.ClientState
substitutePath *ibctesting.Path
@@ -28,7 +28,7 @@
{
"non-matching substitute", func() {
substitutePath.SetupClients()
- substituteClientState, ok := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState)
+ substituteClientState, ok := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
// change trusting period so that test should fail
substituteClientState.TrustingPeriod = time.Hour * 24 * 7
@@ -46,7 +46,7 @@
substitutePath = ibctesting.NewPath(suite.chainA, suite.chainB)
subjectPath.SetupClients()
- subjectClientState, ok := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibctm.ClientState)
+ subjectClientState, ok := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
// expire subject client
@@ -64,7 +64,7 @@
}
}
-func (suite *TendermintTestSuite) TestCheckSubstituteAndUpdateState() {
+func (suite *GnoTestSuite) TestCheckSubstituteAndUpdateState() {
testCases := []struct {
name string
FreezeClient bool
@@ -89,7 +89,7 @@
// construct subject using test case parameters
subjectPath := ibctesting.NewPath(suite.chainA, suite.chainB)
subjectPath.SetupClients()
- subjectClientState, ok := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibctm.ClientState)
+ subjectClientState, ok := suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
if tc.FreezeClient {
@@ -100,7 +100,7 @@
substitutePath := ibctesting.NewPath(suite.chainA, suite.chainB)
substitutePath.SetupClients()
- substituteClientState, ok := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState)
+ substituteClientState, ok := suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
// update trusting period of substitute client state
substituteClientState.TrustingPeriod = time.Hour * 24 * 7
@@ -115,7 +115,7 @@
}
// get updated substitute
- substituteClientState, ok = suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState)
+ substituteClientState, ok = suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
// test that subject gets updated chain-id
@@ -126,18 +126,18 @@
substituteClientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), substitutePath.EndpointA.ClientID)
expectedConsState := substitutePath.EndpointA.GetConsensusState(substituteClientState.LatestHeight)
- expectedProcessedTime, found := ibctm.GetProcessedTime(substituteClientStore, substituteClientState.LatestHeight)
+ expectedProcessedTime, found := ibcgno.GetProcessedTime(substituteClientStore, substituteClientState.LatestHeight)
suite.Require().True(found)
- expectedProcessedHeight, found := ibctm.GetProcessedTime(substituteClientStore, substituteClientState.LatestHeight)
+ expectedProcessedHeight, found := ibcgno.GetProcessedTime(substituteClientStore, substituteClientState.LatestHeight)
suite.Require().True(found)
- expectedIterationKey := ibctm.GetIterationKey(substituteClientStore, substituteClientState.LatestHeight)
+ expectedIterationKey := ibcgno.GetIterationKey(substituteClientStore, substituteClientState.LatestHeight)
err := subjectClientState.CheckSubstituteAndUpdateState(suite.chainA.GetContext(), suite.chainA.App.AppCodec(), subjectClientStore, substituteClientStore, substituteClientState)
if tc.expError == nil {
suite.Require().NoError(err)
- updatedClient, ok := subjectPath.EndpointA.GetClientState().(*ibctm.ClientState)
+ updatedClient, ok := subjectPath.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().Equal(clienttypes.ZeroHeight(), updatedClient.FrozenHeight)
@@ -146,11 +146,11 @@
// check that the correct consensus state was copied over
suite.Require().Equal(substituteClientState.LatestHeight, updatedClient.LatestHeight)
subjectConsState := subjectPath.EndpointA.GetConsensusState(updatedClient.LatestHeight)
- subjectProcessedTime, found := ibctm.GetProcessedTime(subjectClientStore, updatedClient.LatestHeight)
+ subjectProcessedTime, found := ibcgno.GetProcessedTime(subjectClientStore, updatedClient.LatestHeight)
suite.Require().True(found)
- subjectProcessedHeight, found := ibctm.GetProcessedTime(substituteClientStore, updatedClient.LatestHeight)
+ subjectProcessedHeight, found := ibcgno.GetProcessedTime(substituteClientStore, updatedClient.LatestHeight)
suite.Require().True(found)
- subjectIterationKey := ibctm.GetIterationKey(substituteClientStore, updatedClient.LatestHeight)
+ subjectIterationKey := ibcgno.GetIterationKey(substituteClientStore, updatedClient.LatestHeight)
suite.Require().Equal(expectedConsState, subjectConsState)
suite.Require().Equal(expectedProcessedTime, subjectProcessedTime)
@@ -167,10 +167,10 @@
}
}
-func (suite *TendermintTestSuite) TestIsMatchingClientState() {
+func (suite *GnoTestSuite) TestIsMatchingClientState() {
var (
subjectPath, substitutePath *ibctesting.Path
- subjectClientState, substituteClientState *ibctm.ClientState
+ subjectClientState, substituteClientState *ibcgno.ClientState
)
testCases := []struct {
@@ -181,9 +181,9 @@
{
"matching clients", func() {
var ok bool
- subjectClientState, ok = suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibctm.ClientState)
+ subjectClientState, ok = suite.chainA.GetClientState(subjectPath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
- substituteClientState, ok = suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibctm.ClientState)
+ substituteClientState, ok = suite.chainA.GetClientState(substitutePath.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
}, true,
},
@@ -213,8 +213,8 @@
},
{
"not matching, trust level is different", func() {
- subjectClientState.TrustLevel = ibctm.Fraction{2, 3}
- substituteClientState.TrustLevel = ibctm.Fraction{1, 3}
+ subjectClientState.TrustLevel = ibcgno.Fraction{2, 3}
+ substituteClientState.TrustLevel = ibcgno.Fraction{1, 3}
}, false,
},
}
@@ -230,7 +230,7 @@
tc.malleate()
- suite.Require().Equal(tc.isMatch, ibctm.IsMatchingClientState(*subjectClientState, *substituteClientState))
+ suite.Require().Equal(tc.isMatch, ibcgno.IsMatchingClientState(*subjectClientState, *substituteClientState))
})
}
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/store.go 10-gno/store.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/store.go 2025-12-08 12:36:25.319216672 +0100
+++ 10-gno/store.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,19 +1,19 @@
-package tendermint
+package gno
import (
"bytes"
"encoding/binary"
"fmt"
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
/*
@@ -105,7 +105,7 @@
}
// SetProcessedTime stores the time at which a header was processed and the corresponding consensus state was created.
-// This is useful when validating whether a packet has reached the time specified delay period in the tendermint client's
+// This is useful when validating whether a packet has reached the time specified delay period in the gno client's
// verification functions
func SetProcessedTime(clientStore storetypes.KVStore, height exported.Height, timeNs uint64) {
key := ProcessedTimeKey(height)
@@ -113,7 +113,7 @@
clientStore.Set(key, val)
}
-// GetProcessedTime gets the time (in nanoseconds) at which this chain received and processed a tendermint header.
+// GetProcessedTime gets the time (in nanoseconds) at which this chain received and processed a gno header.
// This is used to validate that a received packet has passed the time delay period.
func GetProcessedTime(clientStore storetypes.KVStore, height exported.Height) (uint64, bool) {
key := ProcessedTimeKey(height)
@@ -136,7 +136,7 @@
}
// SetProcessedHeight stores the height at which a header was processed and the corresponding consensus state was created.
-// This is useful when validating whether a packet has reached the specified block delay period in the tendermint client's
+// This is useful when validating whether a packet has reached the specified block delay period in the gno client's
// verification functions
func SetProcessedHeight(clientStore storetypes.KVStore, consHeight, processedHeight exported.Height) {
key := ProcessedHeightKey(consHeight)
@@ -144,7 +144,7 @@
clientStore.Set(key, val)
}
-// GetProcessedHeight gets the height at which this chain received and processed a tendermint header.
+// GetProcessedHeight gets the height at which this chain received and processed a gno header.
// This is used to validate that a received packet has passed the block delay period.
func GetProcessedHeight(clientStore storetypes.KVStore, height exported.Height) (exported.Height, bool) {
key := ProcessedHeightKey(height)
@@ -318,7 +318,7 @@
}
// setConsensusMetadata sets context time as processed time and set context height as processed height
-// as this is internal tendermint light client logic.
+// as this is internal gno light client logic.
// client state and consensus state will be set by client keeper
// set iteration key to provide ability for efficient ordered iteration of consensus states.
func setConsensusMetadata(ctx sdk.Context, clientStore storetypes.KVStore, height exported.Height) {
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/store_test.go 10-gno/store_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/store_test.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/store_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,19 +1,19 @@
-package tendermint_test
+package gno_test
import (
"math"
"time"
+ gno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
solomachine "github.com/cosmos/ibc-go/v10/modules/light-clients/06-solomachine"
- tendermint "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
-func (suite *TendermintTestSuite) TestGetConsensusState() {
+func (suite *GnoTestSuite) TestGetConsensusState() {
var (
height exported.Height
path *ibctesting.Path
@@ -38,7 +38,7 @@
"not a consensus state interface", func() {
// marshal an empty client state and set as consensus state
store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
- clientStateBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), &tendermint.ClientState{})
+ clientStateBz := clienttypes.MustMarshalClientState(suite.chainA.App.AppCodec(), &gno.ClientState{})
store.Set(host.ConsensusStateKey(height), clientStateBz)
}, false, true,
},
@@ -66,14 +66,14 @@
if tc.expPanic {
suite.Require().Panics(func() {
store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
- tendermint.GetConsensusState(store, suite.chainA.Codec, height)
+ gno.GetConsensusState(store, suite.chainA.Codec, height)
})
return
}
store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
- consensusState, found := tendermint.GetConsensusState(store, suite.chainA.Codec, height)
+ consensusState, found := gno.GetConsensusState(store, suite.chainA.Codec, height)
if tc.expPass {
suite.Require().True(found)
@@ -89,7 +89,7 @@
}
}
-func (suite *TendermintTestSuite) TestGetProcessedTime() {
+func (suite *GnoTestSuite) TestGetProcessedTime() {
path := ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.UpdateTime()
@@ -102,7 +102,7 @@
height := path.EndpointA.GetClientLatestHeight()
store := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
- actualTime, ok := tendermint.GetProcessedTime(store, height)
+ actualTime, ok := gno.GetProcessedTime(store, height)
suite.Require().True(ok, "could not retrieve processed time for stored consensus state")
suite.Require().Equal(uint64(expectedTime.UnixNano()), actualTime, "retrieved processed time is not expected value")
@@ -117,16 +117,16 @@
height = path.EndpointA.GetClientLatestHeight()
store = suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
- actualTime, ok = tendermint.GetProcessedTime(store, height)
+ actualTime, ok = gno.GetProcessedTime(store, height)
suite.Require().True(ok, "could not retrieve processed time for stored consensus state")
suite.Require().Equal(uint64(expectedTime.UnixNano()), actualTime, "retrieved processed time is not expected value")
// try to get processed time for height that doesn't exist in store
- _, ok = tendermint.GetProcessedTime(store, clienttypes.NewHeight(1, 1))
+ _, ok = gno.GetProcessedTime(store, clienttypes.NewHeight(1, 1))
suite.Require().False(ok, "retrieved processed time for a non-existent consensus state")
}
-func (suite *TendermintTestSuite) TestIterationKey() {
+func (suite *GnoTestSuite) TestIterationKey() {
testHeights := []exported.Height{
clienttypes.NewHeight(0, 1),
clienttypes.NewHeight(0, 1234),
@@ -134,26 +134,26 @@
clienttypes.NewHeight(math.MaxUint64, math.MaxUint64),
}
for _, h := range testHeights {
- k := tendermint.IterationKey(h)
- retrievedHeight := tendermint.GetHeightFromIterationKey(k)
+ k := gno.IterationKey(h)
+ retrievedHeight := gno.GetHeightFromIterationKey(k)
suite.Require().Equal(h, retrievedHeight, "retrieving height from iteration key failed")
}
}
-func (suite *TendermintTestSuite) TestIterateConsensusStates() {
+func (suite *GnoTestSuite) TestIterateConsensusStates() {
nextValsHash := []byte("nextVals")
// Set iteration keys and consensus states
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 1))
- suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 1), tendermint.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-1")), nextValsHash))
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(4, 9))
- suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(4, 9), tendermint.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash4-9")), nextValsHash))
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 10))
- suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 10), tendermint.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-10")), nextValsHash))
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 4))
- suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 4), tendermint.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-4")), nextValsHash))
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(40, 1))
- suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(40, 1), tendermint.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash40-1")), nextValsHash))
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 1))
+ suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 1), gno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-1")), nextValsHash))
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(4, 9))
+ suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(4, 9), gno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash4-9")), nextValsHash))
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 10))
+ suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 10), gno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-10")), nextValsHash))
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(0, 4))
+ suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(0, 4), gno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash0-4")), nextValsHash))
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), clienttypes.NewHeight(40, 1))
+ suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", clienttypes.NewHeight(40, 1), gno.NewConsensusState(time.Now(), commitmenttypes.NewMerkleRoot([]byte("hash40-1")), nextValsHash))
var testArr []string
cb := func(height exported.Height) bool {
@@ -161,39 +161,39 @@
return false
}
- tendermint.IterateConsensusStateAscending(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), cb)
+ gno.IterateConsensusStateAscending(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), cb)
expectedArr := []string{"0-1", "0-4", "0-10", "4-9", "40-1"}
suite.Require().Equal(expectedArr, testArr)
}
-func (suite *TendermintTestSuite) TestGetNeighboringConsensusStates() {
+func (suite *GnoTestSuite) TestGetNeighboringConsensusStates() {
nextValsHash := []byte("nextVals")
- cs01 := tendermint.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash0-1")), nextValsHash)
- cs04 := tendermint.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash0-4")), nextValsHash)
- cs49 := tendermint.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash4-9")), nextValsHash)
+ cs01 := gno.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash0-1")), nextValsHash)
+ cs04 := gno.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash0-4")), nextValsHash)
+ cs49 := gno.NewConsensusState(time.Now().UTC(), commitmenttypes.NewMerkleRoot([]byte("hash4-9")), nextValsHash)
height01 := clienttypes.NewHeight(0, 1)
height04 := clienttypes.NewHeight(0, 4)
height49 := clienttypes.NewHeight(4, 9)
// Set iteration keys and consensus states
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height01)
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height01)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", height01, cs01)
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height04)
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height04)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", height04, cs04)
- tendermint.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height49)
+ gno.SetIterationKey(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), height49)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), "testClient", height49, cs49)
- prevCs01, ok := tendermint.GetPreviousConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height01)
+ prevCs01, ok := gno.GetPreviousConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height01)
suite.Require().Nil(prevCs01, "consensus state exists before lowest consensus state")
suite.Require().False(ok)
- prevCs49, ok := tendermint.GetPreviousConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height49)
+ prevCs49, ok := gno.GetPreviousConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height49)
suite.Require().Equal(cs04, prevCs49, "previous consensus state is not returned correctly")
suite.Require().True(ok)
- nextCs01, ok := tendermint.GetNextConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height01)
+ nextCs01, ok := gno.GetNextConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height01)
suite.Require().Equal(cs04, nextCs01, "next consensus state not returned correctly")
suite.Require().True(ok)
- nextCs49, ok := tendermint.GetNextConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height49)
+ nextCs49, ok := gno.GetNextConsensusState(suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), "testClient"), suite.chainA.Codec, height49)
suite.Require().Nil(nextCs49, "next consensus state exists after highest consensus state")
suite.Require().False(ok)
}
Only in /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/: tendermint.pb.go
Only in /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/: tendermint_test.go
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/update.go 10-gno/update.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/update.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/update.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,22 +1,24 @@
-package tendermint
+package gno
import (
"bytes"
+ "errors"
"fmt"
- errorsmod "cosmossdk.io/errors"
- storetypes "cosmossdk.io/store/types"
-
- "github.com/cosmos/cosmos-sdk/codec"
- sdk "github.com/cosmos/cosmos-sdk/types"
-
- "github.com/cometbft/cometbft/light"
- cmttypes "github.com/cometbft/cometbft/types"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
+ "github.com/gnolang/gno/tm2/pkg/crypto"
+ "github.com/gnolang/gno/tm2/pkg/crypto/ed25519"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
+
+ errorsmod "cosmossdk.io/errors"
+ storetypes "cosmossdk.io/store/types"
+
+ "github.com/cosmos/cosmos-sdk/codec"
+ sdk "github.com/cosmos/cosmos-sdk/types"
)
// VerifyClientMessage checks if the clientMessage is of type Header or Misbehaviour and verifies the message
@@ -35,7 +37,7 @@
}
// verifyHeader returns an error if:
-// - the client or header provided are not parseable to tendermint types
+// - the client or header provided are not parseable to gno types
// - the header is invalid
// - header height is less than or equal to the trusted header height
// - header revision is not equal to trusted header revision
@@ -47,13 +49,16 @@
header *Header,
) error {
currentTimestamp := ctx.BlockTime()
-
+ fmt.Println(currentTimestamp)
// Retrieve trusted consensus states for each Header in misbehaviour
consState, found := GetConsensusState(clientStore, cdc, header.TrustedHeight)
+ fmt.Println(consState.LcType)
+ fmt.Println(consState.Root)
+ fmt.Println(header.TrustedHeight)
if !found {
return errorsmod.Wrapf(clienttypes.ErrConsensusStateNotFound, "could not get trusted consensus state from clientStore for Header at TrustedHeight: %s", header.TrustedHeight)
}
-
+ fmt.Println(consState.NextValidatorsHash)
if err := checkTrustedHeader(header, consState); err != nil {
return err
}
@@ -68,19 +73,102 @@
)
}
- tmTrustedValidators, err := cmttypes.ValidatorSetFromProto(header.TrustedValidators)
- if err != nil {
- return errorsmod.Wrap(err, "trusted validator set in not tendermint validator set type")
+ gnoTrustedValidators := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)),
+ Proposer: nil,
+ }
+ for i, val := range header.TrustedValidators.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ gnoTrustedValidators.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoTrustedValidators.TotalVotingPower() // ensure TotalVotingPower is set
+ if gnoTrustedValidators.IsNilOrEmpty() {
+ return errorsmod.Wrap(errors.New("not gno validators"), "trusted validator set in not gno validator set type")
+ }
+ var dataHash []byte
+ var lastResultsHash []byte
+ if len(header.SignedHeader.Header.DataHash) == 0 {
+ dataHash = nil
+ } else {
+ dataHash = header.SignedHeader.Header.DataHash
+ }
+ if len(header.SignedHeader.Header.LastResultsHash) == 0 {
+ lastResultsHash = nil
+ } else {
+ lastResultsHash = header.SignedHeader.Header.LastResultsHash
+ }
+ gnoHeader := bfttypes.Header{
+ Version: header.SignedHeader.Header.Version,
+ ChainID: header.SignedHeader.Header.ChainId,
+ Height: header.SignedHeader.Header.Height,
+ Time: header.SignedHeader.Header.Time,
+ NumTxs: header.SignedHeader.Header.NumTxs,
+ TotalTxs: header.SignedHeader.Header.TotalTxs,
+ LastBlockID: bfttypes.BlockID{Hash: header.SignedHeader.Header.LastBlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Header.LastBlockId.PartsHeader.Total), Hash: header.SignedHeader.Header.LastBlockId.PartsHeader.Hash}},
+ LastCommitHash: header.SignedHeader.Header.LastCommitHash,
+ DataHash: dataHash,
+ ValidatorsHash: header.SignedHeader.Header.ValidatorsHash,
+ NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash,
+ ConsensusHash: header.SignedHeader.Header.ConsensusHash,
+ AppHash: header.SignedHeader.Header.AppHash,
+ LastResultsHash: lastResultsHash,
+ ProposerAddress: crypto.MustAddressFromString(header.SignedHeader.Header.ProposerAddress),
+ }
+ gnoCommit := bfttypes.Commit{
+ BlockID: bfttypes.BlockID{Hash: header.SignedHeader.Commit.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(header.SignedHeader.Commit.BlockId.PartsHeader.Total), Hash: header.SignedHeader.Commit.BlockId.PartsHeader.Hash}},
+ Precommits: make([]*bfttypes.CommitSig, len(header.SignedHeader.Commit.Precommits)),
+ }
+ for i, sig := range header.SignedHeader.Commit.Precommits {
+ if sig == nil {
+ continue
+ }
+ gnoCommit.Precommits[i] = &bfttypes.CommitSig{
+ ValidatorIndex: int(sig.ValidatorIndex),
+ Signature: sig.Signature,
+ BlockID: bfttypes.BlockID{Hash: sig.BlockId.Hash, PartsHeader: bfttypes.PartSetHeader{Total: int(sig.BlockId.PartsHeader.Total), Hash: sig.BlockId.PartsHeader.Hash}},
+ Type: bfttypes.SignedMsgType(sig.Type),
+ Height: sig.Height,
+ Round: int(sig.Round),
+ Timestamp: sig.Timestamp,
+ ValidatorAddress: crypto.MustAddressFromString(sig.ValidatorAddress),
+ }
+ }
+ gnoSignedHeader := bfttypes.SignedHeader{
+ Header: &gnoHeader,
+ Commit: &gnoCommit,
}
-
- tmSignedHeader, err := cmttypes.SignedHeaderFromProto(header.SignedHeader)
+ err := gnoSignedHeader.ValidateBasic(header.SignedHeader.Header.ChainId) // ensure signed header is valid
if err != nil {
- return errorsmod.Wrap(err, "signed header in not tendermint signed header type")
+ return errorsmod.Wrap(err, "signed header in not gno signed header type")
}
- tmValidatorSet, err := cmttypes.ValidatorSetFromProto(header.ValidatorSet)
- if err != nil {
- return errorsmod.Wrap(err, "validator set in not tendermint validator set type")
+ gnoValidatorSet := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(header.ValidatorSet.Validators)),
+ Proposer: nil,
+ }
+ for i, val := range header.ValidatorSet.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ gnoValidatorSet.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoValidatorSet.TotalVotingPower() // ensure TotalVotingPower is set
+ if gnoValidatorSet.IsNilOrEmpty() {
+ return errorsmod.Wrap(errors.New("not gno validators"), "trusted validator set in not gno validator set type")
}
// assert header height is newer than consensus state
@@ -94,13 +182,13 @@
// Construct a trusted header using the fields in consensus state
// Only Height, Time, and NextValidatorsHash are necessary for verification
// NOTE: updates must be within the same revision
- trustedHeader := cmttypes.Header{
+ trustedHeader := bfttypes.Header{
ChainID: cs.GetChainID(),
Height: int64(header.TrustedHeight.RevisionHeight),
Time: consState.Timestamp,
NextValidatorsHash: consState.NextValidatorsHash,
}
- signedHeader := cmttypes.SignedHeader{
+ signedHeader := bfttypes.SignedHeader{
Header: &trustedHeader,
}
@@ -109,9 +197,11 @@
// - 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(
+
+ // TODO: replace with gno light client verification
+ err = Verify(
&signedHeader,
- tmTrustedValidators, tmSignedHeader, tmValidatorSet,
+ &gnoTrustedValidators, &gnoSignedHeader, &gnoValidatorSet,
cs.TrustingPeriod, currentTimestamp, cs.MaxClockDrift, cs.TrustLevel.ToTendermint(),
)
if err != nil {
@@ -161,8 +251,8 @@
consensusState := &ConsensusState{
Timestamp: header.GetTime(),
- Root: commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()),
- NextValidatorsHash: header.Header.NextValidatorsHash,
+ Root: commitmenttypes.NewMerkleRoot(header.SignedHeader.Header.AppHash),
+ NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash,
}
// set client state, consensus state and associated metadata
@@ -216,14 +306,32 @@
// checkTrustedHeader checks that consensus state matches trusted fields of Header
func checkTrustedHeader(header *Header, consState *ConsensusState) error {
- tmTrustedValidators, err := cmttypes.ValidatorSetFromProto(header.TrustedValidators)
- if err != nil {
- return errorsmod.Wrap(err, "trusted validator set in not tendermint validator set type")
+ gnoTrustedValset := bfttypes.ValidatorSet{
+ Validators: make([]*bfttypes.Validator, len(header.TrustedValidators.Validators)),
+ Proposer: nil,
+ }
+ for i, val := range header.TrustedValidators.Validators {
+ key := val.PubKey
+ if (key.GetEd25519()) == nil {
+ return errorsmod.Wrap(clienttypes.ErrInvalidHeader, "validator pubkey is not ed25519")
+ }
+ fmt.Println(key.GetEd25519())
+ fmt.Println(val.VotingPower)
+ gnoTrustedValset.Validators[i] = &bfttypes.Validator{
+ Address: crypto.MustAddressFromString(val.Address),
+ PubKey: ed25519.PubKeyEd25519(key.GetEd25519()),
+ VotingPower: val.VotingPower,
+ ProposerPriority: val.ProposerPriority,
+ }
+ }
+ gnoTrustedValset.TotalVotingPower() // ensure TotalVotingPower is set
+ if gnoTrustedValset.IsNilOrEmpty() {
+ return errorsmod.Wrap(errors.New("empty trusted validator set"), "trusted validator set is not gno validator set type")
}
// assert that trustedVals is NextValidators of last trusted header
// to do this, we check that trustedVals.Hash() == consState.NextValidatorsHash
- tvalHash := tmTrustedValidators.Hash()
+ tvalHash := gnoTrustedValset.Hash()
if !bytes.Equal(consState.NextValidatorsHash, tvalHash) {
return errorsmod.Wrapf(
ErrInvalidValidatorSet,
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/update_test.go 10-gno/update_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/update_test.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/update_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"errors"
@@ -8,33 +8,33 @@
sdk "github.com/cosmos/cosmos-sdk/types"
- cmttypes "github.com/cometbft/cometbft/types"
+ bfttypes "github.com/gnolang/gno/tm2/pkg/bft/types"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
host "github.com/cosmos/ibc-go/v10/modules/core/24-host"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
-func (suite *TendermintTestSuite) TestVerifyHeader() {
+func (suite *GnoTestSuite) TestVerifyHeader() {
var (
path *ibctesting.Path
- header *ibctm.Header
+ header *ibcgno.Header
)
// Setup different validators and signers for testing different types of updates
- altPrivVal := cmttypes.NewMockPV()
- altPubKey, err := altPrivVal.GetPubKey()
- suite.Require().NoError(err)
+ altPrivVal := bfttypes.NewMockPV()
+ altPubKey := altPrivVal.PubKey()
+ suite.Require().NotNil(altPubKey)
revisionHeight := int64(height.RevisionHeight)
// create modified heights to use for test-cases
- altVal := cmttypes.NewValidator(altPubKey, 100)
+ altVal := bfttypes.NewValidator(altPubKey, 100)
// Create alternative validator set with only altVal, invalid update (too much change in valSet)
- altValSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{altVal})
+ altValSet := bfttypes.NewValidatorSet([]*bfttypes.Validator{altVal})
altSigners := getAltSigners(altVal, altPrivVal)
testCases := []struct {
@@ -77,7 +77,7 @@
suite.Require().True(ok)
// Create bothValSet with both suite validator and altVal
- bothValSet := cmttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
+ bothValSet := bfttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
bothSigners := suite.chainB.Signers
bothSigners[altVal.Address.String()] = altPrivVal
@@ -95,7 +95,7 @@
suite.Require().True(ok)
// Create bothValSet with both suite validator and altVal
- bothValSet := cmttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
+ bothValSet := bfttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
bothSigners := suite.chainB.Signers
bothSigners[altVal.Address.String()] = altPrivVal
@@ -110,7 +110,7 @@
suite.Require().True(ok)
// Create bothValSet with both suite validator and altVal
- bothValSet := cmttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
+ bothValSet := bfttypes.NewValidatorSet(append(suite.chainB.Vals.Validators, altVal))
bothSigners := suite.chainB.Signers
bothSigners[altVal.Address.String()] = altPrivVal
@@ -324,7 +324,7 @@
}
}
-func (suite *TendermintTestSuite) TestUpdateState() {
+func (suite *GnoTestSuite) TestUpdateState() {
var (
path *ibctesting.Path
clientMessage exported.ClientMessage
@@ -343,15 +343,15 @@
}{
{
"success with height later than latest height", func() {
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.Require().True(path.EndpointA.GetClientLatestHeight().(clienttypes.Height).LT(tmHeader.GetHeight()))
},
func() {
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().True(clientState.LatestHeight.EQ(tmHeader.GetHeight())) // new update, updated client state should have changed
suite.Require().True(clientState.LatestHeight.EQ(consensusHeights[0]))
@@ -365,14 +365,14 @@
err := path.EndpointA.UpdateClient()
suite.Require().NoError(err)
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.Require().True(path.EndpointA.GetClientLatestHeight().(clienttypes.Height).GT(tmHeader.GetHeight()))
prevClientState = path.EndpointA.GetClientState()
},
func() {
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().Equal(clientState, prevClientState) // fill in height, no change to client state
suite.Require().True(clientState.LatestHeight.GT(consensusHeights[0]))
@@ -390,7 +390,7 @@
clientMessage, err = path.EndpointA.Counterparty.Chain.IBCClientHeader(path.EndpointA.Counterparty.Chain.LatestCommittedHeader, trustedHeight)
suite.Require().NoError(err)
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.Require().Equal(path.EndpointA.GetClientLatestHeight().(clienttypes.Height), tmHeader.GetHeight())
@@ -398,12 +398,12 @@
prevConsensusState = path.EndpointA.GetConsensusState(tmHeader.GetHeight())
},
func() {
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().Equal(clientState, prevClientState)
suite.Require().True(clientState.LatestHeight.EQ(consensusHeights[0]))
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.Require().Equal(path.EndpointA.GetConsensusState(tmHeader.GetHeight()), prevConsensusState)
}, true,
@@ -438,10 +438,10 @@
suite.Require().NoError(err)
},
func() {
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().True(clientState.LatestHeight.EQ(tmHeader.GetHeight())) // new update, updated client state should have changed
suite.Require().True(clientState.LatestHeight.EQ(consensusHeights[0]))
@@ -485,10 +485,10 @@
suite.Require().NoError(err)
},
func() {
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().True(clientState.LatestHeight.EQ(tmHeader.GetHeight())) // new update, updated client state should have changed
suite.Require().True(clientState.LatestHeight.EQ(consensusHeights[0]))
@@ -500,7 +500,7 @@
},
{
"invalid ClientMessage type", func() {
- clientMessage = &ibctm.Misbehaviour{}
+ clientMessage = &ibcgno.Misbehaviour{}
},
func() {},
false,
@@ -532,13 +532,13 @@
if tc.expPass {
consensusHeights = lightClientModule.UpdateState(suite.chainA.GetContext(), path.EndpointA.ClientID, clientMessage)
- header, ok := clientMessage.(*ibctm.Header)
+ header, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- expConsensusState := &ibctm.ConsensusState{
+ expConsensusState := &ibcgno.ConsensusState{
Timestamp: header.GetTime(),
- Root: commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()),
- NextValidatorsHash: header.Header.NextValidatorsHash,
+ Root: commitmenttypes.NewMerkleRoot(header.SignedHeader.Header.AppHash),
+ NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash,
}
bz := clientStore.Get(host.ConsensusStateKey(header.GetHeight()))
@@ -561,7 +561,7 @@
}
}
-func (suite *TendermintTestSuite) TestUpdateStateCheckTx() {
+func (suite *GnoTestSuite) TestUpdateStateCheckTx() {
path := ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupClients()
@@ -581,7 +581,7 @@
}
ctx := path.EndpointA.Chain.GetContext()
clientStore := path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID)
- ibctm.IterateConsensusStateAscending(clientStore, getFirstHeightCb)
+ ibcgno.IterateConsensusStateAscending(clientStore, getFirstHeightCb)
// Increment the time by a week
suite.coordinator.IncrementTimeBy(7 * 24 * time.Hour)
@@ -603,13 +603,13 @@
consState, ok := path.EndpointA.Chain.GetConsensusState(path.EndpointA.ClientID, pruneHeight)
suite.Require().Equal(!pruned, ok)
- processTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight)
+ processTime, ok := ibcgno.GetProcessedTime(clientStore, pruneHeight)
suite.Require().Equal(!pruned, ok)
- processHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight)
+ processHeight, ok := ibcgno.GetProcessedHeight(clientStore, pruneHeight)
suite.Require().Equal(!pruned, ok)
- consKey := ibctm.GetIterationKey(clientStore, pruneHeight)
+ consKey := ibcgno.GetIterationKey(clientStore, pruneHeight)
if pruned {
suite.Require().Nil(consState, "expired consensus state not pruned")
@@ -633,7 +633,7 @@
assertPrune(true)
}
-func (suite *TendermintTestSuite) TestPruneConsensusState() {
+func (suite *GnoTestSuite) TestPruneConsensusState() {
// create path and setup clients
path := ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupClients()
@@ -646,7 +646,7 @@
}
ctx := path.EndpointA.Chain.GetContext()
clientStore := path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID)
- ibctm.IterateConsensusStateAscending(clientStore, getFirstHeightCb)
+ ibcgno.IterateConsensusStateAscending(clientStore, getFirstHeightCb)
// this height will be expired but not pruned
err := path.EndpointA.UpdateClient()
@@ -659,11 +659,11 @@
suite.Require().True(ok)
ctx = path.EndpointA.Chain.GetContext()
clientStore = path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper.ClientStore(ctx, path.EndpointA.ClientID)
- expectedProcessTime, ok := ibctm.GetProcessedTime(clientStore, expiredHeight)
+ expectedProcessTime, ok := ibcgno.GetProcessedTime(clientStore, expiredHeight)
suite.Require().True(ok)
- expectedProcessHeight, ok := ibctm.GetProcessedHeight(clientStore, expiredHeight)
+ expectedProcessHeight, ok := ibcgno.GetProcessedHeight(clientStore, expiredHeight)
suite.Require().True(ok)
- expectedConsKey := ibctm.GetIterationKey(clientStore, expiredHeight)
+ expectedConsKey := ibcgno.GetIterationKey(clientStore, expiredHeight)
suite.Require().NotNil(expectedConsKey)
// Increment the time by a week
@@ -687,15 +687,15 @@
suite.Require().Nil(consState, "expired consensus state not pruned")
suite.Require().False(ok)
// check processed time metadata is pruned
- processTime, ok := ibctm.GetProcessedTime(clientStore, pruneHeight)
+ processTime, ok := ibcgno.GetProcessedTime(clientStore, pruneHeight)
suite.Require().Equal(uint64(0), processTime, "processed time metadata not pruned")
suite.Require().False(ok)
- processHeight, ok := ibctm.GetProcessedHeight(clientStore, pruneHeight)
+ processHeight, ok := ibcgno.GetProcessedHeight(clientStore, pruneHeight)
suite.Require().Nil(processHeight, "processed height metadata not pruned")
suite.Require().False(ok)
// check iteration key metadata is pruned
- consKey := ibctm.GetIterationKey(clientStore, pruneHeight)
+ consKey := ibcgno.GetIterationKey(clientStore, pruneHeight)
suite.Require().Nil(consKey, "iteration key not pruned")
// check that second expired consensus state doesn't get deleted
@@ -704,21 +704,21 @@
suite.Require().Equal(expectedConsState, consState, "consensus state incorrectly pruned")
suite.Require().True(ok)
// check processed time metadata is not pruned
- processTime, ok = ibctm.GetProcessedTime(clientStore, expiredHeight)
+ processTime, ok = ibcgno.GetProcessedTime(clientStore, expiredHeight)
suite.Require().Equal(expectedProcessTime, processTime, "processed time metadata incorrectly pruned")
suite.Require().True(ok)
// check processed height metadata is not pruned
- processHeight, ok = ibctm.GetProcessedHeight(clientStore, expiredHeight)
+ processHeight, ok = ibcgno.GetProcessedHeight(clientStore, expiredHeight)
suite.Require().Equal(expectedProcessHeight, processHeight, "processed height metadata incorrectly pruned")
suite.Require().True(ok)
// check iteration key metadata is not pruned
- consKey = ibctm.GetIterationKey(clientStore, expiredHeight)
+ consKey = ibcgno.GetIterationKey(clientStore, expiredHeight)
suite.Require().Equal(expectedConsKey, consKey, "iteration key incorrectly pruned")
}
-func (suite *TendermintTestSuite) TestCheckForMisbehaviour() {
+func (suite *GnoTestSuite) TestCheckForMisbehaviour() {
var (
path *ibctesting.Path
clientMessage exported.ClientMessage
@@ -737,16 +737,16 @@
{
"consensus state already exists, already updated",
func() {
- header, ok := clientMessage.(*ibctm.Header)
+ header, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- consensusState := &ibctm.ConsensusState{
+ consensusState := &ibcgno.ConsensusState{
Timestamp: header.GetTime(),
- Root: commitmenttypes.NewMerkleRoot(header.Header.GetAppHash()),
- NextValidatorsHash: header.Header.NextValidatorsHash,
+ Root: commitmenttypes.NewMerkleRoot(header.SignedHeader.Header.AppHash),
+ NextValidatorsHash: header.SignedHeader.Header.NextValidatorsHash,
}
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), path.EndpointA.ClientID, tmHeader.GetHeight(), consensusState)
},
@@ -767,7 +767,7 @@
suite.Require().True(ok)
misbehaviourHeader := suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, int64(height.RevisionHeight), trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers)
- clientMessage = &ibctm.Misbehaviour{
+ clientMessage = &ibcgno.Misbehaviour{
Header1: misbehaviourHeader,
Header2: misbehaviourHeader,
}
@@ -781,7 +781,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight+1]
suite.Require().True(ok)
- clientMessage = &ibctm.Misbehaviour{
+ clientMessage = &ibcgno.Misbehaviour{
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -790,16 +790,16 @@
{
"consensus state already exists, app hash mismatch",
func() {
- header, ok := clientMessage.(*ibctm.Header)
+ header, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
- consensusState := &ibctm.ConsensusState{
+ consensusState := &ibcgno.ConsensusState{
Timestamp: header.GetTime(),
Root: commitmenttypes.NewMerkleRoot([]byte{}), // empty bytes
NextValidatorsHash: header.Header.NextValidatorsHash,
}
- tmHeader, ok := clientMessage.(*ibctm.Header)
+ tmHeader, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.chainA.GetContext(), path.EndpointA.ClientID, tmHeader.GetHeight(), consensusState)
},
@@ -808,7 +808,7 @@
{
"previous consensus state exists and header time is before previous consensus state time",
func() {
- header, ok := clientMessage.(*ibctm.Header)
+ header, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
// offset header timestamp before previous consensus state timestamp
@@ -819,7 +819,7 @@
{
"next consensus state exists and header time is after next consensus state time",
func() {
- header, ok := clientMessage.(*ibctm.Header)
+ header, ok := clientMessage.(*ibcgno.Header)
suite.Require().True(ok)
// commit block and update client, adding a new consensus state
@@ -853,7 +853,7 @@
// assign the same height, each header will have a different commit hash
header1.Header.Height = header2.Header.Height
- clientMessage = &ibctm.Misbehaviour{
+ clientMessage = &ibcgno.Misbehaviour{
Header1: header1,
Header2: header2,
ClientId: path.EndpointA.ClientID,
@@ -869,7 +869,7 @@
trustedVals, ok := suite.chainB.TrustedValidators[trustedHeight.RevisionHeight+1]
suite.Require().True(ok)
- clientMessage = &ibctm.Misbehaviour{
+ clientMessage = &ibcgno.Misbehaviour{
Header2: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height+3, trustedHeight, suite.chainB.ProposedHeader.Time.Add(time.Minute), suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
Header1: suite.chainB.CreateTMClientHeader(suite.chainB.ChainID, suite.chainB.ProposedHeader.Height, trustedHeight, suite.chainB.ProposedHeader.Time, suite.chainB.Vals, suite.chainB.NextVals, trustedVals, suite.chainB.Signers),
}
@@ -913,7 +913,7 @@
}
}
-func (suite *TendermintTestSuite) TestUpdateStateOnMisbehaviour() {
+func (suite *GnoTestSuite) TestUpdateStateOnMisbehaviour() {
var path *ibctesting.Path
testCases := []struct {
@@ -951,7 +951,7 @@
suite.Require().NotEmpty(clientStateBz)
newClientState := clienttypes.MustUnmarshalClientState(suite.chainA.Codec, clientStateBz)
- suite.Require().Equal(frozenHeight, newClientState.(*ibctm.ClientState).FrozenHeight)
+ suite.Require().Equal(frozenHeight, newClientState.(*ibcgno.ClientState).FrozenHeight)
}
})
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/upgrade.go 10-gno/upgrade.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/upgrade.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/upgrade.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,9 +1,14 @@
-package tendermint
+package gno
import (
"fmt"
"time"
+ clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
+ commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
+ commitmenttypesv2 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2"
+ "github.com/cosmos/ibc-go/v10/modules/core/exported"
+
errorsmod "cosmossdk.io/errors"
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"
@@ -11,25 +16,20 @@
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
-
- clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
- commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
- commitmenttypesv2 "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types/v2"
- "github.com/cosmos/ibc-go/v10/modules/core/exported"
)
// VerifyUpgradeAndUpdateState checks if the upgraded client has been committed by the current client
// It will zero out all client-specific fields and verify all data in client state that must
-// be the same across all valid Tendermint clients for the new chain.
+// be the same across all valid gno clients for the new chain.
// Note, if there is a decrease in the UnbondingPeriod, then the TrustingPeriod, despite being a client-specific field
// is scaled down by the same ratio.
// VerifyUpgrade will return an error if:
-// - the upgradedClient is not a Tendermint ClientState
+// - the upgradedClient is not a gno ClientState
// - the latest height of the client state does not have the same revision number or has a greater
// height than the committed client.
// - the height of upgraded client is not greater than that of current client
// - the latest height of the new client does not match or is greater than the height in committed client
-// - any Tendermint chain specified parameter in upgraded client such as ChainID, UnbondingPeriod,
+// - any gno chain specified parameter in upgraded client such as ChainID, UnbondingPeriod,
// and ProofSpecs do not match parameters set by committed client
func (cs ClientState) VerifyUpgradeAndUpdateState(
ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore,
@@ -40,18 +40,18 @@
return errorsmod.Wrap(clienttypes.ErrInvalidUpgradeClient, "cannot upgrade client, no upgrade path set")
}
- // upgraded client state and consensus state must be IBC tendermint client state and consensus state
- // this may be modified in the future to upgrade to a new IBC tendermint type
+ // upgraded client state and consensus state must be IBC gno client state and consensus state
+ // this may be modified in the future to upgrade to a new IBC gno type
// counterparty must also commit to the upgraded consensus state at a sub-path under the upgrade path specified
tmUpgradeClient, ok := upgradedClient.(*ClientState)
if !ok {
- return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be Tendermint client. expected: %T got: %T",
+ return errorsmod.Wrapf(clienttypes.ErrInvalidClientType, "upgraded client must be gno client. expected: %T got: %T",
&ClientState{}, upgradedClient)
}
tmUpgradeConsState, ok := upgradedConsState.(*ConsensusState)
if !ok {
- return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "upgraded consensus state must be Tendermint consensus state. expected %T, got: %T",
+ return errorsmod.Wrapf(clienttypes.ErrInvalidConsensus, "upgraded consensus state must be gno consensus state. expected %T, got: %T",
&ConsensusState{}, upgradedConsState)
}
diff -bur /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/upgrade_test.go 10-gno/upgrade_test.go
--- /home/julien/downloads/ibc-go/modules/light-clients/07-tendermint/upgrade_test.go 2025-12-08 12:37:51.566995241 +0100
+++ 10-gno/upgrade_test.go 2025-12-08 12:35:52.099698457 +0100
@@ -1,4 +1,4 @@
-package tendermint_test
+package gno_test
import (
"errors"
@@ -7,15 +7,15 @@
sdkmath "cosmossdk.io/math"
upgradetypes "cosmossdk.io/x/upgrade/types"
+ ibcgno "github.com/atomone-hub/atomone/modules/10-gno"
clienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v10/modules/core/23-commitment/types"
"github.com/cosmos/ibc-go/v10/modules/core/exported"
solomachine "github.com/cosmos/ibc-go/v10/modules/light-clients/06-solomachine"
- ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v10/testing"
)
-func (suite *TendermintTestSuite) TestVerifyUpgrade() {
+func (suite *GnoTestSuite) TestVerifyUpgrade() {
var (
newChainID string
upgradedClient exported.ClientState
@@ -49,7 +49,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -60,8 +60,8 @@
{
name: "successful upgrade to same revision",
setup: func() {
- upgradedClient = ibctm.NewClientState(suite.chainB.ChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), upgradedClient.(*ibctm.ClientState).LatestHeight.GetRevisionHeight()+10), commitmenttypes.GetSDKSpecs(), upgradePath)
- upgradedClient = upgradedClient.(*ibctm.ClientState).ZeroCustomFields()
+ upgradedClient = ibcgno.NewClientState(suite.chainB.ChainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), upgradedClient.(*ibcgno.ClientState).LatestHeight.GetRevisionHeight()+10), commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = upgradedClient.(*ibcgno.ClientState).ZeroCustomFields()
upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)
suite.Require().NoError(err)
@@ -80,7 +80,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -92,8 +92,8 @@
name: "successful upgrade with new unbonding period",
setup: func() {
newUnbondingPeriod := time.Hour * 24 * 7 * 2
- upgradedClient = ibctm.NewClientState(suite.chainB.ChainID, ibctm.DefaultTrustLevel, trustingPeriod, newUnbondingPeriod, maxClockDrift, clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), upgradedClient.(*ibctm.ClientState).LatestHeight.GetRevisionHeight()+10), commitmenttypes.GetSDKSpecs(), upgradePath)
- upgradedClient = upgradedClient.(*ibctm.ClientState).ZeroCustomFields()
+ upgradedClient = ibcgno.NewClientState(suite.chainB.ChainID, ibcgno.DefaultTrustLevel, trustingPeriod, newUnbondingPeriod, maxClockDrift, clienttypes.NewHeight(clienttypes.ParseChainID(suite.chainB.ChainID), upgradedClient.(*ibcgno.ClientState).LatestHeight.GetRevisionHeight()+10), commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = upgradedClient.(*ibcgno.ClientState).ZeroCustomFields()
upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)
suite.Require().NoError(err)
@@ -112,7 +112,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -129,7 +129,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
// set upgrade path to empty
@@ -152,7 +152,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -178,7 +178,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -190,7 +190,7 @@
name: "unsuccessful upgrade: committed client does not have zeroed custom fields",
setup: func() {
// non-zeroed upgrade client
- upgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = ibcgno.NewClientState(newChainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)
suite.Require().NoError(err)
@@ -209,7 +209,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -230,7 +230,7 @@
suite.Require().NoError(err)
// change upgradedClient client-specified parameters
- upgradedClient = ibctm.NewClientState("wrongchainID", ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = ibcgno.NewClientState("wrongchainID", ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
suite.coordinator.CommitBlock(suite.chainB)
err = path.EndpointA.UpdateClient()
@@ -238,7 +238,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -259,7 +259,7 @@
suite.Require().NoError(err)
// change upgradedClient client-specified parameters
- upgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, lastHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = ibcgno.NewClientState(newChainID, ibcgno.DefaultTrustLevel, ubdPeriod, ubdPeriod+trustingPeriod, maxClockDrift+5, lastHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
suite.coordinator.CommitBlock(suite.chainB)
err = path.EndpointA.UpdateClient()
@@ -267,7 +267,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -286,7 +286,7 @@
name: "unsuccessful upgrade: relayer-submitted consensus state does not match counterparty-committed consensus state",
setup: func() {
// change submitted upgradedConsensusState
- upgradedConsState = &ibctm.ConsensusState{
+ upgradedConsState = &ibcgno.ConsensusState{
NextValidatorsHash: []byte("maliciousValidators"),
}
@@ -297,7 +297,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -310,7 +310,7 @@
setup: func() {
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -324,7 +324,7 @@
setup: func() {
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -345,7 +345,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -365,7 +365,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -389,14 +389,14 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
upgradedConsensusStateProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
// SetClientState with empty string upgrade path
- tmClient, ok := cs.(*ibctm.ClientState)
+ tmClient, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
tmClient.UpgradePath = []string{""}
suite.chainA.App.GetIBCKeeper().ClientKeeper.SetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID, tmClient)
@@ -419,7 +419,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -443,7 +443,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -467,7 +467,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -491,7 +491,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -503,7 +503,7 @@
name: "unsuccessful upgrade: final client is not valid",
setup: func() {
// new client has smaller unbonding period such that old trusting period is no longer valid
- upgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = ibcgno.NewClientState(newChainID, ibcgno.DefaultTrustLevel, trustingPeriod, trustingPeriod, maxClockDrift, newClientHeight, commitmenttypes.GetSDKSpecs(), upgradePath)
upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)
suite.Require().NoError(err)
@@ -521,7 +521,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
upgradedClientProof, _ = suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(lastHeight.GetRevisionHeight())), tmCs.LatestHeight.GetRevisionHeight())
@@ -547,7 +547,7 @@
cs, found := suite.chainA.App.GetIBCKeeper().ClientKeeper.GetClientState(suite.chainA.GetContext(), path.EndpointA.ClientID)
suite.Require().True(found)
- tmCs, ok := cs.(*ibctm.ClientState)
+ tmCs, ok := cs.(*ibcgno.ClientState)
suite.Require().True(ok)
revisionHeight := tmCs.LatestHeight.GetRevisionHeight()
@@ -571,7 +571,7 @@
path.SetupClients()
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
revisionNumber := clienttypes.ParseChainID(clientState.ChainId)
@@ -579,16 +579,16 @@
newChainID, err = clienttypes.SetRevisionNumber(clientState.ChainId, revisionNumber+1)
suite.Require().NoError(err)
- upgradedClient = ibctm.NewClientState(newChainID, ibctm.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(revisionNumber+1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradedClient = ibcgno.NewClientState(newChainID, ibcgno.DefaultTrustLevel, trustingPeriod, ubdPeriod+trustingPeriod, maxClockDrift, clienttypes.NewHeight(revisionNumber+1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
- if upgraded, ok := upgradedClient.(*ibctm.ClientState); ok {
+ if upgraded, ok := upgradedClient.(*ibcgno.ClientState); ok {
upgradedClient = upgraded.ZeroCustomFields()
}
upgradedClientBz, err = clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradedClient)
suite.Require().NoError(err)
- upgradedConsState = &ibctm.ConsensusState{
+ upgradedConsState = &ibcgno.ConsensusState{
NextValidatorsHash: []byte("nextValsHash"),
}
upgradedConsStateBz, err = clienttypes.MarshalConsensusState(suite.chainA.App.AppCodec(), upgradedConsState)
@@ -596,12 +596,12 @@
tc.setup()
- cs, ok := suite.chainA.GetClientState(path.EndpointA.ClientID).(*ibctm.ClientState)
+ cs, ok := suite.chainA.GetClientState(path.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
// Call ZeroCustomFields on upgraded clients to clear any client-chosen parameters in test-case upgradedClient
- if upgraded, ok := upgradedClient.(*ibctm.ClientState); ok {
+ if upgraded, ok := upgradedClient.(*ibcgno.ClientState); ok {
upgradedClient = upgraded.ZeroCustomFields()
}
@@ -618,7 +618,7 @@
if tc.expErr == nil {
suite.Require().NoError(err, "verify upgrade failed on valid case: %s", tc.name)
- clientState, ok := suite.chainA.GetClientState(path.EndpointA.ClientID).(*ibctm.ClientState)
+ clientState, ok := suite.chainA.GetClientState(path.EndpointA.ClientID).(*ibcgno.ClientState)
suite.Require().True(ok)
suite.Require().NotNil(clientState, "verify upgrade failed on valid case: %s", tc.name)
@@ -632,21 +632,21 @@
}
}
-func (suite *TendermintTestSuite) TestVerifyUpgradeWithNewUnbonding() {
+func (suite *GnoTestSuite) TestVerifyUpgradeWithNewUnbonding() {
suite.SetupTest()
path := ibctesting.NewPath(suite.chainA, suite.chainB)
path.SetupClients()
- clientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ clientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
newUnbondingPeriod := time.Hour * 24 * 7 * 2 // update the unbonding period to two weeks
- upgradeClient := ibctm.NewClientState(clientState.ChainId, ibctm.DefaultTrustLevel, trustingPeriod, newUnbondingPeriod, maxClockDrift, clienttypes.NewHeight(1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
+ upgradeClient := ibcgno.NewClientState(clientState.ChainId, ibcgno.DefaultTrustLevel, trustingPeriod, newUnbondingPeriod, maxClockDrift, clienttypes.NewHeight(1, clientState.LatestHeight.GetRevisionHeight()+1), commitmenttypes.GetSDKSpecs(), upgradePath)
upgradedClientBz, err := clienttypes.MarshalClientState(suite.chainA.App.AppCodec(), upgradeClient.ZeroCustomFields())
suite.Require().NoError(err)
- upgradedConsState := &ibctm.ConsensusState{NextValidatorsHash: []byte("nextValsHash")} // mocked consensus state
+ upgradedConsState := &ibcgno.ConsensusState{NextValidatorsHash: []byte("nextValsHash")} // mocked consensus state
upgradedConsStateBz, err := clienttypes.MarshalConsensusState(suite.chainA.App.AppCodec(), upgradedConsState)
suite.Require().NoError(err)
@@ -666,7 +666,7 @@
upgradedClientProof, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedClientKey(int64(upgradeHeight.GetRevisionHeight())), uint64(suite.chainB.LatestCommittedHeader.Header.Height))
upgradedConsensusStateProof, _ := suite.chainB.QueryUpgradeProof(upgradetypes.UpgradedConsStateKey(int64(upgradeHeight.GetRevisionHeight())), uint64(suite.chainB.LatestCommittedHeader.Header.Height))
- tmClientState, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ tmClientState, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
clientStore := suite.chainA.App.GetIBCKeeper().ClientKeeper.ClientStore(suite.chainA.GetContext(), path.EndpointA.ClientID)
@@ -681,7 +681,7 @@
)
suite.Require().NoError(err)
- upgradedClient, ok := path.EndpointA.GetClientState().(*ibctm.ClientState)
+ upgradedClient, ok := path.EndpointA.GetClientState().(*ibcgno.ClientState)
suite.Require().True(ok)
// assert the unbonding period and the trusting period have been updated correctly
Only in 10-gno/: verifier.go
|
No description provided.