Skip to content

Commit

Permalink
evm: updat eeof header validation for "initcode" containers
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Jul 4, 2024
1 parent 057272c commit 1e97ba1
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions packages/evm/test/eips/eof-header-validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import * as dir from 'node-dir'
import path from 'path'
import { assert, describe, it } from 'vitest'

import { validateEOF } from '../../src/eof/container.js'
import { EOFContainerMode, validateEOF } from '../../src/eof/container.js'
import { ContainerSectionType } from '../../src/eof/verify.js'
import { EVM } from '../../src/index.js'

import { getCommon } from './eof-utils.js'

const testDir = path.resolve('./test/eips/eoftests')
const testDir = path.resolve('../ethereum-tests/eof/fixtures/eof_tests')

Check failure on line 12 in packages/evm/test/eips/eof-header-validation.spec.ts

View workflow job for this annotation

GitHub Actions / test-all-browser (20)

test/eips/eof-header-validation.spec.ts

TypeError: process.cwd is not a function ❯ test/eips/eof-header-validation.spec.ts:12:21

async function getEVM() {
const common = getCommon()
Expand Down Expand Up @@ -51,12 +52,24 @@ await new Promise<void>((resolve, reject) => {
const expected = test.results.Prague.result
const _exception = test.results.Prague.exception

let containerSectionType = ContainerSectionType.RuntimeCode
let eofContainerMode = EOFContainerMode.Default

if (test.containerKind !== undefined) {
if (test.containerKind === 'INITCODE') {
containerSectionType = ContainerSectionType.InitCode
eofContainerMode = EOFContainerMode.Initmode
} else {
throw new Error('unknown container kind: ' + test.containerKind)
}
}

if (expected === true) {
validateEOF(code, evm)
validateEOF(code, evm, containerSectionType, eofContainerMode)
} else {
assert.throws(() => {
// TODO verify that the correct error is thrown
validateEOF(code, evm)
validateEOF(code, evm, containerSectionType, eofContainerMode)
})
}
}
Expand Down

0 comments on commit 1e97ba1

Please sign in to comment.