fix: Verify DAO lock size before tx-pool script execution#5236
Open
Officeyutong wants to merge 2 commits into
Open
fix: Verify DAO lock size before tx-pool script execution#5236Officeyutong wants to merge 2 commits into
Officeyutong wants to merge 2 commits into
Conversation
eval-exec
reviewed
Jun 10, 2026
Comment on lines
+124
to
+139
| let verifier = ContextualTransactionVerifier::new( | ||
| Arc::clone(&rtx), | ||
| consensus, | ||
| data_loader, | ||
| tx_env, | ||
| ); | ||
| verifier | ||
| .verify(max_tx_verify_cycles, true) | ||
| .and_then(|_| { | ||
| DaoScriptSizeVerifier::new( | ||
| rtx, | ||
| Arc::clone(&rtx), | ||
| snapshot.cloned_consensus(), | ||
| snapshot.as_data_loader(), | ||
| ) | ||
| .verify()?; | ||
| Ok(result) | ||
| verifier.verify(max_tx_verify_cycles, false) |
Collaborator
There was a problem hiding this comment.
We don't realy need to make these changes?
Collaborator
|
I think the ideal shape would be move DaoScriptSizeVerifier into ContextualTransactionVerifier , What do you think? @zhangsoledad |
3124892 to
7f01972
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.
What problem does this PR solve?
Queued tx-pool verification could execute transaction scripts before running
DaoScriptSizeVerifier. For remote transactions, the script execution limit comes from the peer-declared cycle count, bounded bymax_block_cycles. This allowed a peer to relay a resolved DAO transaction with a lock-size mismatch and an otherwise expensive script, causing the verify worker to spend cycles before the transaction was rejected by the DAO lock-size rule.What is changed and how it works?
Run the cheap contextual checks without script execution first, then run
DaoScriptSizeVerifier, and only execute scripts after the DAO lock-size rule passes. This keeps the existing verification behavior while rejecting malformed DAO withdrawal transactions before they can consume script verification cycles.Related changes
owner/repo:Check List
Tests
Side effects