// Copyright 2017 The go-ethereum Authors
// (original work)
// Copyright 2024 The Erigon Authors
// (modifications)
// This file is part of Erigon.
//
// Erigon 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.
//
// Erigon 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 Erigon. If not, see <http://www.gnu.org/licenses/>.

package rules

import "errors"

var (
	// ErrInvalidBlock is a generic error to wrap all non-transient genuine protocol validation errors.
	// For example, ErrUnexpectedWithdrawals should be wrapped as ErrInvalidBlock,
	// while an out-of-memory error should not.
	ErrInvalidBlock = errors.New("invalid block")

	// ErrUnknownAncestor is returned when validating a block requires an ancestor
	// that is unknown.
	ErrUnknownAncestor = errors.New("unknown ancestor")

	// ErrUnknownAncestorTD is returned when validating a block requires an ancestor
	// whose total difficulty is unknown.
	ErrUnknownAncestorTD = errors.New("unknown ancestor TD")

	// ErrPrunedAncestor is returned when validating a block requires an ancestor
	// that is known, but the state of which is not available.
	ErrPrunedAncestor = errors.New("pruned ancestor")

	// ErrFutureBlock is returned when a block's timestamp is in the future according
	// to the current node.
	ErrFutureBlock = errors.New("block in the future")

	// ErrInvalidNumber is returned if a block's number doesn't equal its parent's
	// plus one.
	ErrInvalidNumber = errors.New("invalid block number")

	// ErrUnexpectedWithdrawals is returned if a pre-Shanghai block has withdrawals.
	ErrUnexpectedWithdrawals = errors.New("unexpected withdrawals")

	// ErrUnexpectedRequests is returned if a pre-Prague block has EIP-7685 requests.
	ErrUnexpectedRequests = errors.New("unexpected requests")

	// ErrUnexpectedSlotNumber is returned if a pre-Amsterdam block has an EIP-7843 slotNumber.
	ErrUnexpectedSlotNumber = errors.New("unexpected slotNumber")

	// ErrMissingSlotNumber is returned if a post-Amsterdam block has a missing EIP-7843 slotNumber.
	ErrMissingSlotNumber = errors.New("missing slotNumber")

	// ErrUnexpectedBlockAccessListHash is returned if a pre-Amsterdam block has an EIP-7928 blockAccessListHash.
	ErrUnexpectedBlockAccessListHash = errors.New("unexpected bal hash")

	// ErrMissingBlockAccessListHash is returned if a post-Amsterdam block has a missing EIP-7928 blockAccessListHash.
	ErrMissingBlockAccessListHash = errors.New("missing bal hash")
)
