From b57ce4d19b44ec7e425f09515078b49b07ee3b48 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:30:18 +0200 Subject: [PATCH 1/5] docs(x/genutil): fix `genesis migrate` command examples (backport #22090) (#22097) Co-authored-by: tutufen --- x/genutil/client/cli/migrate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/genutil/client/cli/migrate.go b/x/genutil/client/cli/migrate.go index 877df1e0af70..869995efc8c7 100644 --- a/x/genutil/client/cli/migrate.go +++ b/x/genutil/client/cli/migrate.go @@ -36,7 +36,7 @@ func MigrateGenesisCmd(migrations types.MigrationMap) *cobra.Command { Use: "migrate [target-version] [genesis-file]", Short: "Migrate genesis to a specified target version", Long: "Migrate the source genesis into the target version and print to STDOUT", - Example: fmt.Sprintf("%s migrate v0.47 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z", version.AppName), + Example: fmt.Sprintf("%s genesis migrate v0.47 /path/to/genesis.json --chain-id=cosmoshub-3 --genesis-time=2019-04-22T17:00:00Z", version.AppName), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { return MigrateHandler(cmd, args, migrations) From 27f1f7885de45cd013e0b1911c6ae2c77213eaa2 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Thu, 10 Oct 2024 08:35:33 +0200 Subject: [PATCH 2/5] chore(simapp): be consistent with runtime (#22203) --- simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/app.go b/simapp/app.go index 35ce2e5bac23..63178f1ab52e 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -209,7 +209,7 @@ func NewSimApp( legacyAmino := codec.NewLegacyAmino() txConfig := tx.NewTxConfig(appCodec, tx.DefaultSignModes) - if err := txConfig.SigningContext().Validate(); err != nil { + if err := interfaceRegistry.SigningContext().Validate(); err != nil { panic(err) } From 955304a491b895eee2437744ad0a09366d158db7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:40:00 +0200 Subject: [PATCH 3/5] docs: add docs boilerplate (backport #22202) (#22210) Co-authored-by: Julien Robert --- .github/workflows/test.yml | 12 ++++++++++++ docs/docs/build/_category_.json | 5 +++++ docs/docs/build/build.md | 13 +++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 docs/docs/build/_category_.json create mode 100644 docs/docs/build/build.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c647a48e8ad..cf2fea549b2a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -843,3 +843,15 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: projectBaseDir: x/upgrade/ + + test-system: # no system tests in v0.50, set to match required job + runs-on: ubuntu-latest + steps: + - name: do nothing + run: echo "no system tests in v0.50" + + test-system-v2: # no system tests in v0.50, set to match required job + runs-on: ubuntu-latest + steps: + - name: do nothing + run: echo "no system tests in v0.50" diff --git a/docs/docs/build/_category_.json b/docs/docs/build/_category_.json new file mode 100644 index 000000000000..9f3088236274 --- /dev/null +++ b/docs/docs/build/_category_.json @@ -0,0 +1,5 @@ +{ + "label": "Build", + "position": 0, + "link": null +} \ No newline at end of file diff --git a/docs/docs/build/build.md b/docs/docs/build/build.md new file mode 100644 index 000000000000..3b86eb472b52 --- /dev/null +++ b/docs/docs/build/build.md @@ -0,0 +1,13 @@ +--- +sidebar_position: 0 +--- + +# Build + +* [Building Apps](./building-apps/00-app-go.md) - The documentation in this section will guide you through the process of developing your dApp using the Cosmos SDK framework. +* [Modules](./modules/README.md) - Information about the various modules available in the Cosmos SDK: Auth, Authz, Bank, Crisis, Distribution, Evidence, Feegrant, Governance, Mint, Params, Slashing, Staking, Upgrade, NFT, Consensus, Circuit, Genutil. +* [Migrations](./migrations/01-intro.md) - See what has been updated in each release the process of the transition between versions. +* [Packages](./packages/README.md) - Explore a curated collection of pre-built modules and functionalities, streamlining the development process. +* [Tooling](./tooling/README.md) - A suite of utilities designed to enhance the development workflow, optimizing the efficiency of Cosmos SDK-based projects. +* [ADR's](./architecture/README.md) - Provides a structured repository of key decisions made during the development process, which have been documented and offers rationale behind key decisions being made. +* [REST API](https://docs.cosmos.network/api) - A comprehensive reference for the application programming interfaces (APIs) provided by the SDK. From 9efec4293d3c60fefeabfacf7bdb752d2eddea12 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:35:38 +0200 Subject: [PATCH 4/5] fix(x/tx): sort with oneof field name in amino-json (backport #21782) (#22228) Co-authored-by: Luis Carvalho Co-authored-by: Julien Robert --- x/tx/CHANGELOG.md | 4 ++ x/tx/signing/aminojson/json_marshal.go | 51 ++++++++++++++++++-------- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/x/tx/CHANGELOG.md b/x/tx/CHANGELOG.md index 058b9b7d99a2..e156b67370fd 100644 --- a/x/tx/CHANGELOG.md +++ b/x/tx/CHANGELOG.md @@ -33,6 +33,10 @@ Since v0.13.0, x/tx follows Cosmos SDK semver: https://github.com/cosmos/cosmos- ## [Unreleased] +### Bug Fixes + +* [#21782](https://github.com/cosmos/cosmos-sdk/pull/21782) Fix JSON attribute sort order on messages with oneof fields. + ## [v0.13.5](https://github.com/cosmos/cosmos-sdk/releases/tag/x/tx/v0.13.5) - 2024-09-18 ### Improvements diff --git a/x/tx/signing/aminojson/json_marshal.go b/x/tx/signing/aminojson/json_marshal.go index 52defcca6357..f53e351b6ea6 100644 --- a/x/tx/signing/aminojson/json_marshal.go +++ b/x/tx/signing/aminojson/json_marshal.go @@ -268,8 +268,11 @@ func (enc Encoder) marshal(value protoreflect.Value, fd protoreflect.FieldDescri } type nameAndIndex struct { - i int - name string + i int + name string + oneof protoreflect.OneofDescriptor + oneofFieldName string + oneofTypeName string } func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) error { @@ -300,14 +303,37 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er indices := make([]*nameAndIndex, 0, fields.Len()) for i := 0; i < fields.Len(); i++ { f := fields.Get(i) - name := getAminoFieldName(f) - indices = append(indices, &nameAndIndex{i: i, name: name}) + entry := &nameAndIndex{ + i: i, + name: getAminoFieldName(f), + oneof: f.ContainingOneof(), + } + + if entry.oneof != nil { + var err error + entry.oneofFieldName, entry.oneofTypeName, err = getOneOfNames(f) + if err != nil { + return err + } + } + + indices = append(indices, entry) } if shouldSortFields := !enc.doNotSortFields; shouldSortFields { sort.Slice(indices, func(i, j int) bool { ni, nj := indices[i], indices[j] - return ni.name < nj.name + niName, njName := ni.name, nj.name + + if indices[i].oneof != nil { + niName = indices[i].oneofFieldName + } + + if indices[j].oneof != nil { + njName = indices[j].oneofFieldName + } + + return niName < njName }) } @@ -316,22 +342,17 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er name := ni.name f := fields.Get(i) v := msg.Get(f) - oneof := f.ContainingOneof() - isOneOf := oneof != nil - oneofFieldName, oneofTypeName, err := getOneOfNames(f) - if err != nil && isOneOf { - return err - } + isOneOf := ni.oneof != nil writeNil := false if !msg.Has(f) { // msg.WhichOneof(oneof) == nil: no field of the oneof has been set // !emptyOneOfWritten: we haven't written a null for this oneof yet (only write one null per empty oneof) switch { - case isOneOf && msg.WhichOneof(oneof) == nil && !emptyOneOfWritten[oneofFieldName]: - name = oneofFieldName + case isOneOf && msg.WhichOneof(ni.oneof) == nil && !emptyOneOfWritten[ni.oneofFieldName]: + name = ni.oneofFieldName writeNil = true - emptyOneOfWritten[oneofFieldName] = true + emptyOneOfWritten[ni.oneofFieldName] = true case omitEmpty(f): continue case f.Kind() == protoreflect.MessageKind && @@ -349,7 +370,7 @@ func (enc Encoder) marshalMessage(msg protoreflect.Message, writer io.Writer) er } if isOneOf && !writeNil { - _, err = fmt.Fprintf(writer, `"%s":{"type":"%s","value":{`, oneofFieldName, oneofTypeName) + _, err = fmt.Fprintf(writer, `"%s":{"type":"%s","value":{`, ni.oneofFieldName, ni.oneofTypeName) if err != nil { return err } From 751e5ecbb2c7d838d819bbddd35db526c9b25329 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:04:02 +0200 Subject: [PATCH 5/5] chore(x/group): update supported flags (backport #22229) (#22231) Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + x/group/client/cli/tx.go | 2 +- x/group/client/cli/util.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe790e81ef1a..77d7334be531 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (sims) [21906](https://github.com/cosmos/cosmos-sdk/pull/21906) Skip sims test when running dry on validators * (cli) [#21919](https://github.com/cosmos/cosmos-sdk/pull/21919) Query address-by-acc-num by account_id instead of id. +* (x/group) [#22229](https://github.com/cosmos/cosmos-sdk/pull/22229) Accept `1` and `try` in CLI for group proposal exec. ## [v0.50.10](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.50.10) - 2024-09-20 diff --git a/x/group/client/cli/tx.go b/x/group/client/cli/tx.go index 2eece5690afe..59c71073f678 100644 --- a/x/group/client/cli/tx.go +++ b/x/group/client/cli/tx.go @@ -651,7 +651,7 @@ metadata example: }, } - cmd.Flags().String(FlagExec, "", "Set to 1 to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)") + cmd.Flags().String(FlagExec, "", "Set to 1 or 'try' to try to execute proposal immediately after creation (proposers signatures are considered as Yes votes)") flags.AddTxFlagsToCmd(cmd) return cmd diff --git a/x/group/client/cli/util.go b/x/group/client/cli/util.go index 65ad49425a54..2d91167adbbe 100644 --- a/x/group/client/cli/util.go +++ b/x/group/client/cli/util.go @@ -53,7 +53,7 @@ func parseMembers(membersFile string) ([]group.MemberRequest, error) { func execFromString(execStr string) group.Exec { exec := group.Exec_EXEC_UNSPECIFIED - if execStr == ExecTry { + if execStr == ExecTry || execStr == "1" { exec = group.Exec_EXEC_TRY }