Skip to content
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

Pass ibc store for 09-localhost client verification #3056

Closed
3 tasks
Tracked by #3034
damiannolan opened this issue Jan 25, 2023 · 0 comments
Closed
3 tasks
Tracked by #3034

Pass ibc store for 09-localhost client verification #3056

damiannolan opened this issue Jan 25, 2023 · 0 comments

Comments

@damiannolan
Copy link
Contributor

Summary

In 03-connection verify.go, the core IBC store should be passed to VerifyMembership and VerifyNonMembership when operating on the 09-localhost client.

A special case handling should be added to provide this functionality.
If the client type is localhost, then we should pass the core IBC store. Otherwise, the client prefixed store should be passed for other client types.

See reference from #2700.

func (k Keeper) getClientStateAndKVStore(ctx sdk.Context, clientID string) (exported.ClientState, sdk.KVStore, error) {
	clientStore := k.clientKeeper.ClientStore(ctx, clientID)

	clientState, found := k.clientKeeper.GetClientState(ctx, clientID)
	if !found {
		return nil, nil, sdkerrors.Wrap(clienttypes.ErrClientNotFound, clientID)
	}

	var store sdk.KVStore
	switch clientState.(type) {
	case *localhosttypes.ClientState:
		store = ctx.KVStore(k.storeKey)
	default:
		store = clientStore
	}

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

	return clientState, store, nil
}

The sample code above can be refactored. The status check can be removed and performed inside the verification handler.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@damiannolan damiannolan added this to the v7.1.0 milestone Jan 25, 2023
@damiannolan damiannolan self-assigned this Jan 25, 2023
@damiannolan damiannolan moved this to Todo in ibc-go Jan 25, 2023
@damiannolan damiannolan moved this from Todo to In progress in ibc-go Jan 25, 2023
@github-project-automation github-project-automation bot moved this from In progress to Todo in ibc-go Feb 1, 2023
@damiannolan damiannolan moved this from Todo to Done in ibc-go Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 🥳
Development

No branches or pull requests

1 participant