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, 0xe4, 0x96, 0xaf, 0x66, 0x5e, 0x92, 0x0a, 0x25, 0xd0, 0xd5, 0x7c, 0xcf, 0x53, - 0x33, 0xcf, 0xee, 0x75, 0x36, 0x22, 0x11, 0x09, 0xb3, 0xeb, 0xeb, 0x51, 0x0e, 0xec, 0xec, 0x58, - 0x92, 0x30, 0x9d, 0x27, 0x4a, 0xf8, 0x71, 0x36, 0x55, 0x4c, 0xb2, 0xa8, 0x64, 0x2c, 0x16, 0x2c, - 0xbc, 0x6b, 0xe1, 0x23, 0x22, 0x69, 0x89, 0x09, 0x05, 0xe3, 0x76, 0xff, 0xfd, 0x33, 0x4d, 0x92, - 0x45, 0x9c, 0xf1, 0x33, 0x26, 0x3b, 0xb7, 0xc0, 0xcd, 0x48, 0x88, 0x68, 0x4a, 0x7d, 0x33, 0x1b, - 0x65, 0xc7, 0x3e, 0xe1, 0xf3, 0x62, 0x2b, 0xe7, 0x08, 0x72, 0xad, 0x36, 0x11, 0x33, 0xe9, 0x7d, - 0xeb, 0x40, 0xf5, 0x68, 0x86, 0x76, 0xa0, 0x36, 0x12, 0xe3, 0x79, 0xdb, 0xd9, 0x76, 0xfa, 0x97, - 0xf6, 0x36, 0xbd, 0x7f, 0x25, 0xeb, 0x1d, 0xcd, 0x86, 0x62, 0x3c, 0xc7, 0x06, 0x86, 0xee, 0x42, - 0x8b, 0x64, 0x6a, 0x12, 0x30, 0x7e, 0x2c, 0xda, 0x55, 0x13, 0xb3, 0x75, 0x41, 0xcc, 0x20, 0x53, - 0x93, 0x07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xaf, 0xad, 0xaf, 0x66, 0xa3, 0x86, - 0xe9, 0x07, 0xb7, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xda, 0xb6, 0x89, 0x77, 0x09, 0x00, - 0x00, + 0xd4, 0xcb, 0x6a, 0xbc, 0x9e, 0xac, 0x47, 0xf5, 0xce, 0x2c, 0x3b, 0xb3, 0x60, 0xff, 0x08, 0xa4, + 0x0a, 0x09, 0x71, 0xe5, 0xcc, 0x99, 0x1f, 0xd1, 0x13, 0xaa, 0x38, 0x71, 0x82, 0x2a, 0x39, 0x22, + 0xf1, 0x17, 0x40, 0x33, 0x3b, 0xbb, 0x49, 0x8b, 0x6b, 0x17, 0xd1, 0xd3, 0xce, 0xbc, 0xf9, 0xde, + 0x37, 0xdf, 0x9b, 0xf9, 0xf6, 0x0d, 0xb4, 0x43, 0x21, 0x63, 0x21, 0x7d, 0x35, 0xf5, 0xbf, 0xbe, + 0x35, 0xa4, 0x8a, 0xdc, 0xf2, 0xd5, 0xd4, 0x4b, 0x52, 0xa1, 0x04, 0xba, 0x9a, 0xaf, 0x79, 0x6a, + 0xea, 0xd9, 0xb5, 0xf6, 0x66, 0x24, 0x22, 0x61, 0x56, 0x7d, 0x3d, 0xca, 0x81, 0xed, 0x5d, 0x4b, + 0x12, 0xa6, 0xb3, 0x44, 0x09, 0x3f, 0xce, 0x26, 0x8a, 0x49, 0x16, 0x95, 0x8c, 0x45, 0xc0, 0xc2, + 0x3b, 0x16, 0x3e, 0x24, 0x92, 0x96, 0x98, 0x50, 0x30, 0x6e, 0xd7, 0xdf, 0x3f, 0xd7, 0x24, 0x59, + 0xc4, 0x19, 0x3f, 0x67, 0xb2, 0x73, 0x0b, 0xdc, 0x8a, 0x84, 0x88, 0x26, 0xd4, 0x37, 0xb3, 0x61, + 0x76, 0xe2, 0x13, 0x3e, 0x2b, 0x96, 0x72, 0x8e, 0x20, 0xd7, 0x6a, 0x0b, 0x31, 0x93, 0xee, 0xb7, + 0x0e, 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, 0x06, 0xbe, 0xf1, 0x9a, 0xa6, 0x71, + 0xf1, 0xc1, 0xc1, 0xab, 0xd2, 0xbe, 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{