Conversation
gjermundgaraba
left a comment
There was a problem hiding this comment.
Similar to the comment in channel-v2. Genesis (including tests) and most of the wiring happens in the core module for v1. v2 should do the same.
AdityaSripal
left a comment
There was a problem hiding this comment.
I think I would prefer the channelV2Keeper still only taking a single clientV2Keeper since the fact that they are different is an implementation detail that only exists because ibc-go is implementing both IBC Classic and IBC Eureka
But open to pushback from the other engineers
| // CounterpartyInfo gets the CounterpartyInfo from the store corresponding to the request client ID. | ||
| func (q queryServer) CounterpartyInfo(ctx context.Context, request *types.QueryCounterpartyInfoRequest) (*types.QueryCounterpartyInfoResponse, error) { | ||
| sdkCtx := sdk.UnwrapSDKContext(ctx) | ||
|
|
There was a problem hiding this comment.
We generally do a bit more validation before the grpc directly gets from store. Would be good to follow the same.
See the v1 chanKeeper grpc implementation
There was a problem hiding this comment.
Should have a test file for this as well.
| cdc codec.Codec | ||
| ctx sdk.Context | ||
| keeper *keeper.Keeper | ||
| consensusState *ibctm.ConsensusState | ||
| valSet *cmttypes.ValidatorSet | ||
| valSetHash cmtbytes.HexBytes | ||
| privVal cmttypes.PrivValidator | ||
| now time.Time | ||
| past time.Time | ||
| solomachine *ibctesting.Solomachine | ||
|
|
||
| signers map[string]cmttypes.PrivValidator |
There was a problem hiding this comment.
Lot of unnecessary fields here
| GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) | ||
| // GetClientConsensusState gets the stored consensus state from a client at a given height. | ||
| GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) | ||
| // GetClientCounterparty returns the counterpartyInfo given a clientID | ||
| GetClientCounterparty(ctx context.Context, clientID string) (clienttypes.CounterpartyInfo, bool) |
There was a problem hiding this comment.
I kind of think this should remain but have clientV2Keeper implement this interface and only have channelKeeper take in a ClientV2Keeper.
What do you think @gjermundgaraba
There was a problem hiding this comment.
To me it seems a bit strange to have it on v1, since it is not used there. The only reason to keep it on v1 would be to avoid having to deal with v2. I feel like it would be less indirection and clearer code if we use the v2 keeper directly when needed.
There was a problem hiding this comment.
@AdityaSripal do you mean to have the ClientV2Keeper basically wrap the client V1 Keeper and extend it with this extra CounterParty functionality?
There was a problem hiding this comment.
Yes, but i will do this in a separate PR probably after the audit
| @@ -37,13 +41,15 @@ func NewKeeper( | |||
| cdc codec.BinaryCodec, | |||
| env appmodule.Environment, | |||
| clientKeeper types.ClientKeeper, | |||
There was a problem hiding this comment.
Think we should still just have this interface and have clientV2Keeper implement it
There was a problem hiding this comment.
Do you mean have the clientV2Keeper implement the full ClientKeeper interface?
|
| path1.SetupClients() | ||
| // counter party not set up | ||
|
|
||
| expInfo = types.NewCounterpartyInfo(path1.EndpointA.Counterparty.MerklePathPrefix.KeyPath, path1.EndpointA.ClientID) |
There was a problem hiding this comment.
this doesn't need to exist right since we have non-nil err
|
|
||
| // Validate checks the CounterpartyInfos added to the genesis for validity. | ||
| func (gs GenesisState) Validate() error { | ||
| seenIDs := make(map[string]struct{}) |
There was a problem hiding this comment.
why do you do this instead of a bool?
There was a problem hiding this comment.
It's a good check but don't think we do this elsewhere
There was a problem hiding this comment.
You think better to remove? The empty struct pattern is a bit of a go idiom for doing inclusion checks like this. Its technically more space / cache efficient because to the compiler it does not take up space whereas a bool does.
In this case it is such a minor use case that it wont have any impact.
There was a problem hiding this comment.
ahh i see. no its fine keep it as-is
| GetClientState(ctx context.Context, clientID string) (exported.ClientState, bool) | ||
| // GetClientConsensusState gets the stored consensus state from a client at a given height. | ||
| GetClientConsensusState(ctx context.Context, clientID string, height exported.Height) (exported.ConsensusState, bool) | ||
| // GetClientCounterparty returns the counterpartyInfo given a clientID | ||
| GetClientCounterparty(ctx context.Context, clientID string) (clienttypes.CounterpartyInfo, bool) |
There was a problem hiding this comment.
Yes, but i will do this in a separate PR probably after the audit



Description
closes: #7875
closes: #7923
Counterpartykeeper and type logic to av2packageBefore we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/).godoccomments.Files changedin the GitHub PR explorer.SonarCloud Reportin the comment section below once CI passes.