simple

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProcessForwardsTaskType is the task type for forwards processing.
	ProcessForwardsTaskType = "transaction_simple_process_forwards"
	// ProcessBackwardsTaskType is the task type for backwards processing.
	ProcessBackwardsTaskType = "transaction_simple_process_backwards"
	// VerifyForwardsTaskType is the task type for forwards verification.
	VerifyForwardsTaskType = "transaction_simple_verify_forwards"
	// VerifyBackwardsTaskType is the task type for backwards verification.
	VerifyBackwardsTaskType = "transaction_simple_verify_backwards"
)
View Source
const ProcessorName = "transaction_simple"

ProcessorName is the name of the simple transaction processor.

Variables

This section is empty.

Functions

func NewProcessBackwardsTask

func NewProcessBackwardsTask(payload *ProcessPayload) (*asynq.Task, error)

NewProcessBackwardsTask creates a new backwards process task.

func NewProcessForwardsTask

func NewProcessForwardsTask(payload *ProcessPayload) (*asynq.Task, error)

NewProcessForwardsTask creates a new forwards process task.

func NewVerifyBackwardsTask

func NewVerifyBackwardsTask(payload *VerifyPayload) (*asynq.Task, error)

NewVerifyBackwardsTask creates a new backwards verify task.

func NewVerifyForwardsTask

func NewVerifyForwardsTask(payload *VerifyPayload) (*asynq.Task, error)

NewVerifyForwardsTask creates a new forwards verify task.

Types

type Config

type Config struct {
	clickhouse.Config `yaml:",inline"`
	Enabled           bool   `yaml:"enabled"`
	Table             string `yaml:"table"`
}

Config holds configuration for the simple transaction processor.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type CountMismatchError

type CountMismatchError struct {
	Expected int
	Actual   int
}

CountMismatchError represents a transaction count mismatch.

func (*CountMismatchError) Error

func (e *CountMismatchError) Error() string

Error implements the error interface.

type Dependencies

type Dependencies struct {
	Log         logrus.FieldLogger
	Pool        *ethereum.Pool
	Network     *ethereum.Network
	State       *state.Manager
	AsynqClient *asynq.Client
	RedisPrefix string
}

Dependencies contains the dependencies needed for the processor.

type ProcessPayload

type ProcessPayload struct {
	BlockNumber    big.Int `json:"block_number"`
	NetworkID      int32   `json:"network_id"`
	NetworkName    string  `json:"network_name"`
	ProcessingMode string  `json:"processing_mode"`
}

ProcessPayload represents the payload for processing a block.

func (*ProcessPayload) MarshalBinary

func (p *ProcessPayload) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*ProcessPayload) UnmarshalBinary

func (p *ProcessPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor handles simple transaction processing.

func New

func New(ctx context.Context, deps *Dependencies, config *Config) (*Processor, error)

New creates a new simple transaction processor.

func (*Processor) EnqueueTask

func (p *Processor) EnqueueTask(ctx context.Context, task *asynq.Task, opts ...asynq.Option) error

EnqueueTask enqueues a task to the specified queue.

func (*Processor) GetHandlers

func (p *Processor) GetHandlers() map[string]asynq.HandlerFunc

GetHandlers returns the task handlers for this processor.

func (*Processor) GetQueues

func (p *Processor) GetQueues() []c.QueueInfo

GetQueues returns the queues used by this processor.

func (*Processor) Name

func (p *Processor) Name() string

Name returns the processor name.

func (*Processor) ProcessNextBlock

func (p *Processor) ProcessNextBlock(ctx context.Context) error

ProcessNextBlock processes the next available block.

func (*Processor) SetProcessingMode

func (p *Processor) SetProcessingMode(mode string)

SetProcessingMode sets the processing mode for the processor.

func (*Processor) Start

func (p *Processor) Start(ctx context.Context) error

Start starts the processor.

func (*Processor) Stop

func (p *Processor) Stop(ctx context.Context) error

Stop stops the processor.

type Transaction

type Transaction struct {
	UpdatedDateTime    structlog.ClickHouseTime `json:"updated_date_time"`
	BlockNumber        uint64                   `json:"block_number"`
	BlockHash          string                   `json:"block_hash"`
	ParentHash         string                   `json:"parent_hash"`
	Position           uint32                   `json:"position"`
	Hash               string                   `json:"hash"`
	From               string                   `json:"from"`
	To                 *string                  `json:"to"`
	Nonce              uint64                   `json:"nonce"`
	GasPrice           string                   `json:"gas_price"`        // Effective gas price as UInt128 string
	Gas                uint64                   `json:"gas"`              // Gas limit
	GasTipCap          *string                  `json:"gas_tip_cap"`      // Nullable UInt128 string
	GasFeeCap          *string                  `json:"gas_fee_cap"`      // Nullable UInt128 string
	Value              string                   `json:"value"`            // UInt128 string
	Type               uint8                    `json:"type"`             // Transaction type
	Size               uint32                   `json:"size"`             // Transaction size in bytes
	CallDataSize       uint32                   `json:"call_data_size"`   // Size of call data
	BlobGas            *uint64                  `json:"blob_gas"`         // Nullable - for type 3 txs
	BlobGasFeeCap      *string                  `json:"blob_gas_fee_cap"` // Nullable UInt128 string
	BlobHashes         []string                 `json:"blob_hashes"`      // Array of versioned hashes
	Success            bool                     `json:"success"`
	NInputBytes        uint32                   `json:"n_input_bytes"`
	NInputZeroBytes    uint32                   `json:"n_input_zero_bytes"`
	NInputNonzeroBytes uint32                   `json:"n_input_nonzero_bytes"`
	MetaNetworkID      int32                    `json:"meta_network_id"`
	MetaNetworkName    string                   `json:"meta_network_name"`
}

Transaction represents a row in the execution_transaction table.

type VerifyPayload

type VerifyPayload struct {
	BlockNumber   big.Int `json:"block_number"`
	NetworkID     int32   `json:"network_id"`
	NetworkName   string  `json:"network_name"`
	InsertedCount int     `json:"inserted_count"`
}

VerifyPayload represents the payload for verifying a block.

func (*VerifyPayload) MarshalBinary

func (v *VerifyPayload) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*VerifyPayload) UnmarshalBinary

func (v *VerifyPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL