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

fix!: ConsumerModificationProposal is needed in Gaia upgrade handler #2176

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 52 additions & 2 deletions x/ccv/provider/types/legacy_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ import (

const (
ProposalTypeConsumerAddition = "ConsumerAddition"
ProposalTypeConsumerRemoval = "RemoveConsumer"
ProposalTypeConsumerModification = "UpdateConsumer"
ProposalTypeConsumerRemoval = "ConsumerRemoval"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the rename?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just reverted the entire file to what's in ICS main.

ProposalTypeConsumerModification = "ConsumerModification"
ProposalTypeEquivocation = "Equivocation"
ProposalTypeChangeRewardDenoms = "ChangeRewardDenoms"
)

var (
_ govv1beta1.Content = &ConsumerAdditionProposal{}
_ govv1beta1.Content = &ConsumerRemovalProposal{}
_ govv1beta1.Content = &ConsumerModificationProposal{}
_ govv1beta1.Content = &ChangeRewardDenomsProposal{}
_ govv1beta1.Content = &EquivocationProposal{}
)
Expand Down Expand Up @@ -239,6 +240,55 @@ func (sccp *ConsumerRemovalProposal) ValidateBasic() error {
return nil
}

// NewConsumerModificationProposal creates a new consumer modification proposal.
func NewConsumerModificationProposal(title, description, chainID string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a [Deprecated] comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a [Deprecated] comment. It should be deprecated after we get Permissionless.

topN uint32,
validatorsPowerCap uint32,
validatorSetCap uint32,
allowlist []string,
denylist []string,
minStake uint64,
allowInactiveVals bool,
) govv1beta1.Content {
return &ConsumerModificationProposal{
Title: title,
Description: description,
ChainId: chainID,
Top_N: topN,
ValidatorsPowerCap: validatorsPowerCap,
ValidatorSetCap: validatorSetCap,
Allowlist: allowlist,
Denylist: denylist,
MinStake: minStake,
AllowInactiveVals: allowInactiveVals,
}
}

// ProposalRoute returns the routing key of a consumer modification proposal.
func (cccp *ConsumerModificationProposal) ProposalRoute() string { return RouterKey }

// ProposalType returns the type of the consumer modification proposal.
func (cccp *ConsumerModificationProposal) ProposalType() string {
return ProposalTypeConsumerModification
}

// ValidateBasic runs basic stateless validity checks
func (cccp *ConsumerModificationProposal) ValidateBasic() error {
if err := govv1beta1.ValidateAbstract(cccp); err != nil {
return err
}

if strings.TrimSpace(cccp.ChainId) == "" {
return errorsmod.Wrap(ErrInvalidConsumerModificationProposal, "consumer chain id must not be blank")
}

err := ValidatePSSFeatures(cccp.Top_N, cccp.ValidatorsPowerCap)
if err != nil {
return errorsmod.Wrapf(ErrInvalidConsumerModificationProposal, "invalid PSS features: %s", err.Error())
}
return nil
}

// NewEquivocationProposal creates a new equivocation proposal.
// [DEPRECATED]: do not use because equivocations can be submitted
// and verified automatically on the provider.
Expand Down
Loading