Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 38 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
92c9a77
Migrate encode, decode, and broadcast cmd's to use TxGenerator marsha…
aaronc Jun 10, 2020
fed32e2
Fix tests, add EncodingConfig
aaronc Jun 10, 2020
826785e
Add simapp/encoding.go and wire up with simcli
aaronc Jun 10, 2020
91cf429
add godocs
aaronc Jun 10, 2020
eebd0f8
Merge branch 'master' into aaronc/6213-cli-encode
aaronc Jun 10, 2020
1e265f8
fix tests
aaronc Jun 10, 2020
1467cd4
Debugging CLI Tests
aaronc Jun 10, 2020
de78d03
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Jun 11, 2020
23cdeeb
Fix integration test
aaronc Jun 11, 2020
b878734
6391 - lint issues and code coverage (#6414)
atheeshp Jun 15, 2020
7b1fc09
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Jun 15, 2020
e4db342
Fix tests
aaronc Jun 15, 2020
50b56e2
WIP add test for tx sign
atheeshp Jun 16, 2020
796352b
removed commented code
atheeshp Jun 16, 2020
ec3bdfa
Fix flags
anilcse Jun 16, 2020
709b09f
WIP add test for sign
atheeshp Jun 17, 2020
b5e52ff
fixed conflicts
atheeshp Jun 17, 2020
7745688
Address review suggestions
sahith-narahari Jun 17, 2020
1701624
fixed command issue
atheeshp Jun 18, 2020
3496a34
fixed conflicts
atheeshp Jun 18, 2020
5063d7c
Add tests for TxEncoder
sahith-narahari Jun 18, 2020
893e265
Revert sign changes
sahith-narahari Jun 18, 2020
32bbf12
Fix TxEncoder tests
sahith-narahari Jun 18, 2020
a51b36e
Fix GetSign Cmd
sahith-narahari Jun 18, 2020
c33987d
Add tx test
sahith-narahari Jun 18, 2020
766f808
Remove duplicate validation
sahith-narahari Jun 18, 2020
e0cb1d4
Add tests for TxDecoder
sahith-narahari Jun 18, 2020
2621815
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Jun 18, 2020
78daa5e
Fix tests
aaronc Jun 18, 2020
c1d5bf3
Fix tests
aaronc Jun 18, 2020
3bbd081
Merge branch 'master' into aaronc/6213-cli-encode
aaronc Jun 18, 2020
4c5ae0d
Merge branch 'master' into aaronc/6213-cli-encode
mergify[bot] Jun 18, 2020
6cf5831
Output to clientCtx.Output
aaronc Jun 18, 2020
81dc00b
Merge remote-tracking branch 'origin/aaronc/6213-cli-encode' into aar…
aaronc Jun 18, 2020
9fd638a
Merge branch 'master' into aaronc/6213-cli-encode
aaronc Jun 18, 2020
23642fb
Merge branch 'master' into aaronc/6213-cli-encode
mergify[bot] Jun 18, 2020
2f5ac90
Fix cli_tests
sahith-narahari Jun 18, 2020
f578b59
Merge branch 'aaronc/6213-cli-encode' of github.com:cosmos/cosmos-sdk…
sahith-narahari Jun 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
…ronc/6213-cli-encode
  • Loading branch information
aaronc committed Jun 18, 2020
commit 2621815eaf9de2b2dde9b3ef4bd5f1e24aff3178
8 changes: 7 additions & 1 deletion client/tx/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ func Sign(txf Factory, name string, tx client.TxBuilder) error {
return err
}

return txf.txGenerator.TxEncoder()(tx.GetTx())
sigData.Signature = sigBytes
sig = signing.SignatureV2{
PubKey: pubKey,
Data: sigData,
}

return tx.SetSignatures(sig)
}

// GasEstimateResponse defines a response definition for tx gas estimation.
Expand Down
25 changes: 6 additions & 19 deletions client/tx_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,13 @@ type (
// application-defined concrete transaction type. The type returned must
// implement TxBuilder.
TxGenerator interface {
NewTx() TxBuilder
NewFee() Fee
NewSignature() Signature
NewTxBuilder() TxBuilder
SignModeHandler() signing.SignModeHandler

TxEncoder() types.TxEncoder
TxDecoder() types.TxDecoder
TxJSONEncoder() types.TxEncoder
TxJSONDecoder() types.TxDecoder
}

Fee interface {
types.Fee
SetGas(uint64)
SetAmount(types.Coins)
}

Signature interface {
types.Signature
SetPubKey(crypto.PubKey) error
SetSignature([]byte)
TxEncoder() sdk.TxEncoder
TxDecoder() sdk.TxDecoder
TxJSONEncoder() sdk.TxEncoder
TxJSONDecoder() sdk.TxDecoder
}

// TxBuilder defines an interface which an application-defined concrete transaction
Expand Down
3 changes: 2 additions & 1 deletion codec/testdata/test_helper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package testdata

import (
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/tendermint/go-amino"

"github.com/cosmos/cosmos-sdk/codec/types"
)

func NewTestInterfaceRegistry() types.InterfaceRegistry {
Expand Down
2 changes: 1 addition & 1 deletion x/auth/client/cli/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ <appcli> tx broadcast ./mytxn.json
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init()
clientCtx = clientCtx.Init().WithJSONMarshaler(cdc)

if clientCtx.Offline {
return errors.New("cannot broadcast tx during offline mode")
Expand Down
2 changes: 1 addition & 1 deletion x/auth/client/cli/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Read a transaction from <file>, serialize it to the Amino wire protocol, and out
If you supply a dash (-) argument in place of an input filename, the command reads from standard input.`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx := clientCtx.Init()
cliCtx := clientCtx.Init().WithJSONMarshaler(cdc)

tx, err := authclient.ReadTxFromFile(cliCtx, args[0])
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/auth/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestSupply_ValidatePermissions(t *testing.T) {
maccPerms[randomPerm] = []string{"random"}

cdc, _ := simapp.MakeCodecs()
keeper := auth.NewAccountKeeper(
keeper := keeper.NewAccountKeeper(
cdc, app.GetKey(types.StoreKey), app.GetSubspace(types.ModuleName),
types.ProtoBaseAccount, maccPerms,
)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.