Skip to content

Commit dbf6cdb

Browse files
author
yihuang
authored
feat(x/tx): support bytes field as signer (cosmos#21850)
1 parent 0ab189c commit dbf6cdb

File tree

4 files changed

+30
-39
lines changed

4 files changed

+30
-39
lines changed

x/tx/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Since v0.13.0, x/tx follows Cosmos SDK semver: https://github.com/cosmos/cosmos-
3333

3434
## [Unreleased]
3535

36+
### Improvements
37+
38+
* [#21850](https://github.com/cosmos/cosmos-sdk/pull/21850) Support bytes field as signer.
39+
3640
## [v0.13.5](https://github.com/cosmos/cosmos-sdk/releases/tag/x/tx/v0.13.5) - 2024-09-18
3741

3842
### Improvements

x/tx/internal/testpb/signers.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ message DeeplyNestedRepeatedSigner {
9292

9393
message BadSigner {
9494
option (cosmos.msg.v1.signer) = "signer";
95-
bytes signer = 1;
95+
int32 signer = 1;
9696
}
9797

9898
message NoSignerOption {
@@ -107,4 +107,4 @@ message ValidatorSigner {
107107
service TestSimpleSigner {
108108
option (cosmos.msg.v1.service) = true;
109109
rpc TestSimpleSigner(SimpleSigner) returns (SimpleSigner) {}
110-
}
110+
}

x/tx/internal/testpb/signers.pulsar.go

Lines changed: 19 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x/tx/signing/context.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor)
301301
}
302302
return arr, nil
303303
}
304+
case protoreflect.BytesKind:
305+
fieldGetters[i] = func(msg proto.Message, arr [][]byte) ([][]byte, error) {
306+
addrBz := msg.ProtoReflect().Get(field).Bytes()
307+
return append(arr, addrBz), nil
308+
}
304309
default:
305310
return nil, fmt.Errorf("unexpected field type %s for field %s in message %s", field.Kind(), fieldName, descriptor.FullName())
306311
}

0 commit comments

Comments
 (0)