mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-27 00:35:18 +00:00
apply various pr suggestions
This commit is contained in:
parent
d1c0dd18b1
commit
ffbeced199
@ -57,18 +57,29 @@ func handleMsgVote(ctx sdk.Context, k keeper.Keeper, msg types.MsgVote) (*sdk.Re
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
ctx.EventManager().EmitEvent(
|
||||||
|
sdk.NewEvent(
|
||||||
|
sdk.EventTypeMessage,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeySender, msg.Voter.String()),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
// Enact a proposal if it has enough votes
|
// Enact a proposal if it has enough votes
|
||||||
passes, err := k.GetProposalResult(ctx, msg.ProposalID)
|
passes, err := k.GetProposalResult(ctx, msg.ProposalID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if passes {
|
if !passes {
|
||||||
|
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
|
||||||
|
}
|
||||||
|
|
||||||
err = k.EnactProposal(ctx, msg.ProposalID)
|
err = k.EnactProposal(ctx, msg.ProposalID)
|
||||||
outcome := types.AttributeValueProposalPassed
|
outcome := types.AttributeValueProposalPassed
|
||||||
if err != nil {
|
if err != nil {
|
||||||
outcome = types.AttributeValueProposalFailed
|
outcome = types.AttributeValueProposalFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
k.DeleteProposalAndVotes(ctx, msg.ProposalID)
|
k.DeleteProposalAndVotes(ctx, msg.ProposalID)
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
@ -79,15 +90,6 @@ func handleMsgVote(ctx sdk.Context, k keeper.Keeper, msg types.MsgVote) (*sdk.Re
|
|||||||
sdk.NewAttribute(types.AttributeKeyProposalCloseStatus, outcome),
|
sdk.NewAttribute(types.AttributeKeyProposalCloseStatus, outcome),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
ctx.EventManager().EmitEvent(
|
|
||||||
sdk.NewEvent(
|
|
||||||
sdk.EventTypeMessage,
|
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
|
||||||
sdk.NewAttribute(sdk.AttributeKeySender, msg.Voter.String()),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
|
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxCommitteeDescriptionLength int = 5000
|
const MaxCommitteeDescriptionLength int = 512
|
||||||
|
|
||||||
// ------------------------------------------
|
// ------------------------------------------
|
||||||
// Committees
|
// Committees
|
||||||
|
Loading…
Reference in New Issue
Block a user