Merge with develop
This commit is contained in:
commit
d6f6a1f87f
|
@ -39,6 +39,7 @@ BREAKING CHANGES
|
||||||
* [x/stake] [#1013] TendermintUpdates now uses transient store
|
* [x/stake] [#1013] TendermintUpdates now uses transient store
|
||||||
* [x/gov] [#2195] Governance uses BFT Time
|
* [x/gov] [#2195] Governance uses BFT Time
|
||||||
* [x/gov] \#2256 Removed slashing for governance non-voting validators
|
* [x/gov] \#2256 Removed slashing for governance non-voting validators
|
||||||
|
* [simulation] \#2162 Added back correct supply invariants
|
||||||
|
|
||||||
* SDK
|
* SDK
|
||||||
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
|
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (ctx CLIContext) broadcastTxAsync(txBytes []byte) (*ctypes.ResultBroadcastT
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Logger != nil {
|
if ctx.Output != nil {
|
||||||
if ctx.JSON {
|
if ctx.JSON {
|
||||||
type toJSON struct {
|
type toJSON struct {
|
||||||
TxHash string
|
TxHash string
|
||||||
|
@ -119,10 +119,10 @@ func (ctx CLIContext) broadcastTxAsync(txBytes []byte) (*ctypes.ResultBroadcastT
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Logger.Write(bz)
|
ctx.Output.Write(bz)
|
||||||
io.WriteString(ctx.Logger, "\n")
|
io.WriteString(ctx.Output, "\n")
|
||||||
} else {
|
} else {
|
||||||
io.WriteString(ctx.Logger, fmt.Sprintf("async tx sent (tx hash: %s)\n", res.Hash))
|
io.WriteString(ctx.Output, fmt.Sprintf("async tx sent (tx hash: %s)\n", res.Hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,21 +144,21 @@ func (ctx CLIContext) broadcastTxCommit(txBytes []byte) (*ctypes.ResultBroadcast
|
||||||
Response abci.ResponseDeliverTx
|
Response abci.ResponseDeliverTx
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Logger != nil {
|
if ctx.Output != nil {
|
||||||
resJSON := toJSON{res.Height, res.Hash.String(), res.DeliverTx}
|
resJSON := toJSON{res.Height, res.Hash.String(), res.DeliverTx}
|
||||||
bz, err := ctx.Codec.MarshalJSON(resJSON)
|
bz, err := ctx.Codec.MarshalJSON(resJSON)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Logger.Write(bz)
|
ctx.Output.Write(bz)
|
||||||
io.WriteString(ctx.Logger, "\n")
|
io.WriteString(ctx.Output, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Logger != nil {
|
if ctx.Output != nil {
|
||||||
resStr := fmt.Sprintf("Committed at block %d (tx hash: %s)\n", res.Height, res.Hash.String())
|
resStr := fmt.Sprintf("Committed at block %d (tx hash: %s)\n", res.Height, res.Hash.String())
|
||||||
|
|
||||||
if ctx.PrintResponse {
|
if ctx.PrintResponse {
|
||||||
|
@ -167,7 +167,7 @@ func (ctx CLIContext) broadcastTxCommit(txBytes []byte) (*ctypes.ResultBroadcast
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
io.WriteString(ctx.Logger, resStr)
|
io.WriteString(ctx.Output, resStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
|
|
|
@ -11,14 +11,14 @@ import (
|
||||||
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||||
|
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||||
|
"github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/tendermint/tendermint/libs/cli"
|
"github.com/tendermint/tendermint/libs/cli"
|
||||||
tmlite "github.com/tendermint/tendermint/lite"
|
tmlite "github.com/tendermint/tendermint/lite"
|
||||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||||
"os"
|
"os"
|
||||||
"github.com/cosmos/cosmos-sdk/types"
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
|
||||||
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const ctxAccStoreName = "acc"
|
const ctxAccStoreName = "acc"
|
||||||
|
@ -29,7 +29,7 @@ type CLIContext struct {
|
||||||
Codec *codec.Codec
|
Codec *codec.Codec
|
||||||
AccDecoder auth.AccountDecoder
|
AccDecoder auth.AccountDecoder
|
||||||
Client rpcclient.Client
|
Client rpcclient.Client
|
||||||
Logger io.Writer
|
Output io.Writer
|
||||||
Height int64
|
Height int64
|
||||||
NodeURI string
|
NodeURI string
|
||||||
From string
|
From string
|
||||||
|
@ -61,6 +61,7 @@ func NewCLIContext() CLIContext {
|
||||||
|
|
||||||
return CLIContext{
|
return CLIContext{
|
||||||
Client: rpc,
|
Client: rpc,
|
||||||
|
Output: os.Stdout,
|
||||||
NodeURI: nodeURI,
|
NodeURI: nodeURI,
|
||||||
AccountStore: ctxAccStoreName,
|
AccountStore: ctxAccStoreName,
|
||||||
From: viper.GetString(client.FlagFrom),
|
From: viper.GetString(client.FlagFrom),
|
||||||
|
@ -162,9 +163,9 @@ func (ctx CLIContext) WithAccountDecoder(decoder auth.AccountDecoder) CLIContext
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithLogger returns a copy of the context with an updated logger.
|
// WithOutput returns a copy of the context with an updated output writer (e.g. stdout).
|
||||||
func (ctx CLIContext) WithLogger(w io.Writer) CLIContext {
|
func (ctx CLIContext) WithOutput(w io.Writer) CLIContext {
|
||||||
ctx.Logger = w
|
ctx.Output = w
|
||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,8 @@ func createHandler(cdc *codec.Codec) http.Handler {
|
||||||
staticServer := http.FileServer(statikFS)
|
staticServer := http.FileServer(statikFS)
|
||||||
r.PathPrefix("/swagger-ui/").Handler(http.StripPrefix("/swagger-ui/", staticServer))
|
r.PathPrefix("/swagger-ui/").Handler(http.StripPrefix("/swagger-ui/", staticServer))
|
||||||
|
|
||||||
cliCtx := context.NewCLIContext().WithCodec(cdc).WithLogger(os.Stdout)
|
cliCtx := context.NewCLIContext().WithCodec(cdc)
|
||||||
|
|
||||||
|
|
||||||
// TODO: make more functional? aka r = keys.RegisterRoutes(r)
|
// TODO: make more functional? aka r = keys.RegisterRoutes(r)
|
||||||
r.HandleFunc("/version", CLIVersionRequestHandler).Methods("GET")
|
r.HandleFunc("/version", CLIVersionRequestHandler).Methods("GET")
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
@ -24,7 +22,6 @@ func QuizTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
|
@ -49,7 +46,6 @@ func SetTrendTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
@ -25,7 +24,6 @@ func MineCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cli
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||||
|
@ -33,7 +32,6 @@ func BondTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
|
@ -86,8 +84,7 @@ func UnbondTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc)
|
||||||
WithLogger(os.Stdout)
|
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -20,7 +20,7 @@ Read a transaction from <file> and broadcast it to a node. If you supply a dash
|
||||||
in place of an input filename, the command reads from standard input.`,
|
in place of an input filename, the command reads from standard input.`,
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
cliCtx := context.NewCLIContext().WithCodec(codec).WithLogger(os.Stdout)
|
cliCtx := context.NewCLIContext().WithCodec(codec)
|
||||||
stdTx, err := readAndUnmarshalStdTx(cliCtx.Codec, args[0])
|
stdTx, err := readAndUnmarshalStdTx(cliCtx.Codec, args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
@ -30,7 +28,6 @@ func SendTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
if err := cliCtx.EnsureAccountExists(); err != nil {
|
if err := cliCtx.EnsureAccountExists(); err != nil {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||||
|
@ -80,7 +79,6 @@ $ gaiacli gov submit-proposal --title="Test Proposal" --description="My awesome
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
fromAddr, err := cliCtx.GetFromAddress()
|
fromAddr, err := cliCtx.GetFromAddress()
|
||||||
|
@ -164,7 +162,6 @@ func GetCmdDeposit(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
depositerAddr, err := cliCtx.GetFromAddress()
|
depositerAddr, err := cliCtx.GetFromAddress()
|
||||||
|
@ -210,7 +207,6 @@ func GetCmdVote(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
voterAddr, err := cliCtx.GetFromAddress()
|
voterAddr, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
@ -31,7 +30,6 @@ func IBCTransferCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
from, err := cliCtx.GetFromAddress()
|
from, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
@ -24,7 +22,6 @@ func GetCmdUnjail(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
valAddr, err := cliCtx.GetFromAddress()
|
valAddr, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/client/context"
|
"github.com/cosmos/cosmos-sdk/client/context"
|
||||||
|
@ -26,7 +25,6 @@ func GetCmdCreateValidator(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
amounstStr := viper.GetString(FlagAmount)
|
amounstStr := viper.GetString(FlagAmount)
|
||||||
|
@ -116,7 +114,6 @@ func GetCmdEditValidator(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
valAddr, err := cliCtx.GetFromAddress()
|
valAddr, err := cliCtx.GetFromAddress()
|
||||||
|
@ -169,7 +166,6 @@ func GetCmdDelegate(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
amount, err := sdk.ParseCoin(viper.GetString(FlagAmount))
|
amount, err := sdk.ParseCoin(viper.GetString(FlagAmount))
|
||||||
|
@ -228,7 +224,6 @@ func GetCmdBeginRedelegate(storeName string, cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
@ -284,7 +279,6 @@ func GetCmdCompleteRedelegate(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
delAddr, err := cliCtx.GetFromAddress()
|
delAddr, err := cliCtx.GetFromAddress()
|
||||||
|
@ -342,7 +336,6 @@ func GetCmdBeginUnbonding(storeName string, cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
delAddr, err := cliCtx.GetFromAddress()
|
delAddr, err := cliCtx.GetFromAddress()
|
||||||
|
@ -391,7 +384,6 @@ func GetCmdCompleteUnbonding(cdc *codec.Codec) *cobra.Command {
|
||||||
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
txBldr := authtxb.NewTxBuilderFromCLI().WithCodec(cdc)
|
||||||
cliCtx := context.NewCLIContext().
|
cliCtx := context.NewCLIContext().
|
||||||
WithCodec(cdc).
|
WithCodec(cdc).
|
||||||
WithLogger(os.Stdout).
|
|
||||||
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
WithAccountDecoder(authcmd.GetAccountDecoder(cdc))
|
||||||
|
|
||||||
delAddr, err := cliCtx.GetFromAddress()
|
delAddr, err := cliCtx.GetFromAddress()
|
||||||
|
|
|
@ -34,7 +34,7 @@ func AllInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simula
|
||||||
func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simulation.Invariant {
|
func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) simulation.Invariant {
|
||||||
return func(app *baseapp.BaseApp) error {
|
return func(app *baseapp.BaseApp) error {
|
||||||
ctx := app.NewContext(false, abci.Header{})
|
ctx := app.NewContext(false, abci.Header{})
|
||||||
//pool := k.GetPool(ctx)
|
pool := k.GetPool(ctx)
|
||||||
|
|
||||||
loose := sdk.ZeroInt()
|
loose := sdk.ZeroInt()
|
||||||
bonded := sdk.ZeroDec()
|
bonded := sdk.ZeroDec()
|
||||||
|
@ -59,14 +59,14 @@ func SupplyInvariants(ck bank.Keeper, k stake.Keeper, am auth.AccountMapper) sim
|
||||||
})
|
})
|
||||||
|
|
||||||
// Loose tokens should equal coin supply plus unbonding delegations plus tokens on unbonded validators
|
// Loose tokens should equal coin supply plus unbonding delegations plus tokens on unbonded validators
|
||||||
// XXX TODO https://github.com/cosmos/cosmos-sdk/issues/2063#issuecomment-413720872
|
if pool.LooseTokens.RoundInt64() != loose.Int64() {
|
||||||
// require.True(t, pool.LooseTokens.RoundInt64() == loose.Int64(), "expected loose tokens to equal total steak held by accounts - pool.LooseTokens: %v, sum of account tokens: %v\nlog: %s",
|
return fmt.Errorf("expected loose tokens to equal total steak held by accounts - pool.LooseTokens: %v, sum of account tokens: %v", pool.LooseTokens.RoundInt64(), loose.Int64())
|
||||||
// pool.LooseTokens.RoundInt64(), loose.Int64(), log)
|
}
|
||||||
|
|
||||||
// Bonded tokens should equal sum of tokens with bonded validators
|
// Bonded tokens should equal sum of tokens with bonded validators
|
||||||
// XXX TODO https://github.com/cosmos/cosmos-sdk/issues/2063#issuecomment-413720872
|
if pool.BondedTokens.RoundInt64() != bonded.RoundInt64() {
|
||||||
// require.True(t, pool.BondedTokens.RoundInt64() == bonded.RoundInt64(), "expected bonded tokens to equal total steak held by bonded validators - pool.BondedTokens: %v, sum of bonded validator tokens: %v\nlog: %s",
|
return fmt.Errorf("expected bonded tokens to equal total steak held by bonded validators - pool.BondedTokens: %v, sum of bonded validator tokens: %v", pool.BondedTokens.RoundInt64(), bonded.RoundInt64())
|
||||||
// pool.BondedTokens.RoundInt64(), bonded.RoundInt64(), log)
|
}
|
||||||
|
|
||||||
// TODO Inflation check on total supply
|
// TODO Inflation check on total supply
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue