diff --git a/packages/evm/src/opcodes/gas.ts b/packages/evm/src/opcodes/gas.ts index d3a6b1f785..0ed6688aea 100644 --- a/packages/evm/src/opcodes/gas.ts +++ b/packages/evm/src/opcodes/gas.ts @@ -12,7 +12,7 @@ import { } from '@ethereumjs/util' import { BALANCE_LEAF_KEY, - CODE_KECCAK_LEAF_KEY, + CODE_HASH_LEAF_KEY, CODE_SIZE_LEAF_KEY, VERSION_LEAF_KEY, getTreeIndexesForStorageSlot, @@ -275,7 +275,7 @@ export const dynamicGasHandlers: Map { const stem = getStem(this.verkleCrypto, address, 0) - const codeHashKey = getKey(stem, LeafType.CodeKeccak) + const codeHashKey = getKey(stem, LeafType.CodeHash) this._storageCache?.clearContractStorage(address) // Update codeHash to `c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470` this._state[bytesToHex(codeHashKey)] = KECCAK256_NULL_S @@ -521,7 +521,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface { const versionKey = getKey(stem, LeafType.Version) const balanceKey = getKey(stem, LeafType.Balance) const nonceKey = getKey(stem, LeafType.Nonce) - const codeHashKey = getKey(stem, LeafType.CodeKeccak) + const codeHashKey = getKey(stem, LeafType.CodeHash) const codeSizeKey = getKey(stem, LeafType.CodeSize) const versionRaw = this._state[bytesToHex(versionKey)] @@ -607,7 +607,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface { const stem = getStem(this.verkleCrypto, address, 0) const balanceKey = getKey(stem, LeafType.Balance) const nonceKey = getKey(stem, LeafType.Nonce) - const codeHashKey = getKey(stem, LeafType.CodeKeccak) + const codeHashKey = getKey(stem, LeafType.CodeHash) const balanceBuf = setLengthRight(bigIntToBytes(account.balance, true), 32) const nonceBuf = setLengthRight(bigIntToBytes(account.nonce, true), 32) diff --git a/packages/statemanager/test/statelessVerkleStateManager.spec.ts b/packages/statemanager/test/statelessVerkleStateManager.spec.ts index 56c09f1216..9642d15a7f 100644 --- a/packages/statemanager/test/statelessVerkleStateManager.spec.ts +++ b/packages/statemanager/test/statelessVerkleStateManager.spec.ts @@ -118,7 +118,7 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => { const balanceKey = getKey(stem, LeafType.Balance) const nonceKey = getKey(stem, LeafType.Nonce) - const codeHashKey = getKey(stem, LeafType.CodeKeccak) + const codeHashKey = getKey(stem, LeafType.CodeHash) const balanceRaw = stateManager['_state'][bytesToHex(balanceKey)] const nonceRaw = stateManager['_state'][bytesToHex(nonceKey)] diff --git a/packages/verkle/src/types.ts b/packages/verkle/src/types.ts index ddc891daa1..81614ae5a0 100644 --- a/packages/verkle/src/types.ts +++ b/packages/verkle/src/types.ts @@ -128,14 +128,14 @@ export enum LeafType { Version = 0, Balance = 1, Nonce = 2, - CodeKeccak = 3, + CodeHash = 3, CodeSize = 4, } export const VERSION_LEAF_KEY = intToBytes(LeafType.Version) export const BALANCE_LEAF_KEY = intToBytes(LeafType.Balance) export const NONCE_LEAF_KEY = intToBytes(LeafType.Nonce) -export const CODE_KECCAK_LEAF_KEY = intToBytes(LeafType.CodeKeccak) +export const CODE_HASH_LEAF_KEY = intToBytes(LeafType.CodeHash) export const CODE_SIZE_LEAF_KEY = intToBytes(LeafType.CodeSize) export const HEADER_STORAGE_OFFSET = 64 diff --git a/packages/verkle/src/util/keys.ts b/packages/verkle/src/util/keys.ts index fcc113ca93..5f2a3adb7f 100644 --- a/packages/verkle/src/util/keys.ts +++ b/packages/verkle/src/util/keys.ts @@ -2,7 +2,7 @@ import { concatBytes, setLengthRight, toBytes } from '@ethereumjs/util' import { BALANCE_LEAF_KEY, - CODE_KECCAK_LEAF_KEY, + CODE_HASH_LEAF_KEY, CODE_OFFSET, CODE_SIZE_LEAF_KEY, HEADER_STORAGE_OFFSET, @@ -34,8 +34,8 @@ export const getKey = (stem: Uint8Array, leaf: LeafType | Uint8Array) => { return concatBytes(stem, BALANCE_LEAF_KEY) case LeafType.Nonce: return concatBytes(stem, NONCE_LEAF_KEY) - case LeafType.CodeKeccak: - return concatBytes(stem, CODE_KECCAK_LEAF_KEY) + case LeafType.CodeHash: + return concatBytes(stem, CODE_HASH_LEAF_KEY) case LeafType.CodeSize: return concatBytes(stem, CODE_SIZE_LEAF_KEY) default: diff --git a/packages/verkle/test/keys.spec.ts b/packages/verkle/test/keys.spec.ts index cd56436733..0f41b1996e 100644 --- a/packages/verkle/test/keys.spec.ts +++ b/packages/verkle/test/keys.spec.ts @@ -10,7 +10,7 @@ describe('should generate valid tree keys', () => { LeafType.Version, LeafType.Balance, LeafType.Nonce, - LeafType.CodeKeccak, + LeafType.CodeHash, LeafType.CodeSize, ]) { const key = getKey(stem, leaf)