Skip to content

Commit

Permalink
fix(x/auth/tx): avoid panic from intoAnyV2 when v1.PublicKey is optio…
Browse files Browse the repository at this point in the history
…nal (#23148)

(cherry picked from commit 07d5168)

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
mmsqe authored and mergify[bot] committed Jan 6, 2025
1 parent 84301c8 commit af8d3a3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ Ref: https://keepachangelog.com/en/1.0.0/

Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.

<<<<<<< HEAD
=======
### Features

* (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages.
* (client/keys) [#21829](https://github.com/cosmos/cosmos-sdk/pull/21829) Add support for importing hex key using standard input.
* (x/auth/ante) [#23128](https://github.com/cosmos/cosmos-sdk/pull/23128) Allow custom verifyIsOnCurve when validate tx for public key like ethsecp256k1.

### Improvements

### Bug Fixes

* (query) [23002](https://github.com/cosmos/cosmos-sdk/pull/23002) Fix collection filtered pagination.
* (x/auth/tx) [#23148](https://github.com/cosmos/cosmos-sdk/pull/23148) Avoid panic from intoAnyV2 when v1.PublicKey is optional.

### API Breaking Changes

* (x/params) [#22995](https://github.com/cosmos/cosmos-sdk/pull/22995) Remove `x/params`. Migrate to the new params system introduced in `v0.47` as demonstrated [here](https://github.com/cosmos/cosmos-sdk/blob/main/UPGRADING.md#xparams).
* (testutil) [#22392](https://github.com/cosmos/cosmos-sdk/pull/22392) Remove `testutil/network` package. Use the integration framework or systemtests framework instead.

### Deprecated

* (modules) [#22994](https://github.com/cosmos/cosmos-sdk/pull/22994) Deprecate `Invariants` and associated methods.

>>>>>>> 07d5168d2 (fix(x/auth/tx): avoid panic from intoAnyV2 when v1.PublicKey is optional (#23148))
## [v0.52.0-rc.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.52.0-rc.1) - 2024-12-18

Every module contains its own CHANGELOG.md. Please refer to the module you are interested in.
Expand Down
8 changes: 5 additions & 3 deletions x/auth/tx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ func intoV2SignerInfo(v1s []*tx.SignerInfo) []*txv1beta1.SignerInfo {
modeInfoV2 := new(txv1beta1.ModeInfo)
intoV2ModeInfo(v1.ModeInfo, modeInfoV2)
v2 := &txv1beta1.SignerInfo{
PublicKey: intoAnyV2([]*codectypes.Any{v1.PublicKey})[0],
ModeInfo: modeInfoV2,
Sequence: v1.Sequence,
ModeInfo: modeInfoV2,
Sequence: v1.Sequence,
}
if v1.PublicKey != nil {
v2.PublicKey = intoAnyV2([]*codectypes.Any{v1.PublicKey})[0]
}
v2s[i] = v2
}
Expand Down
15 changes: 15 additions & 0 deletions x/auth/tx/builder_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tx

import (
"testing"

any "github.com/cosmos/gogoproto/types/any"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/types/tx"
)

func TestIntoV2SignerInfo(t *testing.T) {
require.NotNil(t, intoV2SignerInfo([]*tx.SignerInfo{{}}))
require.NotNil(t, intoV2SignerInfo([]*tx.SignerInfo{{PublicKey: &any.Any{}}}))
}

0 comments on commit af8d3a3

Please sign in to comment.