fix(evm): skip redundant setUserToken write and event when token unchanged#3272
Merged
Conversation
0xrusowsky
approved these changes
Mar 23, 2026
Contributor
📊 Tempo Precompiles Coverage |
legion2002
approved these changes
Mar 26, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 14, 2026
T3 Meta TIP Collects the T3-gated bug fixes and gas correctness changes identified so far: - Skip redundant `setUserToken` write/event ([#3272](#3272)) - Account creation gas deduction and nonce bump ([#3207](#3207)) - Gas deduction before cold storage/account loads ([#2974](#2974)) - TIP-20: verify paused state before mint/burn ([#3411](#3411)) - Disambiguate optional AA expiry and validity timestamps ([#3500](#3500), [#3501](#3501)) - StablecoinDEX: check token paused in internal balance swaps ([#3204](#3204)) - TIP-20: propagate OOG from `is_initialized` instead of masking as uninitialized ([#3535](#3535)) - StablecoinDEX: fail early on order placement for paused tokens ([#3560](#3560)) Cross-references TIP-1025 (implicit approval for StablecoinDEX) as a standalone T3-gated TIP. --------- Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Co-authored-by: Jennifer <jenpaff0@gmail.com> Co-authored-by: Tanishk Goyal <goyaltanishk02@gmail.com> Co-authored-by: Jennifer <5339211+jenpaff@users.noreply.github.com>
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.
Closes QED-41
setUserToken()unconditionally writes to storage and emitsUserTokenSeteven when the token hasn't changed. Since the event triggers a full O(pool_size) txpool scan viaevict_invalidated_transactions, any account can force network-wide CPU work each block by repeatedly callingsetUserTokenwith the same value.T3+ adds a read-before-write guard that returns early when the stored token already matches, eliminating the redundant write, event, and pool scan.