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
+1
View File
@@ -6,4 +6,5 @@ import "github.com/cosmos/cosmos-sdk/codec"
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*Msg)(nil), nil)
cdc.RegisterInterface((*Tx)(nil), nil)
cdc.RegisterInterface((*Signature)(nil), nil)
}
+2 -1
View File
@@ -4,9 +4,10 @@ import (
"strings"
"testing"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
)
var (
+8
View File
@@ -2,6 +2,8 @@ package types
import (
"encoding/json"
"github.com/tendermint/tendermint/crypto"
)
// Transactions messages must fulfill the Msg
@@ -42,6 +44,12 @@ type Tx interface {
//__________________________________________________________
// Signature defines the properties of the signature payload.
type Signature interface {
GetPubKey() crypto.PubKey
GetSignature() []byte
}
// TxDecoder unmarshals transaction bytes
type TxDecoder func(txBytes []byte) (Tx, Error)