From fd811ccaa1db33571e430129188724ba0921845a Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Thu, 28 Oct 2021 15:40:04 +0200
Subject: [PATCH 01/17] create auxtx
---
client/tx/aux_builder.go | 7 +
docs/core/proto-docs.md | 19 ++
proto/cosmos/tx/v1beta1/tx.proto | 11 +
types/tx/tx.pb.go | 363 +++++++++++++++++++++++++------
4 files changed, 339 insertions(+), 61 deletions(-)
create mode 100644 client/tx/aux_builder.go
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
new file mode 100644
index 000000000000..b82685a6a04c
--- /dev/null
+++ b/client/tx/aux_builder.go
@@ -0,0 +1,7 @@
+package tx
+
+import "github.com/cosmos/cosmos-sdk/types/tx"
+
+type AuxTxBuilder struct {
+ auxTx tx.AuxTx
+}
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 04cffc6b13e9..b8db210a702b 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -661,6 +661,7 @@
- [cosmos/tx/v1beta1/tx.proto](#cosmos/tx/v1beta1/tx.proto)
- [AuthInfo](#cosmos.tx.v1beta1.AuthInfo)
+ - [AuxTx](#cosmos.tx.v1beta1.AuxTx)
- [Fee](#cosmos.tx.v1beta1.Fee)
- [ModeInfo](#cosmos.tx.v1beta1.ModeInfo)
- [ModeInfo.Multi](#cosmos.tx.v1beta1.ModeInfo.Multi)
@@ -9474,6 +9475,24 @@ Since: cosmos-sdk 0.45 |
+
+
+### AuxTx
+AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
+to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
+and will be rejected by the node if sent directly as-is.
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| `sign_doc` | [SignDocDirectAux](#cosmos.tx.v1beta1.SignDocDirectAux) | | sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer signs. |
+| `sig` | [bytes](#bytes) | | sig is the signature of the sign doc. |
+
+
+
+
+
+
### Fee
diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto
index a26cad5d54df..71bcd3fc45cf 100644
--- a/proto/cosmos/tx/v1beta1/tx.proto
+++ b/proto/cosmos/tx/v1beta1/tx.proto
@@ -221,3 +221,14 @@ message Tip {
// tipper is the address of the account paying for the tip
string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
+
+// AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
+// to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
+// and will be rejected by the node if sent directly as-is.
+message AuxTx {
+ // sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
+ // signs.
+ SignDocDirectAux sign_doc = 1;
+ // sig is the signature of the sign doc.
+ bytes sig = 2;
+}
diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go
index 6a7df6c004c3..11e1b5ea2585 100644
--- a/types/tx/tx.pb.go
+++ b/types/tx/tx.pb.go
@@ -907,6 +907,64 @@ func (m *Tip) GetTipper() string {
return ""
}
+// AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
+// to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
+// and will be rejected by the node if sent directly as-is.
+type AuxTx struct {
+ // sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
+ // signs.
+ SignDoc *SignDocDirectAux `protobuf:"bytes,1,opt,name=sign_doc,json=signDoc,proto3" json:"sign_doc,omitempty"`
+ // sig is the signature of the sign doc.
+ Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"`
+}
+
+func (m *AuxTx) Reset() { *m = AuxTx{} }
+func (m *AuxTx) String() string { return proto.CompactTextString(m) }
+func (*AuxTx) ProtoMessage() {}
+func (*AuxTx) Descriptor() ([]byte, []int) {
+ return fileDescriptor_96d1575ffde80842, []int{10}
+}
+func (m *AuxTx) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *AuxTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_AuxTx.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *AuxTx) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AuxTx.Merge(m, src)
+}
+func (m *AuxTx) XXX_Size() int {
+ return m.Size()
+}
+func (m *AuxTx) XXX_DiscardUnknown() {
+ xxx_messageInfo_AuxTx.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_AuxTx proto.InternalMessageInfo
+
+func (m *AuxTx) GetSignDoc() *SignDocDirectAux {
+ if m != nil {
+ return m.SignDoc
+ }
+ return nil
+}
+
+func (m *AuxTx) GetSig() []byte {
+ if m != nil {
+ return m.Sig
+ }
+ return nil
+}
+
func init() {
proto.RegisterType((*Tx)(nil), "cosmos.tx.v1beta1.Tx")
proto.RegisterType((*TxRaw)(nil), "cosmos.tx.v1beta1.TxRaw")
@@ -920,72 +978,76 @@ func init() {
proto.RegisterType((*ModeInfo_Multi)(nil), "cosmos.tx.v1beta1.ModeInfo.Multi")
proto.RegisterType((*Fee)(nil), "cosmos.tx.v1beta1.Fee")
proto.RegisterType((*Tip)(nil), "cosmos.tx.v1beta1.Tip")
+ proto.RegisterType((*AuxTx)(nil), "cosmos.tx.v1beta1.AuxTx")
}
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
var fileDescriptor_96d1575ffde80842 = []byte{
- // 957 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0x45,
- 0x14, 0xf7, 0x66, 0x6d, 0xc7, 0x7e, 0x6d, 0xfa, 0x67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x9e, 0x0e, 0x1a, 0x4f, 0x6f, 0xad, 0x4e, 0x9f, 0xaf, 0x16, 0x61, 0xdb, 0xfc, 0x72, 0x77, 0xfe,
- 0x0e, 0x00, 0x00, 0xff, 0xff, 0x82, 0x38, 0x16, 0x01, 0xda, 0x08, 0x00, 0x00,
+ // 996 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xdc, 0x44,
+ 0x14, 0x5e, 0xc7, 0xbb, 0x9b, 0xdd, 0xd7, 0xa4, 0x4d, 0x47, 0x11, 0xda, 0x6c, 0xd4, 0x6d, 0xd8,
+ 0xaa, 0xb0, 0x97, 0xd8, 0x69, 0x7a, 0x68, 0x41, 0x08, 0xd8, 0x6d, 0xa9, 0x52, 0x95, 0x82, 0x34,
+ 0xc9, 0x85, 0x5e, 0x2c, 0xaf, 0x3d, 0xf1, 0x8e, 0xba, 0x9e, 0x31, 0x9e, 0x31, 0xd8, 0x3f, 0x02,
+ 0xa9, 0x42, 0x42, 0x5c, 0x39, 0x73, 0xe6, 0x47, 0xf4, 0x58, 0x71, 0xe2, 0x04, 0x55, 0x72, 0x44,
+ 0xe2, 0x2f, 0x80, 0x66, 0x3c, 0x76, 0xd2, 0x92, 0xee, 0x56, 0x82, 0x93, 0x67, 0xde, 0x7c, 0xef,
+ 0x9b, 0xef, 0xcd, 0x7b, 0x7e, 0x0f, 0xfa, 0x01, 0x17, 0x31, 0x17, 0xae, 0xcc, 0xdd, 0x6f, 0x6e,
+ 0x4d, 0x89, 0xf4, 0x6f, 0xb9, 0x32, 0x77, 0x92, 0x94, 0x4b, 0x8e, 0xae, 0x96, 0x67, 0x8e, 0xcc,
+ 0x1d, 0x73, 0xd6, 0xdf, 0x8c, 0x78, 0xc4, 0xf5, 0xa9, 0xab, 0x56, 0x25, 0xb0, 0xbf, 0x6b, 0x48,
+ 0x82, 0xb4, 0x48, 0x24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 0xe2, 0x50, 0xa6, 0x94,
+ 0x45, 0xb8, 0x84, 0xa1, 0x7d, 0x58, 0x8d, 0x52, 0x9f, 0x49, 0xd3, 0xd7, 0x16, 0x79, 0x54, 0xc0,
+ 0x61, 0x02, 0xf6, 0x11, 0x4d, 0xd0, 0x9d, 0xb7, 0x0f, 0xb6, 0xa9, 0x82, 0xad, 0x03, 0xd8, 0x83,
+ 0xb6, 0xa4, 0x49, 0x42, 0xd2, 0xb2, 0x55, 0x2d, 0xb8, 0xd2, 0xe0, 0x86, 0x5f, 0x41, 0x6b, 0x9c,
+ 0xe5, 0x47, 0x39, 0xfa, 0x18, 0x3a, 0xaa, 0x48, 0xbc, 0x90, 0x07, 0x26, 0xf1, 0x37, 0xde, 0xf0,
+ 0xdf, 0x9f, 0x9f, 0x19, 0x78, 0x55, 0x98, 0xd1, 0xb6, 0x01, 0xb6, 0xa0, 0x91, 0x99, 0x57, 0x6a,
+ 0x39, 0xf9, 0xe4, 0xf9, 0xc9, 0xc0, 0x7a, 0x71, 0x32, 0xb0, 0x5e, 0x9e, 0x0c, 0xac, 0x67, 0xa7,
+ 0x83, 0xc6, 0x8b, 0xd3, 0x41, 0xe3, 0xb7, 0xd3, 0x41, 0xe3, 0xc9, 0xcd, 0xe5, 0x99, 0x71, 0x65,
+ 0x3e, 0x6d, 0xeb, 0xbf, 0xf9, 0xf6, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x1a, 0x4b, 0xde,
+ 0x35, 0x09, 0x00, 0x00,
}
func (m *Tx) Marshal() (dAtA []byte, err error) {
@@ -1655,6 +1717,48 @@ func (m *Tip) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *AuxTx) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *AuxTx) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *AuxTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Sig) > 0 {
+ i -= len(m.Sig)
+ copy(dAtA[i:], m.Sig)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Sig)))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.SignDoc != nil {
+ {
+ size, err := m.SignDoc.MarshalToSizedBuffer(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = encodeVarintTx(dAtA, i, uint64(size))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@@ -1956,6 +2060,23 @@ func (m *Tip) Size() (n int) {
return n
}
+func (m *AuxTx) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.SignDoc != nil {
+ l = m.SignDoc.Size()
+ n += 1 + l + sovTx(uint64(l))
+ }
+ l = len(m.Sig)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
+ return n
+}
+
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@@ -3753,6 +3874,126 @@ func (m *Tip) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *AuxTx) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: AuxTx: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: AuxTx: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field SignDoc", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.SignDoc == nil {
+ m.SignDoc = &SignDocDirectAux{}
+ }
+ if err := m.SignDoc.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Sig", wireType)
+ }
+ var byteLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ byteLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if byteLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + byteLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Sig = append(m.Sig[:0], dAtA[iNdEx:postIndex]...)
+ if m.Sig == nil {
+ m.Sig = []byte{}
+ }
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipTx(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthTx
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
From e7c1f70bd5011475719f4e1724271c7557f198bf Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Thu, 28 Oct 2021 16:17:35 +0200
Subject: [PATCH 02/17] Add setters on AuxTxBuilder
---
client/tx/aux_builder.go | 140 ++++++++++++++++++++++++++++++++++++++-
types/tx/aux.go | 49 ++++++++++++++
2 files changed, 187 insertions(+), 2 deletions(-)
create mode 100644 types/tx/aux.go
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index b82685a6a04c..e0c7ddcaa236 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -1,7 +1,143 @@
package tx
-import "github.com/cosmos/cosmos-sdk/types/tx"
+import (
+ "github.com/gogo/protobuf/proto"
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+ cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/cosmos/cosmos-sdk/types/tx"
+)
+
+// AuxTxBuilder is a client-side builder for creating an AuxTx.
type AuxTxBuilder struct {
- auxTx tx.AuxTx
+ body *tx.TxBody
+ auxTx *tx.AuxTx
+}
+
+func (b *AuxTxBuilder) SetMemo(memo string) {
+ b.checkEmptyFields()
+
+ b.body.Memo = memo
+}
+
+func (b *AuxTxBuilder) SetTimeoutHeight(height uint64) {
+ b.checkEmptyFields()
+
+ b.body.TimeoutHeight = height
+}
+
+func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
+ anys := make([]*codectypes.Any, len(msgs))
+ for i, msg := range msgs {
+ var err error
+ anys[i], err = codectypes.NewAnyWithValue(msg)
+ if err != nil {
+ return err
+ }
+ }
+
+ b.checkEmptyFields()
+
+ b.body.Messages = anys
+
+ return nil
+}
+
+func (b *AuxTxBuilder) SetAccountNumber(accNum uint64) {
+ b.checkEmptyFields()
+
+ b.auxTx.SignDoc.AccountNumber = accNum
+}
+
+func (b *AuxTxBuilder) SetChainID(chainID string) {
+ b.checkEmptyFields()
+
+ b.auxTx.SignDoc.ChainId = chainID
+}
+
+func (b *AuxTxBuilder) SetSequence(accSeq uint64) {
+ b.checkEmptyFields()
+
+ b.auxTx.SignDoc.Sequence = accSeq
+}
+
+func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
+ b.checkEmptyFields()
+
+ any, err := codectypes.NewAnyWithValue(pk)
+ if err != nil {
+ return err
+ }
+
+ b.auxTx.SignDoc.PublicKey = any
+
+ return nil
+}
+
+func (b *AuxTxBuilder) SetSignature(sig []byte) {
+ if b.auxTx == nil {
+ b.auxTx = &tx.AuxTx{}
+ }
+
+ b.auxTx.Sig = sig
+}
+
+// GetSignBytes returns the builder's sign bytes.
+func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
+ body := b.body
+ if body == nil {
+ return nil, sdkerrors.ErrLogic.Wrap("tx body is nil, call setters on AuxTxBuilder first")
+ }
+
+ bodyBz, err := proto.Marshal(body)
+ if err != nil {
+ return nil, err
+ }
+
+ auxTx := b.auxTx
+ if auxTx == nil {
+ return nil, sdkerrors.ErrLogic.Wrap("aux tx is nil, call setters on AuxTxBuilder first")
+ }
+
+ sd := auxTx.SignDoc
+ if sd == nil {
+ return nil, sdkerrors.ErrLogic.Wrap("sign doc is nil, call setters on AuxTxBuilder first")
+ }
+
+ sd.BodyBytes = bodyBz
+
+ if err := b.auxTx.SignDoc.ValidateBasic(); err != nil {
+ return nil, err
+ }
+
+ signBz, err := proto.Marshal(b.auxTx.SignDoc)
+ if err != nil {
+ return nil, err
+ }
+
+ return signBz, nil
+}
+
+// GetAuxTx returns the builder's AuxTx.
+func (b *AuxTxBuilder) GetAuxTx() (*tx.AuxTx, error) {
+ if err := b.auxTx.ValidateBasic(); err != nil {
+ return nil, err
+ }
+
+ return b.auxTx, nil
+}
+
+func (b *AuxTxBuilder) checkEmptyFields() {
+ if b.body == nil {
+ b.body = &tx.TxBody{}
+ }
+
+ if b.auxTx == nil {
+ b.auxTx = &tx.AuxTx{}
+ if b.auxTx.SignDoc == nil {
+ b.auxTx.SignDoc = &tx.SignDocDirectAux{}
+ }
+ }
}
diff --git a/types/tx/aux.go b/types/tx/aux.go
new file mode 100644
index 000000000000..71c05f87afa6
--- /dev/null
+++ b/types/tx/aux.go
@@ -0,0 +1,49 @@
+package tx
+
+import (
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+ cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
+ sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+)
+
+// ValidateBasic performs stateless validation of the sign doc.
+func (s *SignDocDirectAux) ValidateBasic() error {
+ if len(s.BodyBytes) == 0 {
+ return sdkerrors.ErrInvalidRequest.Wrap("body bytes cannot be empty")
+ }
+
+ if s.PublicKey == nil {
+ return sdkerrors.ErrInvalidPubKey.Wrap("public key cannot be empty")
+ }
+
+ if s.Tip != nil {
+ if len(s.Tip.Amount) == 0 {
+ return sdkerrors.ErrInvalidRequest.Wrap("tip amount cannot be empty")
+ }
+
+ if s.Tip.Tipper == "" {
+ return sdkerrors.ErrInvalidRequest.Wrap("tipper cannot be empty")
+ }
+ }
+
+ return nil
+}
+
+// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
+func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
+ return unpacker.UnpackAny(s.PublicKey, new(cryptotypes.PubKey))
+}
+
+// ValidateBasic performs stateless validation of the auxiliary tx.
+func (a *AuxTx) ValidateBasic() error {
+ if len(a.Sig) == 0 {
+ return sdkerrors.ErrNoSignatures.Wrap("signature cannot be empty")
+ }
+
+ return a.GetSignDoc().ValidateBasic()
+}
+
+// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
+func (a *AuxTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
+ return a.GetSignDoc().UnpackInterfaces(unpacker)
+}
From 2c68763b55034bae3559978c2d392ccffceed17e Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Thu, 28 Oct 2021 16:28:37 +0200
Subject: [PATCH 03/17] Add set tip
---
client/tx/aux_builder.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index e0c7ddcaa236..028d330a457c 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -64,18 +64,24 @@ func (b *AuxTxBuilder) SetSequence(accSeq uint64) {
}
func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
- b.checkEmptyFields()
-
any, err := codectypes.NewAnyWithValue(pk)
if err != nil {
return err
}
+ b.checkEmptyFields()
+
b.auxTx.SignDoc.PublicKey = any
return nil
}
+func (b *AuxTxBuilder) SetTip(tip *tx.Tip) {
+ b.checkEmptyFields()
+
+ b.auxTx.SignDoc.Tip = tip
+}
+
func (b *AuxTxBuilder) SetSignature(sig []byte) {
if b.auxTx == nil {
b.auxTx = &tx.AuxTx{}
From dcfe5ae4feb1752189e5ed28b26d8a2df82033c0 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Thu, 28 Oct 2021 17:29:23 +0200
Subject: [PATCH 04/17] Rename to AuxSignerData
---
client/tx/aux_builder.go | 40 +++----
docs/core/proto-docs.md | 13 ++-
proto/cosmos/tx/v1beta1/tx.proto | 9 +-
types/tx/tx.pb.go | 183 ++++++++++++++++---------------
4 files changed, 124 insertions(+), 121 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index 028d330a457c..05a6aaa66196 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -12,8 +12,8 @@ import (
// AuxTxBuilder is a client-side builder for creating an AuxTx.
type AuxTxBuilder struct {
- body *tx.TxBody
- auxTx *tx.AuxTx
+ body *tx.TxBody
+ auxSignerData *tx.AuxSignerData
}
func (b *AuxTxBuilder) SetMemo(memo string) {
@@ -48,19 +48,19 @@ func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
func (b *AuxTxBuilder) SetAccountNumber(accNum uint64) {
b.checkEmptyFields()
- b.auxTx.SignDoc.AccountNumber = accNum
+ b.auxSignerData.SignDoc.AccountNumber = accNum
}
func (b *AuxTxBuilder) SetChainID(chainID string) {
b.checkEmptyFields()
- b.auxTx.SignDoc.ChainId = chainID
+ b.auxSignerData.SignDoc.ChainId = chainID
}
func (b *AuxTxBuilder) SetSequence(accSeq uint64) {
b.checkEmptyFields()
- b.auxTx.SignDoc.Sequence = accSeq
+ b.auxSignerData.SignDoc.Sequence = accSeq
}
func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
@@ -71,7 +71,7 @@ func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
b.checkEmptyFields()
- b.auxTx.SignDoc.PublicKey = any
+ b.auxSignerData.SignDoc.PublicKey = any
return nil
}
@@ -79,15 +79,15 @@ func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
func (b *AuxTxBuilder) SetTip(tip *tx.Tip) {
b.checkEmptyFields()
- b.auxTx.SignDoc.Tip = tip
+ b.auxSignerData.SignDoc.Tip = tip
}
func (b *AuxTxBuilder) SetSignature(sig []byte) {
- if b.auxTx == nil {
- b.auxTx = &tx.AuxTx{}
+ if b.auxSignerData == nil {
+ b.auxSignerData = &tx.AuxSignerData{}
}
- b.auxTx.Sig = sig
+ b.auxSignerData.Sig = sig
}
// GetSignBytes returns the builder's sign bytes.
@@ -102,7 +102,7 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
return nil, err
}
- auxTx := b.auxTx
+ auxTx := b.auxSignerData
if auxTx == nil {
return nil, sdkerrors.ErrLogic.Wrap("aux tx is nil, call setters on AuxTxBuilder first")
}
@@ -114,11 +114,11 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
sd.BodyBytes = bodyBz
- if err := b.auxTx.SignDoc.ValidateBasic(); err != nil {
+ if err := b.auxSignerData.SignDoc.ValidateBasic(); err != nil {
return nil, err
}
- signBz, err := proto.Marshal(b.auxTx.SignDoc)
+ signBz, err := proto.Marshal(b.auxSignerData.SignDoc)
if err != nil {
return nil, err
}
@@ -127,12 +127,12 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
}
// GetAuxTx returns the builder's AuxTx.
-func (b *AuxTxBuilder) GetAuxTx() (*tx.AuxTx, error) {
- if err := b.auxTx.ValidateBasic(); err != nil {
+func (b *AuxTxBuilder) GetAuxTx() (*tx.AuxSignerData, error) {
+ if err := b.auxSignerData.ValidateBasic(); err != nil {
return nil, err
}
- return b.auxTx, nil
+ return b.auxSignerData, nil
}
func (b *AuxTxBuilder) checkEmptyFields() {
@@ -140,10 +140,10 @@ func (b *AuxTxBuilder) checkEmptyFields() {
b.body = &tx.TxBody{}
}
- if b.auxTx == nil {
- b.auxTx = &tx.AuxTx{}
- if b.auxTx.SignDoc == nil {
- b.auxTx.SignDoc = &tx.SignDocDirectAux{}
+ if b.auxSignerData == nil {
+ b.auxSignerData = &tx.AuxSignerData{}
+ if b.auxSignerData.SignDoc == nil {
+ b.auxSignerData.SignDoc = &tx.SignDocDirectAux{}
}
}
}
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index b8db210a702b..bbaa070a4f13 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -661,7 +661,7 @@
- [cosmos/tx/v1beta1/tx.proto](#cosmos/tx/v1beta1/tx.proto)
- [AuthInfo](#cosmos.tx.v1beta1.AuthInfo)
- - [AuxTx](#cosmos.tx.v1beta1.AuxTx)
+ - [AuxSignerData](#cosmos.tx.v1beta1.AuxSignerData)
- [Fee](#cosmos.tx.v1beta1.Fee)
- [ModeInfo](#cosmos.tx.v1beta1.ModeInfo)
- [ModeInfo.Multi](#cosmos.tx.v1beta1.ModeInfo.Multi)
@@ -9475,12 +9475,13 @@ Since: cosmos-sdk 0.45 |
-
+
-### AuxTx
-AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
-to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
-and will be rejected by the node if sent directly as-is.
+### AuxSignerData
+AuxSignerData is the intermediary format that an auxiliary signer (e.g. a
+tipper) builds and sends to the fee payer (who will build and broadcast the
+actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
+by the node if sent directly as-is.
| Field | Type | Label | Description |
diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto
index 71bcd3fc45cf..13a0ab76a67a 100644
--- a/proto/cosmos/tx/v1beta1/tx.proto
+++ b/proto/cosmos/tx/v1beta1/tx.proto
@@ -222,10 +222,11 @@ message Tip {
string tipper = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
-// AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
-// to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
-// and will be rejected by the node if sent directly as-is.
-message AuxTx {
+// AuxSignerData is the intermediary format that an auxiliary signer (e.g. a
+// tipper) builds and sends to the fee payer (who will build and broadcast the
+// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
+// by the node if sent directly as-is.
+message AuxSignerData {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs.
SignDocDirectAux sign_doc = 1;
diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go
index 11e1b5ea2585..1fd9a3b3552f 100644
--- a/types/tx/tx.pb.go
+++ b/types/tx/tx.pb.go
@@ -907,10 +907,11 @@ func (m *Tip) GetTipper() string {
return ""
}
-// AuxTx is the intermediary tx that an auxiliary signer (e.g. a tipper) builds,
-// to be sent to the final tx's fee payer. AuxTx is not a valid tx in itself,
-// and will be rejected by the node if sent directly as-is.
-type AuxTx struct {
+// AuxSignerData is the intermediary format that an auxiliary signer (e.g. a
+// tipper) builds and sends to the fee payer (who will build and broadcast the
+// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
+// by the node if sent directly as-is.
+type AuxSignerData struct {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs.
SignDoc *SignDocDirectAux `protobuf:"bytes,1,opt,name=sign_doc,json=signDoc,proto3" json:"sign_doc,omitempty"`
@@ -918,18 +919,18 @@ type AuxTx struct {
Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"`
}
-func (m *AuxTx) Reset() { *m = AuxTx{} }
-func (m *AuxTx) String() string { return proto.CompactTextString(m) }
-func (*AuxTx) ProtoMessage() {}
-func (*AuxTx) Descriptor() ([]byte, []int) {
+func (m *AuxSignerData) Reset() { *m = AuxSignerData{} }
+func (m *AuxSignerData) String() string { return proto.CompactTextString(m) }
+func (*AuxSignerData) ProtoMessage() {}
+func (*AuxSignerData) Descriptor() ([]byte, []int) {
return fileDescriptor_96d1575ffde80842, []int{10}
}
-func (m *AuxTx) XXX_Unmarshal(b []byte) error {
+func (m *AuxSignerData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
-func (m *AuxTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+func (m *AuxSignerData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
- return xxx_messageInfo_AuxTx.Marshal(b, m, deterministic)
+ return xxx_messageInfo_AuxSignerData.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
@@ -939,26 +940,26 @@ func (m *AuxTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return b[:n], nil
}
}
-func (m *AuxTx) XXX_Merge(src proto.Message) {
- xxx_messageInfo_AuxTx.Merge(m, src)
+func (m *AuxSignerData) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_AuxSignerData.Merge(m, src)
}
-func (m *AuxTx) XXX_Size() int {
+func (m *AuxSignerData) XXX_Size() int {
return m.Size()
}
-func (m *AuxTx) XXX_DiscardUnknown() {
- xxx_messageInfo_AuxTx.DiscardUnknown(m)
+func (m *AuxSignerData) XXX_DiscardUnknown() {
+ xxx_messageInfo_AuxSignerData.DiscardUnknown(m)
}
-var xxx_messageInfo_AuxTx proto.InternalMessageInfo
+var xxx_messageInfo_AuxSignerData proto.InternalMessageInfo
-func (m *AuxTx) GetSignDoc() *SignDocDirectAux {
+func (m *AuxSignerData) GetSignDoc() *SignDocDirectAux {
if m != nil {
return m.SignDoc
}
return nil
}
-func (m *AuxTx) GetSig() []byte {
+func (m *AuxSignerData) GetSig() []byte {
if m != nil {
return m.Sig
}
@@ -978,76 +979,76 @@ func init() {
proto.RegisterType((*ModeInfo_Multi)(nil), "cosmos.tx.v1beta1.ModeInfo.Multi")
proto.RegisterType((*Fee)(nil), "cosmos.tx.v1beta1.Fee")
proto.RegisterType((*Tip)(nil), "cosmos.tx.v1beta1.Tip")
- proto.RegisterType((*AuxTx)(nil), "cosmos.tx.v1beta1.AuxTx")
+ proto.RegisterType((*AuxSignerData)(nil), "cosmos.tx.v1beta1.AuxSignerData")
}
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
var fileDescriptor_96d1575ffde80842 = []byte{
- // 996 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xdc, 0x44,
- 0x14, 0x5e, 0xc7, 0xbb, 0x9b, 0xdd, 0xd7, 0xa4, 0x4d,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m *Tx) Marshal() (dAtA []byte, err error) {
@@ -1717,7 +1718,7 @@ func (m *Tip) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
-func (m *AuxTx) Marshal() (dAtA []byte, err error) {
+func (m *AuxSignerData) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
@@ -1727,12 +1728,12 @@ func (m *AuxTx) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil
}
-func (m *AuxTx) MarshalTo(dAtA []byte) (int, error) {
+func (m *AuxSignerData) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
-func (m *AuxTx) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+func (m *AuxSignerData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
@@ -2060,7 +2061,7 @@ func (m *Tip) Size() (n int) {
return n
}
-func (m *AuxTx) Size() (n int) {
+func (m *AuxSignerData) Size() (n int) {
if m == nil {
return 0
}
@@ -3874,7 +3875,7 @@ func (m *Tip) Unmarshal(dAtA []byte) error {
}
return nil
}
-func (m *AuxTx) Unmarshal(dAtA []byte) error {
+func (m *AuxSignerData) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
@@ -3897,10 +3898,10 @@ func (m *AuxTx) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
- return fmt.Errorf("proto: AuxTx: wiretype end group for non-group")
+ return fmt.Errorf("proto: AuxSignerData: wiretype end group for non-group")
}
if fieldNum <= 0 {
- return fmt.Errorf("proto: AuxTx: illegal tag %d (wire type %d)", fieldNum, wire)
+ return fmt.Errorf("proto: AuxSignerData: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
From fee39db4621de3d7b99e5fd4a1b12d7c47131a27 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Tue, 2 Nov 2021 18:49:19 +0100
Subject: [PATCH 05/17] Add sign mode in AuxSignerData
---
client/tx/aux_builder.go | 13 +++
docs/core/proto-docs.md | 3 +-
proto/cosmos/tx/v1beta1/tx.proto | 7 +-
types/tx/aux.go | 9 +-
types/tx/tx.pb.go | 172 +++++++++++++++++++------------
5 files changed, 132 insertions(+), 72 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index 05a6aaa66196..a0fe6a04e6e2 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -8,6 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx"
+ "github.com/cosmos/cosmos-sdk/types/tx/signing"
)
// AuxTxBuilder is a client-side builder for creating an AuxTx.
@@ -76,6 +77,18 @@ func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
return nil
}
+func (b *AuxTxBuilder) SetSignMode(mode signing.SignMode) error {
+ switch mode {
+ case signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON:
+ default:
+ return sdkerrors.ErrInvalidRequest.Wrapf("AuxTxBuilder can only sign with %s or %s", signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
+ }
+
+ b.auxSignerData.Mode = mode
+
+ return nil
+}
+
func (b *AuxTxBuilder) SetTip(tip *tx.Tip) {
b.checkEmptyFields()
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index bbaa070a4f13..5ec7f498a0dd 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -9486,7 +9486,8 @@ by the node if sent directly as-is.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| `sign_doc` | [SignDocDirectAux](#cosmos.tx.v1beta1.SignDocDirectAux) | | sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer signs. |
+| `sign_doc` | [SignDocDirectAux](#cosmos.tx.v1beta1.SignDocDirectAux) | | sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer signs. Note: we use the same sign doc even if we're signing with LEGACY_AMINO_JSON. |
+| `mode` | [cosmos.tx.signing.v1beta1.SignMode](#cosmos.tx.signing.v1beta1.SignMode) | | mode is the signing mode of the single signer |
| `sig` | [bytes](#bytes) | | sig is the signature of the sign doc. |
diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto
index 13a0ab76a67a..fee50d388295 100644
--- a/proto/cosmos/tx/v1beta1/tx.proto
+++ b/proto/cosmos/tx/v1beta1/tx.proto
@@ -228,8 +228,11 @@ message Tip {
// by the node if sent directly as-is.
message AuxSignerData {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
- // signs.
+ // signs. Note: we use the same sign doc even if we're signing with
+ // LEGACY_AMINO_JSON.
SignDocDirectAux sign_doc = 1;
+ // mode is the signing mode of the single signer
+ cosmos.tx.signing.v1beta1.SignMode mode = 2;
// sig is the signature of the sign doc.
- bytes sig = 2;
+ bytes sig = 3;
}
diff --git a/types/tx/aux.go b/types/tx/aux.go
index 71c05f87afa6..e642088123b4 100644
--- a/types/tx/aux.go
+++ b/types/tx/aux.go
@@ -4,6 +4,7 @@ import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
+ "github.com/cosmos/cosmos-sdk/types/tx/signing"
)
// ValidateBasic performs stateless validation of the sign doc.
@@ -35,7 +36,11 @@ func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err
}
// ValidateBasic performs stateless validation of the auxiliary tx.
-func (a *AuxTx) ValidateBasic() error {
+func (a *AuxSignerData) ValidateBasic() error {
+ if a.Mode != signing.SignMode_SIGN_MODE_DIRECT_AUX && a.Mode != signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON {
+ return sdkerrors.ErrInvalidRequest.Wrapf("AuxTxBuilder can only sign with %s or %s", signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
+ }
+
if len(a.Sig) == 0 {
return sdkerrors.ErrNoSignatures.Wrap("signature cannot be empty")
}
@@ -44,6 +49,6 @@ func (a *AuxTx) ValidateBasic() error {
}
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
-func (a *AuxTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
+func (a *AuxSignerData) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return a.GetSignDoc().UnpackInterfaces(unpacker)
}
diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go
index 1fd9a3b3552f..d74246565eb1 100644
--- a/types/tx/tx.pb.go
+++ b/types/tx/tx.pb.go
@@ -913,10 +913,13 @@ func (m *Tip) GetTipper() string {
// by the node if sent directly as-is.
type AuxSignerData struct {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
- // signs.
+ // signs. Note: we use the same sign doc even if we're signing with
+ // LEGACY_AMINO_JSON.
SignDoc *SignDocDirectAux `protobuf:"bytes,1,opt,name=sign_doc,json=signDoc,proto3" json:"sign_doc,omitempty"`
+ // mode is the signing mode of the single signer
+ Mode signing.SignMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"`
// sig is the signature of the sign doc.
- Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"`
+ Sig []byte `protobuf:"bytes,3,opt,name=sig,proto3" json:"sig,omitempty"`
}
func (m *AuxSignerData) Reset() { *m = AuxSignerData{} }
@@ -959,6 +962,13 @@ func (m *AuxSignerData) GetSignDoc() *SignDocDirectAux {
return nil
}
+func (m *AuxSignerData) GetMode() signing.SignMode {
+ if m != nil {
+ return m.Mode
+ }
+ return signing.SignMode_SIGN_MODE_UNSPECIFIED
+}
+
func (m *AuxSignerData) GetSig() []byte {
if m != nil {
return m.Sig
@@ -985,70 +995,71 @@ func init() {
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
var fileDescriptor_96d1575ffde80842 = []byte{
- // 1000 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0xdb, 0xb6,
- 0x17, 0xb7, 0x22, 0xdb, 0xb1, 0x5f, 0x93, 0x36, 0x25, 0x82, 0x3f, 0x1c, 0x07, 0x75, 0xf3, 0x77,
- 0xd1, 0xcd, 0x97, 0x48, 0x69, 0x7a, 0x68, 0x37, 0x0c, 0xdb, 0xec, 0x66, 0x45, 0x8a, 0xae, 0x1b,
- 0xc0, 0xe4, 0xd4, 0x8b, 0x40, 0xcb, 0x8c, 0x4c, 0xd4, 0x22, 0x35, 0x91, 0xda, 0xac, 0x0f, 0x31,
- 0xa0, 0x18, 0x30, 0xec, 0xba, 0xf3, 0xce, 0xfb, 0x10, 0x3d, 0x16, 0x3b, 0xed, 0xb4, 0x15, 0xc9,
- 0x71, 0xc0, 0xbe, 0xc2, 0x06, 0x52, 0x94, 0x92, 0x76, 0xa9, 0x5d, 0x60, 0x3b, 0x89, 0x7c, 0xfa,
- 0xbd, 0x1f, 0x7f, 0x8f, 0xef, 0xf1, 0x3d, 0xe8, 0x86, 0x42, 0xc6, 0x42, 0xfa, 0x6a, 0xee, 0x7f,
- 0x7d, 0x67, 0x4c, 0x15, 0xb9, 0xe3, 0xab, 0xb9, 0x97, 0xa4, 0x42, 0x09, 0x74, 0xbd, 0xf8, 0xe7,
- 0xa9, 0xb9, 0x67, 0xff, 0x75, 0x37, 0x23, 0x11, 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 0xbc, 0xa6, 0x01, 0x9c, 0x7f, 0x3c, 0xf0, 0x8a, 0xb4, 0x6f, 0x5c, 0x61, 0xc2,
+ 0xea, 0x7f, 0x34, 0x21, 0x5a, 0x07, 0x57, 0xb2, 0xc8, 0x5c, 0xef, 0x2a, 0xd6, 0xc3, 0xe1, 0x27,
+ 0xcf, 0x4e, 0xba, 0xce, 0xf3, 0x93, 0xae, 0xf3, 0xe2, 0xa4, 0xeb, 0x3c, 0x3d, 0xed, 0x56, 0x9e,
+ 0x9f, 0x76, 0x2b, 0xbf, 0x9d, 0x76, 0x2b, 0x8f, 0x6f, 0x2e, 0xaf, 0xad, 0xaf, 0x66, 0xa3, 0x86,
+ 0xe9, 0x07, 0xb7, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xda, 0xb6, 0x89, 0x77, 0x09, 0x00,
+ 0x00,
}
func (m *Tx) Marshal() (dAtA []byte, err error) {
@@ -1743,7 +1754,12 @@ func (m *AuxSignerData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Sig)
i = encodeVarintTx(dAtA, i, uint64(len(m.Sig)))
i--
- dAtA[i] = 0x12
+ dAtA[i] = 0x1a
+ }
+ if m.Mode != 0 {
+ i = encodeVarintTx(dAtA, i, uint64(m.Mode))
+ i--
+ dAtA[i] = 0x10
}
if m.SignDoc != nil {
{
@@ -2071,6 +2087,9 @@ func (m *AuxSignerData) Size() (n int) {
l = m.SignDoc.Size()
n += 1 + l + sovTx(uint64(l))
}
+ if m.Mode != 0 {
+ n += 1 + sovTx(uint64(m.Mode))
+ }
l = len(m.Sig)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
@@ -3941,6 +3960,25 @@ func (m *AuxSignerData) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 2:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType)
+ }
+ m.Mode = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Mode |= signing.SignMode(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sig", wireType)
}
From 36ca5a72c695449e69a2f14ab434dae2ad67cce3 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Thu, 4 Nov 2021 16:05:39 +0100
Subject: [PATCH 06/17] wip
---
types/tx/aux.go | 7 +++++++
x/auth/tx/builder.go | 19 +++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/types/tx/aux.go b/types/tx/aux.go
index e642088123b4..8804ce851e8f 100644
--- a/types/tx/aux.go
+++ b/types/tx/aux.go
@@ -30,6 +30,13 @@ func (s *SignDocDirectAux) ValidateBasic() error {
return nil
}
+// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
+func (s *SignDocDirectAux) GetPubKey() (cryptotypes.PubKey, error) {
+ var pk cryptotypes.PubKey
+ err :=
+ return pk,nil
+}
+
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(s.PublicKey, new(cryptotypes.PubKey))
diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index d3b83d5018bb..3e685bdddebc 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -357,3 +357,22 @@ func (w *wrapper) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any) {
w.tx.Body.NonCriticalExtensionOptions = extOpts
w.bodyBz = nil
}
+
+func (w *wrapper) AddAuxSignerData(data tx.AuxSignerData) error {
+ err := data.ValidateBasic()
+ if err != nil {
+ return err
+ }
+
+ w.bodyBz = data.SignDoc.BodyBytes
+ w.SetTip(data.GetSignDoc().GetTip())
+
+ w.tx.AuthInfo.SignerInfos = []*tx.SignerInfo{
+ {
+ PublicKey: data.SignDoc.PublicKey,
+ ModeInfo: &tx.ModeInfo{Sum: &tx.ModeInfo_Single_{Single: &tx.ModeInfo_Single{Mode: data.Mode}}},
+ },
+ }
+
+ return nil
+}
From 72333b3326a1602d74079723da37caa846a8f18c Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 15:15:41 +0100
Subject: [PATCH 07/17] Add tests
---
client/tx/aux_builder.go | 59 +++++++--
client/tx/aux_builder_test.go | 225 ++++++++++++++++++++++++++++++++++
types/tx/aux.go | 7 --
types/tx/aux_test.go | 83 +++++++++++++
4 files changed, 354 insertions(+), 20 deletions(-)
create mode 100644 client/tx/aux_builder_test.go
create mode 100644 types/tx/aux_test.go
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index a0fe6a04e6e2..81c721eba4a2 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -9,14 +9,24 @@ import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
+ "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
)
// AuxTxBuilder is a client-side builder for creating an AuxTx.
type AuxTxBuilder struct {
+ // msgs is used to store the sdk.Msgs that are added to the
+ // TxBuilder. It's also added inside body.Messages, because:
+ // - b.msgs is used for constructing the AMINO sign bz,
+ // - b.body is used for constructing the DIRECT_AUX sign bz.
+ msgs []sdk.Msg
body *tx.TxBody
auxSignerData *tx.AuxSignerData
}
+func NewAuxTxBuilder() AuxTxBuilder {
+ return AuxTxBuilder{}
+}
+
func (b *AuxTxBuilder) SetMemo(memo string) {
b.checkEmptyFields()
@@ -41,6 +51,7 @@ func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
b.checkEmptyFields()
+ b.msgs = msgs
b.body.Messages = anys
return nil
@@ -105,35 +116,57 @@ func (b *AuxTxBuilder) SetSignature(sig []byte) {
// GetSignBytes returns the builder's sign bytes.
func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
- body := b.body
- if body == nil {
- return nil, sdkerrors.ErrLogic.Wrap("tx body is nil, call setters on AuxTxBuilder first")
- }
-
- bodyBz, err := proto.Marshal(body)
- if err != nil {
- return nil, err
- }
-
auxTx := b.auxSignerData
if auxTx == nil {
return nil, sdkerrors.ErrLogic.Wrap("aux tx is nil, call setters on AuxTxBuilder first")
}
+ body := b.body
+ if body == nil {
+ return nil, sdkerrors.ErrLogic.Wrap("tx body is nil, call setters on AuxTxBuilder first")
+ }
+
sd := auxTx.SignDoc
if sd == nil {
return nil, sdkerrors.ErrLogic.Wrap("sign doc is nil, call setters on AuxTxBuilder first")
}
+ bodyBz, err := proto.Marshal(body)
+ if err != nil {
+ return nil, err
+ }
+
sd.BodyBytes = bodyBz
if err := b.auxSignerData.SignDoc.ValidateBasic(); err != nil {
return nil, err
}
- signBz, err := proto.Marshal(b.auxSignerData.SignDoc)
- if err != nil {
- return nil, err
+ var signBz []byte
+ switch b.auxSignerData.Mode {
+ case signing.SignMode_SIGN_MODE_DIRECT_AUX:
+ {
+
+ signBz, err = proto.Marshal(b.auxSignerData.SignDoc)
+ if err != nil {
+ return nil, err
+ }
+ }
+ case signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON:
+ {
+ signBz = legacytx.StdSignBytes(
+ b.auxSignerData.SignDoc.ChainId, b.auxSignerData.SignDoc.AccountNumber,
+ b.auxSignerData.SignDoc.Sequence, b.body.TimeoutHeight,
+ // Aux signer never signs over fee.
+ // For LEGACY_AMINO_JSON, we use the convention to sign
+ // over empty fees.
+ // ref: https://github.com/cosmos/cosmos-sdk/pull/10348
+ legacytx.StdFee{},
+ b.msgs, b.body.Memo, b.auxSignerData.SignDoc.Tip,
+ )
+ }
+ default:
+ return nil, sdkerrors.ErrInvalidRequest.Wrapf("got unknown sign mode %s", b.auxSignerData.Mode)
}
return signBz, nil
diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go
new file mode 100644
index 000000000000..984d74e4ecb3
--- /dev/null
+++ b/client/tx/aux_builder_test.go
@@ -0,0 +1,225 @@
+package tx_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ "github.com/cosmos/cosmos-sdk/client/tx"
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+ cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
+ "github.com/cosmos/cosmos-sdk/simapp"
+ "github.com/cosmos/cosmos-sdk/testutil/testdata"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ typestx "github.com/cosmos/cosmos-sdk/types/tx"
+ "github.com/cosmos/cosmos-sdk/types/tx/signing"
+)
+
+func TestAuxTxBuilder(t *testing.T) {
+ encCfg := simapp.MakeTestEncodingConfig()
+ testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
+
+ var b tx.AuxTxBuilder
+ _, pk, addr := testdata.KeyTestPubAddr()
+ pkAny, err := codectypes.NewAnyWithValue(pk)
+ require.NoError(t, err)
+ msg := testdata.NewTestMsg(addr)
+ msgAny, err := codectypes.NewAnyWithValue(msg)
+ require.NoError(t, err)
+ tip := &typestx.Tip{Tipper: addr.String(), Amount: testdata.NewTestFeeAmount()}
+ sig := []byte{42}
+
+ testcases := []struct {
+ name string
+ malleate func() error
+ expErr bool
+ expErrStr string
+ }{
+ {
+ "cannot set SIGN_MODE_DIRECT",
+ func() error {
+ return b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT)
+ },
+ true, "AuxTxBuilder can only sign with SIGN_MODE_DIRECT_AUX or SIGN_MODE_LEGACY_AMINO_JSON",
+ },
+ {
+ "cannot set invalid pubkey",
+ func() error {
+ return b.SetPubKey(cryptotypes.PubKey(nil))
+ },
+ true, "failed packing protobuf message to Any",
+ },
+ {
+ "cannot set invalid Msg",
+ func() error {
+ return b.SetMsgs(sdk.Msg(nil))
+ },
+ true, "failed packing protobuf message to Any",
+ },
+ {
+ "GetSignBytes body should not be nil",
+ func() error {
+ _, err := b.GetSignBytes()
+ return err
+ },
+ true, "aux tx is nil, call setters on AuxTxBuilder first",
+ },
+ {
+ "GetSignBytes pubkey should not be nil",
+ func() error {
+ b.SetMsgs(msg)
+
+ _, err := b.GetSignBytes()
+ return err
+ },
+ true, "public key cannot be empty: invalid pubkey",
+ },
+ {
+ "GetSignBytes invalid sign mode",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+
+ _, err := b.GetSignBytes()
+ return err
+ },
+ true, "got unknown sign mode SIGN_MODE_UNSPECIFIED",
+ },
+ {
+ "GetSignBytes tipper should not be nil (if tip is set)",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(&typestx.Tip{Tipper: addr.String()})
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ return err
+ },
+ true, "tip amount cannot be empty",
+ },
+ {
+ "GetSignBytes works for DIRECT_AUX",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ return err
+ },
+ false, "",
+ },
+ {
+ "GetAuxTx signature should not be empty",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ require.NoError(t, err)
+
+ _, err = b.GetAuxTx()
+ return err
+ },
+ true, "signature cannot be empty: no signatures supplied",
+ },
+ {
+ "GetAuxTx works for DIRECT_AUX",
+ func() error {
+ memo := "test-memo"
+ chainID := "test-chain"
+
+ b.SetAccountNumber(1)
+ b.SetSequence(2)
+ b.SetTimeoutHeight(3)
+ b.SetMemo(memo)
+ b.SetChainID(chainID)
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ require.NoError(t, err)
+ b.SetSignature(sig)
+
+ auxTx, err := b.GetAuxTx()
+ require.NoError(t, err)
+
+ // Make sure auxTx is correctly populated
+ var body typestx.TxBody
+ err = encCfg.Codec.Unmarshal(auxTx.SignDoc.BodyBytes, &body)
+ require.NoError(t, err)
+
+ require.Equal(t, uint64(1), auxTx.SignDoc.AccountNumber)
+ require.Equal(t, uint64(2), auxTx.SignDoc.Sequence)
+ require.Equal(t, uint64(3), body.TimeoutHeight)
+ require.Equal(t, memo, body.Memo)
+ require.Equal(t, chainID, auxTx.SignDoc.ChainId)
+ require.Equal(t, msgAny, body.GetMessages()[0])
+ require.Equal(t, pkAny, auxTx.SignDoc.PublicKey)
+ require.Equal(t, tip, auxTx.SignDoc.Tip)
+ require.Equal(t, signing.SignMode_SIGN_MODE_DIRECT_AUX, auxTx.Mode)
+ require.Equal(t, sig, auxTx.Sig)
+
+ return err
+ },
+ false, "",
+ },
+ {
+ "GetSignBytes works for LEGACY_AMINO_JSON",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ return err
+ },
+ false, "",
+ },
+ {
+ "GetAuxTx works for LEGACY_AMINO_JSON",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ require.NoError(t, err)
+ b.SetSignature(sig)
+
+ _, err = b.GetAuxTx()
+ return err
+ },
+ false, "",
+ },
+ }
+
+ for _, tc := range testcases {
+ tc := tc
+ t.Run(tc.name, func(t *testing.T) {
+ b = tx.NewAuxTxBuilder()
+ err := tc.malleate()
+
+ if tc.expErr {
+ require.Error(t, err)
+ require.Contains(t, err.Error(), tc.expErrStr)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+}
diff --git a/types/tx/aux.go b/types/tx/aux.go
index 8804ce851e8f..e642088123b4 100644
--- a/types/tx/aux.go
+++ b/types/tx/aux.go
@@ -30,13 +30,6 @@ func (s *SignDocDirectAux) ValidateBasic() error {
return nil
}
-// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
-func (s *SignDocDirectAux) GetPubKey() (cryptotypes.PubKey, error) {
- var pk cryptotypes.PubKey
- err :=
- return pk,nil
-}
-
// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method
func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return unpacker.UnpackAny(s.PublicKey, new(cryptotypes.PubKey))
diff --git a/types/tx/aux_test.go b/types/tx/aux_test.go
new file mode 100644
index 000000000000..5a60234a939b
--- /dev/null
+++ b/types/tx/aux_test.go
@@ -0,0 +1,83 @@
+package tx_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ codectypes "github.com/cosmos/cosmos-sdk/codec/types"
+ "github.com/cosmos/cosmos-sdk/testutil/testdata"
+ "github.com/cosmos/cosmos-sdk/types/tx"
+ "github.com/cosmos/cosmos-sdk/types/tx/signing"
+)
+
+func TestSignDocDirectAux(t *testing.T) {
+ bodyBz := []byte{42}
+ _, pk, addr := testdata.KeyTestPubAddr()
+ pkAny, err := codectypes.NewAnyWithValue(pk)
+ require.NoError(t, err)
+
+ testcases := []struct {
+ name string
+ sd tx.SignDocDirectAux
+ expErr bool
+ }{
+ {"empty bodyBz", tx.SignDocDirectAux{}, true},
+ {"empty pubkey", tx.SignDocDirectAux{BodyBytes: bodyBz}, true},
+ {"empty tip amount", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny, Tip: &tx.Tip{Tipper: addr.String()}}, true},
+ {"empty tipper", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny, Tip: &tx.Tip{Amount: testdata.NewTestFeeAmount()}}, true},
+ {"happy case w/o tip", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny}, false},
+ {"happy case w/ tip", tx.SignDocDirectAux{
+ BodyBytes: bodyBz,
+ PublicKey: pkAny,
+ Tip: &tx.Tip{Tipper: addr.String(), Amount: testdata.NewTestFeeAmount()},
+ }, false},
+ }
+
+ for _, tc := range testcases {
+ tc := tc
+ t.Run(tc.name, func(t *testing.T) {
+ err := tc.sd.ValidateBasic()
+
+ if tc.expErr {
+ require.Error(t, err)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+}
+
+func TestAuxSignerData(t *testing.T) {
+ bodyBz := []byte{42}
+ _, pk, _ := testdata.KeyTestPubAddr()
+ pkAny, err := codectypes.NewAnyWithValue(pk)
+ require.NoError(t, err)
+ sig := []byte{42}
+ sd := &tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny}
+
+ testcases := []struct {
+ name string
+ sd tx.AuxSignerData
+ expErr bool
+ }{
+ {"empty sign mode", tx.AuxSignerData{}, true},
+ {"SIGN_MODE_DIRECT", tx.AuxSignerData{Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
+ {"no sig", tx.AuxSignerData{Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
+ {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Mode: signing.SignMode_SIGN_MODE_DIRECT_AUX, SignDoc: sd, Sig: sig}, false},
+ {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Mode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, SignDoc: sd, Sig: sig}, false},
+ }
+
+ for _, tc := range testcases {
+ tc := tc
+ t.Run(tc.name, func(t *testing.T) {
+ err := tc.sd.ValidateBasic()
+
+ if tc.expErr {
+ require.Error(t, err)
+ } else {
+ require.NoError(t, err)
+ }
+ })
+ }
+}
From cbba311ec7a1dfdc7d263fabd9d8be9d9c7c3bf6 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 16:13:07 +0100
Subject: [PATCH 08/17] txBuilder AddAuxSignerData
---
client/tx/aux_builder.go | 8 ++--
client/tx/aux_builder_test.go | 30 ++++++-------
client/tx_config.go | 2 +
x/auth/migrations/legacytx/stdtx_builder.go | 23 +++++++---
x/auth/tx/builder.go | 49 ++++++++++++---------
x/auth/tx/builder_test.go | 42 ++++++++++++++++++
6 files changed, 108 insertions(+), 46 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index 81c721eba4a2..6e1d5db79bd1 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -172,13 +172,13 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
return signBz, nil
}
-// GetAuxTx returns the builder's AuxTx.
-func (b *AuxTxBuilder) GetAuxTx() (*tx.AuxSignerData, error) {
+// GetAuxSignerData returns the builder's AuxTx.
+func (b *AuxTxBuilder) GetAuxSignerData() (tx.AuxSignerData, error) {
if err := b.auxSignerData.ValidateBasic(); err != nil {
- return nil, err
+ return tx.AuxSignerData{}, err
}
- return b.auxSignerData, nil
+ return *b.auxSignerData, nil
}
func (b *AuxTxBuilder) checkEmptyFields() {
diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go
index 984d74e4ecb3..cc69a9f168e9 100644
--- a/client/tx/aux_builder_test.go
+++ b/client/tx/aux_builder_test.go
@@ -114,7 +114,7 @@ func TestAuxTxBuilder(t *testing.T) {
false, "",
},
{
- "GetAuxTx signature should not be empty",
+ "GetAuxSignerData signature should not be empty",
func() error {
b.SetMsgs(msg)
b.SetPubKey(pk)
@@ -125,13 +125,13 @@ func TestAuxTxBuilder(t *testing.T) {
_, err = b.GetSignBytes()
require.NoError(t, err)
- _, err = b.GetAuxTx()
+ _, err = b.GetAuxSignerData()
return err
},
true, "signature cannot be empty: no signatures supplied",
},
{
- "GetAuxTx works for DIRECT_AUX",
+ "GetAuxSignerData works for DIRECT_AUX",
func() error {
memo := "test-memo"
chainID := "test-chain"
@@ -151,24 +151,24 @@ func TestAuxTxBuilder(t *testing.T) {
require.NoError(t, err)
b.SetSignature(sig)
- auxTx, err := b.GetAuxTx()
+ auxSignerData, err := b.GetAuxSignerData()
require.NoError(t, err)
- // Make sure auxTx is correctly populated
+ // Make sure auxSignerData is correctly populated
var body typestx.TxBody
- err = encCfg.Codec.Unmarshal(auxTx.SignDoc.BodyBytes, &body)
+ err = encCfg.Codec.Unmarshal(auxSignerData.SignDoc.BodyBytes, &body)
require.NoError(t, err)
- require.Equal(t, uint64(1), auxTx.SignDoc.AccountNumber)
- require.Equal(t, uint64(2), auxTx.SignDoc.Sequence)
+ require.Equal(t, uint64(1), auxSignerData.SignDoc.AccountNumber)
+ require.Equal(t, uint64(2), auxSignerData.SignDoc.Sequence)
require.Equal(t, uint64(3), body.TimeoutHeight)
require.Equal(t, memo, body.Memo)
- require.Equal(t, chainID, auxTx.SignDoc.ChainId)
+ require.Equal(t, chainID, auxSignerData.SignDoc.ChainId)
require.Equal(t, msgAny, body.GetMessages()[0])
- require.Equal(t, pkAny, auxTx.SignDoc.PublicKey)
- require.Equal(t, tip, auxTx.SignDoc.Tip)
- require.Equal(t, signing.SignMode_SIGN_MODE_DIRECT_AUX, auxTx.Mode)
- require.Equal(t, sig, auxTx.Sig)
+ require.Equal(t, pkAny, auxSignerData.SignDoc.PublicKey)
+ require.Equal(t, tip, auxSignerData.SignDoc.Tip)
+ require.Equal(t, signing.SignMode_SIGN_MODE_DIRECT_AUX, auxSignerData.Mode)
+ require.Equal(t, sig, auxSignerData.Sig)
return err
},
@@ -189,7 +189,7 @@ func TestAuxTxBuilder(t *testing.T) {
false, "",
},
{
- "GetAuxTx works for LEGACY_AMINO_JSON",
+ "GetAuxSignerData works for LEGACY_AMINO_JSON",
func() error {
b.SetMsgs(msg)
b.SetPubKey(pk)
@@ -201,7 +201,7 @@ func TestAuxTxBuilder(t *testing.T) {
require.NoError(t, err)
b.SetSignature(sig)
- _, err = b.GetAuxTx()
+ _, err = b.GetAuxSignerData()
return err
},
false, "",
diff --git a/client/tx_config.go b/client/tx_config.go
index c9db30ff0d7d..cad6d3895acd 100644
--- a/client/tx_config.go
+++ b/client/tx_config.go
@@ -38,6 +38,7 @@ type (
GetTx() signing.Tx
SetMsgs(msgs ...sdk.Msg) error
+ AddSignature(signature signingtypes.SignatureV2) error
SetSignatures(signatures ...signingtypes.SignatureV2) error
SetMemo(memo string)
SetFeeAmount(amount sdk.Coins)
@@ -45,5 +46,6 @@ type (
SetTip(tip *tx.Tip)
SetTimeoutHeight(height uint64)
SetFeeGranter(feeGranter sdk.AccAddress)
+ AddAuxSignerData(tx.AuxSignerData) error
}
)
diff --git a/x/auth/migrations/legacytx/stdtx_builder.go b/x/auth/migrations/legacytx/stdtx_builder.go
index af848d13eb8c..2d6abccedeb3 100644
--- a/x/auth/migrations/legacytx/stdtx_builder.go
+++ b/x/auth/migrations/legacytx/stdtx_builder.go
@@ -34,18 +34,26 @@ func (s *StdTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
return nil
}
+// SetSignatures implements TxBuilder.AddSignature.
+func (s *StdTxBuilder) AddSignature(sig signing.SignatureV2) error {
+ stdSig, err := SignatureV2ToStdSignature(s.cdc, sig)
+ if err != nil {
+ return err
+ }
+
+ s.Signatures = append(s.Signatures, stdSig)
+ return nil
+}
+
// SetSignatures implements TxBuilder.SetSignatures.
func (s *StdTxBuilder) SetSignatures(signatures ...signing.SignatureV2) error {
- sigs := make([]StdSignature, len(signatures))
- var err error
- for i, sig := range signatures {
- sigs[i], err = SignatureV2ToStdSignature(s.cdc, sig)
+ for _, sig := range signatures {
+ err := s.AddSignature(sig)
if err != nil {
return err
}
}
- s.Signatures = sigs
return nil
}
@@ -74,6 +82,11 @@ func (s *StdTxBuilder) SetTimeoutHeight(height uint64) {
// SetFeeGranter does nothing for stdtx
func (s *StdTxBuilder) SetFeeGranter(_ sdk.AccAddress) {}
+// AddAuxSignerData returns an error for StdTxBuilder.
+func (s *StdTxBuilder) AddAuxSignerData(_ tx.AuxSignerData) error {
+ return sdkerrors.ErrLogic.Wrap("cannot use AuxSignerData with StdTxBuilder")
+}
+
// StdTxConfig is a context.TxConfig for StdTx
type StdTxConfig struct {
Cdc *codec.LegacyAmino
diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index 3e685bdddebc..2a48fdf5c5dc 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -284,28 +284,33 @@ func (w *wrapper) SetFeeGranter(feeGranter sdk.AccAddress) {
w.authInfoBz = nil
}
+func (w *wrapper) AddSignature(sig signing.SignatureV2) error {
+ modeInfo, rawSig := SignatureDataToModeInfoAndSig(sig.Data)
+ any, err := codectypes.NewAnyWithValue(sig.PubKey)
+ if err != nil {
+ return err
+ }
+
+ signerInfo := &tx.SignerInfo{
+ PublicKey: any,
+ ModeInfo: modeInfo,
+ Sequence: sig.Sequence,
+ }
+
+ w.setSignerInfos(append(w.tx.AuthInfo.SignerInfos, signerInfo))
+ w.setSignatures(append(w.tx.Signatures, rawSig))
+
+ return nil
+}
+
func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error {
- n := len(signatures)
- signerInfos := make([]*tx.SignerInfo, n)
- rawSigs := make([][]byte, n)
-
- for i, sig := range signatures {
- var modeInfo *tx.ModeInfo
- modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data)
- any, err := codectypes.NewAnyWithValue(sig.PubKey)
+ for _, sig := range signatures {
+ err := w.AddSignature(sig)
if err != nil {
return err
}
- signerInfos[i] = &tx.SignerInfo{
- PublicKey: any,
- ModeInfo: modeInfo,
- Sequence: sig.Sequence,
- }
}
- w.setSignerInfos(signerInfos)
- w.setSignatures(rawSigs)
-
return nil
}
@@ -367,12 +372,12 @@ func (w *wrapper) AddAuxSignerData(data tx.AuxSignerData) error {
w.bodyBz = data.SignDoc.BodyBytes
w.SetTip(data.GetSignDoc().GetTip())
- w.tx.AuthInfo.SignerInfos = []*tx.SignerInfo{
- {
- PublicKey: data.SignDoc.PublicKey,
- ModeInfo: &tx.ModeInfo{Sum: &tx.ModeInfo_Single_{Single: &tx.ModeInfo_Single{Mode: data.Mode}}},
- },
- }
+ w.setSignerInfos(append(w.tx.AuthInfo.SignerInfos, &tx.SignerInfo{
+ PublicKey: data.SignDoc.PublicKey,
+ ModeInfo: &tx.ModeInfo{Sum: &tx.ModeInfo_Single_{Single: &tx.ModeInfo_Single{Mode: data.Mode}}},
+ Sequence: data.SignDoc.Sequence,
+ }))
+ w.setSignatures(append(w.tx.Signatures, data.Sig))
return nil
}
diff --git a/x/auth/tx/builder_test.go b/x/auth/tx/builder_test.go
index e45a67116378..27d3af59af44 100644
--- a/x/auth/tx/builder_test.go
+++ b/x/auth/tx/builder_test.go
@@ -5,6 +5,7 @@ import (
"github.com/stretchr/testify/require"
+ clienttx "github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -313,3 +314,44 @@ func TestBuilderFeeGranter(t *testing.T) {
txBuilder.SetFeeGranter(addr1)
require.Equal(t, addr1, txBuilder.GetTx().FeeGranter())
}
+
+func TestBuilderWithAux(t *testing.T) {
+ tipperPriv, tipperPk, tipperAddr := testdata.KeyTestPubAddr()
+ _, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
+ msg := testdata.NewTestMsg(tipperAddr)
+ tip := &txtypes.Tip{Tipper: tipperAddr.String(), Amount: testdata.NewTestFeeAmount()}
+ chainID := "test-chain"
+
+ // Create an AuxTxBuilder
+ auxBuilder := clienttx.NewAuxTxBuilder()
+ auxBuilder.SetAccountNumber(1)
+ auxBuilder.SetSequence(2)
+ auxBuilder.SetTimeoutHeight(3)
+ auxBuilder.SetMemo(memo)
+ auxBuilder.SetChainID(chainID)
+ auxBuilder.SetMsgs(msg)
+ auxBuilder.SetPubKey(tipperPk)
+ auxBuilder.SetTip(tip)
+ err := auxBuilder.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+ signBz, err := auxBuilder.GetSignBytes()
+ require.NoError(t, err)
+ sig, err := tipperPriv.Sign(signBz)
+ require.NoError(t, err)
+ auxBuilder.SetSignature(sig)
+ auxSignerData, err := auxBuilder.GetAuxSignerData()
+ require.NoError(t, err)
+
+ // Create a TxBuilder
+ w := newBuilder()
+ w.AddAuxSignerData(auxSignerData)
+ w.SetFeePayer(feepayerAddr)
+ w.SetFeeAmount(testdata.NewTestFeeAmount())
+ // Set SignerInfo for the feepayer
+ w.AddSignature(signing.SignatureV2{
+ PubKey: feepayerPk,
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT},
+ Sequence: 5,
+ })
+
+}
From a2498280cfd425fab936854daf5464b770c8a2d4 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 16:58:50 +0100
Subject: [PATCH 09/17] Add TestBuilderWithAux
---
client/tx_config.go | 1 +
x/auth/migrations/legacytx/stdtx_builder.go | 3 +
x/auth/tx/aux_test.go | 87 +++++++++++++++++++++
x/auth/tx/builder_test.go | 42 ----------
4 files changed, 91 insertions(+), 42 deletions(-)
create mode 100644 x/auth/tx/aux_test.go
diff --git a/client/tx_config.go b/client/tx_config.go
index cad6d3895acd..599e6f72c1c5 100644
--- a/client/tx_config.go
+++ b/client/tx_config.go
@@ -45,6 +45,7 @@ type (
SetGasLimit(limit uint64)
SetTip(tip *tx.Tip)
SetTimeoutHeight(height uint64)
+ SetFeePayer(feeGranter sdk.AccAddress)
SetFeeGranter(feeGranter sdk.AccAddress)
AddAuxSignerData(tx.AuxSignerData) error
}
diff --git a/x/auth/migrations/legacytx/stdtx_builder.go b/x/auth/migrations/legacytx/stdtx_builder.go
index 2d6abccedeb3..887211fc9703 100644
--- a/x/auth/migrations/legacytx/stdtx_builder.go
+++ b/x/auth/migrations/legacytx/stdtx_builder.go
@@ -82,6 +82,9 @@ func (s *StdTxBuilder) SetTimeoutHeight(height uint64) {
// SetFeeGranter does nothing for stdtx
func (s *StdTxBuilder) SetFeeGranter(_ sdk.AccAddress) {}
+// SetFeePayer does nothing for stdtx
+func (s *StdTxBuilder) SetFeePayer(_ sdk.AccAddress) {}
+
// AddAuxSignerData returns an error for StdTxBuilder.
func (s *StdTxBuilder) AddAuxSignerData(_ tx.AuxSignerData) error {
return sdkerrors.ErrLogic.Wrap("cannot use AuxSignerData with StdTxBuilder")
diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go
new file mode 100644
index 000000000000..294887147c3b
--- /dev/null
+++ b/x/auth/tx/aux_test.go
@@ -0,0 +1,87 @@
+package tx_test
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/require"
+
+ clienttx "github.com/cosmos/cosmos-sdk/client/tx"
+ "github.com/cosmos/cosmos-sdk/simapp"
+ "github.com/cosmos/cosmos-sdk/testutil/testdata"
+ sdk "github.com/cosmos/cosmos-sdk/types"
+ txtypes "github.com/cosmos/cosmos-sdk/types/tx"
+ "github.com/cosmos/cosmos-sdk/types/tx/signing"
+ authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
+)
+
+func TestBuilderWithAux(t *testing.T) {
+ encCfg := simapp.MakeTestEncodingConfig()
+ testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
+
+ tipperPriv, tipperPk, tipperAddr := testdata.KeyTestPubAddr()
+ _, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
+ msg := testdata.NewTestMsg(tipperAddr)
+ memo := "test-memo"
+ tip := &txtypes.Tip{Tipper: tipperAddr.String(), Amount: sdk.NewCoins(sdk.NewCoin("tip-denom", sdk.NewIntFromUint64(123)))}
+ chainID := "test-chain"
+ gas := testdata.NewTestGasLimit()
+ fee := testdata.NewTestFeeAmount()
+
+ // Create an AuxTxBuilder
+ auxBuilder := clienttx.NewAuxTxBuilder()
+ auxBuilder.SetAccountNumber(1)
+ auxBuilder.SetSequence(2)
+ auxBuilder.SetTimeoutHeight(3)
+ auxBuilder.SetMemo(memo)
+ auxBuilder.SetChainID(chainID)
+ auxBuilder.SetMsgs(msg)
+ auxBuilder.SetPubKey(tipperPk)
+ auxBuilder.SetTip(tip)
+ err := auxBuilder.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+ signBz, err := auxBuilder.GetSignBytes()
+ require.NoError(t, err)
+ sig, err := tipperPriv.Sign(signBz)
+ require.NoError(t, err)
+ auxBuilder.SetSignature(sig)
+ auxSignerData, err := auxBuilder.GetAuxSignerData()
+ require.NoError(t, err)
+
+ // Create a TxBuilder
+ w := encCfg.TxConfig.NewTxBuilder()
+ w.AddAuxSignerData(auxSignerData)
+ w.SetFeePayer(feepayerAddr)
+ w.SetFeeAmount(fee)
+ w.SetGasLimit(gas)
+ w.AddSignature(signing.SignatureV2{
+ PubKey: feepayerPk,
+ Data: &signing.SingleSignatureData{
+ SignMode: signing.SignMode_SIGN_MODE_DIRECT,
+ Signature: []byte{42}}, // dummy sig
+ Sequence: 5,
+ })
+
+ // Make sure tx is correct
+ txBz, err := encCfg.TxConfig.TxEncoder()(w.GetTx())
+ require.NoError(t, err)
+ tx, err := encCfg.TxConfig.TxDecoder()(txBz)
+ require.NoError(t, err)
+ require.Equal(t, tx.(sdk.FeeTx).FeePayer(), feepayerAddr)
+ require.Equal(t, tx.(sdk.FeeTx).GetFee(), fee)
+ require.Equal(t, tx.(sdk.FeeTx).GetGas(), gas)
+ require.Equal(t, tip, tx.(txtypes.TipTx).GetTip())
+ require.Equal(t, msg, tx.GetMsgs()[0])
+ require.Equal(t, memo, tx.(sdk.TxWithMemo).GetMemo())
+ sigs, err := tx.(authsigning.Tx).GetSignaturesV2()
+ require.NoError(t, err)
+ require.Equal(t, signing.SignatureV2{
+ PubKey: tipperPk,
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT_AUX, Signature: sig},
+ Sequence: 2,
+ }, sigs[0])
+ require.Equal(t, signing.SignatureV2{
+ PubKey: feepayerPk,
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT, Signature: []byte{42}},
+ Sequence: 5,
+ }, sigs[1])
+}
diff --git a/x/auth/tx/builder_test.go b/x/auth/tx/builder_test.go
index 27d3af59af44..e45a67116378 100644
--- a/x/auth/tx/builder_test.go
+++ b/x/auth/tx/builder_test.go
@@ -5,7 +5,6 @@ import (
"github.com/stretchr/testify/require"
- clienttx "github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -314,44 +313,3 @@ func TestBuilderFeeGranter(t *testing.T) {
txBuilder.SetFeeGranter(addr1)
require.Equal(t, addr1, txBuilder.GetTx().FeeGranter())
}
-
-func TestBuilderWithAux(t *testing.T) {
- tipperPriv, tipperPk, tipperAddr := testdata.KeyTestPubAddr()
- _, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
- msg := testdata.NewTestMsg(tipperAddr)
- tip := &txtypes.Tip{Tipper: tipperAddr.String(), Amount: testdata.NewTestFeeAmount()}
- chainID := "test-chain"
-
- // Create an AuxTxBuilder
- auxBuilder := clienttx.NewAuxTxBuilder()
- auxBuilder.SetAccountNumber(1)
- auxBuilder.SetSequence(2)
- auxBuilder.SetTimeoutHeight(3)
- auxBuilder.SetMemo(memo)
- auxBuilder.SetChainID(chainID)
- auxBuilder.SetMsgs(msg)
- auxBuilder.SetPubKey(tipperPk)
- auxBuilder.SetTip(tip)
- err := auxBuilder.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
- require.NoError(t, err)
- signBz, err := auxBuilder.GetSignBytes()
- require.NoError(t, err)
- sig, err := tipperPriv.Sign(signBz)
- require.NoError(t, err)
- auxBuilder.SetSignature(sig)
- auxSignerData, err := auxBuilder.GetAuxSignerData()
- require.NoError(t, err)
-
- // Create a TxBuilder
- w := newBuilder()
- w.AddAuxSignerData(auxSignerData)
- w.SetFeePayer(feepayerAddr)
- w.SetFeeAmount(testdata.NewTestFeeAmount())
- // Set SignerInfo for the feepayer
- w.AddSignature(signing.SignatureV2{
- PubKey: feepayerPk,
- Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT},
- Sequence: 5,
- })
-
-}
From eaf32d32d96a8338703dc06d4d4e348e15219304 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 18:55:10 +0100
Subject: [PATCH 10/17] Remove AddSignature
---
client/tx_config.go | 1 -
x/auth/migrations/legacytx/stdtx_builder.go | 18 +++------
x/auth/tx/aux_test.go | 44 ++++++++++++++++-----
x/auth/tx/builder.go | 37 ++++++++---------
4 files changed, 55 insertions(+), 45 deletions(-)
diff --git a/client/tx_config.go b/client/tx_config.go
index 599e6f72c1c5..cb82a06e6686 100644
--- a/client/tx_config.go
+++ b/client/tx_config.go
@@ -38,7 +38,6 @@ type (
GetTx() signing.Tx
SetMsgs(msgs ...sdk.Msg) error
- AddSignature(signature signingtypes.SignatureV2) error
SetSignatures(signatures ...signingtypes.SignatureV2) error
SetMemo(memo string)
SetFeeAmount(amount sdk.Coins)
diff --git a/x/auth/migrations/legacytx/stdtx_builder.go b/x/auth/migrations/legacytx/stdtx_builder.go
index 887211fc9703..0c0454034947 100644
--- a/x/auth/migrations/legacytx/stdtx_builder.go
+++ b/x/auth/migrations/legacytx/stdtx_builder.go
@@ -34,26 +34,18 @@ func (s *StdTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
return nil
}
-// SetSignatures implements TxBuilder.AddSignature.
-func (s *StdTxBuilder) AddSignature(sig signing.SignatureV2) error {
- stdSig, err := SignatureV2ToStdSignature(s.cdc, sig)
- if err != nil {
- return err
- }
-
- s.Signatures = append(s.Signatures, stdSig)
- return nil
-}
-
// SetSignatures implements TxBuilder.SetSignatures.
func (s *StdTxBuilder) SetSignatures(signatures ...signing.SignatureV2) error {
- for _, sig := range signatures {
- err := s.AddSignature(sig)
+ sigs := make([]StdSignature, len(signatures))
+ var err error
+ for i, sig := range signatures {
+ sigs[i], err = SignatureV2ToStdSignature(s.cdc, sig)
if err != nil {
return err
}
}
+ s.Signatures = sigs
return nil
}
diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go
index 294887147c3b..f0a3fdae46f3 100644
--- a/x/auth/tx/aux_test.go
+++ b/x/auth/tx/aux_test.go
@@ -19,7 +19,7 @@ func TestBuilderWithAux(t *testing.T) {
testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
tipperPriv, tipperPk, tipperAddr := testdata.KeyTestPubAddr()
- _, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
+ feepayerPriv, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
msg := testdata.NewTestMsg(tipperAddr)
memo := "test-memo"
tip := &txtypes.Tip{Tipper: tipperAddr.String(), Amount: sdk.NewCoins(sdk.NewCoin("tip-denom", sdk.NewIntFromUint64(123)))}
@@ -41,9 +41,9 @@ func TestBuilderWithAux(t *testing.T) {
require.NoError(t, err)
signBz, err := auxBuilder.GetSignBytes()
require.NoError(t, err)
- sig, err := tipperPriv.Sign(signBz)
+ tipperSig, err := tipperPriv.Sign(signBz)
require.NoError(t, err)
- auxBuilder.SetSignature(sig)
+ auxBuilder.SetSignature(tipperSig)
auxSignerData, err := auxBuilder.GetAuxSignerData()
require.NoError(t, err)
@@ -53,12 +53,36 @@ func TestBuilderWithAux(t *testing.T) {
w.SetFeePayer(feepayerAddr)
w.SetFeeAmount(fee)
w.SetGasLimit(gas)
- w.AddSignature(signing.SignatureV2{
+ sigs, err := w.(authsigning.SigVerifiableTx).GetSignaturesV2()
+ require.NoError(t, err)
+ tipperSigV2 := sigs[0]
+ // Set the fee payer signer info
+ w.SetSignatures(tipperSigV2, signing.SignatureV2{
+ PubKey: feepayerPk,
+ Sequence: 15,
+ })
+ signBz, err = encCfg.TxConfig.SignModeHandler().GetSignBytes(
+ signing.SignMode_SIGN_MODE_DIRECT,
+ authsigning.SignerData{
+ Address: feepayerAddr.String(),
+ ChainID: chainID,
+ AccountNumber: 11,
+ Sequence: 15,
+ SignerIndex: 1,
+ },
+ w.GetTx(),
+ )
+ require.NoError(t, err)
+ feepayerSig, err := feepayerPriv.Sign(signBz)
+ require.NoError(t, err)
+ // Set the fee payer signature
+ w.SetSignatures(tipperSigV2, signing.SignatureV2{
PubKey: feepayerPk,
Data: &signing.SingleSignatureData{
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
- Signature: []byte{42}}, // dummy sig
- Sequence: 5,
+ Signature: feepayerSig,
+ },
+ Sequence: 15,
})
// Make sure tx is correct
@@ -72,16 +96,16 @@ func TestBuilderWithAux(t *testing.T) {
require.Equal(t, tip, tx.(txtypes.TipTx).GetTip())
require.Equal(t, msg, tx.GetMsgs()[0])
require.Equal(t, memo, tx.(sdk.TxWithMemo).GetMemo())
- sigs, err := tx.(authsigning.Tx).GetSignaturesV2()
+ sigs, err = tx.(authsigning.Tx).GetSignaturesV2()
require.NoError(t, err)
require.Equal(t, signing.SignatureV2{
PubKey: tipperPk,
- Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT_AUX, Signature: sig},
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT_AUX, Signature: tipperSig},
Sequence: 2,
}, sigs[0])
require.Equal(t, signing.SignatureV2{
PubKey: feepayerPk,
- Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT, Signature: []byte{42}},
- Sequence: 5,
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT, Signature: feepayerSig},
+ Sequence: 15,
}, sigs[1])
}
diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index 2a48fdf5c5dc..e9a5cd4d493b 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -284,33 +284,28 @@ func (w *wrapper) SetFeeGranter(feeGranter sdk.AccAddress) {
w.authInfoBz = nil
}
-func (w *wrapper) AddSignature(sig signing.SignatureV2) error {
- modeInfo, rawSig := SignatureDataToModeInfoAndSig(sig.Data)
- any, err := codectypes.NewAnyWithValue(sig.PubKey)
- if err != nil {
- return err
- }
-
- signerInfo := &tx.SignerInfo{
- PublicKey: any,
- ModeInfo: modeInfo,
- Sequence: sig.Sequence,
- }
-
- w.setSignerInfos(append(w.tx.AuthInfo.SignerInfos, signerInfo))
- w.setSignatures(append(w.tx.Signatures, rawSig))
-
- return nil
-}
-
func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error {
- for _, sig := range signatures {
- err := w.AddSignature(sig)
+ n := len(signatures)
+ signerInfos := make([]*tx.SignerInfo, n)
+ rawSigs := make([][]byte, n)
+
+ for i, sig := range signatures {
+ var modeInfo *tx.ModeInfo
+ modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data)
+ any, err := codectypes.NewAnyWithValue(sig.PubKey)
if err != nil {
return err
}
+ signerInfos[i] = &tx.SignerInfo{
+ PublicKey: any,
+ ModeInfo: modeInfo,
+ Sequence: sig.Sequence,
+ }
}
+ w.setSignerInfos(signerInfos)
+ w.setSignatures(rawSigs)
+
return nil
}
From 0a04112effe12b6912ba0c4faf2589a8aaf1def6 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 19:01:14 +0100
Subject: [PATCH 11/17] Add since
---
proto/cosmos/tx/v1beta1/tx.proto | 2 ++
1 file changed, 2 insertions(+)
diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto
index fee50d388295..5e19e75d8e4e 100644
--- a/proto/cosmos/tx/v1beta1/tx.proto
+++ b/proto/cosmos/tx/v1beta1/tx.proto
@@ -226,6 +226,8 @@ message Tip {
// tipper) builds and sends to the fee payer (who will build and broadcast the
// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
// by the node if sent directly as-is.
+//
+// Since: cosmos-sdk 0.45
message AuxSignerData {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs. Note: we use the same sign doc even if we're signing with
From 9d18d47050a5c7d07a6232ef848f510e24eb9490 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Mon, 8 Nov 2021 19:09:50 +0100
Subject: [PATCH 12/17] make proto-gen
---
docs/core/proto-docs.md | 2 ++
types/tx/tx.pb.go | 2 ++
x/auth/tx/aux_test.go | 20 ++++++++------------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 5ec7f498a0dd..0d1d228b384a 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -9483,6 +9483,8 @@ tipper) builds and sends to the fee payer (who will build and broadcast the
actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
by the node if sent directly as-is.
+Since: cosmos-sdk 0.45
+
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go
index d74246565eb1..7a09c9f8c554 100644
--- a/types/tx/tx.pb.go
+++ b/types/tx/tx.pb.go
@@ -911,6 +911,8 @@ func (m *Tip) GetTipper() string {
// tipper) builds and sends to the fee payer (who will build and broadcast the
// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected
// by the node if sent directly as-is.
+//
+// Since: cosmos-sdk 0.45
type AuxSignerData struct {
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs. Note: we use the same sign doc even if we're signing with
diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go
index f0a3fdae46f3..7de24282ddb8 100644
--- a/x/auth/tx/aux_test.go
+++ b/x/auth/tx/aux_test.go
@@ -47,35 +47,30 @@ func TestBuilderWithAux(t *testing.T) {
auxSignerData, err := auxBuilder.GetAuxSignerData()
require.NoError(t, err)
- // Create a TxBuilder
+ // Fee payer creates a TxBuilder.
w := encCfg.TxConfig.NewTxBuilder()
- w.AddAuxSignerData(auxSignerData)
+ err = w.AddAuxSignerData(auxSignerData)
+ require.NoError(t, err)
w.SetFeePayer(feepayerAddr)
w.SetFeeAmount(fee)
w.SetGasLimit(gas)
sigs, err := w.(authsigning.SigVerifiableTx).GetSignaturesV2()
require.NoError(t, err)
tipperSigV2 := sigs[0]
- // Set the fee payer signer info
+ // Set all signer infos.
w.SetSignatures(tipperSigV2, signing.SignatureV2{
PubKey: feepayerPk,
Sequence: 15,
})
signBz, err = encCfg.TxConfig.SignModeHandler().GetSignBytes(
signing.SignMode_SIGN_MODE_DIRECT,
- authsigning.SignerData{
- Address: feepayerAddr.String(),
- ChainID: chainID,
- AccountNumber: 11,
- Sequence: 15,
- SignerIndex: 1,
- },
+ authsigning.SignerData{Address: feepayerAddr.String(), ChainID: chainID, AccountNumber: 11, Sequence: 15, SignerIndex: 1},
w.GetTx(),
)
require.NoError(t, err)
feepayerSig, err := feepayerPriv.Sign(signBz)
require.NoError(t, err)
- // Set the fee payer signature
+ // Set all signatures.
w.SetSignatures(tipperSigV2, signing.SignatureV2{
PubKey: feepayerPk,
Data: &signing.SingleSignatureData{
@@ -85,7 +80,7 @@ func TestBuilderWithAux(t *testing.T) {
Sequence: 15,
})
- // Make sure tx is correct
+ // Make sure tx is correct.
txBz, err := encCfg.TxConfig.TxEncoder()(w.GetTx())
require.NoError(t, err)
tx, err := encCfg.TxConfig.TxDecoder()(txBz)
@@ -96,6 +91,7 @@ func TestBuilderWithAux(t *testing.T) {
require.Equal(t, tip, tx.(txtypes.TipTx).GetTip())
require.Equal(t, msg, tx.GetMsgs()[0])
require.Equal(t, memo, tx.(sdk.TxWithMemo).GetMemo())
+ require.Equal(t, uint64(3), tx.(sdk.TxWithTimeoutHeight).GetTimeoutHeight())
sigs, err = tx.(authsigning.Tx).GetSignaturesV2()
require.NoError(t, err)
require.Equal(t, signing.SignatureV2{
From b9f3cf3f43f8f93bcb48731a3323e3a1c025fae5 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Tue, 9 Nov 2021 12:24:01 +0100
Subject: [PATCH 13/17] AddAuxSignerData correct order
---
x/auth/tx/aux_test.go | 84 +++++++++++++++++++++--------
x/auth/tx/builder.go | 61 +++++++++++++++++++--
x/auth/tx/builder_test.go | 8 +--
x/auth/tx/config.go | 2 +-
x/auth/tx/encode_decode_test.go | 2 +-
x/auth/tx/legacy_amino_json_test.go | 8 +--
6 files changed, 128 insertions(+), 37 deletions(-)
diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go
index 7de24282ddb8..83347ab282ce 100644
--- a/x/auth/tx/aux_test.go
+++ b/x/auth/tx/aux_test.go
@@ -14,42 +14,73 @@ import (
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
)
+// TestBuilderWithAux creates a tx with 2 aux signers:
+// - 1st one is tipper,
+// - 2nd one is just an aux signer.
+// Then it tests integrating the 2 AuxSignerData into a
+// client.TxBuilder created by the fee payer.
func TestBuilderWithAux(t *testing.T) {
encCfg := simapp.MakeTestEncodingConfig()
testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
+ // The final TX has 3 signers, in this order.
tipperPriv, tipperPk, tipperAddr := testdata.KeyTestPubAddr()
+ aux2Priv, aux2Pk, aux2Addr := testdata.KeyTestPubAddr()
feepayerPriv, feepayerPk, feepayerAddr := testdata.KeyTestPubAddr()
- msg := testdata.NewTestMsg(tipperAddr)
+
+ msg := testdata.NewTestMsg(tipperAddr, aux2Addr)
memo := "test-memo"
tip := &txtypes.Tip{Tipper: tipperAddr.String(), Amount: sdk.NewCoins(sdk.NewCoin("tip-denom", sdk.NewIntFromUint64(123)))}
chainID := "test-chain"
gas := testdata.NewTestGasLimit()
fee := testdata.NewTestFeeAmount()
- // Create an AuxTxBuilder
- auxBuilder := clienttx.NewAuxTxBuilder()
- auxBuilder.SetAccountNumber(1)
- auxBuilder.SetSequence(2)
- auxBuilder.SetTimeoutHeight(3)
- auxBuilder.SetMemo(memo)
- auxBuilder.SetChainID(chainID)
- auxBuilder.SetMsgs(msg)
- auxBuilder.SetPubKey(tipperPk)
- auxBuilder.SetTip(tip)
- err := auxBuilder.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
- require.NoError(t, err)
- signBz, err := auxBuilder.GetSignBytes()
+ // Create an AuxTxBuilder for tipper (1st signer)
+ tipperBuilder := clienttx.NewAuxTxBuilder()
+ tipperBuilder.SetAccountNumber(1)
+ tipperBuilder.SetSequence(2)
+ tipperBuilder.SetTimeoutHeight(3)
+ tipperBuilder.SetMemo(memo)
+ tipperBuilder.SetChainID(chainID)
+ tipperBuilder.SetMsgs(msg)
+ tipperBuilder.SetPubKey(tipperPk)
+ tipperBuilder.SetTip(tip)
+ err := tipperBuilder.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+ signBz, err := tipperBuilder.GetSignBytes()
require.NoError(t, err)
tipperSig, err := tipperPriv.Sign(signBz)
require.NoError(t, err)
- auxBuilder.SetSignature(tipperSig)
- auxSignerData, err := auxBuilder.GetAuxSignerData()
+ tipperBuilder.SetSignature(tipperSig)
+ tipperSignerData, err := tipperBuilder.GetAuxSignerData()
+ require.NoError(t, err)
+
+ // Create an AuxTxBuilder for aux2 (2nd signer)
+ aux2Builder := clienttx.NewAuxTxBuilder()
+ aux2Builder.SetAccountNumber(11)
+ aux2Builder.SetSequence(12)
+ aux2Builder.SetTimeoutHeight(3)
+ aux2Builder.SetMemo(memo)
+ aux2Builder.SetChainID(chainID)
+ aux2Builder.SetMsgs(msg)
+ aux2Builder.SetPubKey(aux2Pk)
+ aux2Builder.SetTip(tip)
+ err = aux2Builder.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
+ require.NoError(t, err)
+ signBz, err = aux2Builder.GetSignBytes()
+ require.NoError(t, err)
+ aux2Sig, err := aux2Priv.Sign(signBz)
+ require.NoError(t, err)
+ aux2Builder.SetSignature(aux2Sig)
+ aux2SignerData, err := aux2Builder.GetAuxSignerData()
require.NoError(t, err)
- // Fee payer creates a TxBuilder.
+ // Fee payer (3rd and last signer) creates a TxBuilder.
w := encCfg.TxConfig.NewTxBuilder()
- err = w.AddAuxSignerData(auxSignerData)
+ // Note: we're testing calling AddAuxSignerData in the wrong order.
+ err = w.AddAuxSignerData(aux2SignerData)
+ require.NoError(t, err)
+ err = w.AddAuxSignerData(tipperSignerData)
require.NoError(t, err)
w.SetFeePayer(feepayerAddr)
w.SetFeeAmount(fee)
@@ -57,8 +88,9 @@ func TestBuilderWithAux(t *testing.T) {
sigs, err := w.(authsigning.SigVerifiableTx).GetSignaturesV2()
require.NoError(t, err)
tipperSigV2 := sigs[0]
+ aux2SigV2 := sigs[1]
// Set all signer infos.
- w.SetSignatures(tipperSigV2, signing.SignatureV2{
+ w.SetSignatures(tipperSigV2, aux2SigV2, signing.SignatureV2{
PubKey: feepayerPk,
Sequence: 15,
})
@@ -71,13 +103,13 @@ func TestBuilderWithAux(t *testing.T) {
feepayerSig, err := feepayerPriv.Sign(signBz)
require.NoError(t, err)
// Set all signatures.
- w.SetSignatures(tipperSigV2, signing.SignatureV2{
+ w.SetSignatures(tipperSigV2, aux2SigV2, signing.SignatureV2{
PubKey: feepayerPk,
Data: &signing.SingleSignatureData{
SignMode: signing.SignMode_SIGN_MODE_DIRECT,
Signature: feepayerSig,
},
- Sequence: 15,
+ Sequence: 22,
})
// Make sure tx is correct.
@@ -94,14 +126,20 @@ func TestBuilderWithAux(t *testing.T) {
require.Equal(t, uint64(3), tx.(sdk.TxWithTimeoutHeight).GetTimeoutHeight())
sigs, err = tx.(authsigning.Tx).GetSignaturesV2()
require.NoError(t, err)
+ require.Len(t, sigs, 3)
require.Equal(t, signing.SignatureV2{
PubKey: tipperPk,
Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT_AUX, Signature: tipperSig},
Sequence: 2,
}, sigs[0])
+ require.Equal(t, signing.SignatureV2{
+ PubKey: aux2Pk,
+ Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, Signature: aux2Sig},
+ Sequence: 12,
+ }, sigs[1])
require.Equal(t, signing.SignatureV2{
PubKey: feepayerPk,
Data: &signing.SingleSignatureData{SignMode: signing.SignMode_SIGN_MODE_DIRECT, Signature: feepayerSig},
- Sequence: 15,
- }, sigs[1])
+ Sequence: 22,
+ }, sigs[2])
}
diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index e9a5cd4d493b..7c1b09543465 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -4,6 +4,7 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/cosmos/cosmos-sdk/client"
+ "github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -17,6 +18,8 @@ import (
// wrapper is a wrapper around the tx.Tx proto.Message which retain the raw
// body and auth_info bytes.
type wrapper struct {
+ cdc codec.Codec
+
tx *tx.Tx
// bodyBz represents the protobuf encoding of TxBody. This should be encoding
@@ -46,8 +49,9 @@ type ExtensionOptionsTxBuilder interface {
SetNonCriticalExtensionOptions(...*codectypes.Any)
}
-func newBuilder() *wrapper {
+func newBuilder(cdc codec.Codec) *wrapper {
return &wrapper{
+ cdc: cdc,
tx: &tx.Tx{
Body: &tx.TxBody{},
AuthInfo: &tx.AuthInfo{
@@ -315,10 +319,28 @@ func (w *wrapper) setSignerInfos(infos []*tx.SignerInfo) {
w.authInfoBz = nil
}
+func (w *wrapper) setSignerInfoAtIndex(index int, info *tx.SignerInfo) {
+ if w.tx.AuthInfo.SignerInfos == nil {
+ w.tx.AuthInfo.SignerInfos = make([]*tx.SignerInfo, len(w.GetSigners()))
+ }
+
+ w.tx.AuthInfo.SignerInfos[index] = info
+ // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo
+ w.authInfoBz = nil
+}
+
func (w *wrapper) setSignatures(sigs [][]byte) {
w.tx.Signatures = sigs
}
+func (w *wrapper) setSignatureAtIndex(index int, sig []byte) {
+ if w.tx.Signatures == nil {
+ w.tx.Signatures = make([][]byte, len(w.GetSigners()))
+ }
+
+ w.tx.Signatures[index] = sig
+}
+
func (w *wrapper) GetTx() authsigning.Tx {
return w
}
@@ -365,14 +387,45 @@ func (w *wrapper) AddAuxSignerData(data tx.AuxSignerData) error {
}
w.bodyBz = data.SignDoc.BodyBytes
+
+ var body tx.TxBody
+ err = w.cdc.Unmarshal(w.bodyBz, &body)
+ if err != nil {
+ return err
+ }
+
+ w.SetMemo(body.Memo)
+ w.SetTimeoutHeight(body.TimeoutHeight)
+ w.SetExtensionOptions(body.ExtensionOptions...)
+ w.SetNonCriticalExtensionOptions(body.NonCriticalExtensionOptions...)
+ msgs := make([]sdk.Msg, len(body.Messages))
+ for i, msgAny := range body.Messages {
+ msgs[i] = msgAny.GetCachedValue().(sdk.Msg)
+ }
+ w.SetMsgs(msgs...)
w.SetTip(data.GetSignDoc().GetTip())
- w.setSignerInfos(append(w.tx.AuthInfo.SignerInfos, &tx.SignerInfo{
+ // Get the aux signer's index in GetSigners.
+ signerIndex := -1
+ pk, ok := data.SignDoc.PublicKey.GetCachedValue().(cryptotypes.PubKey)
+ if !ok {
+ return sdkerrors.ErrInvalidType.Wrapf("expected %T, got %T", (cryptotypes.PubKey)(nil), pk)
+ }
+ for i, signer := range w.GetSigners() {
+ if signer.Equals(sdk.AccAddress(pk.Address())) {
+ signerIndex = i
+ }
+ }
+ if signerIndex < 0 {
+ return sdkerrors.ErrLogic.Wrapf("address %s is not a signer", sdk.AccAddress(pk.Address()))
+ }
+
+ w.setSignerInfoAtIndex(signerIndex, &tx.SignerInfo{
PublicKey: data.SignDoc.PublicKey,
ModeInfo: &tx.ModeInfo{Sum: &tx.ModeInfo_Single_{Single: &tx.ModeInfo_Single{Mode: data.Mode}}},
Sequence: data.SignDoc.Sequence,
- }))
- w.setSignatures(append(w.tx.Signatures, data.Sig))
+ })
+ w.setSignatureAtIndex(signerIndex, data.Sig)
return nil
}
diff --git a/x/auth/tx/builder_test.go b/x/auth/tx/builder_test.go
index e45a67116378..f7122dd39218 100644
--- a/x/auth/tx/builder_test.go
+++ b/x/auth/tx/builder_test.go
@@ -19,7 +19,7 @@ func TestTxBuilder(t *testing.T) {
_, pubkey, addr := testdata.KeyTestPubAddr()
marshaler := codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
- txBuilder := newBuilder()
+ txBuilder := newBuilder(nil)
memo := "sometestmemo"
msgs := []sdk.Msg{testdata.NewTestMsg(addr)}
@@ -136,7 +136,7 @@ func TestBuilderValidateBasic(t *testing.T) {
// require to fail validation upon invalid fee
badFeeAmount := testdata.NewTestFeeAmount()
badFeeAmount[0].Amount = sdk.NewInt(-5)
- txBuilder := newBuilder()
+ txBuilder := newBuilder(nil)
var sig1, sig2 signing.SignatureV2
sig1 = signing.SignatureV2{
@@ -277,7 +277,7 @@ func TestBuilderFeePayer(t *testing.T) {
for name, tc := range cases {
t.Run(name, func(t *testing.T) {
// setup basic tx
- txBuilder := newBuilder()
+ txBuilder := newBuilder(nil)
err := txBuilder.SetMsgs(msgs...)
require.NoError(t, err)
txBuilder.SetGasLimit(200000)
@@ -301,7 +301,7 @@ func TestBuilderFeeGranter(t *testing.T) {
feeAmount := testdata.NewTestFeeAmount()
msgs := []sdk.Msg{msg1}
- txBuilder := newBuilder()
+ txBuilder := newBuilder(nil)
err := txBuilder.SetMsgs(msgs...)
require.NoError(t, err)
txBuilder.SetGasLimit(200000)
diff --git a/x/auth/tx/config.go b/x/auth/tx/config.go
index 8402423dbf77..f850014b657d 100644
--- a/x/auth/tx/config.go
+++ b/x/auth/tx/config.go
@@ -35,7 +35,7 @@ func NewTxConfig(protoCodec codec.ProtoCodecMarshaler, enabledSignModes []signin
}
func (g config) NewTxBuilder() client.TxBuilder {
- return newBuilder()
+ return newBuilder(g.protoCodec)
}
// WrapTxBuilder returns a builder from provided transaction
diff --git a/x/auth/tx/encode_decode_test.go b/x/auth/tx/encode_decode_test.go
index d4d5ad7554d0..5991f6653450 100644
--- a/x/auth/tx/encode_decode_test.go
+++ b/x/auth/tx/encode_decode_test.go
@@ -24,7 +24,7 @@ func TestDefaultTxDecoderError(t *testing.T) {
encoder := DefaultTxEncoder()
decoder := DefaultTxDecoder(cdc)
- builder := newBuilder()
+ builder := newBuilder(nil)
err := builder.SetMsgs(testdata.NewTestMsg())
require.NoError(t, err)
diff --git a/x/auth/tx/legacy_amino_json_test.go b/x/auth/tx/legacy_amino_json_test.go
index 9734e7704eea..7bb4770fa6bd 100644
--- a/x/auth/tx/legacy_amino_json_test.go
+++ b/x/auth/tx/legacy_amino_json_test.go
@@ -86,7 +86,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
for _, tc := range testcases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
- bldr := newBuilder()
+ bldr := newBuilder(nil)
buildTx(t, bldr)
tx := bldr.GetTx()
tc.malleate(bldr)
@@ -104,7 +104,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
})
}
- bldr := newBuilder()
+ bldr := newBuilder(nil)
buildTx(t, bldr)
tx := bldr.GetTx()
signingData := signing.SignerData{
@@ -120,7 +120,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
require.Error(t, err)
// expect error with extension options
- bldr = newBuilder()
+ bldr = newBuilder(nil)
buildTx(t, bldr)
any, err := cdctypes.NewAnyWithValue(testdata.NewTestMsg())
require.NoError(t, err)
@@ -130,7 +130,7 @@ func TestLegacyAminoJSONHandler_GetSignBytes(t *testing.T) {
require.Error(t, err)
// expect error with non-critical extension options
- bldr = newBuilder()
+ bldr = newBuilder(nil)
buildTx(t, bldr)
bldr.tx.Body.NonCriticalExtensionOptions = []*cdctypes.Any{any}
tx = bldr.GetTx()
From 0917b768c66416025a1d4ca86ecda7c7e55fb9db Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Tue, 9 Nov 2021 13:01:48 +0100
Subject: [PATCH 14/17] Add addess in AuxSignerData
---
client/tx/aux_builder.go | 6 +
client/tx/aux_builder_test.go | 21 ++++
docs/core/proto-docs.md | 1 +
proto/cosmos/tx/v1beta1/tx.proto | 10 +-
types/tx/aux.go | 4 +
types/tx/aux_test.go | 13 +-
types/tx/tx.pb.go | 196 ++++++++++++++++++++-----------
x/auth/tx/aux_test.go | 2 +
x/auth/tx/builder.go | 8 +-
9 files changed, 175 insertions(+), 86 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index 6e1d5db79bd1..0644047c151a 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -27,6 +27,12 @@ func NewAuxTxBuilder() AuxTxBuilder {
return AuxTxBuilder{}
}
+func (b *AuxTxBuilder) SetAddress(addr string) {
+ b.checkEmptyFields()
+
+ b.auxSignerData.Address = addr
+}
+
func (b *AuxTxBuilder) SetMemo(memo string) {
b.checkEmptyFields()
diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go
index cc69a9f168e9..e226d46b9e1a 100644
--- a/client/tx/aux_builder_test.go
+++ b/client/tx/aux_builder_test.go
@@ -113,12 +113,30 @@ func TestAuxTxBuilder(t *testing.T) {
},
false, "",
},
+ {
+ "GetAuxSignerData address should not be empty",
+ func() error {
+ b.SetMsgs(msg)
+ b.SetPubKey(pk)
+ b.SetTip(tip)
+ err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
+ require.NoError(t, err)
+
+ _, err = b.GetSignBytes()
+ require.NoError(t, err)
+
+ _, err = b.GetAuxSignerData()
+ return err
+ },
+ true, "address cannot be empty: invalid request",
+ },
{
"GetAuxSignerData signature should not be empty",
func() error {
b.SetMsgs(msg)
b.SetPubKey(pk)
b.SetTip(tip)
+ b.SetAddress(addr.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -144,6 +162,7 @@ func TestAuxTxBuilder(t *testing.T) {
b.SetMsgs(msg)
b.SetPubKey(pk)
b.SetTip(tip)
+ b.SetAddress(addr.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -180,6 +199,7 @@ func TestAuxTxBuilder(t *testing.T) {
b.SetMsgs(msg)
b.SetPubKey(pk)
b.SetTip(tip)
+ b.SetAddress(addr.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
require.NoError(t, err)
@@ -194,6 +214,7 @@ func TestAuxTxBuilder(t *testing.T) {
b.SetMsgs(msg)
b.SetPubKey(pk)
b.SetTip(tip)
+ b.SetAddress(addr.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
require.NoError(t, err)
diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md
index 0d1d228b384a..c780a14b5a54 100644
--- a/docs/core/proto-docs.md
+++ b/docs/core/proto-docs.md
@@ -9488,6 +9488,7 @@ Since: cosmos-sdk 0.45
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
+| `address` | [string](#string) | | address is the bech32-encoded address of the auxiliary signer. If using AuxSignerData across different chains, the bech32 prefix of the target chain (where the final transaction is broadcasted) should be used. |
| `sign_doc` | [SignDocDirectAux](#cosmos.tx.v1beta1.SignDocDirectAux) | | sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer signs. Note: we use the same sign doc even if we're signing with LEGACY_AMINO_JSON. |
| `mode` | [cosmos.tx.signing.v1beta1.SignMode](#cosmos.tx.signing.v1beta1.SignMode) | | mode is the signing mode of the single signer |
| `sig` | [bytes](#bytes) | | sig is the signature of the sign doc. |
diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/proto/cosmos/tx/v1beta1/tx.proto
index 5e19e75d8e4e..5f63b9364bdd 100644
--- a/proto/cosmos/tx/v1beta1/tx.proto
+++ b/proto/cosmos/tx/v1beta1/tx.proto
@@ -229,12 +229,16 @@ message Tip {
//
// Since: cosmos-sdk 0.45
message AuxSignerData {
+ // address is the bech32-encoded address of the auxiliary signer. If using
+ // AuxSignerData across different chains, the bech32 prefix of the target
+ // chain (where the final transaction is broadcasted) should be used.
+ string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs. Note: we use the same sign doc even if we're signing with
// LEGACY_AMINO_JSON.
- SignDocDirectAux sign_doc = 1;
+ SignDocDirectAux sign_doc = 2;
// mode is the signing mode of the single signer
- cosmos.tx.signing.v1beta1.SignMode mode = 2;
+ cosmos.tx.signing.v1beta1.SignMode mode = 3;
// sig is the signature of the sign doc.
- bytes sig = 3;
+ bytes sig = 4;
}
diff --git a/types/tx/aux.go b/types/tx/aux.go
index e642088123b4..5f589ec037f9 100644
--- a/types/tx/aux.go
+++ b/types/tx/aux.go
@@ -37,6 +37,10 @@ func (s *SignDocDirectAux) UnpackInterfaces(unpacker codectypes.AnyUnpacker) err
// ValidateBasic performs stateless validation of the auxiliary tx.
func (a *AuxSignerData) ValidateBasic() error {
+ if a.Address == "" {
+ return sdkerrors.ErrInvalidRequest.Wrapf("address cannot be empty")
+ }
+
if a.Mode != signing.SignMode_SIGN_MODE_DIRECT_AUX && a.Mode != signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON {
return sdkerrors.ErrInvalidRequest.Wrapf("AuxTxBuilder can only sign with %s or %s", signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
}
diff --git a/types/tx/aux_test.go b/types/tx/aux_test.go
index 5a60234a939b..de9382b4ec77 100644
--- a/types/tx/aux_test.go
+++ b/types/tx/aux_test.go
@@ -50,7 +50,7 @@ func TestSignDocDirectAux(t *testing.T) {
func TestAuxSignerData(t *testing.T) {
bodyBz := []byte{42}
- _, pk, _ := testdata.KeyTestPubAddr()
+ _, pk, addr := testdata.KeyTestPubAddr()
pkAny, err := codectypes.NewAnyWithValue(pk)
require.NoError(t, err)
sig := []byte{42}
@@ -61,11 +61,12 @@ func TestAuxSignerData(t *testing.T) {
sd tx.AuxSignerData
expErr bool
}{
- {"empty sign mode", tx.AuxSignerData{}, true},
- {"SIGN_MODE_DIRECT", tx.AuxSignerData{Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
- {"no sig", tx.AuxSignerData{Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
- {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Mode: signing.SignMode_SIGN_MODE_DIRECT_AUX, SignDoc: sd, Sig: sig}, false},
- {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Mode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, SignDoc: sd, Sig: sig}, false},
+ {"empty address", tx.AuxSignerData{}, true},
+ {"empty sign mode", tx.AuxSignerData{Address: addr.String()}, true},
+ {"SIGN_MODE_DIRECT", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
+ {"no sig", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
+ {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode_SIGN_MODE_DIRECT_AUX, SignDoc: sd, Sig: sig}, false},
+ {"happy case WITH DIRECT_AUX", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, SignDoc: sd, Sig: sig}, false},
}
for _, tc := range testcases {
diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go
index 7a09c9f8c554..f28f9fb6a227 100644
--- a/types/tx/tx.pb.go
+++ b/types/tx/tx.pb.go
@@ -914,14 +914,18 @@ func (m *Tip) GetTipper() string {
//
// Since: cosmos-sdk 0.45
type AuxSignerData struct {
+ // address is the bech32-encoded address of the auxiliary signer. If using
+ // AuxSignerData across different chains, the bech32 prefix of the target
+ // chain (where the final transaction is broadcasted) should be used.
+ Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
// sign_doc is the SIGN_MOD_DIRECT_AUX sign doc that the auxiliary signer
// signs. Note: we use the same sign doc even if we're signing with
// LEGACY_AMINO_JSON.
- SignDoc *SignDocDirectAux `protobuf:"bytes,1,opt,name=sign_doc,json=signDoc,proto3" json:"sign_doc,omitempty"`
+ SignDoc *SignDocDirectAux `protobuf:"bytes,2,opt,name=sign_doc,json=signDoc,proto3" json:"sign_doc,omitempty"`
// mode is the signing mode of the single signer
- Mode signing.SignMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"`
+ Mode signing.SignMode `protobuf:"varint,3,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"`
// sig is the signature of the sign doc.
- Sig []byte `protobuf:"bytes,3,opt,name=sig,proto3" json:"sig,omitempty"`
+ Sig []byte `protobuf:"bytes,4,opt,name=sig,proto3" json:"sig,omitempty"`
}
func (m *AuxSignerData) Reset() { *m = AuxSignerData{} }
@@ -957,6 +961,13 @@ func (m *AuxSignerData) XXX_DiscardUnknown() {
var xxx_messageInfo_AuxSignerData proto.InternalMessageInfo
+func (m *AuxSignerData) GetAddress() string {
+ if m != nil {
+ return m.Address
+ }
+ return ""
+}
+
func (m *AuxSignerData) GetSignDoc() *SignDocDirectAux {
if m != nil {
return m.SignDoc
@@ -997,71 +1008,71 @@ func init() {
func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) }
var fileDescriptor_96d1575ffde80842 = []byte{
- // 1009 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6f, 0x1b, 0x45,
- 0x14, 0xf6, 0x7a, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x74, 0x14, 0x21, 0xc7, 0x51, 0xdd, 0xe0, 0xaa,
+ // 1018 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x6f, 0x1b, 0x45,
+ 0x14, 0xf6, 0x66, 0x6d, 0xc7, 0x7e, 0x4d, 0xda, 0x74, 0x14, 0x21, 0xc7, 0x51, 0xdd, 0xe0, 0xaa,
0xe0, 0x4b, 0x76, 0xd3, 0xf4, 0xd0, 0x82, 0x10, 0x60, 0x37, 0x54, 0xa9, 0x4a, 0x41, 0x9a, 0xe4,
- 0xd4, 0xcb, 0x6a, 0xbc, 0x9e, 0xac, 0x47, 0xf5, 0xce, 0x2c, 0x3b, 0xb3, 0x60, 0xff, 0x11, 0x48,
- 0x15, 0x12, 0x42, 0xe2, 0xc4, 0x99, 0x33, 0x7f, 0x44, 0x8f, 0x15, 0x27, 0x4e, 0x50, 0x25, 0x47,
- 0x24, 0xfe, 0x05, 0xd0, 0xcc, 0xce, 0x6e, 0xd2, 0x92, 0xda, 0x45, 0xf4, 0xb4, 0xf3, 0xe3, 0x7b,
- 0xdf, 0x7c, 0x6f, 0xde, 0xb7, 0x6f, 0xa0, 0x13, 0x0a, 0x19, 0x0b, 0xe9, 0xab, 0x99, 0xff, 0xf5,
- 0xad, 0x11, 0x55, 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xbe, 0x8b, 0x85, 0x71, 0xdd, 0xff, 0x68, 0x5c, 0xb4, 0x01, 0xae,
+ 0x64, 0x91, 0x39, 0xe0, 0x35, 0xac, 0x87, 0x83, 0x4f, 0x9e, 0x9d, 0x76, 0x9c, 0xe7, 0xa7, 0x1d,
+ 0xe7, 0xc5, 0x69, 0xc7, 0x79, 0x7a, 0xd6, 0xa9, 0x3c, 0x3f, 0xeb, 0x54, 0x7e, 0x3b, 0xeb, 0x54,
+ 0x1e, 0xdf, 0x5c, 0xee, 0x07, 0x5f, 0x4d, 0x87, 0x75, 0xd3, 0x43, 0x6e, 0xff, 0x13, 0x00, 0x00,
+ 0xff, 0xff, 0x83, 0x68, 0x7c, 0x6c, 0xab, 0x09, 0x00, 0x00,
}
func (m *Tx) Marshal() (dAtA []byte, err error) {
@@ -1756,12 +1767,12 @@ func (m *AuxSignerData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
copy(dAtA[i:], m.Sig)
i = encodeVarintTx(dAtA, i, uint64(len(m.Sig)))
i--
- dAtA[i] = 0x1a
+ dAtA[i] = 0x22
}
if m.Mode != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.Mode))
i--
- dAtA[i] = 0x10
+ dAtA[i] = 0x18
}
if m.SignDoc != nil {
{
@@ -1773,6 +1784,13 @@ func (m *AuxSignerData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
+ dAtA[i] = 0x12
+ }
+ if len(m.Address) > 0 {
+ i -= len(m.Address)
+ copy(dAtA[i:], m.Address)
+ i = encodeVarintTx(dAtA, i, uint64(len(m.Address)))
+ i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
@@ -2085,6 +2103,10 @@ func (m *AuxSignerData) Size() (n int) {
}
var l int
_ = l
+ l = len(m.Address)
+ if l > 0 {
+ n += 1 + l + sovTx(uint64(l))
+ }
if m.SignDoc != nil {
l = m.SignDoc.Size()
n += 1 + l + sovTx(uint64(l))
@@ -3926,6 +3948,38 @@ func (m *AuxSignerData) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowTx
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthTx
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthTx
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Address = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SignDoc", wireType)
}
@@ -3961,7 +4015,7 @@ func (m *AuxSignerData) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
- case 2:
+ case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType)
}
@@ -3980,7 +4034,7 @@ func (m *AuxSignerData) Unmarshal(dAtA []byte) error {
break
}
}
- case 3:
+ case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Sig", wireType)
}
diff --git a/x/auth/tx/aux_test.go b/x/auth/tx/aux_test.go
index 83347ab282ce..72774712b3ce 100644
--- a/x/auth/tx/aux_test.go
+++ b/x/auth/tx/aux_test.go
@@ -37,6 +37,7 @@ func TestBuilderWithAux(t *testing.T) {
// Create an AuxTxBuilder for tipper (1st signer)
tipperBuilder := clienttx.NewAuxTxBuilder()
+ tipperBuilder.SetAddress(tipperAddr.String())
tipperBuilder.SetAccountNumber(1)
tipperBuilder.SetSequence(2)
tipperBuilder.SetTimeoutHeight(3)
@@ -57,6 +58,7 @@ func TestBuilderWithAux(t *testing.T) {
// Create an AuxTxBuilder for aux2 (2nd signer)
aux2Builder := clienttx.NewAuxTxBuilder()
+ aux2Builder.SetAddress(aux2Addr.String())
aux2Builder.SetAccountNumber(11)
aux2Builder.SetSequence(12)
aux2Builder.SetTimeoutHeight(3)
diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index 7c1b09543465..91e3546c74d7 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -407,17 +407,13 @@ func (w *wrapper) AddAuxSignerData(data tx.AuxSignerData) error {
// Get the aux signer's index in GetSigners.
signerIndex := -1
- pk, ok := data.SignDoc.PublicKey.GetCachedValue().(cryptotypes.PubKey)
- if !ok {
- return sdkerrors.ErrInvalidType.Wrapf("expected %T, got %T", (cryptotypes.PubKey)(nil), pk)
- }
for i, signer := range w.GetSigners() {
- if signer.Equals(sdk.AccAddress(pk.Address())) {
+ if signer.String() == data.Address {
signerIndex = i
}
}
if signerIndex < 0 {
- return sdkerrors.ErrLogic.Wrapf("address %s is not a signer", sdk.AccAddress(pk.Address()))
+ return sdkerrors.ErrLogic.Wrapf("address %s is not a signer", data.Address)
}
w.setSignerInfoAtIndex(signerIndex, &tx.SignerInfo{
From 0acd018c310a423d170411af99b17b27d46cdbb6 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Tue, 9 Nov 2021 13:30:07 +0100
Subject: [PATCH 15/17] Fix proto lint
---
proto/cosmos/group/v1beta1/types.proto | 1 -
1 file changed, 1 deletion(-)
diff --git a/proto/cosmos/group/v1beta1/types.proto b/proto/cosmos/group/v1beta1/types.proto
index 7ef8ad43bd06..5c4a8f99dd47 100644
--- a/proto/cosmos/group/v1beta1/types.proto
+++ b/proto/cosmos/group/v1beta1/types.proto
@@ -9,7 +9,6 @@ import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
-import "cosmos_proto/cosmos.proto";
// Member represents a group member with an account address,
// non-zero weight and metadata.
From 0d752ef9437f2d3ddacbf6782f03055d28fcc57f Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Wed, 10 Nov 2021 11:16:47 +0100
Subject: [PATCH 16/17] Address reviews
---
client/tx/aux_builder.go | 23 +++++--
client/tx/aux_builder_test.go | 112 ++++++++++++++++++----------------
client/tx/legacy_test.go | 7 ++-
types/tx/aux_test.go | 2 +-
4 files changed, 84 insertions(+), 60 deletions(-)
diff --git a/client/tx/aux_builder.go b/client/tx/aux_builder.go
index 0644047c151a..1e0c1a91a77c 100644
--- a/client/tx/aux_builder.go
+++ b/client/tx/aux_builder.go
@@ -12,7 +12,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
)
-// AuxTxBuilder is a client-side builder for creating an AuxTx.
+// AuxTxBuilder is a client-side builder for creating an AuxSignerData.
type AuxTxBuilder struct {
// msgs is used to store the sdk.Msgs that are added to the
// TxBuilder. It's also added inside body.Messages, because:
@@ -23,28 +23,34 @@ type AuxTxBuilder struct {
auxSignerData *tx.AuxSignerData
}
+// NewAuxTxBuilder creates a new client-side builder for constructing an
+// AuxSignerData.
func NewAuxTxBuilder() AuxTxBuilder {
return AuxTxBuilder{}
}
+// SetAddress sets the aux signer's bech32 address.
func (b *AuxTxBuilder) SetAddress(addr string) {
b.checkEmptyFields()
b.auxSignerData.Address = addr
}
+// SetMemo sets a memo in the tx.
func (b *AuxTxBuilder) SetMemo(memo string) {
b.checkEmptyFields()
b.body.Memo = memo
}
+// SetTimeoutHeight sets a timeout height in the tx.
func (b *AuxTxBuilder) SetTimeoutHeight(height uint64) {
b.checkEmptyFields()
b.body.TimeoutHeight = height
}
+// SetMsgs sets an array of Msgs in the tx.
func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
anys := make([]*codectypes.Any, len(msgs))
for i, msg := range msgs {
@@ -63,24 +69,28 @@ func (b *AuxTxBuilder) SetMsgs(msgs ...sdk.Msg) error {
return nil
}
+// SetAccountNumber sets the aux signer's account number in the AuxSignerData.
func (b *AuxTxBuilder) SetAccountNumber(accNum uint64) {
b.checkEmptyFields()
b.auxSignerData.SignDoc.AccountNumber = accNum
}
+// SetChainID sets the chain id in the AuxSignerData.
func (b *AuxTxBuilder) SetChainID(chainID string) {
b.checkEmptyFields()
b.auxSignerData.SignDoc.ChainId = chainID
}
+// SetSequence sets the aux signer's sequence in the AuxSignerData.
func (b *AuxTxBuilder) SetSequence(accSeq uint64) {
b.checkEmptyFields()
b.auxSignerData.SignDoc.Sequence = accSeq
}
+// SetPubKey sets the aux signer's pubkey in the AuxSignerData.
func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
any, err := codectypes.NewAnyWithValue(pk)
if err != nil {
@@ -94,6 +104,8 @@ func (b *AuxTxBuilder) SetPubKey(pk cryptotypes.PubKey) error {
return nil
}
+// SetSignMode sets the aux signer's sign mode. Allowed sign modes are
+// DIRECT_AUX and LEGACY_AMINO_JSON.
func (b *AuxTxBuilder) SetSignMode(mode signing.SignMode) error {
switch mode {
case signing.SignMode_SIGN_MODE_DIRECT_AUX, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON:
@@ -106,16 +118,16 @@ func (b *AuxTxBuilder) SetSignMode(mode signing.SignMode) error {
return nil
}
+// SetTip sets an optional tip.
func (b *AuxTxBuilder) SetTip(tip *tx.Tip) {
b.checkEmptyFields()
b.auxSignerData.SignDoc.Tip = tip
}
+// SetSignature sets the aux signer's signature.
func (b *AuxTxBuilder) SetSignature(sig []byte) {
- if b.auxSignerData == nil {
- b.auxSignerData = &tx.AuxSignerData{}
- }
+ b.checkEmptyFields()
b.auxSignerData.Sig = sig
}
@@ -152,7 +164,6 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
switch b.auxSignerData.Mode {
case signing.SignMode_SIGN_MODE_DIRECT_AUX:
{
-
signBz, err = proto.Marshal(b.auxSignerData.SignDoc)
if err != nil {
return nil, err
@@ -178,7 +189,7 @@ func (b *AuxTxBuilder) GetSignBytes() ([]byte, error) {
return signBz, nil
}
-// GetAuxSignerData returns the builder's AuxTx.
+// GetAuxSignerData returns the builder's AuxSignerData.
func (b *AuxTxBuilder) GetAuxSignerData() (tx.AuxSignerData, error) {
if err := b.auxSignerData.ValidateBasic(); err != nil {
return tx.AuxSignerData{}, err
diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go
index e226d46b9e1a..b8bc4f6c80b8 100644
--- a/client/tx/aux_builder_test.go
+++ b/client/tx/aux_builder_test.go
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/tx"
+ "github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/simapp"
@@ -20,14 +21,6 @@ func TestAuxTxBuilder(t *testing.T) {
testdata.RegisterInterfaces(encCfg.InterfaceRegistry)
var b tx.AuxTxBuilder
- _, pk, addr := testdata.KeyTestPubAddr()
- pkAny, err := codectypes.NewAnyWithValue(pk)
- require.NoError(t, err)
- msg := testdata.NewTestMsg(addr)
- msgAny, err := codectypes.NewAnyWithValue(msg)
- require.NoError(t, err)
- tip := &typestx.Tip{Tipper: addr.String(), Amount: testdata.NewTestFeeAmount()}
- sig := []byte{42}
testcases := []struct {
name string
@@ -67,7 +60,7 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetSignBytes pubkey should not be nil",
func() error {
- b.SetMsgs(msg)
+ b.SetMsgs(msg1)
_, err := b.GetSignBytes()
return err
@@ -77,8 +70,8 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetSignBytes invalid sign mode",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
_, err := b.GetSignBytes()
return err
@@ -88,9 +81,9 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetSignBytes tipper should not be nil (if tip is set)",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
- b.SetTip(&typestx.Tip{Tipper: addr.String()})
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
+ b.SetTip(&typestx.Tip{Tipper: addr1.String()})
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -102,8 +95,8 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetSignBytes works for DIRECT_AUX",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -116,8 +109,8 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetAuxSignerData address should not be empty",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -133,10 +126,10 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetAuxSignerData signature should not be empty",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
- b.SetAddress(addr.String())
+ b.SetAddress(addr1.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
@@ -151,43 +144,26 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetAuxSignerData works for DIRECT_AUX",
func() error {
- memo := "test-memo"
- chainID := "test-chain"
-
b.SetAccountNumber(1)
b.SetSequence(2)
- b.SetTimeoutHeight(3)
+ b.SetTimeoutHeight(timeoutHeight)
b.SetMemo(memo)
b.SetChainID(chainID)
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
- b.SetAddress(addr.String())
+ b.SetAddress(addr1.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
_, err = b.GetSignBytes()
require.NoError(t, err)
- b.SetSignature(sig)
+ b.SetSignature(rawSig)
auxSignerData, err := b.GetAuxSignerData()
- require.NoError(t, err)
// Make sure auxSignerData is correctly populated
- var body typestx.TxBody
- err = encCfg.Codec.Unmarshal(auxSignerData.SignDoc.BodyBytes, &body)
- require.NoError(t, err)
-
- require.Equal(t, uint64(1), auxSignerData.SignDoc.AccountNumber)
- require.Equal(t, uint64(2), auxSignerData.SignDoc.Sequence)
- require.Equal(t, uint64(3), body.TimeoutHeight)
- require.Equal(t, memo, body.Memo)
- require.Equal(t, chainID, auxSignerData.SignDoc.ChainId)
- require.Equal(t, msgAny, body.GetMessages()[0])
- require.Equal(t, pkAny, auxSignerData.SignDoc.PublicKey)
- require.Equal(t, tip, auxSignerData.SignDoc.Tip)
- require.Equal(t, signing.SignMode_SIGN_MODE_DIRECT_AUX, auxSignerData.Mode)
- require.Equal(t, sig, auxSignerData.Sig)
+ checkCorrectData(t, encCfg.Codec, auxSignerData, signing.SignMode_SIGN_MODE_DIRECT_AUX)
return err
},
@@ -196,10 +172,10 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetSignBytes works for LEGACY_AMINO_JSON",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
- b.SetAddress(addr.String())
+ b.SetAddress(addr1.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
require.NoError(t, err)
@@ -211,18 +187,27 @@ func TestAuxTxBuilder(t *testing.T) {
{
"GetAuxSignerData works for LEGACY_AMINO_JSON",
func() error {
- b.SetMsgs(msg)
- b.SetPubKey(pk)
+ b.SetAccountNumber(1)
+ b.SetSequence(2)
+ b.SetTimeoutHeight(timeoutHeight)
+ b.SetMemo(memo)
+ b.SetChainID(chainID)
+ b.SetMsgs(msg1)
+ b.SetPubKey(pub1)
b.SetTip(tip)
- b.SetAddress(addr.String())
+ b.SetAddress(addr1.String())
err := b.SetSignMode(signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
require.NoError(t, err)
_, err = b.GetSignBytes()
require.NoError(t, err)
- b.SetSignature(sig)
+ b.SetSignature(rawSig)
+
+ auxSignerData, err := b.GetAuxSignerData()
+
+ // Make sure auxSignerData is correctly populated
+ checkCorrectData(t, encCfg.Codec, auxSignerData, signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON)
- _, err = b.GetAuxSignerData()
return err
},
false, "",
@@ -244,3 +229,26 @@ func TestAuxTxBuilder(t *testing.T) {
})
}
}
+
+// checkCorrectData that the auxSignerData's content matches the inputs we gave.
+func checkCorrectData(t *testing.T, cdc codec.Codec, auxSignerData typestx.AuxSignerData, signMode signing.SignMode) {
+ pkAny, err := codectypes.NewAnyWithValue(pub1)
+ require.NoError(t, err)
+ msgAny, err := codectypes.NewAnyWithValue(msg1)
+ require.NoError(t, err)
+
+ var body typestx.TxBody
+ err = cdc.Unmarshal(auxSignerData.SignDoc.BodyBytes, &body)
+ require.NoError(t, err)
+
+ require.Equal(t, uint64(1), auxSignerData.SignDoc.AccountNumber)
+ require.Equal(t, uint64(2), auxSignerData.SignDoc.Sequence)
+ require.Equal(t, timeoutHeight, body.TimeoutHeight)
+ require.Equal(t, memo, body.Memo)
+ require.Equal(t, chainID, auxSignerData.SignDoc.ChainId)
+ require.Equal(t, msgAny, body.GetMessages()[0])
+ require.Equal(t, pkAny, auxSignerData.SignDoc.PublicKey)
+ require.Equal(t, tip, auxSignerData.SignDoc.Tip)
+ require.Equal(t, signMode, auxSignerData.Mode)
+ require.Equal(t, rawSig, auxSignerData.Sig)
+}
diff --git a/client/tx/legacy_test.go b/client/tx/legacy_test.go
index 65949a038fa1..8d5b451b7c09 100644
--- a/client/tx/legacy_test.go
+++ b/client/tx/legacy_test.go
@@ -13,6 +13,7 @@ import (
"github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/types"
+ typestx "github.com/cosmos/cosmos-sdk/types/tx"
signing2 "github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
@@ -29,15 +30,19 @@ var (
fee = types.NewCoins(types.NewInt64Coin("bam", 100))
_, pub1, addr1 = testdata.KeyTestPubAddr()
_, _, addr2 = testdata.KeyTestPubAddr()
+ rawSig = []byte("dummy")
sig = signing2.SignatureV2{
PubKey: pub1,
Data: &signing2.SingleSignatureData{
SignMode: signing2.SignMode_SIGN_MODE_LEGACY_AMINO_JSON,
- Signature: []byte("dummy"),
+ Signature: rawSig,
},
}
msg0 = banktypes.NewMsgSend(addr1, addr2, types.NewCoins(types.NewInt64Coin("wack", 1)))
msg1 = banktypes.NewMsgSend(addr1, addr2, types.NewCoins(types.NewInt64Coin("wack", 2)))
+
+ chainID = "test-chain"
+ tip = &typestx.Tip{Tipper: addr1.String(), Amount: testdata.NewTestFeeAmount()}
)
func buildTestTx(t *testing.T, builder client.TxBuilder) {
diff --git a/types/tx/aux_test.go b/types/tx/aux_test.go
index de9382b4ec77..4925dc33de0d 100644
--- a/types/tx/aux_test.go
+++ b/types/tx/aux_test.go
@@ -64,7 +64,7 @@ func TestAuxSignerData(t *testing.T) {
{"empty address", tx.AuxSignerData{}, true},
{"empty sign mode", tx.AuxSignerData{Address: addr.String()}, true},
{"SIGN_MODE_DIRECT", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
- {"no sig", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT)}, true},
+ {"no sig", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)}, true},
{"happy case WITH DIRECT_AUX", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode_SIGN_MODE_DIRECT_AUX, SignDoc: sd, Sig: sig}, false},
{"happy case WITH DIRECT_AUX", tx.AuxSignerData{Address: addr.String(), Mode: signing.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, SignDoc: sd, Sig: sig}, false},
}
From 5327a794accd80baf5990fc082962f7bb8c85267 Mon Sep 17 00:00:00 2001
From: Amaury M <1293565+amaurym@users.noreply.github.com>
Date: Wed, 10 Nov 2021 16:17:25 +0100
Subject: [PATCH 17/17] Remove tip.amount == nil validation
---
client/tx/aux_builder_test.go | 4 ++--
types/tx/aux.go | 4 ----
types/tx/aux_test.go | 1 -
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/client/tx/aux_builder_test.go b/client/tx/aux_builder_test.go
index b8bc4f6c80b8..385c98f4c456 100644
--- a/client/tx/aux_builder_test.go
+++ b/client/tx/aux_builder_test.go
@@ -83,14 +83,14 @@ func TestAuxTxBuilder(t *testing.T) {
func() error {
b.SetMsgs(msg1)
b.SetPubKey(pub1)
- b.SetTip(&typestx.Tip{Tipper: addr1.String()})
+ b.SetTip(&typestx.Tip{})
err := b.SetSignMode(signing.SignMode_SIGN_MODE_DIRECT_AUX)
require.NoError(t, err)
_, err = b.GetSignBytes()
return err
},
- true, "tip amount cannot be empty",
+ true, "tipper cannot be empty",
},
{
"GetSignBytes works for DIRECT_AUX",
diff --git a/types/tx/aux.go b/types/tx/aux.go
index 5f589ec037f9..2c9a71262252 100644
--- a/types/tx/aux.go
+++ b/types/tx/aux.go
@@ -18,10 +18,6 @@ func (s *SignDocDirectAux) ValidateBasic() error {
}
if s.Tip != nil {
- if len(s.Tip.Amount) == 0 {
- return sdkerrors.ErrInvalidRequest.Wrap("tip amount cannot be empty")
- }
-
if s.Tip.Tipper == "" {
return sdkerrors.ErrInvalidRequest.Wrap("tipper cannot be empty")
}
diff --git a/types/tx/aux_test.go b/types/tx/aux_test.go
index 4925dc33de0d..02b39f0f356e 100644
--- a/types/tx/aux_test.go
+++ b/types/tx/aux_test.go
@@ -24,7 +24,6 @@ func TestSignDocDirectAux(t *testing.T) {
}{
{"empty bodyBz", tx.SignDocDirectAux{}, true},
{"empty pubkey", tx.SignDocDirectAux{BodyBytes: bodyBz}, true},
- {"empty tip amount", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny, Tip: &tx.Tip{Tipper: addr.String()}}, true},
{"empty tipper", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny, Tip: &tx.Tip{Amount: testdata.NewTestFeeAmount()}}, true},
{"happy case w/o tip", tx.SignDocDirectAux{BodyBytes: bodyBz, PublicKey: pkAny}, false},
{"happy case w/ tip", tx.SignDocDirectAux{