Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle an edge case in newpayload block execution #3131

Merged
merged 3 commits into from
Nov 1, 2023
Merged
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
31 changes: 23 additions & 8 deletions packages/client/src/rpc/modules/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,20 +924,35 @@ export class Engine {
}
}
} catch (error) {
const latestValidHash = await validHash(
headBlock.header.parentHash,
this.chain,
this.chainCache
)

const errorMsg = `${error}`.toLowerCase()
if (errorMsg.includes('block') && errorMsg.includes('not found')) {
throw {
code: INTERNAL_ERROR,
message: errorMsg,
if (blocks.length > 1) {
// this error can come if the block tries to load a previous block yet not in the chain via BLOCKHASH
// opcode.
//
// i) error coding of the evm errors should be a better way to handle this OR
// ii) figure out a way to pass let the evm access the above blocks which is what connects this
// chain to vmhead. to be handled in skeleton refactoring to blockchain class

const response = { status: Status.SYNCING, latestValidHash, validationError: null }
return response
} else {
throw {
code: INTERNAL_ERROR,
message: errorMsg,
}
}
}

const validationError = `Error verifying block while running: ${errorMsg}`
this.config.logger.error(validationError)
const latestValidHash = await validHash(
headBlock.header.parentHash,
this.chain,
this.chainCache
)

const response = { status: Status.INVALID, latestValidHash, validationError }
this.invalidBlocks.set(blockHash.slice(2), error as Error)
this.remoteBlocks.delete(blockHash.slice(2))
Expand Down