diff --git a/x/auth/tx/builder_test.go b/x/auth/tx/builder_test.go index 2fb88905beb2..d64d920c880c 100644 --- a/x/auth/tx/builder_test.go +++ b/x/auth/tx/builder_test.go @@ -2,21 +2,25 @@ package tx import ( "testing" + "time" "github.com/stretchr/testify/require" errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/testutil" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + testutil2 "github.com/cosmos/cosmos-sdk/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" txtypes "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" ) func TestTxBuilder(t *testing.T) { @@ -333,3 +337,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 := testutil.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()) +}