From 72aab62d504ca744c8c86ca222214a965c23b1a1 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Mon, 16 Jan 2023 15:37:45 +0100 Subject: [PATCH 1/5] refactor: Move to `x/tx` package --- x/tx/textual/bytes_test.go | 55 +++++++++++ x/tx/textual/coin_test.go | 123 ++++++++++++++++++++++++ x/tx/textual/duration_test.go | 60 ++++++++++++ x/tx/textual/enum_test.go | 69 +++++++++++++ x/tx/textual/internal/cbor/cbor_test.go | 103 ++++++++++++++++++++ x/tx/textual/valuerenderer_test.go | 60 ++++++++++++ 6 files changed, 470 insertions(+) create mode 100644 x/tx/textual/bytes_test.go create mode 100644 x/tx/textual/coin_test.go create mode 100644 x/tx/textual/duration_test.go create mode 100644 x/tx/textual/enum_test.go create mode 100644 x/tx/textual/internal/cbor/cbor_test.go create mode 100644 x/tx/textual/valuerenderer_test.go diff --git a/x/tx/textual/bytes_test.go b/x/tx/textual/bytes_test.go new file mode 100644 index 000000000000..3492d23860eb --- /dev/null +++ b/x/tx/textual/bytes_test.go @@ -0,0 +1,55 @@ +package textual_test + +import ( + "context" + "encoding/json" + "os" + "testing" + + "cosmossdk.io/x/tx/textual" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func TestBytesJsonTestCases(t *testing.T) { + var testcases []bytesTest + // Bytes.json contains bytes that are represented in base64 format, and + // their expected results in hex. + raw, err := os.ReadFile("./internal/testdata/bytes.json") + require.NoError(t, err) + err = json.Unmarshal(raw, &testcases) + require.NoError(t, err) + + textual := textual.NewTextual(nil) + + for _, tc := range testcases { + t.Run(tc.hex, func(t *testing.T) { + valrend, err := textual.GetFieldValueRenderer(fieldDescriptorFromName("BYTES")) + require.NoError(t, err) + + screens, err := valrend.Format(context.Background(), protoreflect.ValueOfBytes(tc.base64)) + require.NoError(t, err) + require.Equal(t, 1, len(screens)) + require.Equal(t, tc.hex, screens[0].Text) + + // Round trip + val, err := valrend.Parse(context.Background(), screens) + require.NoError(t, err) + if len(tc.base64) > 35 { + require.Equal(t, 0, len(val.Bytes())) + } else { + require.Equal(t, tc.base64, val.Bytes()) + } + }) + } +} + +type bytesTest struct { + base64 []byte + hex string +} + +func (t *bytesTest) UnmarshalJSON(b []byte) error { + a := []interface{}{&t.base64, &t.hex} + return json.Unmarshal(b, &a) +} diff --git a/x/tx/textual/coin_test.go b/x/tx/textual/coin_test.go new file mode 100644 index 000000000000..78a2d610fffe --- /dev/null +++ b/x/tx/textual/coin_test.go @@ -0,0 +1,123 @@ +package textual_test + +import ( + "context" + "encoding/json" + "fmt" + "os" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/reflect/protoreflect" + + bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + "cosmossdk.io/x/tx/textual" +) + +// mockCoinMetadataKey is used in the mock coin metadata querier. +func mockCoinMetadataKey(denom string) string { + return fmt.Sprintf("%s-%s", "coin-metadata", denom) +} + +// mockCoinMetadataQuerier is a mock querier for coin metadata used for test +// purposes. +func mockCoinMetadataQuerier(ctx context.Context, denom string) (*bankv1beta1.Metadata, error) { + v := ctx.Value(mockCoinMetadataKey(denom)) + if v == nil { + return nil, nil + } + + return v.(*bankv1beta1.Metadata), nil +} + +// addMetadataToContext appends relevant coin metadata to the mock context +// used in tests. +func addMetadataToContext(ctx context.Context, metadata *bankv1beta1.Metadata) context.Context { + if metadata == nil { + return ctx + } + + for _, m := range metadata.DenomUnits { + ctx = context.WithValue(ctx, mockCoinMetadataKey(m.Denom), metadata) + } + + return ctx +} + +func TestMetadataQuerier(t *testing.T) { + // Errors on nil metadata querier + txt := textual.NewTextual(nil) + vr, err := txt.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) + require.NoError(t, err) + _, err = vr.Format(context.Background(), protoreflect.ValueOf((&basev1beta1.Coin{}).ProtoReflect())) + require.Error(t, err) + + // Errors if metadata querier returns an error + expErr := fmt.Errorf("mock error") + txt = textual.NewTextual(func(_ context.Context, _ string) (*bankv1beta1.Metadata, error) { + return nil, expErr + }) + vr, err = txt.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) + require.NoError(t, err) + _, err = vr.Format(context.Background(), protoreflect.ValueOf((&basev1beta1.Coin{}).ProtoReflect())) + require.ErrorIs(t, err, expErr) + _, err = vr.(textual.RepeatedValueRenderer).FormatRepeated(context.Background(), protoreflect.ValueOf(NewGenericList([]*basev1beta1.Coin{{}}))) + require.ErrorIs(t, err, expErr) +} + +func TestCoinJsonTestcases(t *testing.T) { + var testcases []coinJsonTest + raw, err := os.ReadFile("./internal/testdata/coin.json") + require.NoError(t, err) + err = json.Unmarshal(raw, &testcases) + require.NoError(t, err) + + textual := textual.NewTextual(mockCoinMetadataQuerier) + vr, err := textual.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) + require.NoError(t, err) + + for _, tc := range testcases { + t.Run(tc.Text, func(t *testing.T) { + if tc.Proto != nil { + ctx := addMetadataToContext(context.Background(), tc.Metadata) + + screens, err := vr.Format(ctx, protoreflect.ValueOf(tc.Proto.ProtoReflect())) + + if tc.Error { + require.Error(t, err) + return + } + + require.NoError(t, err) + require.Equal(t, 1, len(screens)) + require.Equal(t, tc.Text, screens[0].Text) + + // Round trip. + value, err := vr.Parse(ctx, screens) + if tc.Error { + require.Error(t, err) + return + } + + require.NoError(t, err) + coin, ok := value.Message().Interface().(*basev1beta1.Coin) + require.True(t, ok) + + checkCoinEqual(t, coin, tc.Proto) + } + }) + } +} + +// coinJsonTest is the type of test cases in the testdata file. +// If the test case has a Proto, try to Format() it. If Error is set, expect +// an error, otherwise match Text, then Parse() the text and expect it to +// match (via proto.Equals()) the original Proto. If the test case has no +// Proto, try to Parse() the Text and expect an error if Error is set. +type coinJsonTest struct { + Proto *basev1beta1.Coin + Metadata *bankv1beta1.Metadata + Error bool + Text string +} diff --git a/x/tx/textual/duration_test.go b/x/tx/textual/duration_test.go new file mode 100644 index 000000000000..437241a29516 --- /dev/null +++ b/x/tx/textual/duration_test.go @@ -0,0 +1,60 @@ +package textual_test + +import ( + "context" + "encoding/json" + "fmt" + "os" + "testing" + + "cosmossdk.io/x/tx/textual" + "github.com/stretchr/testify/require" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + dpb "google.golang.org/protobuf/types/known/durationpb" +) + +type durationTest struct { + Proto *dpb.Duration + Text string + Error bool +} + +func TestDurationJSON(t *testing.T) { + raw, err := os.ReadFile("./internal/testdata/duration.json") + require.NoError(t, err) + + var testcases []durationTest + err = json.Unmarshal(raw, &testcases) + require.NoError(t, err) + + for i, tc := range testcases { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + rend := textual.NewDurationValueRenderer() + + var screens []textual.Screen + if tc.Proto != nil { + screens, err = rend.Format(context.Background(), protoreflect.ValueOf(tc.Proto.ProtoReflect())) + if tc.Error { + require.Error(t, err) + return + } + require.NoError(t, err) + require.Equal(t, 1, len(screens)) + require.Equal(t, tc.Text, screens[0].Text) + } + + val, err := rend.Parse(context.Background(), screens) + if tc.Error { + require.Error(t, err) + return + } + require.NoError(t, err) + msg := val.Message().Interface() + require.IsType(t, &dpb.Duration{}, msg) + duration := msg.(*dpb.Duration) + require.True(t, proto.Equal(duration, tc.Proto), "%v vs %v", duration, tc.Proto) + }) + } +} diff --git a/x/tx/textual/enum_test.go b/x/tx/textual/enum_test.go new file mode 100644 index 000000000000..5fdea7c72dae --- /dev/null +++ b/x/tx/textual/enum_test.go @@ -0,0 +1,69 @@ +package textual_test + +import ( + "context" + "encoding/json" + "os" + "strings" + "testing" + + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/testpb" + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/testing/protocmp" +) + +type enumTest struct { + Proto json.RawMessage + Text string +} + +func TestEnumJsonTestcases(t *testing.T) { + var testcases []enumTest + raw, err := os.ReadFile("./internal/testdata/enum.json") + require.NoError(t, err) + err = json.Unmarshal(raw, &testcases) + require.NoError(t, err) + + textual := textual.NewTextual(nil) + + for _, tc := range testcases { + t.Run(tc.Text, func(t *testing.T) { + m := &testpb.Baz{} + err := protojson.Unmarshal(tc.Proto, m) + require.NoError(t, err) + + fd := getFd(tc.Proto, m) + valrend, err := textual.GetFieldValueRenderer(fd) + require.NoError(t, err) + + val := m.ProtoReflect().Get(fd) + screens, err := valrend.Format(context.Background(), val) + require.NoError(t, err) + require.Equal(t, 1, len(screens)) + require.Equal(t, tc.Text, screens[0].Text) + + // Round trip + parsedVal, err := valrend.Parse(context.Background(), screens) + require.NoError(t, err) + diff := cmp.Diff(val.Interface(), parsedVal.Interface(), protocmp.Transform()) + require.Empty(t, diff) + }) + } +} + +// getFd returns the field descriptor on Baz whose value is set. Since golang +// treats empty and default values as the same, we actually parse the protojson +// encoded string to retrieve which field is set. +func getFd(proto json.RawMessage, m *testpb.Baz) protoreflect.FieldDescriptor { + if strings.Contains(string(proto), `"ee"`) { + return m.ProtoReflect().Descriptor().Fields().ByNumber(1) + } else if strings.Contains(string(proto), `"ie"`) { + return m.ProtoReflect().Descriptor().Fields().ByNumber(2) + } else { + return m.ProtoReflect().Descriptor().Fields().ByNumber(3) + } +} diff --git a/x/tx/textual/internal/cbor/cbor_test.go b/x/tx/textual/internal/cbor/cbor_test.go new file mode 100644 index 000000000000..a574f7f3cdb5 --- /dev/null +++ b/x/tx/textual/internal/cbor/cbor_test.go @@ -0,0 +1,103 @@ +package cbor_test + +import ( + "bytes" + "encoding/hex" + "fmt" + "testing" + + "cosmossdk.io/x/tx/textual/internal/cbor" + "github.com/stretchr/testify/require" +) + +var ( + ui = cbor.NewUint + txt = cbor.NewText + arr = cbor.NewArray + mp = cbor.NewMap + ent = cbor.NewEntry +) + +func TestCborRFC(t *testing.T) { + for i, tc := range []struct { + cb cbor.Cbor + encoding string + expectError bool + }{ + // Examples come from RFC8949, Appendix A + {cb: ui(0), encoding: "00"}, + {cb: ui(1), encoding: "01"}, + {cb: ui(10), encoding: "0a"}, + {cb: ui(23), encoding: "17"}, + {cb: ui(24), encoding: "1818"}, + {cb: ui(25), encoding: "1819"}, + {cb: ui(100), encoding: "1864"}, + {cb: ui(1000), encoding: "1903e8"}, + {cb: ui(1000000), encoding: "1a000f4240"}, + {cb: ui(1000000000000), encoding: "1b000000e8d4a51000"}, + {cb: ui(18446744073709551615), encoding: "1bffffffffffffffff"}, + {cb: cbor.NewBool(false), encoding: "f4"}, + {cb: cbor.NewBool(true), encoding: "f5"}, + {cb: txt(""), encoding: "60"}, + {cb: txt("a"), encoding: "6161"}, + {cb: txt("IETF"), encoding: "6449455446"}, + {cb: txt("\"\\"), encoding: "62225c"}, + {cb: txt("\u00fc"), encoding: "62c3bc"}, + {cb: txt("\u6c34"), encoding: "63e6b0b4"}, + // Go doesn't like string literals with surrogate pairs, create manually + {cb: txt(string([]byte{0xf0, 0x90, 0x85, 0x91})), encoding: "64f0908591"}, + {cb: arr(), encoding: "80"}, + {cb: arr(ui(1), ui(2)).Append(ui(3)), encoding: "83010203"}, + { + cb: arr(ui(1)). + Append(arr(ui(2), ui(3))). + Append(arr().Append(ui(4)).Append(ui(5))), + encoding: "8301820203820405", + }, + { + cb: arr( + ui(1), ui(2), ui(3), ui(4), ui(5), + ui(6), ui(7), ui(8), ui(9), ui(10), + ui(11), ui(12), ui(13), ui(14), ui(15), + ui(16), ui(17), ui(18), ui(19), ui(20), + ui(21), ui(22), ui(23), ui(24), ui(25)), + encoding: "98190102030405060708090a0b0c0d0e0f101112131415161718181819", + }, + {cb: mp(), encoding: "a0"}, + {cb: mp(ent(ui(1), ui(2))).Add(ui(3), ui(4)), encoding: "a201020304"}, + {cb: mp(ent(txt("a"), ui(1)), ent(txt("b"), arr(ui(2), ui(3)))), encoding: "a26161016162820203"}, + {cb: arr(txt("a"), mp(ent(txt("b"), txt("c")))), encoding: "826161a161626163"}, + { + cb: mp( + ent(txt("a"), txt("A")), + ent(txt("b"), txt("B")), + ent(txt("c"), txt("C")), + ent(txt("d"), txt("D")), + ent(txt("e"), txt("E"))), + encoding: "a56161614161626142616361436164614461656145", + }, + // Departing from the RFC + {cb: mp(ent(ui(1), ui(2)), ent(ui(1), ui(2))), expectError: true}, + // Map has deterministic order based on key encoding + { + cb: mp( + ent(txt("aa"), ui(0)), + ent(txt("a"), ui(2)), + ent(ui(1), txt("b"))), + encoding: "a301616261610262616100", + }, + } { + t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { + var buf bytes.Buffer + err := tc.cb.Encode(&buf) + if tc.expectError { + require.Error(t, err) + return + } + require.NoError(t, err) + want, err := hex.DecodeString(tc.encoding) + require.NoError(t, err) + require.Equal(t, want, buf.Bytes()) + }) + } +} diff --git a/x/tx/textual/valuerenderer_test.go b/x/tx/textual/valuerenderer_test.go new file mode 100644 index 000000000000..dc37f385542c --- /dev/null +++ b/x/tx/textual/valuerenderer_test.go @@ -0,0 +1,60 @@ +package textual_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/reflect/protoreflect" + + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/testpb" +) + +func TestDispatcher(t *testing.T) { + testcases := []struct { + name string + expErr bool + expValueRenderer textual.ValueRenderer + }{ + {"UINT32", false, textual.NewIntValueRenderer(fieldDescriptorFromName("UINT32"))}, + {"UINT64", false, textual.NewIntValueRenderer(fieldDescriptorFromName("UINT64"))}, + {"SDKINT", false, textual.NewIntValueRenderer(fieldDescriptorFromName("SDKINT"))}, + {"SDKDEC", false, textual.NewDecValueRenderer()}, + {"BYTES", false, textual.NewBytesValueRenderer()}, + {"TIMESTAMP", false, textual.NewTimestampValueRenderer()}, + {"DURATION", false, textual.NewDurationValueRenderer()}, + {"COIN", false, textual.NewCoinsValueRenderer(nil)}, + {"COINS", false, textual.NewCoinsValueRenderer(nil)}, + {"ENUM", false, textual.NewEnumValueRenderer(fieldDescriptorFromName("ENUM"))}, + {"ANY", false, textual.NewAnyValueRenderer(nil)}, + {"FLOAT", true, nil}, + } + + for _, tc := range testcases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + textual := textual.NewTextual(nil) + rend, err := textual.GetFieldValueRenderer(fieldDescriptorFromName(tc.name)) + + if tc.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.IsType(t, tc.expValueRenderer, rend) + } + }) + } +} + +// fieldDescriptorFromName is like GetADR050ValueRenderer, but taking a Go type +// as input instead of a protoreflect.FieldDescriptor. +func fieldDescriptorFromName(name string) protoreflect.FieldDescriptor { + a := (&testpb.A{}).ProtoReflect().Descriptor().Fields() + fd := a.ByName(protoreflect.Name(name)) + if fd == nil { + panic(fmt.Errorf("no field descriptor for %s", name)) + } + + return fd +} From 972679c4b4d9cc5ab7862878ce8a44fbbd7dcc5c Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Mon, 16 Jan 2023 15:38:30 +0100 Subject: [PATCH 2/5] refactor: Move to `x/tx` package --- simapp/go.sum | 4 - tests/go.sum | 2 - tx/textual/bytes_test.go | 55 -------- tx/textual/coin_test.go | 123 ------------------ tx/textual/duration_test.go | 60 --------- tx/textual/enum_test.go | 69 ---------- tx/textual/internal/cbor/cbor_test.go | 103 --------------- tx/textual/valuerenderer_test.go | 60 --------- {tx => x/tx}/go.mod | 2 +- {tx => x/tx}/go.sum | 0 {tx => x/tx}/signing/sign_mode_handler.go | 0 {tx => x/tx}/sonar-project.properties | 0 {tx => x/tx}/textual/any.go | 0 {tx => x/tx}/textual/any_test.go | 2 +- {tx => x/tx}/textual/bench_test.go | 0 {tx => x/tx}/textual/bytes.go | 0 {tx => x/tx}/textual/coins.go | 0 {tx => x/tx}/textual/coins_test.go | 2 +- {tx => x/tx}/textual/dec.go | 0 {tx => x/tx}/textual/dec_test.go | 2 +- {tx => x/tx}/textual/duration.go | 0 {tx => x/tx}/textual/e2e_test.go | 4 +- {tx => x/tx}/textual/encode.go | 2 +- {tx => x/tx}/textual/encode_test.go | 0 {tx => x/tx}/textual/enum.go | 0 {tx => x/tx}/textual/int.go | 0 {tx => x/tx}/textual/int_test.go | 2 +- {tx => x/tx}/textual/internal/cbor/cbor.go | 0 .../tx}/textual/internal/testdata/README.md | 0 .../tx}/textual/internal/testdata/any.json | 0 .../tx}/textual/internal/testdata/bytes.json | 0 .../tx}/textual/internal/testdata/coin.json | 0 .../tx}/textual/internal/testdata/coins.json | 0 .../textual/internal/testdata/decimals.json | 0 .../textual/internal/testdata/duration.json | 0 .../tx}/textual/internal/testdata/e2e.json | 0 .../tx}/textual/internal/testdata/encode.json | 0 .../tx}/textual/internal/testdata/enum.json | 0 .../textual/internal/testdata/integers.json | 0 .../textual/internal/testdata/message.json | 0 .../textual/internal/testdata/repeated.json | 0 .../tx}/textual/internal/testdata/string.json | 0 .../textual/internal/testdata/timestamp.json | 0 .../tx}/textual/internal/testdata/tx.json | 0 {tx => x/tx}/textual/internal/testpb/1.proto | 2 +- .../tx}/textual/internal/testpb/1.pulsar.go | 0 {tx => x/tx}/textual/internal/testpb/Makefile | 0 .../tx}/textual/internal/testpb/buf.gen.yaml | 2 +- {tx => x/tx}/textual/internal/testpb/buf.lock | 0 {tx => x/tx}/textual/internal/testpb/buf.yaml | 0 .../tx}/textual/internal/textualpb/Makefile | 0 .../textual/internal/textualpb/buf.gen.yaml | 2 +- .../tx}/textual/internal/textualpb/buf.lock | 0 .../tx}/textual/internal/textualpb/buf.yaml | 0 .../tx}/textual/internal/textualpb/doc.go | 0 .../textual/internal/textualpb/textual.proto | 0 .../internal/textualpb/textual.pulsar.go | 0 {tx => x/tx}/textual/message.go | 0 {tx => x/tx}/textual/message_test.go | 4 +- .../tx}/textual/protoreflect_list_test.go | 0 {tx => x/tx}/textual/repeated_test.go | 4 +- {tx => x/tx}/textual/string.go | 0 {tx => x/tx}/textual/string_test.go | 2 +- {tx => x/tx}/textual/timestamp.go | 0 {tx => x/tx}/textual/timestamp_test.go | 2 +- {tx => x/tx}/textual/tx.go | 2 +- {tx => x/tx}/textual/tx_test.go | 6 +- {tx => x/tx}/textual/types.go | 0 {tx => x/tx}/textual/valuerenderer.go | 4 +- 69 files changed, 23 insertions(+), 499 deletions(-) delete mode 100644 tx/textual/bytes_test.go delete mode 100644 tx/textual/coin_test.go delete mode 100644 tx/textual/duration_test.go delete mode 100644 tx/textual/enum_test.go delete mode 100644 tx/textual/internal/cbor/cbor_test.go delete mode 100644 tx/textual/valuerenderer_test.go rename {tx => x/tx}/go.mod (96%) rename {tx => x/tx}/go.sum (100%) rename {tx => x/tx}/signing/sign_mode_handler.go (100%) rename {tx => x/tx}/sonar-project.properties (100%) rename {tx => x/tx}/textual/any.go (100%) rename {tx => x/tx}/textual/any_test.go (98%) rename {tx => x/tx}/textual/bench_test.go (100%) rename {tx => x/tx}/textual/bytes.go (100%) rename {tx => x/tx}/textual/coins.go (100%) rename {tx => x/tx}/textual/coins_test.go (99%) rename {tx => x/tx}/textual/dec.go (100%) rename {tx => x/tx}/textual/dec_test.go (96%) rename {tx => x/tx}/textual/duration.go (100%) rename {tx => x/tx}/textual/e2e_test.go (95%) rename {tx => x/tx}/textual/encode.go (95%) rename {tx => x/tx}/textual/encode_test.go (100%) rename {tx => x/tx}/textual/enum.go (100%) rename {tx => x/tx}/textual/int.go (100%) rename {tx => x/tx}/textual/int_test.go (98%) rename {tx => x/tx}/textual/internal/cbor/cbor.go (100%) rename {tx => x/tx}/textual/internal/testdata/README.md (100%) rename {tx => x/tx}/textual/internal/testdata/any.json (100%) rename {tx => x/tx}/textual/internal/testdata/bytes.json (100%) rename {tx => x/tx}/textual/internal/testdata/coin.json (100%) rename {tx => x/tx}/textual/internal/testdata/coins.json (100%) rename {tx => x/tx}/textual/internal/testdata/decimals.json (100%) rename {tx => x/tx}/textual/internal/testdata/duration.json (100%) rename {tx => x/tx}/textual/internal/testdata/e2e.json (100%) rename {tx => x/tx}/textual/internal/testdata/encode.json (100%) rename {tx => x/tx}/textual/internal/testdata/enum.json (100%) rename {tx => x/tx}/textual/internal/testdata/integers.json (100%) rename {tx => x/tx}/textual/internal/testdata/message.json (100%) rename {tx => x/tx}/textual/internal/testdata/repeated.json (100%) rename {tx => x/tx}/textual/internal/testdata/string.json (100%) rename {tx => x/tx}/textual/internal/testdata/timestamp.json (100%) rename {tx => x/tx}/textual/internal/testdata/tx.json (100%) rename {tx => x/tx}/textual/internal/testpb/1.proto (98%) rename {tx => x/tx}/textual/internal/testpb/1.pulsar.go (100%) rename {tx => x/tx}/textual/internal/testpb/Makefile (100%) rename {tx => x/tx}/textual/internal/testpb/buf.gen.yaml (85%) rename {tx => x/tx}/textual/internal/testpb/buf.lock (100%) rename {tx => x/tx}/textual/internal/testpb/buf.yaml (100%) rename {tx => x/tx}/textual/internal/textualpb/Makefile (100%) rename {tx => x/tx}/textual/internal/textualpb/buf.gen.yaml (84%) rename {tx => x/tx}/textual/internal/textualpb/buf.lock (100%) rename {tx => x/tx}/textual/internal/textualpb/buf.yaml (100%) rename {tx => x/tx}/textual/internal/textualpb/doc.go (100%) rename {tx => x/tx}/textual/internal/textualpb/textual.proto (100%) rename {tx => x/tx}/textual/internal/textualpb/textual.pulsar.go (100%) rename {tx => x/tx}/textual/message.go (100%) rename {tx => x/tx}/textual/message_test.go (94%) rename {tx => x/tx}/textual/protoreflect_list_test.go (100%) rename {tx => x/tx}/textual/repeated_test.go (95%) rename {tx => x/tx}/textual/string.go (100%) rename {tx => x/tx}/textual/string_test.go (98%) rename {tx => x/tx}/textual/timestamp.go (100%) rename {tx => x/tx}/textual/timestamp_test.go (98%) rename {tx => x/tx}/textual/tx.go (99%) rename {tx => x/tx}/textual/tx_test.go (97%) rename {tx => x/tx}/textual/types.go (100%) rename {tx => x/tx}/textual/valuerenderer.go (98%) diff --git a/simapp/go.sum b/simapp/go.sum index 8b39c1ab1ced..1ca076c930d5 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -60,8 +60,6 @@ cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= cosmossdk.io/math v1.0.0-beta.4 h1:JtKedVLGzA0vv84xjYmZ75RKG35Kf2WwcFu8IjRkIIw= cosmossdk.io/math v1.0.0-beta.4/go.mod h1:An0MllWJY6PxibUpnwGk8jOm+a/qIxlKmL5Zyp9NnaM= -cosmossdk.io/tools/confix v0.0.0-20230110102841-9742029158ad h1:pKd9i/hHfUDZ4KCxIqXYHMIm9iJ3M6TGCQPpdC3bo3s= -cosmossdk.io/tools/confix v0.0.0-20230110102841-9742029158ad/go.mod h1:2Nh3ruqssRMhsrsCv404hW6fqSJGFfl2fWp6RDJbRAw= cosmossdk.io/tools/rosetta v0.2.0 h1:Ae499UiZ9yPNCXvjOBO/R9I1pksCJfxoqWauEZgA/gs= cosmossdk.io/tools/rosetta v0.2.0/go.mod h1:3mn8QuE2wLUdTi77/gbDXdFqXZdBdiBJhgAWUTSXPv8= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -197,8 +195,6 @@ github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieEL github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32/go.mod h1:kwMlEC4wWvB48zAShGKVqboJL6w4zCLesaNQ3YLU2BQ= github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0= github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE= -github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc h1:sWSnxj3Yb4suTbO2mveJoJTQznW23d9/fIulZ3VIdnM= -github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc/go.mod h1:1sllUQ6kHXQoYNIkvHcyTElmOfNWsYqJUVLMsZhjJOI= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= diff --git a/tests/go.sum b/tests/go.sum index 34204cd3b559..fa21ea211967 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -192,8 +192,6 @@ github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieEL github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32/go.mod h1:kwMlEC4wWvB48zAShGKVqboJL6w4zCLesaNQ3YLU2BQ= github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0= github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE= -github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc h1:sWSnxj3Yb4suTbO2mveJoJTQznW23d9/fIulZ3VIdnM= -github.com/cosmos/cosmos-sdk/x/nft v0.0.0-20230113085233-fae3332d62fc/go.mod h1:1sllUQ6kHXQoYNIkvHcyTElmOfNWsYqJUVLMsZhjJOI= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= diff --git a/tx/textual/bytes_test.go b/tx/textual/bytes_test.go deleted file mode 100644 index ab82a8cd37c0..000000000000 --- a/tx/textual/bytes_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package textual_test - -import ( - "context" - "encoding/json" - "os" - "testing" - - "cosmossdk.io/tx/textual" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/reflect/protoreflect" -) - -func TestBytesJsonTestCases(t *testing.T) { - var testcases []bytesTest - // Bytes.json contains bytes that are represented in base64 format, and - // their expected results in hex. - raw, err := os.ReadFile("./internal/testdata/bytes.json") - require.NoError(t, err) - err = json.Unmarshal(raw, &testcases) - require.NoError(t, err) - - textual := textual.NewTextual(nil) - - for _, tc := range testcases { - t.Run(tc.hex, func(t *testing.T) { - valrend, err := textual.GetFieldValueRenderer(fieldDescriptorFromName("BYTES")) - require.NoError(t, err) - - screens, err := valrend.Format(context.Background(), protoreflect.ValueOfBytes(tc.base64)) - require.NoError(t, err) - require.Equal(t, 1, len(screens)) - require.Equal(t, tc.hex, screens[0].Text) - - // Round trip - val, err := valrend.Parse(context.Background(), screens) - require.NoError(t, err) - if len(tc.base64) > 35 { - require.Equal(t, 0, len(val.Bytes())) - } else { - require.Equal(t, tc.base64, val.Bytes()) - } - }) - } -} - -type bytesTest struct { - base64 []byte - hex string -} - -func (t *bytesTest) UnmarshalJSON(b []byte) error { - a := []interface{}{&t.base64, &t.hex} - return json.Unmarshal(b, &a) -} diff --git a/tx/textual/coin_test.go b/tx/textual/coin_test.go deleted file mode 100644 index 43071b5807f3..000000000000 --- a/tx/textual/coin_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package textual_test - -import ( - "context" - "encoding/json" - "fmt" - "os" - "testing" - - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/reflect/protoreflect" - - bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - "cosmossdk.io/tx/textual" -) - -// mockCoinMetadataKey is used in the mock coin metadata querier. -func mockCoinMetadataKey(denom string) string { - return fmt.Sprintf("%s-%s", "coin-metadata", denom) -} - -// mockCoinMetadataQuerier is a mock querier for coin metadata used for test -// purposes. -func mockCoinMetadataQuerier(ctx context.Context, denom string) (*bankv1beta1.Metadata, error) { - v := ctx.Value(mockCoinMetadataKey(denom)) - if v == nil { - return nil, nil - } - - return v.(*bankv1beta1.Metadata), nil -} - -// addMetadataToContext appends relevant coin metadata to the mock context -// used in tests. -func addMetadataToContext(ctx context.Context, metadata *bankv1beta1.Metadata) context.Context { - if metadata == nil { - return ctx - } - - for _, m := range metadata.DenomUnits { - ctx = context.WithValue(ctx, mockCoinMetadataKey(m.Denom), metadata) - } - - return ctx -} - -func TestMetadataQuerier(t *testing.T) { - // Errors on nil metadata querier - txt := textual.NewTextual(nil) - vr, err := txt.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) - require.NoError(t, err) - _, err = vr.Format(context.Background(), protoreflect.ValueOf((&basev1beta1.Coin{}).ProtoReflect())) - require.Error(t, err) - - // Errors if metadata querier returns an error - expErr := fmt.Errorf("mock error") - txt = textual.NewTextual(func(_ context.Context, _ string) (*bankv1beta1.Metadata, error) { - return nil, expErr - }) - vr, err = txt.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) - require.NoError(t, err) - _, err = vr.Format(context.Background(), protoreflect.ValueOf((&basev1beta1.Coin{}).ProtoReflect())) - require.ErrorIs(t, err, expErr) - _, err = vr.(textual.RepeatedValueRenderer).FormatRepeated(context.Background(), protoreflect.ValueOf(NewGenericList([]*basev1beta1.Coin{{}}))) - require.ErrorIs(t, err, expErr) -} - -func TestCoinJsonTestcases(t *testing.T) { - var testcases []coinJsonTest - raw, err := os.ReadFile("./internal/testdata/coin.json") - require.NoError(t, err) - err = json.Unmarshal(raw, &testcases) - require.NoError(t, err) - - textual := textual.NewTextual(mockCoinMetadataQuerier) - vr, err := textual.GetFieldValueRenderer(fieldDescriptorFromName("COIN")) - require.NoError(t, err) - - for _, tc := range testcases { - t.Run(tc.Text, func(t *testing.T) { - if tc.Proto != nil { - ctx := addMetadataToContext(context.Background(), tc.Metadata) - - screens, err := vr.Format(ctx, protoreflect.ValueOf(tc.Proto.ProtoReflect())) - - if tc.Error { - require.Error(t, err) - return - } - - require.NoError(t, err) - require.Equal(t, 1, len(screens)) - require.Equal(t, tc.Text, screens[0].Text) - - // Round trip. - value, err := vr.Parse(ctx, screens) - if tc.Error { - require.Error(t, err) - return - } - - require.NoError(t, err) - coin, ok := value.Message().Interface().(*basev1beta1.Coin) - require.True(t, ok) - - checkCoinEqual(t, coin, tc.Proto) - } - }) - } -} - -// coinJsonTest is the type of test cases in the testdata file. -// If the test case has a Proto, try to Format() it. If Error is set, expect -// an error, otherwise match Text, then Parse() the text and expect it to -// match (via proto.Equals()) the original Proto. If the test case has no -// Proto, try to Parse() the Text and expect an error if Error is set. -type coinJsonTest struct { - Proto *basev1beta1.Coin - Metadata *bankv1beta1.Metadata - Error bool - Text string -} diff --git a/tx/textual/duration_test.go b/tx/textual/duration_test.go deleted file mode 100644 index 88dd12152f06..000000000000 --- a/tx/textual/duration_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package textual_test - -import ( - "context" - "encoding/json" - "fmt" - "os" - "testing" - - "cosmossdk.io/tx/textual" - "github.com/stretchr/testify/require" - - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/reflect/protoreflect" - dpb "google.golang.org/protobuf/types/known/durationpb" -) - -type durationTest struct { - Proto *dpb.Duration - Text string - Error bool -} - -func TestDurationJSON(t *testing.T) { - raw, err := os.ReadFile("./internal/testdata/duration.json") - require.NoError(t, err) - - var testcases []durationTest - err = json.Unmarshal(raw, &testcases) - require.NoError(t, err) - - for i, tc := range testcases { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - rend := textual.NewDurationValueRenderer() - - var screens []textual.Screen - if tc.Proto != nil { - screens, err = rend.Format(context.Background(), protoreflect.ValueOf(tc.Proto.ProtoReflect())) - if tc.Error { - require.Error(t, err) - return - } - require.NoError(t, err) - require.Equal(t, 1, len(screens)) - require.Equal(t, tc.Text, screens[0].Text) - } - - val, err := rend.Parse(context.Background(), screens) - if tc.Error { - require.Error(t, err) - return - } - require.NoError(t, err) - msg := val.Message().Interface() - require.IsType(t, &dpb.Duration{}, msg) - duration := msg.(*dpb.Duration) - require.True(t, proto.Equal(duration, tc.Proto), "%v vs %v", duration, tc.Proto) - }) - } -} diff --git a/tx/textual/enum_test.go b/tx/textual/enum_test.go deleted file mode 100644 index 2076ba4a55ce..000000000000 --- a/tx/textual/enum_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package textual_test - -import ( - "context" - "encoding/json" - "os" - "strings" - "testing" - - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/testpb" - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/testing/protocmp" -) - -type enumTest struct { - Proto json.RawMessage - Text string -} - -func TestEnumJsonTestcases(t *testing.T) { - var testcases []enumTest - raw, err := os.ReadFile("./internal/testdata/enum.json") - require.NoError(t, err) - err = json.Unmarshal(raw, &testcases) - require.NoError(t, err) - - textual := textual.NewTextual(nil) - - for _, tc := range testcases { - t.Run(tc.Text, func(t *testing.T) { - m := &testpb.Baz{} - err := protojson.Unmarshal(tc.Proto, m) - require.NoError(t, err) - - fd := getFd(tc.Proto, m) - valrend, err := textual.GetFieldValueRenderer(fd) - require.NoError(t, err) - - val := m.ProtoReflect().Get(fd) - screens, err := valrend.Format(context.Background(), val) - require.NoError(t, err) - require.Equal(t, 1, len(screens)) - require.Equal(t, tc.Text, screens[0].Text) - - // Round trip - parsedVal, err := valrend.Parse(context.Background(), screens) - require.NoError(t, err) - diff := cmp.Diff(val.Interface(), parsedVal.Interface(), protocmp.Transform()) - require.Empty(t, diff) - }) - } -} - -// getFd returns the field descriptor on Baz whose value is set. Since golang -// treats empty and default values as the same, we actually parse the protojson -// encoded string to retrieve which field is set. -func getFd(proto json.RawMessage, m *testpb.Baz) protoreflect.FieldDescriptor { - if strings.Contains(string(proto), `"ee"`) { - return m.ProtoReflect().Descriptor().Fields().ByNumber(1) - } else if strings.Contains(string(proto), `"ie"`) { - return m.ProtoReflect().Descriptor().Fields().ByNumber(2) - } else { - return m.ProtoReflect().Descriptor().Fields().ByNumber(3) - } -} diff --git a/tx/textual/internal/cbor/cbor_test.go b/tx/textual/internal/cbor/cbor_test.go deleted file mode 100644 index 5f3250d4e66b..000000000000 --- a/tx/textual/internal/cbor/cbor_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package cbor_test - -import ( - "bytes" - "encoding/hex" - "fmt" - "testing" - - "cosmossdk.io/tx/textual/internal/cbor" - "github.com/stretchr/testify/require" -) - -var ( - ui = cbor.NewUint - txt = cbor.NewText - arr = cbor.NewArray - mp = cbor.NewMap - ent = cbor.NewEntry -) - -func TestCborRFC(t *testing.T) { - for i, tc := range []struct { - cb cbor.Cbor - encoding string - expectError bool - }{ - // Examples come from RFC8949, Appendix A - {cb: ui(0), encoding: "00"}, - {cb: ui(1), encoding: "01"}, - {cb: ui(10), encoding: "0a"}, - {cb: ui(23), encoding: "17"}, - {cb: ui(24), encoding: "1818"}, - {cb: ui(25), encoding: "1819"}, - {cb: ui(100), encoding: "1864"}, - {cb: ui(1000), encoding: "1903e8"}, - {cb: ui(1000000), encoding: "1a000f4240"}, - {cb: ui(1000000000000), encoding: "1b000000e8d4a51000"}, - {cb: ui(18446744073709551615), encoding: "1bffffffffffffffff"}, - {cb: cbor.NewBool(false), encoding: "f4"}, - {cb: cbor.NewBool(true), encoding: "f5"}, - {cb: txt(""), encoding: "60"}, - {cb: txt("a"), encoding: "6161"}, - {cb: txt("IETF"), encoding: "6449455446"}, - {cb: txt("\"\\"), encoding: "62225c"}, - {cb: txt("\u00fc"), encoding: "62c3bc"}, - {cb: txt("\u6c34"), encoding: "63e6b0b4"}, - // Go doesn't like string literals with surrogate pairs, create manually - {cb: txt(string([]byte{0xf0, 0x90, 0x85, 0x91})), encoding: "64f0908591"}, - {cb: arr(), encoding: "80"}, - {cb: arr(ui(1), ui(2)).Append(ui(3)), encoding: "83010203"}, - { - cb: arr(ui(1)). - Append(arr(ui(2), ui(3))). - Append(arr().Append(ui(4)).Append(ui(5))), - encoding: "8301820203820405", - }, - { - cb: arr( - ui(1), ui(2), ui(3), ui(4), ui(5), - ui(6), ui(7), ui(8), ui(9), ui(10), - ui(11), ui(12), ui(13), ui(14), ui(15), - ui(16), ui(17), ui(18), ui(19), ui(20), - ui(21), ui(22), ui(23), ui(24), ui(25)), - encoding: "98190102030405060708090a0b0c0d0e0f101112131415161718181819", - }, - {cb: mp(), encoding: "a0"}, - {cb: mp(ent(ui(1), ui(2))).Add(ui(3), ui(4)), encoding: "a201020304"}, - {cb: mp(ent(txt("a"), ui(1)), ent(txt("b"), arr(ui(2), ui(3)))), encoding: "a26161016162820203"}, - {cb: arr(txt("a"), mp(ent(txt("b"), txt("c")))), encoding: "826161a161626163"}, - { - cb: mp( - ent(txt("a"), txt("A")), - ent(txt("b"), txt("B")), - ent(txt("c"), txt("C")), - ent(txt("d"), txt("D")), - ent(txt("e"), txt("E"))), - encoding: "a56161614161626142616361436164614461656145", - }, - // Departing from the RFC - {cb: mp(ent(ui(1), ui(2)), ent(ui(1), ui(2))), expectError: true}, - // Map has deterministic order based on key encoding - { - cb: mp( - ent(txt("aa"), ui(0)), - ent(txt("a"), ui(2)), - ent(ui(1), txt("b"))), - encoding: "a301616261610262616100", - }, - } { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - var buf bytes.Buffer - err := tc.cb.Encode(&buf) - if tc.expectError { - require.Error(t, err) - return - } - require.NoError(t, err) - want, err := hex.DecodeString(tc.encoding) - require.NoError(t, err) - require.Equal(t, want, buf.Bytes()) - }) - } -} diff --git a/tx/textual/valuerenderer_test.go b/tx/textual/valuerenderer_test.go deleted file mode 100644 index 48613426cb67..000000000000 --- a/tx/textual/valuerenderer_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package textual_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/reflect/protoreflect" - - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/testpb" -) - -func TestDispatcher(t *testing.T) { - testcases := []struct { - name string - expErr bool - expValueRenderer textual.ValueRenderer - }{ - {"UINT32", false, textual.NewIntValueRenderer(fieldDescriptorFromName("UINT32"))}, - {"UINT64", false, textual.NewIntValueRenderer(fieldDescriptorFromName("UINT64"))}, - {"SDKINT", false, textual.NewIntValueRenderer(fieldDescriptorFromName("SDKINT"))}, - {"SDKDEC", false, textual.NewDecValueRenderer()}, - {"BYTES", false, textual.NewBytesValueRenderer()}, - {"TIMESTAMP", false, textual.NewTimestampValueRenderer()}, - {"DURATION", false, textual.NewDurationValueRenderer()}, - {"COIN", false, textual.NewCoinsValueRenderer(nil)}, - {"COINS", false, textual.NewCoinsValueRenderer(nil)}, - {"ENUM", false, textual.NewEnumValueRenderer(fieldDescriptorFromName("ENUM"))}, - {"ANY", false, textual.NewAnyValueRenderer(nil)}, - {"FLOAT", true, nil}, - } - - for _, tc := range testcases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - textual := textual.NewTextual(nil) - rend, err := textual.GetFieldValueRenderer(fieldDescriptorFromName(tc.name)) - - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - require.IsType(t, tc.expValueRenderer, rend) - } - }) - } -} - -// fieldDescriptorFromName is like GetADR050ValueRenderer, but taking a Go type -// as input instead of a protoreflect.FieldDescriptor. -func fieldDescriptorFromName(name string) protoreflect.FieldDescriptor { - a := (&testpb.A{}).ProtoReflect().Descriptor().Fields() - fd := a.ByName(protoreflect.Name(name)) - if fd == nil { - panic(fmt.Errorf("no field descriptor for %s", name)) - } - - return fd -} diff --git a/tx/go.mod b/x/tx/go.mod similarity index 96% rename from tx/go.mod rename to x/tx/go.mod index 91a4e0168ba7..ed98d02212aa 100644 --- a/tx/go.mod +++ b/x/tx/go.mod @@ -1,4 +1,4 @@ -module cosmossdk.io/tx +module cosmossdk.io/x/tx go 1.19 diff --git a/tx/go.sum b/x/tx/go.sum similarity index 100% rename from tx/go.sum rename to x/tx/go.sum diff --git a/tx/signing/sign_mode_handler.go b/x/tx/signing/sign_mode_handler.go similarity index 100% rename from tx/signing/sign_mode_handler.go rename to x/tx/signing/sign_mode_handler.go diff --git a/tx/sonar-project.properties b/x/tx/sonar-project.properties similarity index 100% rename from tx/sonar-project.properties rename to x/tx/sonar-project.properties diff --git a/tx/textual/any.go b/x/tx/textual/any.go similarity index 100% rename from tx/textual/any.go rename to x/tx/textual/any.go diff --git a/tx/textual/any_test.go b/x/tx/textual/any_test.go similarity index 98% rename from tx/textual/any_test.go rename to x/tx/textual/any_test.go index e6842d0448bb..a8a8e2f55602 100644 --- a/tx/textual/any_test.go +++ b/x/tx/textual/any_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/require" diff --git a/tx/textual/bench_test.go b/x/tx/textual/bench_test.go similarity index 100% rename from tx/textual/bench_test.go rename to x/tx/textual/bench_test.go diff --git a/tx/textual/bytes.go b/x/tx/textual/bytes.go similarity index 100% rename from tx/textual/bytes.go rename to x/tx/textual/bytes.go diff --git a/tx/textual/coins.go b/x/tx/textual/coins.go similarity index 100% rename from tx/textual/coins.go rename to x/tx/textual/coins.go diff --git a/tx/textual/coins_test.go b/x/tx/textual/coins_test.go similarity index 99% rename from tx/textual/coins_test.go rename to x/tx/textual/coins_test.go index ca8105b9d92d..4f42abe94bcf 100644 --- a/tx/textual/coins_test.go +++ b/x/tx/textual/coins_test.go @@ -9,7 +9,7 @@ import ( bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" "cosmossdk.io/math" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/tx/textual/dec.go b/x/tx/textual/dec.go similarity index 100% rename from tx/textual/dec.go rename to x/tx/textual/dec.go diff --git a/tx/textual/dec_test.go b/x/tx/textual/dec_test.go similarity index 96% rename from tx/textual/dec_test.go rename to x/tx/textual/dec_test.go index 92063230481d..bc1952a36fb3 100644 --- a/tx/textual/dec_test.go +++ b/x/tx/textual/dec_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/tx/textual/duration.go b/x/tx/textual/duration.go similarity index 100% rename from tx/textual/duration.go rename to x/tx/textual/duration.go diff --git a/tx/textual/e2e_test.go b/x/tx/textual/e2e_test.go similarity index 95% rename from tx/textual/e2e_test.go rename to x/tx/textual/e2e_test.go index 3d2675570619..cfccff0f2e3c 100644 --- a/tx/textual/e2e_test.go +++ b/x/tx/textual/e2e_test.go @@ -16,8 +16,8 @@ import ( _ "cosmossdk.io/api/cosmos/crypto/multisig" _ "cosmossdk.io/api/cosmos/crypto/secp256k1" _ "cosmossdk.io/api/cosmos/gov/v1" - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/textualpb" + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/textualpb" ) type e2eJsonTest struct { diff --git a/tx/textual/encode.go b/x/tx/textual/encode.go similarity index 95% rename from tx/textual/encode.go rename to x/tx/textual/encode.go index 6a9f0f97ba15..cfa916070f86 100644 --- a/tx/textual/encode.go +++ b/x/tx/textual/encode.go @@ -3,7 +3,7 @@ package textual import ( "io" - "cosmossdk.io/tx/textual/internal/cbor" + "cosmossdk.io/x/tx/textual/internal/cbor" ) var ( diff --git a/tx/textual/encode_test.go b/x/tx/textual/encode_test.go similarity index 100% rename from tx/textual/encode_test.go rename to x/tx/textual/encode_test.go diff --git a/tx/textual/enum.go b/x/tx/textual/enum.go similarity index 100% rename from tx/textual/enum.go rename to x/tx/textual/enum.go diff --git a/tx/textual/int.go b/x/tx/textual/int.go similarity index 100% rename from tx/textual/int.go rename to x/tx/textual/int.go diff --git a/tx/textual/int_test.go b/x/tx/textual/int_test.go similarity index 98% rename from tx/textual/int_test.go rename to x/tx/textual/int_test.go index 48e339a04ccf..bac7bb9d3d36 100644 --- a/tx/textual/int_test.go +++ b/x/tx/textual/int_test.go @@ -11,7 +11,7 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" "cosmossdk.io/math" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" ) func TestIntJsonTestcases(t *testing.T) { diff --git a/tx/textual/internal/cbor/cbor.go b/x/tx/textual/internal/cbor/cbor.go similarity index 100% rename from tx/textual/internal/cbor/cbor.go rename to x/tx/textual/internal/cbor/cbor.go diff --git a/tx/textual/internal/testdata/README.md b/x/tx/textual/internal/testdata/README.md similarity index 100% rename from tx/textual/internal/testdata/README.md rename to x/tx/textual/internal/testdata/README.md diff --git a/tx/textual/internal/testdata/any.json b/x/tx/textual/internal/testdata/any.json similarity index 100% rename from tx/textual/internal/testdata/any.json rename to x/tx/textual/internal/testdata/any.json diff --git a/tx/textual/internal/testdata/bytes.json b/x/tx/textual/internal/testdata/bytes.json similarity index 100% rename from tx/textual/internal/testdata/bytes.json rename to x/tx/textual/internal/testdata/bytes.json diff --git a/tx/textual/internal/testdata/coin.json b/x/tx/textual/internal/testdata/coin.json similarity index 100% rename from tx/textual/internal/testdata/coin.json rename to x/tx/textual/internal/testdata/coin.json diff --git a/tx/textual/internal/testdata/coins.json b/x/tx/textual/internal/testdata/coins.json similarity index 100% rename from tx/textual/internal/testdata/coins.json rename to x/tx/textual/internal/testdata/coins.json diff --git a/tx/textual/internal/testdata/decimals.json b/x/tx/textual/internal/testdata/decimals.json similarity index 100% rename from tx/textual/internal/testdata/decimals.json rename to x/tx/textual/internal/testdata/decimals.json diff --git a/tx/textual/internal/testdata/duration.json b/x/tx/textual/internal/testdata/duration.json similarity index 100% rename from tx/textual/internal/testdata/duration.json rename to x/tx/textual/internal/testdata/duration.json diff --git a/tx/textual/internal/testdata/e2e.json b/x/tx/textual/internal/testdata/e2e.json similarity index 100% rename from tx/textual/internal/testdata/e2e.json rename to x/tx/textual/internal/testdata/e2e.json diff --git a/tx/textual/internal/testdata/encode.json b/x/tx/textual/internal/testdata/encode.json similarity index 100% rename from tx/textual/internal/testdata/encode.json rename to x/tx/textual/internal/testdata/encode.json diff --git a/tx/textual/internal/testdata/enum.json b/x/tx/textual/internal/testdata/enum.json similarity index 100% rename from tx/textual/internal/testdata/enum.json rename to x/tx/textual/internal/testdata/enum.json diff --git a/tx/textual/internal/testdata/integers.json b/x/tx/textual/internal/testdata/integers.json similarity index 100% rename from tx/textual/internal/testdata/integers.json rename to x/tx/textual/internal/testdata/integers.json diff --git a/tx/textual/internal/testdata/message.json b/x/tx/textual/internal/testdata/message.json similarity index 100% rename from tx/textual/internal/testdata/message.json rename to x/tx/textual/internal/testdata/message.json diff --git a/tx/textual/internal/testdata/repeated.json b/x/tx/textual/internal/testdata/repeated.json similarity index 100% rename from tx/textual/internal/testdata/repeated.json rename to x/tx/textual/internal/testdata/repeated.json diff --git a/tx/textual/internal/testdata/string.json b/x/tx/textual/internal/testdata/string.json similarity index 100% rename from tx/textual/internal/testdata/string.json rename to x/tx/textual/internal/testdata/string.json diff --git a/tx/textual/internal/testdata/timestamp.json b/x/tx/textual/internal/testdata/timestamp.json similarity index 100% rename from tx/textual/internal/testdata/timestamp.json rename to x/tx/textual/internal/testdata/timestamp.json diff --git a/tx/textual/internal/testdata/tx.json b/x/tx/textual/internal/testdata/tx.json similarity index 100% rename from tx/textual/internal/testdata/tx.json rename to x/tx/textual/internal/testdata/tx.json diff --git a/tx/textual/internal/testpb/1.proto b/x/tx/textual/internal/testpb/1.proto similarity index 98% rename from tx/textual/internal/testpb/1.proto rename to x/tx/textual/internal/testpb/1.proto index 070e91264b78..f3f12f62155b 100644 --- a/tx/textual/internal/testpb/1.proto +++ b/x/tx/textual/internal/testpb/1.proto @@ -7,7 +7,7 @@ import "google/protobuf/descriptor.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "cosmossdk.io/tx/textual/internal/testpb"; +option go_package = "cosmossdk.io/x/tx/textual/internal/testpb"; // A is used for testing value renderers. message A { diff --git a/tx/textual/internal/testpb/1.pulsar.go b/x/tx/textual/internal/testpb/1.pulsar.go similarity index 100% rename from tx/textual/internal/testpb/1.pulsar.go rename to x/tx/textual/internal/testpb/1.pulsar.go diff --git a/tx/textual/internal/testpb/Makefile b/x/tx/textual/internal/testpb/Makefile similarity index 100% rename from tx/textual/internal/testpb/Makefile rename to x/tx/textual/internal/testpb/Makefile diff --git a/tx/textual/internal/testpb/buf.gen.yaml b/x/tx/textual/internal/testpb/buf.gen.yaml similarity index 85% rename from tx/textual/internal/testpb/buf.gen.yaml rename to x/tx/textual/internal/testpb/buf.gen.yaml index 137c21bccb00..cc934eb887ec 100644 --- a/tx/textual/internal/testpb/buf.gen.yaml +++ b/x/tx/textual/internal/testpb/buf.gen.yaml @@ -2,7 +2,7 @@ version: v1 managed: enabled: true go_package_prefix: - default: cosmossdk.io/tx/textual/internal/testpb + default: cosmossdk.io/x/tx/textual/internal/testpb except: - buf.build/googleapis/googleapis - buf.build/cosmos/gogo-proto diff --git a/tx/textual/internal/testpb/buf.lock b/x/tx/textual/internal/testpb/buf.lock similarity index 100% rename from tx/textual/internal/testpb/buf.lock rename to x/tx/textual/internal/testpb/buf.lock diff --git a/tx/textual/internal/testpb/buf.yaml b/x/tx/textual/internal/testpb/buf.yaml similarity index 100% rename from tx/textual/internal/testpb/buf.yaml rename to x/tx/textual/internal/testpb/buf.yaml diff --git a/tx/textual/internal/textualpb/Makefile b/x/tx/textual/internal/textualpb/Makefile similarity index 100% rename from tx/textual/internal/textualpb/Makefile rename to x/tx/textual/internal/textualpb/Makefile diff --git a/tx/textual/internal/textualpb/buf.gen.yaml b/x/tx/textual/internal/textualpb/buf.gen.yaml similarity index 84% rename from tx/textual/internal/textualpb/buf.gen.yaml rename to x/tx/textual/internal/textualpb/buf.gen.yaml index cb7e5827824c..08ecaa895c46 100644 --- a/tx/textual/internal/textualpb/buf.gen.yaml +++ b/x/tx/textual/internal/textualpb/buf.gen.yaml @@ -2,7 +2,7 @@ version: v1 managed: enabled: true go_package_prefix: - default: cosmossdk.io/tx/textual/internal/textualpb + default: cosmossdk.io/x/tx/textual/internal/textualpb except: - buf.build/googleapis/googleapis - buf.build/cosmos/gogo-proto diff --git a/tx/textual/internal/textualpb/buf.lock b/x/tx/textual/internal/textualpb/buf.lock similarity index 100% rename from tx/textual/internal/textualpb/buf.lock rename to x/tx/textual/internal/textualpb/buf.lock diff --git a/tx/textual/internal/textualpb/buf.yaml b/x/tx/textual/internal/textualpb/buf.yaml similarity index 100% rename from tx/textual/internal/textualpb/buf.yaml rename to x/tx/textual/internal/textualpb/buf.yaml diff --git a/tx/textual/internal/textualpb/doc.go b/x/tx/textual/internal/textualpb/doc.go similarity index 100% rename from tx/textual/internal/textualpb/doc.go rename to x/tx/textual/internal/textualpb/doc.go diff --git a/tx/textual/internal/textualpb/textual.proto b/x/tx/textual/internal/textualpb/textual.proto similarity index 100% rename from tx/textual/internal/textualpb/textual.proto rename to x/tx/textual/internal/textualpb/textual.proto diff --git a/tx/textual/internal/textualpb/textual.pulsar.go b/x/tx/textual/internal/textualpb/textual.pulsar.go similarity index 100% rename from tx/textual/internal/textualpb/textual.pulsar.go rename to x/tx/textual/internal/textualpb/textual.pulsar.go diff --git a/tx/textual/message.go b/x/tx/textual/message.go similarity index 100% rename from tx/textual/message.go rename to x/tx/textual/message.go diff --git a/tx/textual/message_test.go b/x/tx/textual/message_test.go similarity index 94% rename from tx/textual/message_test.go rename to x/tx/textual/message_test.go index 694e750e6a83..f355b3cdef07 100644 --- a/tx/textual/message_test.go +++ b/x/tx/textual/message_test.go @@ -10,8 +10,8 @@ import ( "github.com/stretchr/testify/require" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/testpb" + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/testpb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/tx/textual/protoreflect_list_test.go b/x/tx/textual/protoreflect_list_test.go similarity index 100% rename from tx/textual/protoreflect_list_test.go rename to x/tx/textual/protoreflect_list_test.go diff --git a/tx/textual/repeated_test.go b/x/tx/textual/repeated_test.go similarity index 95% rename from tx/textual/repeated_test.go rename to x/tx/textual/repeated_test.go index e85439db7898..dfa6c6e38008 100644 --- a/tx/textual/repeated_test.go +++ b/x/tx/textual/repeated_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/testpb" + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/testpb" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/tx/textual/string.go b/x/tx/textual/string.go similarity index 100% rename from tx/textual/string.go rename to x/tx/textual/string.go diff --git a/tx/textual/string_test.go b/x/tx/textual/string_test.go similarity index 98% rename from tx/textual/string_test.go rename to x/tx/textual/string_test.go index 9d6f10e37d2d..09621f660a52 100644 --- a/tx/textual/string_test.go +++ b/x/tx/textual/string_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" "github.com/stretchr/testify/require" "google.golang.org/protobuf/reflect/protoreflect" ) diff --git a/tx/textual/timestamp.go b/x/tx/textual/timestamp.go similarity index 100% rename from tx/textual/timestamp.go rename to x/tx/textual/timestamp.go diff --git a/tx/textual/timestamp_test.go b/x/tx/textual/timestamp_test.go similarity index 98% rename from tx/textual/timestamp_test.go rename to x/tx/textual/timestamp_test.go index eec34deb05a1..6ab351f9cb21 100644 --- a/tx/textual/timestamp_test.go +++ b/x/tx/textual/timestamp_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "cosmossdk.io/tx/textual" + "cosmossdk.io/x/tx/textual" "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" diff --git a/tx/textual/tx.go b/x/tx/textual/tx.go similarity index 99% rename from tx/textual/tx.go rename to x/tx/textual/tx.go index 5617ae22f767..28074cb67d9f 100644 --- a/tx/textual/tx.go +++ b/x/tx/textual/tx.go @@ -17,7 +17,7 @@ import ( msg "cosmossdk.io/api/cosmos/msg/v1" signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1" txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" - "cosmossdk.io/tx/textual/internal/textualpb" + "cosmossdk.io/x/tx/textual/internal/textualpb" ) var ( diff --git a/tx/textual/tx_test.go b/x/tx/textual/tx_test.go similarity index 97% rename from tx/textual/tx_test.go rename to x/tx/textual/tx_test.go index 42e0c0c96e99..a36358bd372c 100644 --- a/tx/textual/tx_test.go +++ b/x/tx/textual/tx_test.go @@ -20,9 +20,9 @@ import ( _ "cosmossdk.io/api/cosmos/crypto/secp256k1" _ "cosmossdk.io/api/cosmos/gov/v1" txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1" - "cosmossdk.io/tx/signing" - "cosmossdk.io/tx/textual" - "cosmossdk.io/tx/textual/internal/textualpb" + "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/tx/textual" + "cosmossdk.io/x/tx/textual/internal/textualpb" ) // txJsonTestTx represents the type that in the JSON test diff --git a/tx/textual/types.go b/x/tx/textual/types.go similarity index 100% rename from tx/textual/types.go rename to x/tx/textual/types.go diff --git a/tx/textual/valuerenderer.go b/x/tx/textual/valuerenderer.go similarity index 98% rename from tx/textual/valuerenderer.go rename to x/tx/textual/valuerenderer.go index 2ab789136887..851370a3b8d8 100644 --- a/tx/textual/valuerenderer.go +++ b/x/tx/textual/valuerenderer.go @@ -13,8 +13,8 @@ import ( bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" basev1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" - "cosmossdk.io/tx/signing" - "cosmossdk.io/tx/textual/internal/textualpb" + "cosmossdk.io/x/tx/signing" + "cosmossdk.io/x/tx/textual/internal/textualpb" cosmos_proto "github.com/cosmos/cosmos-proto" ) From 8c95939258f776623c61a56eb8cb7ddb8862ac28 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Mon, 16 Jan 2023 15:51:33 +0100 Subject: [PATCH 3/5] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 118cb04e4ada..801616162f8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,6 +156,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* (tx) [#14634](https://github.com/cosmos/cosmos-sdk/pull/14634) Move the `tx` go module to `x/tx`. * (snapshots) [#14597](https://github.com/cosmos/cosmos-sdk/pull/14597) Move `snapshots` to `store/snapshots`, rename and bump proto package to v1. * (crypto/keyring) [#14151](https://github.com/cosmos/cosmos-sdk/pull/14151) Move keys presentation from `crypto/keyring` to `client/keys` * (modules) [#13850](https://github.com/cosmos/cosmos-sdk/pull/13850) and [#14046](https://github.com/cosmos/cosmos-sdk/pull/14046) Remove gogoproto stringer annotations. This removes the custom `String()` methods on all types that were using the annotations. From c67abd0ad3c49106d554d672917c8419c602d9dc Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Mon, 16 Jan 2023 17:06:03 +0100 Subject: [PATCH 4/5] checklist --- .github/dependabot.yml | 2 +- .github/labeler.yml | 2 ++ .github/workflows/test.yml | 14 +++++++------- x/tx/CHANGELOG.md | 7 +++++++ x/tx/sonar-project.properties | 4 ++-- 5 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 x/tx/CHANGELOG.md diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 81d4cee8678e..143c0767b10a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -94,7 +94,7 @@ updates: - "A:automerge" - dependencies - package-ecosystem: gomod - directory: "/tx" + directory: "/x/tx" schedule: interval: weekly labels: diff --git a/.github/labeler.yml b/.github/labeler.yml index 87b45b26d6a1..f204e8d399f7 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -39,6 +39,8 @@ - x/consensus/**/* "C:x/circuit": - x/circuit/**/* +"C:x/tx": + - x/tx/**/* "C:collections": - collections/**/* "C:Cosmovisor": diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9660f4f4de00..eff5ca80a1dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -559,7 +559,7 @@ jobs: # NOTE: The following jobs are used to test the Cosmos SDK Go submodules present under x/{module}. # They run when there is a diff in their respective directories. - test-tx: + test-x-tx: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -567,18 +567,18 @@ jobs: with: go-version: 1.19.4 cache: true - cache-dependency-path: tx/go.sum + cache-dependency-path: x/tx/go.sum - uses: technote-space/get-diff-action@v6.1.2 id: git_diff with: PATTERNS: | - tx/**/*.go - tx/go.mod - tx/go.sum + x/tx/**/*.go + x/tx/go.mod + x/tx/go.sum - name: tests if: env.GIT_DIFF run: | - cd tx + cd x/tx go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock rocksdb_build' ./... - name: sonarcloud if: ${{ env.GIT_DIFF && !github.event.pull_request.draft }} @@ -587,7 +587,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: - projectBaseDir: tx/ + projectBaseDir: x/tx/ test-x-nft: runs-on: ubuntu-latest diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md new file mode 100644 index 000000000000..82e66fb32d3d --- /dev/null +++ b/x/tx/CHANGELOG.md @@ -0,0 +1,7 @@ +# CHANGELOG + +## Unreleased + +### Features + +### Improvements diff --git a/x/tx/sonar-project.properties b/x/tx/sonar-project.properties index b04a5c4f8048..ea9faa57b72c 100644 --- a/x/tx/sonar-project.properties +++ b/x/tx/sonar-project.properties @@ -1,7 +1,7 @@ -sonar.projectKey=cosmos-sdk-tx +sonar.projectKey=cosmos-sdk-x/tx sonar.organization=cosmos -sonar.projectName=Cosmos SDK - Tx +sonar.projectName=Cosmos SDK - x/tx sonar.project.monorepo.enabled=true sonar.sources=. From 5c27a952855192776715074318b8929401cda361 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Mon, 16 Jan 2023 17:15:33 +0100 Subject: [PATCH 5/5] Revert sonar --- x/tx/sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tx/sonar-project.properties b/x/tx/sonar-project.properties index ea9faa57b72c..4550b73afb2c 100644 --- a/x/tx/sonar-project.properties +++ b/x/tx/sonar-project.properties @@ -1,4 +1,4 @@ -sonar.projectKey=cosmos-sdk-x/tx +sonar.projectKey=cosmos-sdk-tx sonar.organization=cosmos sonar.projectName=Cosmos SDK - x/tx