Skip to content

Commit

Permalink
Tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
ulbqb committed Mar 10, 2023
1 parent eab7233 commit 7719baf
Show file tree
Hide file tree
Showing 36 changed files with 198 additions and 200 deletions.
10 changes: 5 additions & 5 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4008,7 +4008,7 @@ to preserve uniqueness of different data sign byte encodings.
<a name="ibc.lightclients.tendermint.v1.ClientState"></a>

### ClientState
ClientState from Ostracon tracks the current validator set, latest height,
ClientState from Tendermint tracks the current validator set, latest height,
and a possible frozen height.


Expand All @@ -4034,7 +4034,7 @@ and a possible frozen height.
<a name="ibc.lightclients.tendermint.v1.ConsensusState"></a>

### ConsensusState
ConsensusState defines the consensus state from Ostracon.
ConsensusState defines the consensus state from Tendermint.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -4068,9 +4068,9 @@ supports positive values.
<a name="ibc.lightclients.tendermint.v1.Header"></a>

### Header
Header defines the Ostracon client consensus Header.
Header defines the Tendermint client consensus Header.
It encapsulates all the information necessary to update from a trusted
Ostracon ConsensusState. The inclusion of TrustedHeight and
Tendermint ConsensusState. The inclusion of TrustedHeight and
TrustedValidators allows this update to process correctly, so long as the
ConsensusState for the TrustedHeight exists, this removes race conditions
among relayers The SignedHeader and ValidatorSet are the new untrusted update
Expand Down Expand Up @@ -4103,7 +4103,7 @@ that implements Misbehaviour interface expected by ICS-02

| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_id` | [string](#string) | | **Deprecated.** ClientID is deprecated |
| `client_id` | [string](#string) | | |
| `header_1` | [Header](#ibc.lightclients.tendermint.v1.Header) | | |
| `header_2` | [Header](#ibc.lightclients.tendermint.v1.Header) | | |

Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/host/types/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
// the packet acknowledgement.
func NewErrorAcknowledgement(err error) channeltypes.Acknowledgement {
// the ABCI code is included in the abcitypes.ResponseDeliverTx hash
// constructed in Ostracon and is therefore determinstic
// constructed in Tendermint and is therefore determinstic
_, code, _ := sdkerrors.ABCIInfo(err, false) // discard non-deterministic codespace and log values

errorString := fmt.Sprintf("ABCI code: %d: %s", code, ackErrorString)
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ A general pseudo algorithm would look like the following:
3. Query the client state using the identifiers pair. Note that this query will return a `"Not
Found"` response if the current chain is not connected to this channel.
4. Retrieve the the client identifier or chain identifier from the client state (eg: on
Ostracon clients) and store it locally.
Tendermint clients) and store it locally.

Using the gRPC gataway client service the steps above would be, with a given IBC token `ibc/7F1D3FCF4AE79E1554D670D1AD949A9BA4E4A3C76C63093E17E446A46061A7A2` stored on `chainB`:

