-
Notifications
You must be signed in to change notification settings - Fork 193
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
Draft: MRENCLAVE support antehandler #1676
base: cosmos-sdk-0.50.x-merged
Are you sure you want to change the base?
Draft: MRENCLAVE support antehandler #1676
Conversation
Now MREnclaveHash resides in the "Plan.info" field of the MsgSoftwareUpgrade message. We find the latest passed proposal and extract MREnclaveHash from there.
// verifyUpgradeProposal verifies the latest passed upgrade proposal to ensure the MREnclave hash matches. | ||
func (a *CountTXDecorator) verifyUpgradeProposal(ctx sdk.Context, msgUpgrade *types.MsgUpgradeProposalPassed) error { | ||
iterator, err := a.govkeeper.Proposals.Iterate(ctx, nil) | ||
if err != nil { |
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.
ctx.Logger().Error(fmt.Sprintf("Governance Keeper Proposal: %s", err))
No need to use ! sign.
x/compute/internal/keeper/ante.go
Outdated
func (a *CountTXDecorator) verifyUpgradeProposal(ctx sdk.Context, msgUpgrade *types.MsgUpgradeProposalPassed) error { | ||
iterator, err := a.govkeeper.Proposals.Iterate(ctx, nil) | ||
if err != nil { | ||
ctx.Logger().Error("Failed to get the iterator of proposals!", err.Error()) |
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.
You may want to return the actual error
x/compute/internal/keeper/ante.go
Outdated
var latestMREnclaveHash string | ||
|
||
// Iterate through the proposals | ||
for ; iterator.Valid(); iterator.Next() { |
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.
you should use for range iterator construct
x/compute/internal/keeper/ante.go
Outdated
proposal, err := iterator.Value() | ||
if err != nil { | ||
ctx.Logger().Error("Failed to get the proposal from iterator!", err.Error()) | ||
return errors.New("Failed to get the proposal from iterator!") |
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.
user fmt.Errorf. No need to use ! sign
x/compute/internal/keeper/ante.go
Outdated
} | ||
// Check if the proposal has passed and is of type MsgSoftwareUpgrade | ||
if proposal.Status == v1.ProposalStatus_PROPOSAL_STATUS_PASSED { | ||
if len(proposal.GetMessages()) > 0 && proposal.Messages[0].GetTypeUrl() == "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade" { |
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.
Please use a const for "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"
1857d07
to
a95b51a
Compare
No description provided.