Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kaushik/add missing timeout stamp #24103

Draft
wants to merge 4 commits into
base: release/v0.53.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (x/auth/tx) [#23492](https://github.com/cosmos/cosmos-sdk/pull/23492) Add missing timeoutTimestamp in newBuilderFromDecodedTx.
* (baseapp) [#24042](https://github.com/cosmos/cosmos-sdk/pull/24042) Fixed a data race inside BaseApp.getContext, found by end-to-end (e2e) tests.
* (client/server) [#24059](https://github.com/cosmos/cosmos-sdk/pull/24059) Consistently set viper prefix in client and server. It defaults for the binary name for both client and server.
* (client/keys) [#24041](https://github.com/cosmos/cosmos-sdk/pull/24041) `keys delete` won't terminate when a key is not found, but will log the error.
Expand Down
24 changes: 24 additions & 0 deletions x/auth/tx/builder_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package tx

import (
"github.com/cosmos/cosmos-sdk/client"
testutil2 "github.com/cosmos/cosmos-sdk/testutil"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
"testing"
"time"

"github.com/stretchr/testify/require"

Expand All @@ -11,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/testutil"
codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -333,3 +338,22 @@ func TestBuilderFeeGranter(t *testing.T) {
txBuilder.SetFeeGranter(addr1)
require.Equal(t, addr1.String(), sdk.AccAddress(txBuilder.GetTx().FeeGranter()).String())
}

func TestBuilderWithTimeoutTimestamp(t *testing.T) {
cdc := codectestutil.CodecOptions{}.NewCodec()
interfaceRegistry := cdc.InterfaceRegistry()
interfaceRegistry.SigningContext()
txConfig := NewTxConfig(cdc, DefaultSignModes)
txBuilder := txConfig.NewTxBuilder()
txBuilder.SetTimeoutTimestamp(time.Unix(1, 0))
encodedTx, err := txConfig.TxJSONEncoder()(txBuilder.GetTx())
require.NoError(t, err)
file := testutil2.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.(*wrapper)
require.False(t, b.tx.Body.TimeoutTimestamp.IsZero())
}
Loading