diff --git a/docs/architecture/adr-050-sign-mode-textual-annex1.md b/docs/architecture/adr-050-sign-mode-textual-annex1.md index d947757d12..bb162cb1f7 100644 --- a/docs/architecture/adr-050-sign-mode-textual-annex1.md +++ b/docs/architecture/adr-050-sign-mode-textual-annex1.md @@ -4,6 +4,7 @@ * Dec 06, 2021: Initial Draft * Feb 07, 2022: Draft read and concept-ACKed by the Ledger team. +* Dec 01, 2022: Remove `Object: ` prefix on Any header screen. ## Status @@ -181,14 +182,14 @@ See example above with `message Vote{}`. * Rendered as: ``` -Object: + > ``` #### Examples ``` -Object: type.googleapis.com/cosmos.gov.v1.Vote +type.googleapis.com/cosmos.gov.v1.Vote > Vote object >> Proposal id: 4 >> Vote: cosmos1abc...def diff --git a/tx/textual/internal/testdata/any.json b/tx/textual/internal/testdata/any.json index 5e1ad03289..c8d50f12fd 100644 --- a/tx/textual/internal/testdata/any.json +++ b/tx/textual/internal/testdata/any.json @@ -4,7 +4,7 @@ "@type": "/Foo" }, "screens": [ - {"text": "Object: /Foo"}, + {"text": "/Foo"}, {"text": "Foo object", "indent": 1} ] }, @@ -14,7 +14,7 @@ "full_name": "testing" }, "screens": [ - {"text": "Object: /Foo"}, + {"text": "/Foo"}, {"text": "Foo object", "indent": 1}, {"text": "Full name: testing", "indent": 2} ] @@ -25,7 +25,7 @@ "value": "2006-01-02T15:04:05Z" }, "screens": [ - {"text": "Object: /google.protobuf.Timestamp"}, + {"text": "/google.protobuf.Timestamp"}, {"text": "2006-01-02T15:04:05Z", "indent": 1} ] }, @@ -37,8 +37,8 @@ } }, "screens": [ - {"text": "Object: /google.protobuf.Any"}, - {"text": "Object: /Foo", "indent": 1}, + {"text": "/google.protobuf.Any"}, + {"text": "/Foo", "indent": 1}, {"text": "Foo object", "indent": 2} ] }, @@ -51,8 +51,8 @@ } }, "screens": [ - {"text": "Object: /google.protobuf.Any"}, - {"text": "Object: /Foo", "indent": 1}, + {"text": "/google.protobuf.Any"}, + {"text": "/Foo", "indent": 1}, {"text": "Foo object", "indent": 2}, {"text": "Full name: testing", "indent": 3} ] @@ -66,9 +66,9 @@ } }, "screens": [ - {"text": "Object: /A"}, + {"text": "/A"}, {"text": "A object", "indent": 1}, - {"text": "ANY: Object: /Foo", "indent": 2}, + {"text": "ANY: /Foo", "indent": 2}, {"text": "Foo object", "indent": 3}, {"text": "Full name: testing", "indent": 4} ] diff --git a/tx/textual/valuerenderer/any.go b/tx/textual/valuerenderer/any.go index 69cd9f0ba7..6fd00b8d85 100644 --- a/tx/textual/valuerenderer/any.go +++ b/tx/textual/valuerenderer/any.go @@ -3,7 +3,6 @@ package valuerenderer import ( "context" "fmt" - "strings" "github.com/cosmos/cosmos-proto/any" "google.golang.org/protobuf/reflect/protoreflect" @@ -47,7 +46,7 @@ func (ar anyValueRenderer) Format(ctx context.Context, v protoreflect.Value) ([] } screens := make([]Screen, 1+len(subscreens)) - screens[0].Text = "Object: " + anymsg.GetTypeUrl() + screens[0].Text = anymsg.GetTypeUrl() for i, subscreen := range subscreens { subscreen.Indent++ screens[i+1] = subscreen @@ -65,13 +64,7 @@ func (ar anyValueRenderer) Parse(ctx context.Context, screens []Screen) (protore return nilValue, fmt.Errorf("bad indentation: want 0, got %d", screens[0].Indent) } - prefix := "Object: " - if !strings.HasPrefix(screens[0].Text, prefix) { - return nilValue, fmt.Errorf("bad Any header: %s", screens[0].Text) - } - url := strings.TrimPrefix(screens[0].Text, prefix) - - msgType, err := protoregistry.GlobalTypes.FindMessageByURL(url) + msgType, err := protoregistry.GlobalTypes.FindMessageByURL(screens[0].Text) if err != nil { return nilValue, err }