Skip to content

Commit

Permalink
vm: ensure system address is not created if it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed May 4, 2024
1 parent 6357645 commit f427ca0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vm/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const accumulateEIP7002Requests = async (vm: VM, requests: CLRequest[]): Promise
)
const systemAddress = Address.fromString(bytesToHex(systemAddressBytes))

const addrIsEmpty = (await vm.stateManager.getAccount(systemAddress)) === undefined

const results = await vm.evm.runCall({
caller: systemAddress,
gasLimit: BigInt(1_000_000),
Expand All @@ -92,6 +94,10 @@ const accumulateEIP7002Requests = async (vm: VM, requests: CLRequest[]): Promise
requests.push(request)
}
}

if (addrIsEmpty) {
await vm.stateManager.deleteAccount(systemAddress)
}
}

const accumulateDeposits = async (
Expand Down

0 comments on commit f427ca0

Please sign in to comment.