@tokamak-zk-evm/synthesizer
Version:
Tokamak zk-EVM Synthesizer - Processes Ethereum transactions into wire maps for Tokamak zk-SNARK proof generation
17 lines (13 loc) • 510 B
text/typescript
import { keccak256 } from 'ethereum-cryptography/keccak.js'
import { equalsBytes } from 'ethereum-cryptography/utils'
import { FORMAT, MAGIC } from './constants.js'
export const EOFBYTES = new Uint8Array([FORMAT, MAGIC])
export const EOFHASH = keccak256(EOFBYTES)
/**
* Returns `true` if `code` is an EOF contract, otherwise `false`
* @param code Code to test
*/
export function isEOF(code: Uint8Array): boolean {
const check = code.subarray(0, EOFBYTES.length)
return equalsBytes(EOFBYTES, check)
}