Skip to content

Remove duplicate exception definitions #1816

Description

@marioevz

Currently we define TransactionException in two different files:

@unique
class TransactionException(ExceptionBase):
"""
Exception raised when a transaction is invalid, and thus cannot be
executed.
If a transaction with any of these exceptions is included in a block, the
block is invalid.
"""
TYPE_NOT_SUPPORTED = auto()
"""Transaction type is not supported on this chain configuration."""
SENDER_NOT_EOA = auto()
"""Transaction is coming from address that is not exist anymore."""

@unique
class TransactionException(ExceptionBase):
"""
Exception raised when a transaction is invalid, and thus cannot be
executed.
If a transaction with any of these exceptions is included in a block, the
block is invalid.
"""
TYPE_NOT_SUPPORTED = auto()
"""Transaction type is not supported on this chain configuration."""
SENDER_NOT_EOA = auto()
"""Transaction is coming from address that is not exist anymore."""

And BlockException also in two different files:

@unique
class BlockException(ExceptionBase):
"""
Exception raised when a block is invalid, but not due to a transaction.
E.g. all transactions in the block are valid, and can be applied to the
state, but the block header contains an invalid field.
"""
TOO_MANY_UNCLES = auto()
"""Block declares too many uncles over the allowed limit."""
UNCLE_IN_CHAIN = auto()
"""Block declares uncle header that is already imported into chain."""

@unique
class BlockException(ExceptionBase):
"""
Exception raised when a block is invalid, but not due to a transaction.
E.g. all transactions in the block are valid, and can be applied to the
state, but the block header contains an invalid field.
"""
TOO_MANY_UNCLES = auto()
"""Block declares too many uncles over the allowed limit."""
UNCLE_IN_CHAIN = auto()
"""Block declares uncle header that is already imported into chain."""

They should be defined in a single file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions