Generalize auth/types.StdSignature (#4507)

New Signature interface available in the top level types package.
auth.StdSignature implements such interface. User defined auth
module can now define their own custom signature types.

Work carried out in the context of the following issues:
- #4488
- #4487
This commit is contained in:
Alessio Treglia
2019-06-07 14:21:35 +01:00
committed by GitHub
parent c777fb9108
commit a32d5a46d7
29 changed files with 124 additions and 78 deletions
+2 -1
View File
@@ -3,8 +3,9 @@ package keys
import (
"io/ioutil"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/input"
)
func importKeyCommand() *cobra.Command {
+2 -1
View File
@@ -1,8 +1,9 @@
package keys
import (
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/flags"
)
func listKeysCmd() *cobra.Command {
+2 -1
View File
@@ -5,9 +5,10 @@ import (
"strings"
"testing"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/input"
)
func Test_RunMnemonicCmdNormal(t *testing.T) {
+2 -1
View File
@@ -3,8 +3,9 @@ package keys
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/input"
)
func updateKeyCommand() *cobra.Command {
+4 -4
View File
@@ -100,7 +100,7 @@ func TestReadStdTxFromFile(t *testing.T) {
// Build a test transaction
fee := authtypes.NewStdFee(50000, sdk.Coins{sdk.NewInt64Coin("atom", 150)})
stdTx := authtypes.NewStdTx([]sdk.Msg{}, fee, []authtypes.StdSignature{}, "foomemo")
stdTx := authtypes.NewStdTx([]sdk.Msg{}, fee, nil, "foomemo")
// Write it to the file
encodedTx, _ := cdc.MarshalJSON(stdTx)
@@ -143,8 +143,8 @@ func TestValidateCmd(t *testing.T) {
}{
{"misspelled command", []string{"comission"}, true},
{"no command provided", []string{}, false},
{"help flag", []string{"comission", "--help"}, false},
{"shorthand help flag", []string{"comission", "-h"}, false},
{"help flag", []string{"commission", "--help"}, false},
{"shorthand help flag", []string{"commission", "-h"}, false},
}
for _, tt := range tests {
@@ -158,7 +158,7 @@ func TestValidateCmd(t *testing.T) {
func compareEncoders(t *testing.T, expected sdk.TxEncoder, actual sdk.TxEncoder) {
msgs := []sdk.Msg{sdk.NewTestMsg(addr)}
tx := authtypes.NewStdTx(msgs, authtypes.StdFee{}, []authtypes.StdSignature{}, "")
tx := authtypes.NewStdTx(msgs, authtypes.StdFee{}, []sdk.Signature{}, "")
defaultEncoderBytes, err := expected(tx)
require.NoError(t, err)