cosmos-sdk/x/crisis/msg.go
frog power 4000 df4394185e
Merge PR #3656: Broken-Invar Tx - aka. Crisis module
* beginning thinking on issue

* ...

* working

* working

* working fee pool distribution

* spek outline

* spec update

* gas refund calculations

* simulation saved to ~/.gaiad/simulations/

* lean simulation output

int

* cleanup bank simulation messages

* operation messges

int

* lint

* move simulation to its own module

* move simulation log code to log.go

* logger overhaul

int

* distribution comments

* fix compiling

* cleanup modifications to x/distribution/keeper/allocation.go

int

int

int

* gov bug

* result.IsOK() minimization

* importExport typo bug

* pending

* address @alexanderbez comments

* simple @cwgoes comments addressed

* event logging unified approach

* distr module name constant

* implementing

* compiles

* gaia integration

* proper constant fee removal

* crisis genesis

* go.sum update

* ...

* debugging

* fix sum errors

* missing err checks

* working implementing CLI

* remove query command

* crisis expected keepers in other modules

* crisis testing infrastructure

* working

* tests complete

* modify handler to still panic if not enough pool coins, docs working

* spec tags

* docs complete

* CL

* assert invariants on a blockly basis gaiad functionality

* gaiad CL

* transaction details in runtime invariance panic

* Apply suggestions from code review

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* sender tags

* @mossid suggestions

int

* @cwgoes comments final

* Apply suggestions from code review

Co-Authored-By: rigelrozanski <rigel.rozanski@gmail.com>

* bug seems fixed (#3998)

* delete unused line in zero height export bug
2019-03-28 19:27:47 -04:00

53 lines
1.6 KiB
Go

package crisis
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// MsgVerifyInvariant - message struct to verify a particular invariance
type MsgVerifyInvariant struct {
Sender sdk.AccAddress `json:"sender"`
InvariantModuleName string `json:"invariant_module_name"`
InvariantRoute string `json:"invariant_route"`
}
// ensure Msg interface compliance at compile time
var _ sdk.Msg = &MsgVerifyInvariant{}
// NewMsgVerifyInvariant creates a new MsgVerifyInvariant object
func NewMsgVerifyInvariant(sender sdk.AccAddress, invariantModuleName,
invariantRoute string) MsgVerifyInvariant {
return MsgVerifyInvariant{
Sender: sender,
InvariantModuleName: invariantModuleName,
InvariantRoute: invariantRoute,
}
}
//nolint
func (msg MsgVerifyInvariant) Route() string { return ModuleName }
func (msg MsgVerifyInvariant) Type() string { return "verify_invariant" }
// get the bytes for the message signer to sign on
func (msg MsgVerifyInvariant) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{msg.Sender} }
// GetSignBytes gets the sign bytes for the msg MsgVerifyInvariant
func (msg MsgVerifyInvariant) GetSignBytes() []byte {
bz := MsgCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
// quick validity check
func (msg MsgVerifyInvariant) ValidateBasic() sdk.Error {
if msg.Sender.Empty() {
return ErrNilSender(DefaultCodespace)
}
return nil
}
// FullInvariantRoute - get the messages full invariant route
func (msg MsgVerifyInvariant) FullInvariantRoute() string {
return msg.InvariantModuleName + "/" + msg.InvariantRoute
}