-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat: Compatibility between the voteweighted package and ICS consumer keeper #315
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #315 +/- ##
=======================================
Coverage ? 56.79%
=======================================
Files ? 228
Lines ? 10790
Branches ? 0
=======================================
Hits ? 6128
Misses ? 4149
Partials ? 513 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems nice! Two requests:
- there is no way to create CCVConsumerCompatKeeper now, because ccvKeeper is a private field. Can you add a constructor to it please?
- can you also implement another ValidatorStore as well for CCVConsumerCompatKeeper? (it's used in another place)
type ValidatorStore interface {
GetPubKeyByConsAddr(context.Context, sdk.ConsAddress) (cmtprotocrypto.PublicKey, error)
}
I implemented it like this (seems to be working):
func (c ConsumerValidatorStore) GetPubKeyByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (cmtprotocrypto.PublicKey, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
val, found := c.k.GetCCValidator(sdkCtx, consAddr)
if !found {
// TODO
return cmtprotocrypto.PublicKey{}, fmt.Errorf("not found CCValidator for address = TODO: ")
}
consPubKey, err := val.ConsPubKey()
if err != nil {
// TODO
return cmtprotocrypto.PublicKey{}, fmt.Errorf("TODO")
}
tmPubKey, err := cryptocodec.ToCmtProtoPublicKey(consPubKey)
if err != nil {
// TODO
return cmtprotocrypto.PublicKey{}, err
}
return tmPubKey, nil
}
pkg/math/voteweighted/ccv_compat.go
Outdated
// TotalBondedTokens iterates through all CCVs and returns the sum of all validator power. | ||
func (c CCVConsumerCompatKeeper) TotalBondedTokens(ctx context.Context) (math.Int, error) { | ||
total := math.NewInt(0) | ||
sdkCtx, ok := ctx.(sdk.Context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about using sdkCtx := sdk.UnwrapSDKContext(ctx)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Adds compat types so that ICS chains can use slinky.
It uses validator power instead of bonded tokens in the stake-weighted median computation.
It uses the most recent version of ics v5.0.0-alpha1.