chore(x/tx): Harmonize TypeResolver interface (#16846)

This commit is contained in:
Julien Robert
2023-07-11 13:44:55 +00:00
committed by GitHub
parent a54ee26657
commit 3c1c4c5a9c
5 changed files with 15 additions and 5 deletions
+5 -2
View File
@@ -31,13 +31,16 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]
## v0.9.0
### Bug Fixes
* [#16681](https://github.com/cosmos/cosmos-sdk/pull/16681): catch and fix `(*Decoder).Decode` crash from invalid length prefix in Tx bytes
* [#16681](https://github.com/cosmos/cosmos-sdk/pull/16681): Catch and fix `(*Decoder).Decode` crash from invalid length prefix in Tx bytes.
### Improvements
* [#16684](https://github.com/cosmos/cosmos-sdk/pull/16684): x/tx/signing/aminojson: use io.WriteString+fmt.Fprintf to remove unnecessary string->[]byte roundtrip
* [#16846](https://github.com/cosmos/cosmos-sdk/pull/16846): Harmonize interface `signing.TypeResolver` with the rest of the codebase (orm and client/v2).
* [#16684](https://github.com/cosmos/cosmos-sdk/pull/16684): Use `io.WriteString`+`fmt.Fprintf` to remove unnecessary `string`->`[]byte` roundtrip.
## v0.8.0
+1 -1
View File
@@ -22,7 +22,7 @@ type SignModeHandler struct {
// SignModeHandlerOptions are the options for the SignModeHandler.
type SignModeHandlerOptions struct {
FileResolver signing.ProtoFileResolver
TypeResolver protoregistry.MessageTypeResolver
TypeResolver signing.TypeResolver
Encoder *Encoder
}
+1 -1
View File
@@ -26,7 +26,7 @@ type EncoderOptions struct {
// DonotSortFields when set turns off sorting of field names.
DoNotSortFields bool
// TypeResolver is used to resolve protobuf message types by TypeURL when marshaling any packed messages.
TypeResolver protoregistry.MessageTypeResolver
TypeResolver signing.TypeResolver
// FileResolver is used to resolve protobuf file descriptors TypeURL when TypeResolver fails.
FileResolver signing.ProtoFileResolver
}
+6 -1
View File
@@ -14,6 +14,11 @@ import (
"cosmossdk.io/core/address"
)
type TypeResolver interface {
protoregistry.MessageTypeResolver
protoregistry.ExtensionTypeResolver
}
// Context is a context for retrieving the list of signers from a
// message where signers are specified by the cosmos.msg.v1.signer protobuf
// option. It also contains the ProtoFileResolver and address.Codec's used
@@ -34,7 +39,7 @@ type Options struct {
FileResolver ProtoFileResolver
// TypeResolver is the protobuf type resolver to use for resolving message types.
TypeResolver protoregistry.MessageTypeResolver
TypeResolver TypeResolver
// AddressCodec is the codec for converting addresses between strings and bytes.
AddressCodec address.Codec
+2
View File
@@ -222,6 +222,8 @@ var (
)
func FuzzCoinsJSONTestcases(f *testing.F) {
f.Skip() // https://github.com/cosmos/cosmos-sdk/pull/16521#issuecomment-1614507574
// Generate some seeds.
seed, err := os.ReadFile("./internal/testdata/coins.json")
if err != nil {