Skip to content

Commit

Permalink
Fix engine-cancun hive tests (#3308)
Browse files Browse the repository at this point in the history
* client: attempt to fix some hive tests [no ci]

* client: fix test
  • Loading branch information
jochem-brouwer authored Oct 13, 2024
1 parent 94503b7 commit 6b0ac5a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/client/src/rpc/error-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const INTERNAL_ERROR = -32603
export const TOO_LARGE_REQUEST = -38004
export const UNSUPPORTED_FORK = -38005
export const UNKNOWN_PAYLOAD = -32001
export const INVALID_FORKCHOICE_STATE = -38002
export const INVALID_HEX_STRING = -32000

export const validEngineCodes = [
Expand Down
9 changes: 5 additions & 4 deletions packages/client/src/service/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
utf8ToBytes,
} from '@ethereumjs/util'

import { INVALID_FORKCHOICE_STATE } from '../rpc/error-code.js'
import { short, timeDuration } from '../util/index.js'
import { DBKey, MetaDBManager } from '../util/metaDBManager.js'

Expand Down Expand Up @@ -749,7 +750,7 @@ export class Skeleton extends MetaDBManager {
if (this.status.linked || shouldBeSafeNumber >= subchain0.tail) {
if (safeBlock === undefined) {
throw {
code: INVALID_PARAMS,
code: INVALID_FORKCHOICE_STATE,
message: `safe block not available in canonical chain`,
}
} else {
Expand All @@ -759,7 +760,7 @@ export class Skeleton extends MetaDBManager {
!equalsBytes(safeBlock.hash(), canonicalBlock.hash())
) {
throw {
code: INVALID_PARAMS,
code: INVALID_FORKCHOICE_STATE,
message: `safe block not canonical in chain`,
}
}
Expand All @@ -769,7 +770,7 @@ export class Skeleton extends MetaDBManager {
if (this.status.linked || shouldBeFinalizedNumber >= subchain0.tail) {
if (finalizedBlock === undefined) {
throw {
code: INVALID_PARAMS,
code: INVALID_FORKCHOICE_STATE,
message: `finalized block not available in canonical chain`,
}
} else {
Expand All @@ -779,7 +780,7 @@ export class Skeleton extends MetaDBManager {
!equalsBytes(finalizedBlock.hash(), canonicalBlock.hash())
) {
throw {
code: INVALID_PARAMS,
code: INVALID_FORKCHOICE_STATE,
message: `finalized block not canonical in chain`,
}
}
Expand Down
10 changes: 5 additions & 5 deletions packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Common, Hardfork, Mainnet } from '@ethereumjs/common'
import { bytesToHex, randomBytes } from '@ethereumjs/util'
import { assert, describe, it, vi } from 'vitest'

import { INVALID_PARAMS } from '../../../src/rpc/error-code.js'
import { INVALID_FORKCHOICE_STATE, INVALID_PARAMS } from '../../../src/rpc/error-code.js'
import { blockToExecutionPayload } from '../../../src/rpc/modules/index.js'
import { beaconData } from '../../testdata/blocks/beacon.js'
import { postMergeData } from '../../testdata/geth-genesis/post-merge.js'
Expand Down Expand Up @@ -183,7 +183,7 @@ describe(method, () => {
finalizedBlockHash: '0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4b',
},
])
assert.equal(res.error.code, INVALID_PARAMS)
assert.equal(res.error.code, INVALID_FORKCHOICE_STATE)
assert.ok(res.error.message.includes('finalized block not available in canonical chain'))
})

Expand All @@ -196,7 +196,7 @@ describe(method, () => {
safeBlockHash: '0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4b',
},
])
assert.equal(res.error.code, INVALID_PARAMS)
assert.equal(res.error.code, INVALID_FORKCHOICE_STATE)
assert.ok(res.error.message.includes('safe block not available'))
})

Expand Down Expand Up @@ -277,7 +277,7 @@ describe(method, () => {
},
])

assert.equal(res.error.code, -32602)
assert.equal(res.error.code, INVALID_FORKCHOICE_STATE)
assert.ok(res.error.message.includes('safe'))
assert.ok(res.error.message.includes('canonical'))
})
Expand Down Expand Up @@ -317,7 +317,7 @@ describe(method, () => {
},
])

assert.equal(res.error.code, -32602)
assert.equal(res.error.code, INVALID_FORKCHOICE_STATE)
assert.ok(res.error.message.includes('finalized'))
assert.ok(res.error.message.includes('canonical'))
})
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/benchmarks/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ async function main() {
// Input validation
if (args.length < 4) {
console.log(
'Please provide at least one benchmark name when running a benchmark or doing profiling.'
'Please provide at least one benchmark name when running a benchmark or doing profiling.',
)
console.log(
'Usage: npm run benchmarks|profiling -- BENCHMARK_NAME[:NUM_SAMPLES][,BENCHMARK_NAME[:NUM_SAMPLES]]'
'Usage: npm run benchmarks|profiling -- BENCHMARK_NAME[:NUM_SAMPLES][,BENCHMARK_NAME[:NUM_SAMPLES]]',
)
console.log(`Benchmarks available: ${Object.keys(BENCHMARKS).join(', ')}`)
return process.exit(1)
Expand Down

0 comments on commit 6b0ac5a

Please sign in to comment.