Skip to content

Commit

Permalink
fix: revert unnecessary change in 02-client-refactor branch (#1883)
Browse files Browse the repository at this point in the history
* revert error naming changes

* fix error naming in 03-connection usage
  • Loading branch information
colin-axner authored Aug 5, 2022
1 parent 81f2d09 commit 311a563
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions modules/core/02-client/keeper/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, clientMsg exporte
clientStore := k.ClientStore(ctx, clientID)

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(types.ErrClientStateNotFound, "cannot update client (%s) with status %s", clientID, status)
return sdkerrors.Wrapf(types.ErrClientNotActive, "cannot update client (%s) with status %s", clientID, status)
}

if err := clientState.VerifyClientMessage(ctx, k.cdc, clientStore, clientMsg); err != nil {
Expand Down Expand Up @@ -120,7 +120,7 @@ func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient e
clientStore := k.ClientStore(ctx, clientID)

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(types.ErrClientStateNotFound, "cannot upgrade client (%s) with status %s", clientID, status)
return sdkerrors.Wrapf(types.ErrClientNotActive, "cannot upgrade client (%s) with status %s", clientID, status)
}

if err := clientState.VerifyUpgradeAndUpdateState(ctx, k.cdc, clientStore,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/keeper/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdatePropo
substituteClientStore := k.ClientStore(ctx, p.SubstituteClientId)

if status := substituteClientState.Status(ctx, substituteClientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(types.ErrClientStateNotFound, "substitute client is not Active, status is %s", status)
return sdkerrors.Wrapf(types.ErrClientNotActive, "substitute client is not Active, status is %s", status)
}

if err := subjectClientState.CheckSubstituteAndUpdateState(ctx, k.cdc, subjectClientStore, substituteClientStore, substituteClientState); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/02-client/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ var (
ErrInvalidHeight = sdkerrors.Register(SubModuleName, 26, "invalid height")
ErrInvalidSubstitute = sdkerrors.Register(SubModuleName, 27, "invalid client state substitute")
ErrInvalidUpgradeProposal = sdkerrors.Register(SubModuleName, 28, "invalid upgrade proposal")
ErrClientStateNotFound = sdkerrors.Register(SubModuleName, 29, "client state not found")
ErrClientNotActive = sdkerrors.Register(SubModuleName, 29, "client state is not active")
)
2 changes: 1 addition & 1 deletion modules/core/03-connection/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (k Keeper) GetTimestampAtHeight(ctx sdk.Context, connection types.Connectio
clientState, found := k.clientKeeper.GetClientState(ctx, connection.GetClientID())
if !found {
return 0, sdkerrors.Wrapf(
clienttypes.ErrClientStateNotFound, "clientID (%s)", connection.GetClientID(),
clienttypes.ErrClientNotFound, "clientID (%s)", connection.GetClientID(),
)
}

Expand Down
16 changes: 8 additions & 8 deletions modules/core/03-connection/keeper/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (k Keeper) VerifyClientState(
}

if status := targetClient.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

merklePath := commitmenttypes.NewMerklePath(host.FullClientStatePath(connection.GetCounterparty().GetClientID()))
Expand Down Expand Up @@ -81,7 +81,7 @@ func (k Keeper) VerifyClientConsensusState(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

merklePath := commitmenttypes.NewMerklePath(host.FullConsensusStatePath(connection.GetCounterparty().GetClientID(), consensusHeight))
Expand Down Expand Up @@ -130,7 +130,7 @@ func (k Keeper) VerifyConnectionState(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

merklePath := commitmenttypes.NewMerklePath(host.ConnectionPath(connectionID))
Expand Down Expand Up @@ -185,7 +185,7 @@ func (k Keeper) VerifyChannelState(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

merklePath := commitmenttypes.NewMerklePath(host.ChannelPath(portID, channelID))
Expand Down Expand Up @@ -241,7 +241,7 @@ func (k Keeper) VerifyPacketCommitment(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

// get time and block delays
Expand Down Expand Up @@ -291,7 +291,7 @@ func (k Keeper) VerifyPacketAcknowledgement(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

// get time and block delays
Expand Down Expand Up @@ -341,7 +341,7 @@ func (k Keeper) VerifyPacketReceiptAbsence(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

// get time and block delays
Expand Down Expand Up @@ -390,7 +390,7 @@ func (k Keeper) VerifyNextSequenceRecv(
}

if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "client (%s) status is %s", clientID, status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "client (%s) status is %s", clientID, status)
}

// get time and block delays
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (k Keeper) SendPacket(
// prevent accidental sends with clients that cannot be updated
clientStore := k.clientKeeper.ClientStore(ctx, connectionEnd.GetClientID())
if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active {
return sdkerrors.Wrapf(clienttypes.ErrClientStateNotFound, "cannot send packet using client (%s) with status %s", connectionEnd.GetClientID(), status)
return sdkerrors.Wrapf(clienttypes.ErrClientNotActive, "cannot send packet using client (%s) with status %s", connectionEnd.GetClientID(), status)
}

// check if packet is timed out on the receiving chain
Expand Down

0 comments on commit 311a563

Please sign in to comment.