From b7471fbd3c7d31947a53bd886325ddf9da117188 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Thu, 2 Jan 2025 17:12:08 +0800 Subject: [PATCH] fix(x/auth/tx): avoid panic from intoAnyV2 when v1.PublicKey is optional --- CHANGELOG.md | 1 + x/auth/tx/builder.go | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86e8a2054b2b..d0d2894b104f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i ### 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 diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go index 2b1c866e8e0a..17b23f8b645b 100644 --- a/x/auth/tx/builder.go +++ b/x/auth/tx/builder.go @@ -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 }