mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +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 {
|
||||
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
|
||||
passes, err := k.GetProposalResult(ctx, msg.ProposalID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if passes {
|
||||
if !passes {
|
||||
return &sdk.Result{Events: ctx.EventManager().Events()}, nil
|
||||
}
|
||||
|
||||
err = k.EnactProposal(ctx, msg.ProposalID)
|
||||
outcome := types.AttributeValueProposalPassed
|
||||
if err != nil {
|
||||
outcome = types.AttributeValueProposalFailed
|
||||
}
|
||||
|
||||
k.DeleteProposalAndVotes(ctx, msg.ProposalID)
|
||||
|
||||
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),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const MaxCommitteeDescriptionLength int = 5000
|
||||
const MaxCommitteeDescriptionLength int = 512
|
||||
|
||||
// ------------------------------------------
|
||||
// Committees
|
||||
|
Loading…
Reference in New Issue
Block a user