Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/client/lib/rpc/modules/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export enum Status {
ACCEPTED = 'ACCEPTED',
INVALID = 'INVALID',
INVALID_BLOCK_HASH = 'INVALID_BLOCK_HASH',
INVALID_TERMINAL_BLOCK = 'INVALID_TERMINAL_BLOCK',
SYNCING = 'SYNCING',
VALID = 'VALID',
}
Expand Down Expand Up @@ -349,7 +348,6 @@ export class Engine {
* SYNCING - sync process is in progress
* ACCEPTED - blockHash is valid, doesn't extend the canonical chain, hasn't been fully validated
* INVALID_BLOCK_HASH - blockHash validation failed
* INVALID_TERMINAL_BLOCK - block fails transition block validity
* 2. latestValidHash: DATA|null - the hash of the most recent
* valid block in the branch defined by payload and its ancestors
* 3. validationError: String|null - validation error message
Expand Down Expand Up @@ -396,9 +394,9 @@ export class Engine {
const validTerminalBlock = await validateTerminalBlock(parent, this.chain)
if (!validTerminalBlock) {
const response = {
status: Status.INVALID_TERMINAL_BLOCK,
status: Status.INVALID,
validationError: null,
latestValidHash: null,
latestValidHash: bufferToHex(zeros(32)),
}
this.connectionManager.lastNewPayload({ payload: params[0], response })
return response
Expand Down Expand Up @@ -471,7 +469,6 @@ export class Engine {
* VALID
* INVALID
* SYNCING
* INVALID_TERMINAL_BLOCK
* 2. payloadId: DATA|null - 8 Bytes - identifier of the payload build process or `null`
*/
async forkchoiceUpdatedV1(
Expand Down Expand Up @@ -522,9 +519,9 @@ export class Engine {
if (!validTerminalBlock) {
const response = {
payloadStatus: {
status: Status.INVALID_TERMINAL_BLOCK,
status: Status.INVALID,
validationError: null,
latestValidHash: null,
latestValidHash: bufferToHex(zeros(32)),
},
payloadId: null,
}
Expand Down
7 changes: 5 additions & 2 deletions packages/client/test/rpc/engine/forkchoiceUpdatedV1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { checkError } from '../util'
import genesisJSON from '../../testdata/geth-genesis/post-merge.json'
import blocks from '../../testdata/blocks/beacon.json'
import { batchBlocks } from './newPayloadV1.spec'
import { bufferToHex, zeros } from 'ethereumjs-util'

const method = 'engine_forkchoiceUpdatedV1'

Expand Down Expand Up @@ -114,7 +115,8 @@ tape(`${method}: invalid terminal block with only genesis block`, async (t) => {

const req = params(method, [validForkChoiceState, null])
const expectRes = (res: any) => {
t.equal(res.body.result.payloadStatus.status, 'INVALID_TERMINAL_BLOCK')
t.equal(res.body.result.payloadStatus.status, 'INVALID')
t.equal(res.body.result.payloadStatus.latestValidHash, bufferToHex(zeros(32)))
}
await baseRequest(t, server, req, 200, expectRes)
})
Expand Down Expand Up @@ -149,7 +151,8 @@ tape(`${method}: invalid terminal block with 1+ blocks`, async (t) => {
null,
])
const expectRes = (res: any) => {
t.equal(res.body.result.payloadStatus.status, 'INVALID_TERMINAL_BLOCK')
t.equal(res.body.result.payloadStatus.status, 'INVALID')
t.equal(res.body.result.payloadStatus.latestValidHash, bufferToHex(zeros(32)))
}
await baseRequest(t, server, req, 200, expectRes)
})
Expand Down
4 changes: 3 additions & 1 deletion packages/client/test/rpc/engine/newPayloadV1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx'
import { Address } from 'ethereumjs-util'
import blocks from '../../testdata/blocks/beacon.json'
import { HttpServer } from 'jayson'
import { bufferToHex, zeros } from 'ethereumjs-util'

const method = 'engine_newPayloadV1'

Expand Down Expand Up @@ -135,7 +136,8 @@ tape(`${method}: invalid terminal block`, async (t) => {

const req = params(method, [blockData, null])
const expectRes = (res: any) => {
t.equal(res.body.result.status, 'INVALID_TERMINAL_BLOCK')
t.equal(res.body.result.status, 'INVALID')
t.equal(res.body.result.latestValidHash, bufferToHex(zeros(32)))
}
await baseRequest(t, server, req, 200, expectRes)
})
Expand Down