Expand Down Expand Up @@ -101,7 +101,7 @@ In some [exceptional cases](https://github.com/cosmos/ibc-go/blob/main/docs/arch
To mitigate this, a client update governance proposal can be submitted to update the frozen client
with a new valid header. Once the proposal passes the client state will be unfrozen and the funds
from the associated channels will then be unlocked. This mechanism only applies to clients that
allow updates via governance, such as Ostracon clients.
allow updates via governance, such as Tendermint clients.

In addition to this, it's important to mention that a token must be sent back along the exact route
that it took originally un order to return it to its original form on the source chain (eg: the
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/types/ack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const (
// the packet acknowledgement.
func NewErrorAcknowledgement(err error) channeltypes.Acknowledgement {
// the ABCI code is included in the abcitypes.ResponseDeliverTx hash
// constructed in Ostracon and is therefore deterministic
// constructed in Tendermint and is therefore deterministic
_, code, _ := sdkerrors.ABCIInfo(err, false) // discard non-determinstic codespace and log values

errorString := fmt.Sprintf("ABCI code: %d: %s", code, ackErrorString)
Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ func GetCmdQueryHeader() *cobra.Command {
cmd := &cobra.Command{
Use: "header",
Short: "Query the latest header of the running chain",
Long: "Query the latest Ostracon header of the running chain",
Long: "Query the latest Tendermint header of the running chain",
Example: fmt.Sprintf("%s query %s %s header", version.AppName, host.ModuleName, types.SubModuleName),
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
header, _, err := utils.QueryOstraconHeader(clientCtx)
header, _, err := utils.QueryTendermintHeader(clientCtx)
if err != nil {
return err
}
Expand Down
12 changes: 6 additions & 6 deletions modules/core/02-client/client/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func QueryClientStateABCI(
) (*types.QueryClientStateResponse, error) {
key := host.FullClientStateKey(clientID)

value, proofBz, proofHeight, err := ibcclient.QueryOstraconProof(clientCtx, key)
value, proofBz, proofHeight, err := ibcclient.QueryTendermintProof(clientCtx, key)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -92,7 +92,7 @@ func QueryConsensusStateABCI(
) (*types.QueryConsensusStateResponse, error) {
key := host.FullConsensusStateKey(clientID, height)

value, proofBz, proofHeight, err := ibcclient.QueryOstraconProof(clientCtx, key)
value, proofBz, proofHeight, err := ibcclient.QueryTendermintProof(clientCtx, key)
if err != nil {
return nil, err
}
Expand All @@ -117,9 +117,9 @@ func QueryConsensusStateABCI(
return types.NewQueryConsensusStateResponse(anyConsensusState, proofBz, proofHeight), nil
}

// QueryOstraconHeader takes a client context and returns the appropriate
// ostracon header
func QueryOstraconHeader(clientCtx client.Context) (ibcoctypes.Header, int64, error) {
// QueryTendermintHeader takes a client context and returns the appropriate
// tendermint header
func QueryTendermintHeader(clientCtx client.Context) (ibcoctypes.Header, int64, error) {
node, err := clientCtx.GetNode()
if err != nil {
return ibcoctypes.Header{}, 0, err
Expand Down Expand Up @@ -165,7 +165,7 @@ func QueryOstraconHeader(clientCtx client.Context) (ibcoctypes.Header, int64, er
}

// QuerySelfConsensusState takes a client context and returns the appropriate
// ostracon consensus state
// tendermint consensus state
func QuerySelfConsensusState(clientCtx client.Context) (*ibcoctypes.ConsensusState, int64, error) {
node, err := clientCtx.GetNode()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (k Keeper) CreateClient(
k.Logger(ctx).Info("client created at height", "client-id", clientID, "height", clientState.GetLatestHeight().String())

// verifies initial consensus state against client state and initializes client store with any client-specific metadata
// e.g. set ProcessedTime in Ostracon clients
// e.g. set ProcessedTime in Tendermint clients
if err := clientState.Initialize(ctx, k.cdc, k.ClientStore(ctx, clientID), consensusState); err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (suite *KeeperTestSuite) TestCreateClient() {
}
}

func (suite *KeeperTestSuite) TestUpdateClientOstracon() {
func (suite *KeeperTestSuite) TestUpdateClientTendermint() {
var (
path *ibctesting.Path
updateHeader *ibcoctypes.Header
Expand Down Expand Up @@ -364,7 +364,7 @@ func (suite *KeeperTestSuite) TestUpgradeClient() {
expPass: false,
},
{
name: "ostracon client VerifyUpgrade fails",
name: "tendermint client VerifyUpgrade fails",
setup: func() {
// last Height is at next block
lastHeight = clienttypes.NewHeight(0, uint64(suite.chainB.GetContext().BlockHeight()+1))
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (
func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error {
tmClient, ok := clientState.(*ibcoctypes.ClientState)
if !ok {
return sdkerrors.Wrapf(types.ErrInvalidClient, "client must be a Ostracon client, expected: %T, got: %T",
return sdkerrors.Wrapf(types.ErrInvalidClient, "client must be a Tendermint client, expected: %T, got: %T",
&ibcoctypes.ClientState{}, tmClient)
}

Expand Down
6 changes: 3 additions & 3 deletions modules/core/02-client/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const (
testChainID = "gaiahub-0"
testChainIDRevision1 = "gaiahub-1"

testClientID = "ostracon-0"
testClientID2 = "ostracon-1"
testClientID3 = "ostracon-2"
testClientID = "tendermint-0"
testClientID2 = "tendermint-1"
testClientID3 = "tendermint-2"

height = 5

Expand Down
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func NewMigrator(keeper Keeper) Migrator {
// This migration
// - migrates solo machine client states from v1 to v2 protobuf definition
// - prunes solo machine consensus states
// - prunes expired ostracon consensus states
// - adds iteration and processed height keys for unexpired ostracon consensus states
// - prunes expired tendermint consensus states
// - adds iteration and processed height keys for unexpired tendermint consensus states
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v100.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
}
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (suite *KeeperTestSuite) TestClientUpdateProposal() {
}, false,
},
{
"cannot use solomachine as substitute for ostracon client", func() {
"cannot use solomachine as substitute for tendermint client", func() {
solomachine := ibctesting.NewSolomachine(suite.T(), suite.cdc, "solo machine", "", 1)
solomachine.Sequence = subjectClientState.GetLatestHeight().GetRevisionHeight() + 1
substituteClientState = solomachine.ClientState()
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/legacy/v100/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
//
// - Update solo machine client state protobuf definition (v1 to v2)
// - Remove all solo machine consensus states
// - Remove all expired ostracon consensus states
// - Adds ProcessedHeight and Iteration keys for unexpired ostracon consensus states
// - Remove all expired tendermint consensus states
// - Adds ProcessedHeight and Iteration keys for unexpired tendermint consensus states
func MigrateGenesis(cdc codec.BinaryCodec, clientGenState *types.GenesisState, genesisBlockTime time.Time, selfHeight exported.Height) (*types.GenesisState, error) {
// To prune the consensus states, we will create new clientsConsensus
// and clientsMetadata. These slices will be filled up with consensus states
// which should not be pruned. No solo machine consensus states should be added
// and only unexpired consensus states for ostracon clients will be added.
// and only unexpired consensus states for tendermint clients will be added.
// The metadata keys for unexpired consensus states will be added to clientsMetadata
var (
clientsConsensus []types.ClientConsensusStates
Expand Down Expand Up @@ -93,7 +93,7 @@ func MigrateGenesis(cdc codec.BinaryCodec, clientGenState *types.GenesisState, g
// collect metadata for unexpired consensus states
var clientMetadata []types.GenesisMetadata

// remove all expired ostracon consensus state metadata by adding only
// remove all expired tendermint consensus state metadata by adding only
// unexpired consensus state metadata
for _, consState := range unexpiredConsensusStates {
for _, identifiedGenMetadata := range clientGenState.ClientsMetadata {
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/legacy/v100/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
solomachine := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "06-solomachine-0", "testing", 1)
solomachineMulti := ibctesting.NewSolomachine(suite.T(), suite.chainA.Codec, "06-solomachine-1", "testing", 4)

// create ostracon clients
// create tendermint clients
suite.coordinator.SetupClients(path)
err := path.EndpointA.UpdateClient()
suite.Require().NoError(err)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
clientStore.Set(host.ConsensusStateKey(height2), bz)
clientStore.Set(host.ConsensusStateKey(height3), bz)
}
// solo machine clients must come before ostracon in expected
// solo machine clients must come before tendermint in expected
clientGenState.Clients = append(clients, clientGenState.Clients...)

// migrate store get expected genesis
Expand All @@ -122,7 +122,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
suite.Require().NoError(err)
expectedClientGenState := ibcclient.ExportGenesis(path.EndpointA.Chain.GetContext(), path.EndpointA.Chain.App.GetIBCKeeper().ClientKeeper)

// NOTE: genesis time isn't updated since we aren't testing for ostracon consensus state pruning
// NOTE: genesis time isn't updated since we aren't testing for tendermint consensus state pruning
migrated, err := v100.MigrateGenesis(codec.NewProtoCodec(clientCtx.InterfaceRegistry), &clientGenState, suite.coordinator.CurrentTime, types.GetSelfHeight(suite.chainA.GetContext()))
suite.Require().NoError(err)

Expand Down Expand Up @@ -169,7 +169,7 @@ func (suite *LegacyTestSuite) TestMigrateGenesisSolomachine() {
suite.Require().Equal(string(expectedIndentedBz), string(indentedBz))
}

func (suite *LegacyTestSuite) TestMigrateGenesisOstracon() {
func (suite *LegacyTestSuite) TestMigrateGenesisTendermint() {
// create two paths and setup clients
path1 := ibctesting.NewPath(suite.chainA, suite.chainB)
path2 := ibctesting.NewPath(suite.chainA, suite.chainB)
Expand Down
10 changes: 5 additions & 5 deletions modules/core/02-client/legacy/v100/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
//
// - Migrating solo machine client states from v1 to v2 protobuf definition
// - Pruning all solo machine consensus states
// - Pruning expired ostracon consensus states
// - Adds ProcessedHeight and Iteration keys for unexpired ostracon consensus states
// - Pruning expired tendermint consensus states
// - Adds ProcessedHeight and Iteration keys for unexpired tendermint consensus states
func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec) (err error) {
store := ctx.KVStore(storeKey)
iterator := sdk.KVStorePrefixIterator(store, host.KeyClientStorePrefix)
Expand Down Expand Up @@ -84,12 +84,12 @@ func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryCodec)
case exported.Tendermint:
var clientState exported.ClientState
if err := cdc.UnmarshalInterface(bz, &clientState); err != nil {
return sdkerrors.Wrap(err, "failed to unmarshal client state bytes into ostracon client state")
return sdkerrors.Wrap(err, "failed to unmarshal client state bytes into tendermint client state")
}

tmClientState, ok := clientState.(*ibcoctypes.ClientState)
if !ok {
return sdkerrors.Wrap(clienttypes.ErrInvalidClient, "client state is not ostracon even though client id contains 07-tendermint")
return sdkerrors.Wrap(clienttypes.ErrInvalidClient, "client state is not tendermint even though client id contains 07-tendermint")
}

// add iteration keys so pruning will be successful
Expand Down Expand Up @@ -148,7 +148,7 @@ func pruneSolomachineConsensusStates(clientStore sdk.KVStore) {
}
}

// addConsensusMetadata adds the iteration key and processed height for all ostracon consensus states
// addConsensusMetadata adds the iteration key and processed height for all tendermint consensus states
// These keys were not included in the previous release of the IBC module. Adding the iteration keys allows
// for pruning iteration.
func addConsensusMetadata(ctx sdk.Context, clientStore sdk.KVStore) {
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/legacy/v100/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (suite *LegacyTestSuite) TestMigrateStoreSolomachine() {
clientStore.Set(host.ConsensusStateKey(height3), bz)
}

// create ostracon clients
// create tendermint clients
suite.coordinator.SetupClients(path)

err := v100.MigrateStore(path.EndpointA.Chain.GetContext(), path.EndpointA.Chain.GetSimApp().GetKey(host.StoreKey), path.EndpointA.Chain.App.AppCodec())
Expand All @@ -114,9 +114,9 @@ func (suite *LegacyTestSuite) TestMigrateStoreSolomachine() {
}
}

// only test migration for ostracon clients
// ensure all expired consensus states are removed from ostracon client stores
func (suite *LegacyTestSuite) TestMigrateStoreOstracon() {
// only test migration for tendermint clients
// ensure all expired consensus states are removed from tendermint client stores
func (suite *LegacyTestSuite) TestMigrateStoreTendermint() {
// create path and setup clients
path1 := ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.SetupClients(path1)
Expand Down
8 changes: 4 additions & 4 deletions modules/core/02-client/types/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (suite *TypesTestSuite) TestMarshalConsensusStateWithHeight() {
},
},
{
"ostracon client", func() {
"tendermint client", func() {
path := ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.SetupClients(path)
clientState := suite.chainA.GetClientState(path.EndpointA.ClientID)
Expand Down Expand Up @@ -63,13 +63,13 @@ func TestValidateClientType(t *testing.T) {
clientType string
expPass bool
}{
{"valid", "ostracon", true},
{"valid", "tendermint", true},
{"valid solomachine", "solomachine-v1", true},
{"too large", "ostraconostraconostraconostraconostraconostraconostracon", false},
{"too large", "tenderminttenderminttenderminttenderminttenderminttenderminttendermint", false},
{"too short", "t", false},
{"blank id", " ", false},
{"empty id", "", false},
{"ends with dash", "ostracon-", false},
{"ends with dash", "tendermint-", false},
}

for _, tc := range testCases {
Expand Down
10 changes: 5 additions & 5 deletions modules/core/02-client/types/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (suite *TypesTestSuite) TestPackClientState() {
true,
},
{
"ostracon client",
"tendermint client",
ibcoctypes.NewClientState(chainID, ibctesting.DefaultTrustLevel, ibctesting.TrustingPeriod, ibctesting.UnbondingPeriod, ibctesting.MaxClockDrift, clientHeight, commitmenttypes.GetSDKSpecs(), ibctesting.UpgradePath, false, false),
true,
},
Expand Down Expand Up @@ -81,7 +81,7 @@ func (suite *TypesTestSuite) TestPackConsensusState() {
true,
},
{
"ostracon consensus",
"tendermint consensus",
suite.chainA.LastHeader.ConsensusState(),
true,
},
Expand Down Expand Up @@ -127,7 +127,7 @@ func (suite *TypesTestSuite) TestPackHeader() {
true,
},
{
"ostracon header",
"tendermint header",
suite.chainA.LastHeader,
true,
},
Expand Down Expand Up @@ -174,8 +174,8 @@ func (suite *TypesTestSuite) TestPackMisbehaviour() {
true,
},
{
"ostracon misbehaviour",
ibcoctypes.NewMisbehaviour("ostracon-0", suite.chainA.LastHeader, suite.chainA.LastHeader),
"tendermint misbehaviour",
ibcoctypes.NewMisbehaviour("tendermint-0", suite.chainA.LastHeader, suite.chainA.LastHeader),
true,
},
{
Expand Down
Loading

0 comments on commit 7719baf

Please sign in to comment.