Engine API structures and methods specified for Paris.
This structure maps on the ExecutionPayload structure of the beacon chain spec. The fields are encoded as follows:
parentHash:DATA, 32 BytesfeeRecipient:DATA, 20 BytesstateRoot:DATA, 32 BytesreceiptsRoot:DATA, 32 ByteslogsBloom:DATA, 256 BytesprevRandao:DATA, 32 BytesblockNumber:QUANTITY, 64 BitsgasLimit:QUANTITY, 64 BitsgasUsed:QUANTITY, 64 Bitstimestamp:QUANTITY, 64 BitsextraData:DATA, 0 to 32 BytesbaseFeePerGas:QUANTITY, 256 BitsblockHash:DATA, 32 Bytestransactions:Array of DATA- Array of transaction objects, each object is a byte list (DATA) representingTransactionType || TransactionPayloadorLegacyTransactionas defined in EIP-2718
This structure encapsulates the fork choice state. The fields are encoded as follows:
headBlockHash:DATA, 32 Bytes - block hash of the head of the canonical chainsafeBlockHash:DATA, 32 Bytes - the "safe" block hash of the canonical chain under certain synchrony and honesty assumptions. This value MUST be either equal to or an ancestor ofheadBlockHashfinalizedBlockHash:DATA, 32 Bytes - block hash of the most recent finalized block
Note: safeBlockHash and finalizedBlockHash fields are allowed to have 0x0000000000000000000000000000000000000000000000000000000000000000 value unless transition block is finalized.
This structure contains the attributes required to initiate a payload build process in the context of an engine_forkchoiceUpdated call. The fields are encoded as follows:
timestamp:QUANTITY, 64 Bits - value for thetimestampfield of the new payloadprevRandao:DATA, 32 Bytes - value for theprevRandaofield of the new payloadsuggestedFeeRecipient:DATA, 20 Bytes - suggested value for thefeeRecipientfield of the new payload
This structure contains the result of processing a payload. The fields are encoded as follows:
status:enum-"VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH"latestValidHash:DATA|null, 32 Bytes - the hash of the most recent valid block in the branch defined by payload and its ancestorsvalidationError:String|null- a message providing additional details on the validation error if the payload is classified asINVALIDorINVALID_BLOCK_HASH.
This structure contains configurable settings of the transition process. The fields are encoded as follows:
terminalTotalDifficulty:QUANTITY, 256 Bits - maps on theTERMINAL_TOTAL_DIFFICULTYparameter of EIP-3675terminalBlockHash:DATA, 32 Bytes - maps onTERMINAL_BLOCK_HASHparameter of EIP-3675terminalBlockNumber:QUANTITY, 64 Bits - maps onTERMINAL_BLOCK_NUMBERparameter of EIP-3675
Payload validation process consists of validating a payload with respect to the block header and execution environment rule sets. The process is specified as follows:
-
Client software MAY obtain a parent state by executing ancestors of a payload as a part of the validation process. In this case each ancestor MUST also pass payload validation process.
-
Client software MUST validate that the most recent PoW block in the chain of a payload ancestors satisfies terminal block conditions according to EIP-3675. This check maps to the transition block validity section of the EIP. If this validation fails, the response MUST contain
{status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000}. Additionally, each block in a tree of descendants of an invalid terminal block MUST be deemedINVALID. -
Client software MUST validate a payload according to the block header and execution environment rule set with modifications to these rule sets defined in the Block Validity section of EIP-3675:
- If validation succeeds, the response MUST contain
{status: VALID, latestValidHash: payload.blockHash} - If validation fails, the response MUST contain
{status: INVALID, latestValidHash: validHash}wherevalidHashMUST be:- The block hash of the ancestor of the invalid payload satisfying the following two conditions:
- It is fully validated and deemed
VALID - Any other ancestor of the invalid payload with a higher
blockNumberisINVALID
- It is fully validated and deemed
0x0000000000000000000000000000000000000000000000000000000000000000if the above conditions are satisfied by a PoW block.nullif client software cannot determine the ancestor of the invalid payload satisfying the above conditions.
- The block hash of the ancestor of the invalid payload satisfying the following two conditions:
- Client software MUST NOT surface an
INVALIDpayload over any API endpoint and p2p interface.
-
Payload validation process MUST be idempotent with respect to payload's validity status (
VALID | INVALID), i.e. a payload which validity status isINVALID (INVALID_BLOCK_HASH)MUST NOT becomeVALIDand vice versa at any point in time when it subsequently runs through the validation process. Client software MAY change payload status fromINVALIDtoSYNCING | ACCEPTEDas long as the payload remainsINVALIDas a result of any further run of the validation process. -
Client software MAY provide additional details on the validation error if a payload is deemed
INVALIDby assigning the corresponding message to thevalidationErrorfield. -
The process of validating a payload on the canonical chain MUST NOT be affected by an active sync process on a side branch of the block tree. For example, if side branch
BisSYNCINGbut the requisite data for validating a payload from canonical branchAis available, client software MUST run full validation of the payload and respond accordingly.
In the context of this specification, the sync is understood as the process of obtaining data required to validate a payload. The sync process may consist of the following stages:
- Pulling data from remote peers in the network.
- Passing ancestors of a payload through the Payload validation and obtaining a parent state.
Note: Each of these stages is optional. Exact behavior of client software during the sync process is implementation dependent.
The payload build process is specified as follows:
-
Client software MUST set the payload field values according to the set of parameters passed into this method with exception of the
suggestedFeeRecipient. The builtExecutionPayloadMAY deviate thefeeRecipientfield value from what is specified by thesuggestedFeeRecipientparameter. -
Client software SHOULD build the initial version of the payload which has an empty transaction set.
-
Client software SHOULD start the process of updating the payload. The strategy of this process is implementation dependent. The default strategy is to keep the transaction set up-to-date with the state of local mempool.
-
Client software SHOULD stop the updating process when either a call to
engine_getPayloadwith the build process'spayloadIdis made orSECONDS_PER_SLOT(12s in the Mainnet configuration) have passed since the point in time identified by thetimestampparameter. -
Client software MUST begin a new build process if given
PayloadAttributesdoesn't match payload attributes of an existing build process. Every new build process MUST be uniquely identified by the returnedpayloadIdvalue. -
If a build process with given
PayloadAttributesalready exists, client software SHOULD NOT restart it.
- method:
engine_newPayloadV1 - params:
- timeout: 8s
- result:
PayloadStatusV1 - error: code and message set in case an exception happens while processing the payload.
-
Client software MUST validate that all
transactionshave non-zero length (at least 1 byte). Client software MUST run this validation in all cases even if this branch or any other branches of the block tree are in an active sync process. -
Client software MUST validate
blockHashvalue as being equivalent toKeccak256(RLP(ExecutionBlockHeader)), whereExecutionBlockHeaderis the execution layer block header (the former PoW block header structure). Fields of this object are set to the corresponding payload values and constant values according to the Block structure section of EIP-3675, extended with the corresponding section of EIP-4399. Client software MUST run this validation in all cases even if this branch or any other branches of the block tree are in an active sync process. -
Client software MAY initiate a sync process if requisite data for payload validation is missing. Sync process is specified in the Sync section.
-
Client software MUST validate the payload if it extends the canonical chain and requisite data for the validation is locally available. The validation process is specified in the Payload validation section.
-
Client software MAY NOT validate the payload if the payload doesn't belong to the canonical chain.
-
Client software MUST respond to this method call in the following way:
{status: INVALID, latestValidHash: null, validationError: errorMessage | null}iftransactionscontains zero length or invalid entries{status: INVALID_BLOCK_HASH, latestValidHash: null, validationError: errorMessage | null}if theblockHashvalidation has failed{status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000, validationError: errorMessage | null}if terminal block conditions are not satisfied{status: SYNCING, latestValidHash: null, validationError: null}if requisite data for the payload's acceptance or validation is missing- with the payload status obtained from the Payload validation process if the payload has been fully validated while processing the call
{status: ACCEPTED, latestValidHash: null, validationError: null}if the following conditions are met:- all
transactionshave non-zero length - the
blockHashof the payload is valid - the payload doesn't extend the canonical chain
- the payload hasn't been fully validated
- ancestors of a payload are known and comprise a well-formed chain.
- all
- If any of the above fails due to errors unrelated to the normal processing flow of the method, client software MUST respond with an error object.
- method: "engine_forkchoiceUpdatedV1"
- params:
forkchoiceState:Object- instance ofForkchoiceStateV1payloadAttributes:Object|null- instance ofPayloadAttributesV1ornull
- timeout: 8s
- result:
objectpayloadStatus:PayloadStatusV1; values of thestatusfield in the context of this method are restricted to the following subset:"VALID""INVALID""SYNCING"
payloadId:DATA|null, 8 Bytes - identifier of the payload build process ornull
- error: code and message set in case an exception happens while the validating payload, updating the forkchoice or initiating the payload build process.
-
Client software MAY initiate a sync process if
forkchoiceState.headBlockHashreferences an unknown payload or a payload that can't be validated because data that are requisite for the validation is missing. The sync process is specified in the Sync section. -
Client software MAY skip an update of the forkchoice state and MUST NOT begin a payload build process if there is a known
finalizedBlockHashandforkchoiceState.headBlockHashreferences aVALIDancestor of the latest known finalized block, i.e. the ancestor passed payload validation process and deemedVALID. In the case of such an event, client software MUST return{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}. -
If
forkchoiceState.headBlockHashreferences a PoW block, client software MUST validate this block with respect to terminal block conditions according to EIP-3675. This check maps to the transition block validity section of the EIP. Additionally, if this validation fails, client software MUST NOT update the forkchoice state and MUST NOT begin a payload build process. -
Before updating the forkchoice state, client software MUST ensure the validity of the payload referenced by
forkchoiceState.headBlockHash, and MAY validate the payload while processing the call. The validation process is specified in the Payload validation section. If the validation process fails, client software MUST NOT update the forkchoice state and MUST NOT begin a payload build process. -
Client software MUST return
-38002: Invalid forkchoice stateerror if the payload referenced byforkchoiceState.headBlockHashisVALIDand a payload referenced by eitherforkchoiceState.finalizedBlockHashorforkchoiceState.safeBlockHashdoes not belong to the chain defined byforkchoiceState.headBlockHash. -
Client software MUST return
-38006: Too deep reorgerror if the depth of reorg toforkchoiceState.headBlockHashexceeds the limitation specific to the client software. -
Client software MUST update its forkchoice state if payloads referenced by
forkchoiceState.headBlockHashandforkchoiceState.finalizedBlockHashareVALID. The update is specified as follows:
- The values
(forkchoiceState.headBlockHash, forkchoiceState.finalizedBlockHash)of this method call map on thePOS_FORKCHOICE_UPDATEDevent of EIP-3675 and MUST be processed according to the specification defined in the EIP - All updates to the forkchoice state resulting from this call MUST be made atomically.
-
Client software MUST process provided
payloadAttributesafter successfully applying theforkchoiceStateand only if the payload referenced byforkchoiceState.headBlockHashisVALID. The processing flow is as follows:-
Verify that
payloadAttributes.timestampis greater thantimestampof a block referenced byforkchoiceState.headBlockHashand return-38003: Invalid payload attributeson failure. -
If
payloadAttributespasses all validation steps, begin a payload build process building on top offorkchoiceState.headBlockHashand identified viabuildProcessIdvalue. The build process is specified in the Payload building section. -
If
payloadAttributesvalidation fails, theforkchoiceStateupdate MUST NOT be rolled back.
-
-
Client software MUST respond to this method call in the following way:
{payloadStatus: {status: SYNCING, latestValidHash: null, validationError: null}, payloadId: null}ifforkchoiceState.headBlockHashreferences an unknown payload or a payload that can't be validated because requisite data for the validation is missing{payloadStatus: {status: INVALID, latestValidHash: validHash, validationError: errorMessage | null}, payloadId: null}obtained from the Payload validation process if the payload is deemedINVALID{payloadStatus: {status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000, validationError: errorMessage | null}, payloadId: null}obtained either from the Payload validation process or as a result of validating a terminal PoW block referenced byforkchoiceState.headBlockHash{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}if the payload is deemedVALIDand a build process hasn't been started{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: buildProcessId}if the payload is deemedVALIDand the build process has begun{error: {code: -38002, message: "Invalid forkchoice state"}}ifforkchoiceStateis either invalid or inconsistent{error: {code: -38003, message: "Invalid payload attributes"}}if the payload is deemedVALIDandforkchoiceStatehas been applied successfully, but no build process has been started due to invalidpayloadAttributes{error: {code: -38006, message: "Too deep reorg"}}if requested reorg depth exceeds the limitation.
- If any of the above fails due to errors unrelated to the normal processing flow of the method, client software MUST respond with an error object.
- method:
engine_getPayloadV1 - params:
payloadId:DATA, 8 Bytes - Identifier of the payload build process
- timeout: 1s
- result:
ExecutionPayloadV1 - error: code and message set in case an exception happens while getting the payload.
-
Given the
payloadIdclient software MUST return the most recent version of the payload that is available in the corresponding build process at the time of receiving the call. -
The call MUST return
-38001: Unknown payloaderror if the build process identified by thepayloadIddoes not exist. -
Client software MAY stop the corresponding build process after serving this call.
- method:
engine_exchangeTransitionConfigurationV1 - params:
transitionConfiguration:Object- instance ofTransitionConfigurationV1
- timeout: 1s
- result:
TransitionConfigurationV1 - error: code and message set in case an exception happens while getting a transition configuration.
-
Execution Layer client software MUST respond with configurable setting values that are set according to the Client software configuration section of EIP-3675.
-
Execution Layer client software SHOULD surface an error to the user if local configuration settings mismatch corresponding values received in the call of this method, with exception for
terminalBlockNumbervalue. -
Consensus Layer client software SHOULD surface an error to the user if local configuration settings mismatch corresponding values obtained from the response to the call of this method.
-
Consensus Layer client software SHOULD poll this endpoint every 60 seconds.
-
Execution Layer client software SHOULD surface an error to the user if it does not receive a request on this endpoint at least once every 120 seconds.
-
Considering the absence of the
TERMINAL_BLOCK_NUMBERsetting, Consensus Layer client software MAY use0value for theterminalBlockNumberfield in the input parameters of this call. -
Considering the absence of the
TERMINAL_TOTAL_DIFFICULTYvalue (i.e. when a value has not been decided), Consensus Layer and Execution Layer client software MUST use115792089237316195423570985008687907853269984665640564039457584007913129638912value (equal to2**256-2**10) for theterminalTotalDifficultyinput parameter of this call.