Migrate x/auth cmd's to TxGenerator marshaling (#6391)

* Migrate encode, decode, and broadcast cmd's to use TxGenerator marshal methods

* Fix tests, add EncodingConfig

* Add simapp/encoding.go and wire up with simcli

* add godocs

* fix tests

* Debugging CLI Tests

* Fix integration test

* 6391 - lint issues and code coverage (#6414)

* fixed lint issue of "txEncodeRespStr"

* added tests for encode.go

* WIP: added tests for decode.go

* added txEncoder at bytes

* updated decode test

* updated txBytes to use TxEncoder in decoder test

* added a require after TxEncoder

* removed file save

* debug decode command

* fixed decode tests

* added decode cli

* updated encode and decode in a single file

* separated decode test from encode test

* review changes

* removed register interface

* review change

* Fix tests

* WIP add test for tx sign

* removed commented code

* Fix flags

* WIP add test for sign

* Address review suggestions

* fixed command issue

* Add tests for TxEncoder

* Revert sign changes

* Fix TxEncoder tests

* Fix GetSign Cmd

* Add tx test

* Remove duplicate validation

* Add tests for TxDecoder

* Fix tests

* Fix tests

* Output to clientCtx.Output

* Fix cli_tests

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Aaron Craelius
2020-06-18 20:29:41 +00:00
committed by GitHub
co-authored by atheeshp atheesh anilCSE sahith-narahari mergify[bot]
parent 5040ff87c4
commit 712d23740f
32 changed files with 440 additions and 179 deletions
+29 -29
View File
@@ -7,33 +7,30 @@ import (
"testing"
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/std"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/simapp"
)
var (
cdc = std.MakeCodec(simapp.ModuleBasics)
"github.com/cosmos/cosmos-sdk/simapp/params"
)
// Fixtures is used to setup the testing environment
type Fixtures struct {
BuildDir string
RootDir string
SimdBinary string
SimcliBinary string
ChainID string
RPCAddr string
Port string
SimdHome string
SimcliHome string
P2PAddr string
Cdc *codec.Codec
T *testing.T
BuildDir string
RootDir string
SimdBinary string
SimcliBinary string
ChainID string
RPCAddr string
Port string
SimdHome string
SimcliHome string
P2PAddr string
Cdc *codec.Codec
EncodingConfig params.EncodingConfig
T *testing.T
}
// NewFixtures creates a new instance of Fixtures with many vars set
@@ -52,18 +49,21 @@ func NewFixtures(t *testing.T) *Fixtures {
t.Skip("builddir is empty, skipping")
}
encodingConfig := simapp.MakeEncodingConfig()
return &Fixtures{
T: t,
BuildDir: buildDir,
RootDir: tmpDir,
SimdBinary: filepath.Join(buildDir, "simd"),
SimcliBinary: filepath.Join(buildDir, "simcli"),
SimdHome: filepath.Join(tmpDir, ".simd"),
SimcliHome: filepath.Join(tmpDir, ".simcli"),
RPCAddr: servAddr,
P2PAddr: p2pAddr,
Cdc: cdc,
Port: port,
T: t,
BuildDir: buildDir,
RootDir: tmpDir,
SimdBinary: filepath.Join(buildDir, "simd"),
SimcliBinary: filepath.Join(buildDir, "simcli"),
SimdHome: filepath.Join(tmpDir, ".simd"),
SimcliHome: filepath.Join(tmpDir, ".simcli"),
RPCAddr: servAddr,
P2PAddr: p2pAddr,
Cdc: encodingConfig.Amino,
EncodingConfig: encodingConfig,
Port: port,
}
}
+1 -4
View File
@@ -11,8 +11,6 @@ import (
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
@@ -99,8 +97,7 @@ func TestCLISimdAddGenesisAccount(t *testing.T) {
genesisState := f.GenesisState()
interfaceRegistry := codectypes.NewInterfaceRegistry()
appCodec := std.NewAppCodec(f.Cdc, interfaceRegistry)
appCodec := f.EncodingConfig.Marshaler
accounts := authtypes.GetGenesisStateFromAppState(appCodec, genesisState).Accounts
balances := banktypes.GetGenesisStateFromAppState(f.Cdc, genesisState).Balances