Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm,vm: remove the hacks to prevent account cleanups of system contracts #3418

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/evm/src/journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Hardfork } from '@ethereumjs/common'
import {
Address,
RIPEMD160_ADDRESS_STRING,
bigIntToHex,
bytesToHex,
bytesToUnprefixedHex,
stripHexPrefix,
Expand Down Expand Up @@ -198,13 +197,6 @@ export class Journal {
const address = new Address(hexToBytes(`0x${addressHex}`))
const account = await this.stateManager.getAccount(address)
if (account === undefined || account.isEmpty()) {
if (this.common.isActivatedEIP(2935)) {
// The history storage address is exempt of state clearing by EIP-158 if the EIP is activated
const addr = bigIntToHex(this.common.param('vm', 'historyStorageAddress')).slice(2)
if (addressHex === addr) {
continue
}
}
await this.deleteAccount(address)
if (this.DEBUG) {
this._debug(`Cleanup touched account address=${address} (>= SpuriousDragon)`)
Expand Down
6 changes: 6 additions & 0 deletions packages/vm/src/runBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ export async function accumulateParentBlockHash(
}
// eslint-disable-next-line no-empty
} catch (_e) {}

// do cleanup if the code was not deployed
await this.evm.journal.cleanup()
}

export async function accumulateParentBeaconBlockRoot(
Expand Down Expand Up @@ -566,6 +569,9 @@ export async function accumulateParentBeaconBlockRoot(
setLengthLeft(bigIntToBytes(timestampExtended), 32),
root
)

// do cleanup if the code was not deployed
await this.evm.journal.cleanup()
}

/**
Expand Down
Loading