chore: gofumpt (#11839)

* fumpt using main not master...

* be more descriptive

* fumpt

* fix nits

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
Jacob Gadikian
2022-05-19 10:55:27 +02:00
committed by GitHub
co-authored by Julien Robert
parent bc2d553f77
commit 55054282d2
412 changed files with 1020 additions and 1059 deletions
+2 -2
View File
@@ -192,7 +192,7 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) {
return
}
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
if err != nil {
return err
}
@@ -259,7 +259,7 @@ func makeBatchMultisignCmd() func(cmd *cobra.Command, args []string) error {
txFactory = txFactory.WithSignMode(signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
}
var infile = os.Stdin
infile := os.Stdin
if args[0] != "-" {
infile, err = os.Open(args[0])
defer func() {
+2 -2
View File
@@ -153,7 +153,7 @@ func setOutputFile(cmd *cobra.Command) (func(), error) {
return func() {}, nil
}
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
if err != nil {
return func() {}, err
}
@@ -302,7 +302,7 @@ func makeSignCmd() func(cmd *cobra.Command, args []string) error {
return nil
}
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644)
if err != nil {
return err
}
+1
View File
@@ -1,3 +1,4 @@
//go:build norace
// +build norace
package testutil
+4 -3
View File
@@ -231,7 +231,7 @@ func (s *IntegrationTestSuite) TestCLISignGenOnly() {
func (s *IntegrationTestSuite) TestCLISignBatch() {
val := s.network.Validators[0]
var sendTokens = sdk.NewCoins(
sendTokens := sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), sdk.NewInt(10)),
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
)
@@ -284,7 +284,7 @@ func (s *IntegrationTestSuite) TestCLISignAminoJSON() {
require := s.Require()
val1 := s.network.Validators[0]
txCfg := val1.ClientCtx.TxConfig
var sendTokens = sdk.NewCoins(
sendTokens := sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val1.Moniker), sdk.NewInt(10)),
sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)),
)
@@ -1813,7 +1813,8 @@ func (s *IntegrationTestSuite) TestAuxToFee() {
}
func (s *IntegrationTestSuite) createBankMsg(val *network.Validator, toAddr sdk.AccAddress, amount sdk.Coins, extraFlags ...string) (testutil.BufferWriter, error) {
flags := []string{fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
flags := []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees,
sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
+2 -2
View File
@@ -68,7 +68,8 @@ func SignTx(txFactory tx.Factory, clientCtx client.Context, name string, txBuild
// This function should only be used when signing with a multisig. For
// normal keys, please use SignTx directly.
func SignTxWithSignerAddress(txFactory tx.Factory, clientCtx client.Context, addr sdk.AccAddress,
name string, txBuilder client.TxBuilder, offline, overwrite bool) (err error) {
name string, txBuilder client.TxBuilder, offline, overwrite bool,
) (err error) {
// Multisigs only support LEGACY_AMINO_JSON signing.
if txFactory.SignMode() == signing.SignMode_SIGN_MODE_UNSPECIFIED {
txFactory = txFactory.WithSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
@@ -145,7 +146,6 @@ func (bs *BatchScanner) Scan() bool {
func populateAccountFromState(
txBldr tx.Factory, clientCtx client.Context, addr sdk.AccAddress,
) (tx.Factory, error) {
num, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, addr)
if err != nil {
return txBldr, err
+1 -1
View File
@@ -149,7 +149,7 @@ func compareEncoders(t *testing.T, expected sdk.TxEncoder, actual sdk.TxEncoder)
}
func makeCodec() *codec.LegacyAmino {
var cdc = codec.NewLegacyAmino()
cdc := codec.NewLegacyAmino()
sdk.RegisterLegacyAminoCodec(cdc)
cryptocodec.RegisterCrypto(cdc)
authtypes.RegisterLegacyAminoCodec(cdc)
-2
View File
@@ -39,7 +39,6 @@ func (ak AccountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequ
accounts = append(accounts, any)
return nil
})
if err != nil {
return nil, status.Errorf(codes.Internal, "paginate: %v", err)
}
@@ -59,7 +58,6 @@ func (ak AccountKeeper) Account(c context.Context, req *types.QueryAccountReques
ctx := sdk.UnwrapSDKContext(c)
addr, err := sdk.AccAddressFromBech32(req.Address)
if err != nil {
return nil, err
}
+5 -13
View File
@@ -16,9 +16,7 @@ const addrStr = "cosmos13c3d4wq2t22dl0dstraf8jc3f902e3fsy9n3wv"
var addrBytes = []byte{0x8e, 0x22, 0xda, 0xb8, 0xa, 0x5a, 0x94, 0xdf, 0xbd, 0xb0, 0x58, 0xfa, 0x93, 0xcb, 0x11, 0x49, 0x5e, 0xac, 0xc5, 0x30}
func (suite *KeeperTestSuite) TestGRPCQueryAccounts() {
var (
req *types.QueryAccountsRequest
)
var req *types.QueryAccountsRequest
_, _, first := testdata.KeyTestPubAddr()
_, _, second := testdata.KeyTestPubAddr()
@@ -74,9 +72,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryAccounts() {
}
func (suite *KeeperTestSuite) TestGRPCQueryAccount() {
var (
req *types.QueryAccountRequest
)
var req *types.QueryAccountRequest
_, _, addr := testdata.KeyTestPubAddr()
testCases := []struct {
@@ -200,9 +196,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryParameters() {
}
func (suite *KeeperTestSuite) TestGRPCQueryModuleAccounts() {
var (
req *types.QueryModuleAccountsRequest
)
var req *types.QueryModuleAccountsRequest
testCases := []struct {
msg string
@@ -217,7 +211,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryModuleAccounts() {
},
true,
func(res *types.QueryModuleAccountsResponse) {
var mintModuleExists = false
mintModuleExists := false
for _, acc := range res.Accounts {
var account types.AccountI
err := suite.app.InterfaceRegistry().UnpackAny(acc, &account)
@@ -240,7 +234,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryModuleAccounts() {
},
true,
func(res *types.QueryModuleAccountsResponse) {
var mintModuleExists = false
mintModuleExists := false
for _, acc := range res.Accounts {
var account types.AccountI
err := suite.app.InterfaceRegistry().UnpackAny(acc, &account)
@@ -337,7 +331,6 @@ func (suite *KeeperTestSuite) TestAddressBytesToString() {
suite.Require().Error(err)
suite.Require().Nil(res)
}
})
}
}
@@ -384,7 +377,6 @@ func (suite *KeeperTestSuite) TestAddressStringToBytes() {
suite.Require().Error(err)
suite.Require().Nil(res)
}
})
}
}
-1
View File
@@ -74,7 +74,6 @@ func NewAccountKeeper(
cdc codec.BinaryCodec, key storetypes.StoreKey, paramstore paramtypes.Subspace, proto func() types.AccountI,
maccPerms map[string][]string, bech32Prefix string,
) AccountKeeper {
// set KeyTable if it has not already been set
if !paramstore.HasKeyTable() {
paramstore = paramstore.WithKeyTable(types.ParamKeyTable())
-1
View File
@@ -246,7 +246,6 @@ func (s *MWTestSuite) TestTxHeightTimeoutMiddleware() {
// SimulateTx
_, err = txHandler.SimulateTx(sdk.WrapSDKContext(ctx), tx.Request{Tx: testTx})
s.Require().Equal(tc.expectErr, err != nil, err)
})
}
}
-1
View File
@@ -41,7 +41,6 @@ func (cbgh consumeBlockGasHandler) DeliverTx(ctx context.Context, req tx.Request
sdkCtx.BlockGasMeter().ConsumeGas(
sdkCtx.GasMeter().GasConsumedToLimit(), "block gas meter",
)
}()
return cbgh.next.DeliverTx(ctx, req)
+1 -1
View File
@@ -52,7 +52,7 @@ func (s *MWTestSuite) TestBranchStore() {
// testMsgTxHandler is a test txHandler that handles one single TestMsg,
// consumes the given `tc.gasToConsume`, and sets the bank store "ok" key to "ok".
var testMsgTxHandler = customTxHandler{func(ctx context.Context, req tx.Request) (tx.Response, error) {
testMsgTxHandler := customTxHandler{func(ctx context.Context, req tx.Request) (tx.Response, error) {
msg, ok := req.Tx.GetMsgs()[0].(*testdata.TestMsg)
if !ok {
return tx.Response{}, fmt.Errorf("Wrong Msg type, expected %T, got %T", (*testdata.TestMsg)(nil), msg)
+2 -1
View File
@@ -174,7 +174,8 @@ func SigGasNoConsumer(meter sdk.GasMeter, sig []byte, pubkey crypto.PubKey, para
}
func genTxWithFeeGranter(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums,
accSeqs []uint64, feeGranter sdk.AccAddress, priv ...cryptotypes.PrivKey) (sdk.Tx, error) {
accSeqs []uint64, feeGranter sdk.AccAddress, priv ...cryptotypes.PrivKey,
) (sdk.Tx, error) {
sigs := make([]signing.SignatureV2, len(priv))
// create a random length memo
+2
View File
@@ -102,10 +102,12 @@ var _ tx.Handler = customTxHandler{}
func (h customTxHandler) DeliverTx(ctx context.Context, req tx.Request) (tx.Response, error) {
return h.fn(ctx, req)
}
func (h customTxHandler) CheckTx(ctx context.Context, req tx.Request, _ tx.RequestCheckTx) (tx.Response, tx.ResponseCheckTx, error) {
res, err := h.fn(ctx, req)
return res, tx.ResponseCheckTx{}, err
}
func (h customTxHandler) SimulateTx(ctx context.Context, req tx.Request) (tx.Response, error) {
return h.fn(ctx, req)
}
+2 -1
View File
@@ -949,7 +949,8 @@ func TestCountSubkeys(t *testing.T) {
multiLevelSubKey1 := kmultisig.NewLegacyAminoPubKey(4, genPubKeys(5))
multiLevelSubKey2 := kmultisig.NewLegacyAminoPubKey(4, genPubKeys(5))
multiLevelMultiKey := kmultisig.NewLegacyAminoPubKey(2, []cryptotypes.PubKey{
multiLevelSubKey1, multiLevelSubKey2, secp256k1.GenPrivKey().PubKey()})
multiLevelSubKey1, multiLevelSubKey2, secp256k1.GenPrivKey().PubKey(),
})
type args struct {
pub cryptotypes.PubKey
}
-1
View File
@@ -263,7 +263,6 @@ func ConsumeMultisignatureVerificationGas(
meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey,
params types.Params, accSeq uint64,
) error {
size := sig.BitArray.Count()
sigIndex := 0
+6 -3
View File
@@ -18,8 +18,10 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
)
var initialRegens = sdk.NewCoins(sdk.NewCoin("regen", sdk.NewInt(1000)))
var initialAtoms = sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1000)))
var (
initialRegens = sdk.NewCoins(sdk.NewCoin("regen", sdk.NewInt(1000)))
initialAtoms = sdk.NewCoins(sdk.NewCoin("atom", sdk.NewInt(1000)))
)
// setupAcctsForTips sets up 2 accounts:
// - tipper has 1000 regens
@@ -182,7 +184,8 @@ func (s *MWTestSuite) mkFeePayerTxBuilder(
Data: &signing.SingleSignatureData{
SignMode: signMode,
Signature: nil,
}}
},
}
sigsV2 := append([]signing.SignatureV2{tipperSigsV2}, feePayerSigV2)
txBuilder.SetSignatures(sigsV2...)
+1 -1
View File
@@ -190,7 +190,7 @@ func mkDecoder(unmarshaler Unmarshaler) sdk.TxDecoder {
if len(txBytes) == 0 {
return nil, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "tx bytes are empty")
}
var tx = StdTx{}
tx := StdTx{}
// StdTx.Msg is an interface. The concrete types
// are registered by MakeTxCodec
err := unmarshaler(txBytes, &tx)
+1 -1
View File
@@ -26,7 +26,7 @@ var (
)
func init() {
var amino = codec.NewLegacyAmino()
amino := codec.NewLegacyAmino()
RegisterLegacyAminoCodec(amino)
}
-4
View File
@@ -48,7 +48,6 @@ const (
// PLEASE DO NOT REPLICATE THIS PATTERN IN YOUR OWN APP.
func migrateVestingAccounts(ctx sdk.Context, account types.AccountI, queryServer grpc.Server) (types.AccountI, error) {
bondDenom, err := getBondDenom(ctx, queryServer)
if err != nil {
return nil, err
}
@@ -64,7 +63,6 @@ func migrateVestingAccounts(ctx sdk.Context, account types.AccountI, queryServer
addr,
queryServer,
)
if err != nil {
return nil, err
}
@@ -74,7 +72,6 @@ func migrateVestingAccounts(ctx sdk.Context, account types.AccountI, queryServer
addr,
queryServer,
)
if err != nil {
return nil, err
}
@@ -85,7 +82,6 @@ func migrateVestingAccounts(ctx sdk.Context, account types.AccountI, queryServer
bondDenom,
queryServer,
)
if err != nil {
return nil, err
}
-11
View File
@@ -32,7 +32,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has vested, multiple delegations less than the total account balance",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(200)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
@@ -57,7 +56,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has vested, single delegations which exceed the vested amount",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(200)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
@@ -78,7 +76,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has vested, multiple delegations which exceed the vested amount",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(200)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
@@ -103,7 +100,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has not vested, single delegations which exceed the vested amount",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(200)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
@@ -122,7 +118,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has not vested, multiple delegations which exceed the vested amount",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(200)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().AddDate(1, 0, 0).Unix())
@@ -185,7 +180,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"delayed vesting has vested, single delegation greater than the total account balance",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(300)))
delayedAccount := types.NewDelayedVestingAccount(baseAccount, vestedCoins, ctx.BlockTime().Unix())
@@ -206,7 +200,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time after blocktime",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(1, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(2, 0, 0).Unix()
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
@@ -229,7 +222,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time passed but not ended",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(-1, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(2, 0, 0).Unix()
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
@@ -252,7 +244,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"continuous vesting, start time and endtime passed",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
startTime := ctx.BlockTime().AddDate(-2, 0, 0).Unix()
endTime := ctx.BlockTime().AddDate(-1, 0, 0).Unix()
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
@@ -275,7 +266,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
{
"periodic vesting account, yet to be vested, some rewards delegated",
func(app *simapp.SimApp, ctx sdk.Context, validator stakingtypes.Validator, delegatorAddr sdk.AccAddress) {
baseAccount := authtypes.NewBaseAccountWithAddress(delegatorAddr)
vestedCoins := sdk.NewCoins(sdk.NewCoin(app.StakingKeeper.BondDenom(ctx), sdk.NewInt(100)))
@@ -597,7 +587,6 @@ func TestMigrateVestingAccounts(t *testing.T) {
)
})
}
}
func trackingCorrected(ctx sdk.Context, t *testing.T, ak authkeeper.AccountKeeper, addr sdk.AccAddress, expDelVesting sdk.Coins, expDelFree sdk.Coins) {
+4 -2
View File
@@ -154,9 +154,11 @@ func (s *TxConfigTestSuite) TestTxBuilderSetSignatures() {
s.Require().NoError(err)
msigData = multisig.NewMultisig(2)
multisig.AddSignature(msigData, &signingtypes.SingleSignatureData{
SignMode: signModeHandler.DefaultMode(), Signature: mSigBz1}, 0)
SignMode: signModeHandler.DefaultMode(), Signature: mSigBz1,
}, 0)
multisig.AddSignature(msigData, &signingtypes.SingleSignatureData{
SignMode: signModeHandler.DefaultMode(), Signature: mSigBz2}, 0)
SignMode: signModeHandler.DefaultMode(), Signature: mSigBz2,
}, 0)
// set signature
sigData1.Signature = sigBz
-1
View File
@@ -30,7 +30,6 @@ func (signModeDirectAuxHandler) Modes() []signingtypes.SignMode {
func (signModeDirectAuxHandler) GetSignBytes(
mode signingtypes.SignMode, data signing.SignerData, tx sdk.Tx,
) ([]byte, error) {
if mode != signingtypes.SignMode_SIGN_MODE_DIRECT_AUX {
return nil, fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_DIRECT_AUX, mode)
}
+19 -10
View File
@@ -198,7 +198,7 @@ func TestRejectNonADR027(t *testing.T) {
// bodyBz's length prefix is 5, with `5` as varint encoding. We also try a
// longer varint encoding for 5: `133 00`.
longVarintBodyBz := append(append([]byte{bodyBz[0]}, byte(133), byte(00)), bodyBz[2:]...)
longVarintBodyBz := append(append([]byte{bodyBz[0]}, byte(133), byte(0o0)), bodyBz[2:]...)
tests := []struct {
name string
@@ -259,15 +259,24 @@ func TestVarintMinLength(t *testing.T) {
tests := []struct {
n uint64
}{
{1<<7 - 1}, {1 << 7},
{1<<14 - 1}, {1 << 14},
{1<<21 - 1}, {1 << 21},
{1<<28 - 1}, {1 << 28},
{1<<35 - 1}, {1 << 35},
{1<<42 - 1}, {1 << 42},
{1<<49 - 1}, {1 << 49},
{1<<56 - 1}, {1 << 56},
{1<<63 - 1}, {1 << 63},
{1<<7 - 1},
{1 << 7},
{1<<14 - 1},
{1 << 14},
{1<<21 - 1},
{1 << 21},
{1<<28 - 1},
{1 << 28},
{1<<35 - 1},
{1 << 35},
{1<<42 - 1},
{1 << 42},
{1<<49 - 1},
{1 << 49},
{1<<56 - 1},
{1 << 56},
{1<<63 - 1},
{1 << 63},
{math.MaxUint64},
}
-1
View File
@@ -42,6 +42,5 @@ func DefaultJSONTxEncoder(cdc codec.ProtoCodecMarshaler) sdk.TxEncoder {
}
return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx)
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ func QueryTx(clientCtx client.Context, hashHexStr string) (*sdk.TxResponse, erro
return nil, err
}
//TODO: this may not always need to be proven
// TODO: this may not always need to be proven
// https://github.com/cosmos/cosmos-sdk/issues/6807
resTx, err := node.Tx(context.Background(), hash, true)
if err != nil {
+2 -2
View File
@@ -3,9 +3,10 @@ package tx
import (
"context"
"fmt"
"strings"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"strings"
gogogrpc "github.com/gogo/protobuf/grpc"
"github.com/golang/protobuf/proto" // nolint: staticcheck
@@ -235,7 +236,6 @@ func (s txServer) GetBlockWithTxs(ctx context.Context, req *txtypes.GetBlockWith
Total: blockTxsLn,
},
}, nil
}
func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) {
+1 -3
View File
@@ -81,9 +81,7 @@ func TestGenesisAccountIterator(t *testing.T) {
}
func TestPackAccountsAny(t *testing.T) {
var (
accounts []*codectypes.Any
)
var accounts []*codectypes.Any
testCases := []struct {
msg string
-1
View File
@@ -26,7 +26,6 @@ func TestHasPermission(t *testing.T) {
has = permAddr.HasPermission(tc.permission)
require.Equal(t, tc.expectHas, has, "test case #%d", i)
}
}
func TestValidatePermissions(t *testing.T) {
@@ -1,3 +1,4 @@
//go:build norace
// +build norace
package testutil
-1
View File
@@ -222,5 +222,4 @@ func (s msgServer) CreatePeriodicVestingAccount(goCtx context.Context, msg *type
),
)
return &types.MsgCreatePeriodicVestingAccountResponse{}, nil
}
+1
View File
@@ -2,6 +2,7 @@ package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
+16 -8
View File
@@ -193,8 +193,10 @@ func (bva BaseVestingAccount) MarshalYAML() (interface{}, error) {
// Continuous Vesting Account
var _ vestexported.VestingAccount = (*ContinuousVestingAccount)(nil)
var _ authtypes.GenesisAccount = (*ContinuousVestingAccount)(nil)
var (
_ vestexported.VestingAccount = (*ContinuousVestingAccount)(nil)
_ authtypes.GenesisAccount = (*ContinuousVestingAccount)(nil)
)
// NewContinuousVestingAccountRaw creates a new ContinuousVestingAccount object from BaseVestingAccount
func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount {
@@ -307,8 +309,10 @@ func (cva ContinuousVestingAccount) MarshalYAML() (interface{}, error) {
// Periodic Vesting Account
var _ vestexported.VestingAccount = (*PeriodicVestingAccount)(nil)
var _ authtypes.GenesisAccount = (*PeriodicVestingAccount)(nil)
var (
_ vestexported.VestingAccount = (*PeriodicVestingAccount)(nil)
_ authtypes.GenesisAccount = (*PeriodicVestingAccount)(nil)
)
// NewPeriodicVestingAccountRaw creates a new PeriodicVestingAccount object from BaseVestingAccount
func NewPeriodicVestingAccountRaw(bva *BaseVestingAccount, startTime int64, periods Periods) *PeriodicVestingAccount {
@@ -451,8 +455,10 @@ func (pva PeriodicVestingAccount) MarshalYAML() (interface{}, error) {
// Delayed Vesting Account
var _ vestexported.VestingAccount = (*DelayedVestingAccount)(nil)
var _ authtypes.GenesisAccount = (*DelayedVestingAccount)(nil)
var (
_ vestexported.VestingAccount = (*DelayedVestingAccount)(nil)
_ authtypes.GenesisAccount = (*DelayedVestingAccount)(nil)
)
// NewDelayedVestingAccountRaw creates a new DelayedVestingAccount object from BaseVestingAccount
func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount {
@@ -519,8 +525,10 @@ func (dva DelayedVestingAccount) String() string {
//-----------------------------------------------------------------------------
// Permanent Locked Vesting Account
var _ vestexported.VestingAccount = (*PermanentLockedAccount)(nil)
var _ authtypes.GenesisAccount = (*PermanentLockedAccount)(nil)
var (
_ vestexported.VestingAccount = (*PermanentLockedAccount)(nil)
_ authtypes.GenesisAccount = (*PermanentLockedAccount)(nil)
)
// NewPermanentLockedAccount returns a PermanentLockedAccount
func NewPermanentLockedAccount(baseAcc *authtypes.BaseAccount, coins sdk.Coins) *PermanentLockedAccount {
+3 -1
View File
@@ -362,7 +362,8 @@ func TestGetVestedCoinsPeriodicVestingAcc(t *testing.T) {
vestedCoins = pva.GetVestedCoins(now.Add(18 * time.Hour))
require.Equal(t,
sdk.Coins{
sdk.NewInt64Coin(feeDenom, 750), sdk.NewInt64Coin(stakeDenom, 75)}, vestedCoins)
sdk.NewInt64Coin(feeDenom, 750), sdk.NewInt64Coin(stakeDenom, 75),
}, vestedCoins)
// require 100% of coins vested
vestedCoins = pva.GetVestedCoins(now.Add(48 * time.Hour))
@@ -809,6 +810,7 @@ func (s *VestingAccountTestSuite) TestDelayedVestingAccountMarshal() {
_, err = app.AccountKeeper.UnmarshalAccount(bz[:len(bz)/2])
require.NotNil(err)
}
func (s *VestingAccountTestSuite) TestPermanentLockedAccountMarshal() {
app := s.app
require := s.Require()