diff --git a/packages/evm/src/opcodes/gas.ts b/packages/evm/src/opcodes/gas.ts index 0100d38bf0..ade64847b8 100644 --- a/packages/evm/src/opcodes/gas.ts +++ b/packages/evm/src/opcodes/gas.ts @@ -261,7 +261,7 @@ export const dynamicGasHandlers: Map { } return expandedValues } - -export function decodeLeafBasicData(encodedBasicData: Uint8Array): VerkleLeafBasicData { - const versionBytes = encodedBasicData.slice(0, VERSION_BYTES_LENGTH) - const nonceBytes = encodedBasicData.slice(NONCE_OFFSET, NONCE_OFFSET + NONCE_BYTES_LENGTH) - const codeSizeBytes = encodedBasicData.slice( - CODE_SIZE_OFFSET, - CODE_SIZE_OFFSET + CODE_SIZE_BYTES_LENGTH - ) - const balanceBytes = encodedBasicData.slice(BALANCE_OFFSET, BALANCE_OFFSET + BALANCE_BYTES_LENGTH) - - const version = bytesToInt32(versionBytes, true) - const nonce = bytesToBigInt(nonceBytes, true) - const codeSize = bytesToInt32(codeSizeBytes, true) - const balance = bytesToBigInt(balanceBytes, true) - - return { version, nonce, codeSize, balance } -} - -export function encodeLeafBasicData(basicData: VerkleLeafBasicData): Uint8Array { - const encodedVersion = setLengthRight(int32ToBytes(basicData.version, true), VERSION_BYTES_LENGTH) - const encodedNonce = setLengthRight(bigIntToBytes(basicData.nonce, true), NONCE_BYTES_LENGTH) - const encodedCodeSize = setLengthRight( - int32ToBytes(basicData.codeSize, true), - CODE_SIZE_BYTES_LENGTH - ) - const encodedBalance = setLengthRight( - bigIntToBytes(basicData.balance, true), - BALANCE_BYTES_LENGTH - ) - return concatBytes(encodedVersion, encodedNonce, encodedCodeSize, encodedBalance) -}