forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate x/auth cmd's to TxGenerator marshaling (cosmos#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 (cosmos#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 <[email protected]> Co-authored-by: atheesh <[email protected]> Co-authored-by: anilCSE <[email protected]> Co-authored-by: sahith-narahari <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
653353f
commit d6d10d0
Showing
6 changed files
with
84 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package simapp | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/simapp/params" | ||
"github.com/cosmos/cosmos-sdk/std" | ||
) | ||
|
||
// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. | ||
// | ||
// TODO: this file should add a "+build test_amino" flag for #6190 and a proto.go file with a protobuf configuration | ||
func MakeEncodingConfig() params.EncodingConfig { | ||
encodingConfig := params.MakeEncodingConfig() | ||
std.RegisterCodec(encodingConfig.Amino) | ||
std.RegisterInterfaces(encodingConfig.InterfaceRegistry) | ||
ModuleBasics.RegisterCodec(encodingConfig.Amino) | ||
ModuleBasics.RegisterInterfaceModules(encodingConfig.InterfaceRegistry) | ||
return encodingConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package params | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/codec/types" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
) | ||
|
||
// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. | ||
// | ||
// TODO: this file should add a "+build test_amino" flag for #6190 and a proto.go file with a protobuf configuration | ||
func MakeEncodingConfig() EncodingConfig { | ||
cdc := codec.New() | ||
interfaceRegistry := types.NewInterfaceRegistry() | ||
marshaler := codec.NewHybridCodec(cdc, interfaceRegistry) | ||
|
||
return EncodingConfig{ | ||
InterfaceRegistry: interfaceRegistry, | ||
Marshaler: marshaler, | ||
TxGenerator: authtypes.StdTxGenerator{Cdc: cdc}, | ||
Amino: cdc, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package params | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
"github.com/cosmos/cosmos-sdk/codec/types" | ||
) | ||
|
||
// EncodingConfig specifies the concrete encoding types to use for a given app. | ||
// This is provided for compatibility between protobuf and amino implementations. | ||
type EncodingConfig struct { | ||
InterfaceRegistry types.InterfaceRegistry | ||
Marshaler codec.Marshaler | ||
TxGenerator client.TxGenerator | ||
Amino *codec.Codec | ||
} |