Skip to content

Commit

Permalink
fix(x/tx): fallback to injected resolver for placeholder descriptors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kocubinski authored Dec 12, 2024
1 parent 14c841c commit 629106e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/tx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Since v0.13.0, x/tx follows Cosmos SDK semver: https://github.com/cosmos/cosmos-

## [Unreleased]

## [v1.0.0-alpha.3](https://github.com/cosmos/cosmos-sdk/releases/tag/x/tx/v1.0.0-alpha.3) - 2024-12-12

### Bug Fixes

* [#22852](https://github.com/cosmos/cosmos-sdk/pull/22852) Fallback to injected resolver for placeholder descriptors.

## [v1.0.0-alpha.2](https://github.com/cosmos/cosmos-sdk/releases/tag/x/tx/v1.0.0-alpha.2) - 2024-11-01

* [#22311](https://github.com/cosmos/cosmos-sdk/pull/22311) Fix add feePayer as signer.
Expand Down
11 changes: 11 additions & 0 deletions x/tx/decode/unknown.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ func RejectUnknownFields(bz []byte, desc protoreflect.MessageDescriptor, allowUn
if fieldMessage == nil {
continue
}
// if a message descriptor is a placeholder resolve it using the injected resolver.
// this can happen when a descriptor has been registered in the
// "google.golang.org/protobuf" resgistry but not in "github.com/cosmos/gogoproto".
// fixes: https://github.com/cosmos/cosmos-sdk/issues/22574
if fieldMessage.IsPlaceholder() {
gogoDesc, err := resolver.FindDescriptorByName(fieldMessage.FullName())
if err != nil {
return hasUnknownNonCriticals, fmt.Errorf("could not resolve placeholder descriptor: %v: %w", fieldMessage, err)
}
fieldMessage = gogoDesc.(protoreflect.MessageDescriptor)
}

// consume length prefix of nested message
_, o := protowire.ConsumeVarint(fieldBytes)
Expand Down

0 comments on commit 629106e

Please sign in to comment.