2022-01-31 15:22:35 +03:00
|
|
|
// Copyright 2022 The go-ethereum Authors
|
|
|
|
// This file is part of the go-ethereum library.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
|
|
|
|
package beacon
|
|
|
|
|
2022-05-17 12:32:55 +03:00
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/rpc"
|
|
|
|
)
|
2022-01-31 15:22:35 +03:00
|
|
|
|
|
|
|
var (
|
2022-03-11 15:14:45 +03:00
|
|
|
// VALID is returned by the engine API in the following calls:
|
|
|
|
// - newPayloadV1: if the payload was already known or was just validated and executed
|
|
|
|
// - forkchoiceUpdateV1: if the chain accepted the reorg (might ignore if it's stale)
|
|
|
|
VALID = "VALID"
|
|
|
|
|
|
|
|
// INVALID is returned by the engine API in the following calls:
|
|
|
|
// - newPayloadV1: if the payload failed to execute on top of the local chain
|
|
|
|
// - forkchoiceUpdateV1: if the new head is unknown, pre-merge, or reorg to it fails
|
|
|
|
INVALID = "INVALID"
|
|
|
|
|
|
|
|
// SYNCING is returned by the engine API in the following calls:
|
|
|
|
// - newPayloadV1: if the payload was accepted on top of an active sync
|
|
|
|
// - forkchoiceUpdateV1: if the new head was seen before, but not part of the chain
|
|
|
|
SYNCING = "SYNCING"
|
|
|
|
|
|
|
|
// ACCEPTED is returned by the engine API in the following calls:
|
|
|
|
// - newPayloadV1: if the payload was accepted, but not processed (side chain)
|
|
|
|
ACCEPTED = "ACCEPTED"
|
|
|
|
|
2022-05-17 12:32:55 +03:00
|
|
|
INVALIDBLOCKHASH = "INVALID_BLOCK_HASH"
|
2022-03-17 18:20:03 +03:00
|
|
|
|
2022-05-20 11:12:12 +03:00
|
|
|
GenericServerError = rpc.CustomError{Code: -32000, ValidationError: "Server error"}
|
|
|
|
UnknownPayload = rpc.CustomError{Code: -38001, ValidationError: "Unknown payload"}
|
|
|
|
InvalidForkChoiceState = rpc.CustomError{Code: -38002, ValidationError: "Invalid forkchoice state"}
|
|
|
|
InvalidPayloadAttributes = rpc.CustomError{Code: -38003, ValidationError: "Invalid payload attributes"}
|
2022-03-17 18:20:03 +03:00
|
|
|
|
2022-05-17 12:32:55 +03:00
|
|
|
STATUS_INVALID = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
|
|
|
|
STATUS_SYNCING = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}
|
|
|
|
INVALID_TERMINAL_BLOCK = PayloadStatusV1{Status: INVALID, LatestValidHash: &common.Hash{}}
|
2022-01-31 15:22:35 +03:00
|
|
|
)
|