From 07aa3acd288afca4f2c290d87bafca7b4e4b344a Mon Sep 17 00:00:00 2001 From: Jame <71260863+ZWJKFLC@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:18:11 +0800 Subject: [PATCH] Update EIPS/eip-7637.md Fix code logic Co-authored-by: g11tech --- EIPS/eip-7637.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-7637.md b/EIPS/eip-7637.md index ae9f8abe123ea6..8bc356b8e06853 100644 --- a/EIPS/eip-7637.md +++ b/EIPS/eip-7637.md @@ -63,9 +63,12 @@ def extcodehash(evm: Evm) -> None: address = to_address(pop(evm.stack)) charge_gas(evm, GAS_CODE_HASH) account = get_account(evm.env.state, address) - codehash = U256.from_be_bytes(keccak256(account.code)) - if codehash == U256(hexstr="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"): + if account == EMPTY_ACCOUNT: codehash = U256(0) + else: + codehash = U256.from_be_bytes(keccak256(account.code)) + if codehash == U256(hexstr="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"): + codehash = U256(0) push(evm.stack, codehash) evm.pc += 1 ```