Skip to content

Commit

Permalink
feat: apply cronos x/tx (#210)
Browse files Browse the repository at this point in the history
* feat(x/tx): support bytes field as signer (cosmos#21850)

* Problem: multisig account failed on threshold encode after send tx   (cosmos#808)

* fix(x/tx): don't shadow Amino marshalling error messages (cosmos#19955)

* use directly instead of cast

---------

Co-authored-by: Antonio Pitasi <[email protected]>

* feat: Fix datarace

---------

Co-authored-by: mmsqe <[email protected]>
Co-authored-by: Antonio Pitasi <[email protected]>
  • Loading branch information
3 people committed Dec 17, 2024
1 parent ba7ac45 commit 190e93f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 39 deletions.
4 changes: 2 additions & 2 deletions x/tx/internal/testpb/signers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ message DeeplyNestedRepeatedSigner {

message BadSigner {
option (cosmos.msg.v1.signer) = "signer";
bytes signer = 1;
int32 signer = 1;
}

message NoSignerOption {
Expand All @@ -107,4 +107,4 @@ message ValidatorSigner {
service TestSimpleSigner {
option (cosmos.msg.v1.service) = true;
rpc TestSimpleSigner(SimpleSigner) returns (SimpleSigner) {}
}
}
56 changes: 19 additions & 37 deletions x/tx/internal/testpb/signers.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions x/tx/signing/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,19 @@ func (c *Context) makeGetSignersFunc(descriptor protoreflect.MessageDescriptor)
}
return arr, nil
}
case protoreflect.BytesKind:
fieldGetters[i] = func(msg proto.Message, arr [][]byte) ([][]byte, error) {
addrBz := msg.ProtoReflect().Get(field).Bytes()
return append(arr, addrBz), nil
}
default:
return nil, fmt.Errorf("unexpected field type %s for field %s in message %s", field.Kind(), fieldName, descriptor.FullName())
}
}

return func(message proto.Message) ([][]byte, error) {
var signers [][]byte
var err error
for _, getter := range fieldGetters {
signers, err = getter(message, signers)
if err != nil {
Expand Down

0 comments on commit 190e93f

Please sign in to comment.