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

[Bug]: newBuilderFromDecodedTx looses TimeoutTimestamp when wraps a transaction #23491

Closed
1 task done
pakuula opened this issue Jan 23, 2025 · 0 comments · Fixed by #23492
Closed
1 task done

[Bug]: newBuilderFromDecodedTx looses TimeoutTimestamp when wraps a transaction #23491

pakuula opened this issue Jan 23, 2025 · 0 comments · Fixed by #23492
Labels

Comments

@pakuula
Copy link

pakuula commented Jan 23, 2025

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Here is a bash script that generates and unordered transaction and signs it offline. The signed transaction gets 0 timeout_timestamp field.

To reproduce:

  • install jq tool
  • make sure that simd is in the path.
which jq >/dev/null || { echo "jq is required but not installed. Exiting." && exit 1; }
which simd > /dev/null || { echo "simd not in PATH. Exiting." && exit 1; }

rm -rf zzz
SIMD="simd --home zzz"

$SIMD config set client keyring-backend "test" --skip-validate 

$SIMD keys add test --no-backup > /dev/null
address=$($SIMD keys show test -a)

$SIMD tx bank send $address $address 123stake --unordered --timeout-timestamp $(date +%s) --chain-id test --generate-only | tee unsigned.json | jq .body.timeout_timestamp
$SIMD tx sign unsigned.json --from $address --offline -a 0 -s 0 --chain-id test | jq .body.timeout_timestamp

Output:

"2025-01-23T21:57:22Z"
"0001-01-01T00:00:00Z"

The first line is the timeout_timestamp field from the unsigned transaction.
The second line is the timeout_timestamp field from the signed transaction.

The reason: cosmos-sdk/x/auth/tx/builder.go, function newBuilderFromDecodedTx
When it creates a new tx builder, it doesn't copy TimestampTimeOut field from the decoded tx:

timeoutHeight: decoded.GetTimeoutHeight(),

Patch:

diff --git a/x/auth/tx/builder.go b/x/auth/tx/builder.go
index d8dcc5edb3..e67fb21b9b 100644
--- a/x/auth/tx/builder.go
+++ b/x/auth/tx/builder.go
@@ -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(),

Cosmos SDK Version

0.52.x

How to reproduce?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

1 participant