Skip to content

Commit

Permalink
Merge pull request #243 from MANTRA-Chain/update-to-latest
Browse files Browse the repository at this point in the history
chore: Bring Mantra-sdk up to date with upstream
  • Loading branch information
mantrachain-support authored Nov 5, 2024
2 parents 413f775 + 072b0ca commit 47fdce5
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 21 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -850,3 +850,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"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions client/keys/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Otherwise, we try to deserialize it using Amino into LegacyInfo. If this attempt
LegacyInfo to Protobuf serialization format and overwrite the keyring entry. If any error occurred, it will be
outputted in CLI and migration will be continued until all keys in the keyring DB are exhausted.
See https://github.com/cosmos/cosmos-sdk/pull/9695 for more details.
It is recommended to run in 'dry-run' mode first to verify all key migration material.
`,
Args: cobra.NoArgs,
RunE: runMigrateCmd,
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/build/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"label": "Build",
"position": 0,
"link": null
}
13 changes: 13 additions & 0 deletions docs/docs/build/build.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion x/genutil/client/cli/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion x/group/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/group/client/cli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 4 additions & 0 deletions x/tx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 36 additions & 15 deletions x/tx/signing/aminojson/json_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
})
}

Expand All @@ -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 &&
Expand All @@ -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
}
Expand Down

0 comments on commit 47fdce5

Please sign in to comment.