[5/n][guardian-integration] unify Step 2 / Step 3 withdrawal timestamp#485
Closed
0xsiddharthks wants to merge 0 commit intosiddharth/guardian-integrationfrom
Closed
[5/n][guardian-integration] unify Step 2 / Step 3 withdrawal timestamp#4850xsiddharthks wants to merge 0 commit intosiddharth/guardian-integrationfrom
0xsiddharthks wants to merge 0 commit intosiddharth/guardian-integrationfrom
Conversation
bmwill
reviewed
Apr 23, 2026
Comment on lines
+118
to
+122
| // Sui checkpoint timestamp (ms) observed by the leader when building | ||
| // the commitment. Stored verbatim on the on-chain | ||
| // `WithdrawalTransaction.timestamp_ms` so Step 2 pre-check and Step 3 | ||
| // guardian hard reserve read the same value. | ||
| uint64 timestamp_ms = 5; |
Contributor
There was a problem hiding this comment.
We should avoid any timestamps that can be manipulated and are set other than by reading the onchain clock.
31d2f5e to
e02a373
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step 2 (commitment pre-check) and Step 3 (guardian hard reserve) used different timestamps — Step 2 read the leader's
checkpoint_timestamp_ms, while Step 3 read the on-chainWithdrawalTransaction.timestamp_msset by Move'sclock.timestamp_ms(). They could drift by seconds, and Step 2 could pass while Step 3 failed after the user's balance was already burned. This PR unifies them.WithdrawalTxCommitmentgainstimestamp_ms: u64; the leader fills it with its checkpoint timestamp when building the commitment. Step 2'scapacity_atnow readsapproval.timestamp_ms / 1000— same source as Step 3.SignWithdrawalTxConstructionRequest.timestamp_msadded.validate_withdrawal_tx_commitmentrejects the commitment before BLS-signing if the leader's timestamp differs from this node's latest checkpoint by more than 5 minutes — catches both far-future (capacity theft) and far-past (stuck-forever DoS) values.WithdrawalCommitmentMessagecarriestimestamp_ms;commit_withdrawal_txtakes it as a parameter and includes it in the BLS-verified message.new_withdrawal_txndropsclock: &Clockin favour oftimestamp_ms: u64, so the on-chain value is exactly what the committee signed.Test
cargo nextest run -p hashi-types -p hashi-guardian -p hashi— 327/327.sui move testinpackages/hashi— 74/74.make fmt && make clippy— clean.