Skip to content

Commit

Permalink
fix(x/auth/tx): add missing timeoutTimestamp in newBuilderFromDecoded…
Browse files Browse the repository at this point in the history
…Tx (#23492)
  • Loading branch information
mmsqe authored Jan 24, 2025
1 parent 8493d4f commit 494389d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i

### Bug Fixes

* (x/auth/tx) [#23492](https://github.com/cosmos/cosmos-sdk/pull/23492) Add missing timeoutTimestamp in newBuilderFromDecodedTx.

### 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).
Expand Down
1 change: 1 addition & 0 deletions x/auth/tx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func newBuilderFromDecodedTx(
codec: codec,
msgs: decoded.Messages,
timeoutHeight: decoded.GetTimeoutHeight(),
timeoutTimestamp: decoded.GetTimeoutTimeStamp(),
granter: decoded.FeeGranter(),
payer: payer,
unordered: decoded.GetUnordered(),
Expand Down
22 changes: 22 additions & 0 deletions x/auth/tx/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,32 @@ import (
any "github.com/cosmos/gogoproto/types/any"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/client"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/types/tx"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
)

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

func TestBuilderWithTimeoutTimestamp(t *testing.T) {
cdc := codectestutil.CodecOptions{}.NewCodec()
interfaceRegistry := cdc.InterfaceRegistry()
signingCtx := interfaceRegistry.SigningContext()
txConfig := NewTxConfig(cdc, signingCtx.AddressCodec(), signingCtx.ValidatorAddressCodec(), DefaultSignModes)
txBuilder := txConfig.NewTxBuilder()
encodedTx, err := txConfig.TxJSONEncoder()(txBuilder.GetTx())
require.NoError(t, err)
file := testutil.WriteToNewTempFile(t, string(encodedTx))
clientCtx := client.Context{InterfaceRegistry: interfaceRegistry, TxConfig: txConfig}
decodedTx, err := authclient.ReadTxFromFile(clientCtx, file.Name())
require.NoError(t, err)
txBldr, err := txConfig.WrapTxBuilder(decodedTx)
require.NoError(t, err)
b := txBldr.(*builder)
require.False(t, b.timeoutTimestamp.IsZero())
}

0 comments on commit 494389d

Please sign in to comment.