@@ -18,8 +18,7 @@ import { assert, describe, it } from 'vitest'
1818
1919import { eip4844Data } from '../../client/test/testdata/geth-genesis/eip4844.js'
2020import { defaultBlock } from '../src/evm.js'
21- import { ERROR } from '../src/exceptions.js'
22- import { createEVM } from '../src/index.js'
21+ import { EVMErrorCode , createEVM } from '../src/index.js'
2322
2423import type { EVMRunCallOpts } from '../src/types.js'
2524
@@ -138,7 +137,7 @@ describe('RunCall tests', () => {
138137
139138 assert . ok (
140139 byzantiumResult . execResult . exceptionError &&
141- byzantiumResult . execResult . exceptionError . error === 'invalid opcode' ,
140+ byzantiumResult . execResult . exceptionError . type . code === 'invalid opcode' ,
142141 'byzantium cannot accept constantinople opcodes (SHL)' ,
143142 )
144143 assert . ok (
@@ -272,7 +271,10 @@ describe('RunCall tests', () => {
272271
273272 assert . equal ( runCallArgs . gasLimit , result . execResult . executionGasUsed , 'gas used correct' )
274273 assert . equal ( result . execResult . gasRefund , BigInt ( 0 ) , 'gas refund correct' )
275- assert . ok ( result . execResult . exceptionError ! . error === ERROR . OUT_OF_GAS , 'call went out of gas' )
274+ assert . ok (
275+ result . execResult . exceptionError ! . type . code === EVMErrorCode . OUT_OF_GAS ,
276+ 'call went out of gas' ,
277+ )
276278 } )
277279
278280 it ( 'ensure selfdestruct pays for creating new accounts' , async ( ) => {
@@ -512,7 +514,7 @@ describe('RunCall tests', () => {
512514
513515 const res2 = await evm . runCall ( { ...runCallArgs , skipBalance : false } )
514516 assert . ok (
515- res2 . execResult . exceptionError ?. error . match ( 'insufficient balance' ) ,
517+ res2 . execResult . exceptionError ?. type . code . match ( 'insufficient balance' ) ,
516518 'runCall reverts when insufficient sender balance and skipBalance is false' ,
517519 )
518520 } )
@@ -536,8 +538,8 @@ describe('RunCall tests', () => {
536538
537539 const result = await evm . runCall ( runCallArgs )
538540 assert . equal (
539- result . execResult . exceptionError ?. error ,
540- ERROR . CODESIZE_EXCEEDS_MAXIMUM ,
541+ result . execResult . exceptionError ?. type . code ,
542+ EVMErrorCode . CODESIZE_EXCEEDS_MAXIMUM ,
541543 'reported error is correct' ,
542544 )
543545 } )
@@ -648,7 +650,7 @@ describe('RunCall tests', () => {
648650 }
649651
650652 const res = await evm . runCall ( runCallArgs )
651- assert . ok ( res . execResult . exceptionError ?. error === ERROR . CODESIZE_EXCEEDS_MAXIMUM )
653+ assert . ok ( res . execResult . exceptionError ?. type . code === EVMErrorCode . CODESIZE_EXCEEDS_MAXIMUM )
652654
653655 // Create a contract which goes OOG when creating
654656 const runCallArgs2 = {
@@ -657,7 +659,7 @@ describe('RunCall tests', () => {
657659 }
658660
659661 const res2 = await evm . runCall ( runCallArgs2 )
660- assert . ok ( res2 . execResult . exceptionError ?. error === ERROR . OUT_OF_GAS )
662+ assert . ok ( res2 . execResult . exceptionError ?. type . code === EVMErrorCode . OUT_OF_GAS )
661663 } )
662664
663665 it ( 'ensure code deposit errors are logged correctly (Frontier)' , async ( ) => {
@@ -671,7 +673,8 @@ describe('RunCall tests', () => {
671673 }
672674
673675 const res = await evm . runCall ( runCallArgs )
674- assert . ok ( res . execResult . exceptionError ?. error === ERROR . CODESTORE_OUT_OF_GAS )
676+ // TODO: This now fails?
677+ assert . ok ( res . execResult . exceptionError ?. type . code === EVMErrorCode . CODESTORE_OUT_OF_GAS )
675678
676679 // Create a contract which goes OOG when creating
677680 const runCallArgs2 = {
@@ -680,7 +683,7 @@ describe('RunCall tests', () => {
680683 }
681684
682685 const res2 = await evm . runCall ( runCallArgs2 )
683- assert . ok ( res2 . execResult . exceptionError ?. error === ERROR . OUT_OF_GAS )
686+ assert . ok ( res2 . execResult . exceptionError ?. type . code === EVMErrorCode . OUT_OF_GAS )
684687 } )
685688
686689 it ( 'ensure call and callcode handle gas stipend correctly' , async ( ) => {
0 commit comments