Skip to content

Optimization: CreateAccount only clears state if code hash exists#2255

Merged
stevenlanders merged 5 commits intomainfrom
optimize-clear-account-state
Jul 24, 2025
Merged

Optimization: CreateAccount only clears state if code hash exists#2255
stevenlanders merged 5 commits intomainfrom
optimize-clear-account-state

Conversation

@stevenlanders
Copy link
Copy Markdown
Contributor

Describe your changes and provide context

  • when an account is created by evm, it needs to clear out any existing contract state
  • clearing / deleting is expensive, so it makes sense to try to early-bail if possible
  • the new logic only clears if the code hash key is set

Testing performed to validate your change

  • perf analysis on pacific-1 rpc node
  • fixed unit tests that were not setting code

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.09%. Comparing base (b16814c) to head (30bd1de).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2255      +/-   ##
==========================================
- Coverage   60.12%   60.09%   -0.04%     
==========================================
  Files         309      309              
  Lines       29995    30029      +34     
==========================================
+ Hits        18035    18045      +10     
- Misses      10685    10707      +22     
- Partials     1275     1277       +2     
Files with missing lines Coverage Δ
x/evm/state/state.go 97.91% <100.00%> (+2.17%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stevenlanders stevenlanders changed the title On CreateAccount, only clear state if code hash key exists Optimization: CreateAccount only clears state if code hash key exists Jul 23, 2025
@stevenlanders stevenlanders changed the title Optimization: CreateAccount only clears state if code hash key exists Optimization: CreateAccount only clears state if code hash exists Jul 23, 2025
@philipsu522 philipsu522 requested a review from codchen July 23, 2025 19:07
@stevenlanders stevenlanders enabled auto-merge (squash) July 24, 2025 15:24
@stevenlanders stevenlanders merged commit 93c867b into main Jul 24, 2025
68 of 70 checks passed
@stevenlanders stevenlanders deleted the optimize-clear-account-state branch July 24, 2025 15:35
yzang2019 added a commit that referenced this pull request Jul 24, 2025
* main:
  Optimization: CreateAccount only clears state if code hash exists (#2255)
  chore: bump btcec to v2.3.2, x/crypto to v0.31.0 (#2238)
  Use legacy transaction decoder for historical height (#2234)
  Make flushing receipt synchronous (#2250)
  [SEI-9824][SEI-9825] Update oracle MidBlock logic (#2251)
  Fix data race in price-feeder websocket controller (#2256)
  Add tests for price feeder providers (#2253)
  remove arm64 target from CI due to slow running (#2254)
  Harden solo precompile (#2236)
  Add CODEOWNERS (#2237)
  Require MsgClaim sender to match signer (#2232)
  Remove writeset estimation to alleviate AccAddress mutex contention (#2239)
philipsu522 pushed a commit that referenced this pull request Aug 11, 2025
)

* only clear state if code size key exists

* use hash instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants