Skip to content

fix(evm): skip redundant setUserToken write and event when token unchanged#3272

Merged
fgimenez merged 1 commit into
mainfrom
fgimenez/qed-41
Mar 26, 2026
Merged

fix(evm): skip redundant setUserToken write and event when token unchanged#3272
fgimenez merged 1 commit into
mainfrom
fgimenez/qed-41

Conversation

@fgimenez
Copy link
Copy Markdown
Contributor

Closes QED-41

setUserToken() unconditionally writes to storage and emits UserTokenSet even when the token hasn't changed. Since the event triggers a full O(pool_size) txpool scan via evict_invalidated_transactions, any account can force network-wide CPU work each block by repeatedly calling setUserToken with 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.

@github-actions
Copy link
Copy Markdown
Contributor

📊 Tempo Precompiles Coverage

📦 Download full HTML report

@fgimenez fgimenez added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 2985dfa Mar 26, 2026
38 checks passed
@fgimenez fgimenez deleted the fgimenez/qed-41 branch March 26, 2026 16:07
@jenpaff jenpaff added T3 and removed T3-CHAIN-old labels Mar 31, 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-evm Related to the EVM T3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants