nodetype

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

README

The Service package

This package contains the different service types, currently Sequencer and Validator. It should only contain the driving logic built on top of the different components from the components package. Those services expect that the state would already be preinitialized when they are created so the responsibility for this for now sits within the enclave. Example of this is resynchronising the stateDB upon a restart.

Documentation

Index

Constants

View Source
const RollupDelay = 2 // number of L1 blocks to exclude when creating a rollup. This will minimize compression reorg issues.

Variables

This section is empty.

Functions

func ExportCrossChainData added in v0.24.1

func ExportCrossChainData(ctx context.Context, storage storage.Storage, fromSeqNo uint64, toSeqNo uint64) (*common.ExtCrossChainBundle, error)

Types

type NodeType

type NodeType interface {
	// SubmitTransaction - L2 obscuro transactions need to be passed here. Sequencers
	// will put them in the mempool while validators might put them in a queue and monitor
	// for censorship.
	SubmitTransaction(*common.L2Tx) error

	// OnL1Fork - logic to be performed when there is an L1 Fork
	OnL1Fork(ctx context.Context, fork *common.ChainFork) error

	// OnL1Block - performed after the block was processed
	OnL1Block(ctx context.Context, block *types.Block, result *components.BlockIngestionType) error

	ExportCrossChainData(context.Context, uint64, uint64) (*common.ExtCrossChainBundle, error)

	Close() error
}

NodeType - the interface for any service type running in Obscuro nodes. Should only contain the shared functionality that every service type needs to have.

type ObsValidator

type ObsValidator interface {
	// ExecuteStoredBatches - try to execute all stored by unexecuted batches
	ExecuteStoredBatches(context.Context) error

	VerifySequencerSignature(*core.Batch) error

	NodeType
}

func NewValidator

func NewValidator(
	consumer components.L1BlockProcessor,
	batchExecutor components.BatchExecutor,
	registry components.BatchRegistry,
	rollupConsumer components.RollupConsumer,
	chainConfig *params.ChainConfig,
	storage storage.Storage,
	sigValidator *components.SignatureValidator,
	mempool *txpool.TxPool,
	enclaveKey *crypto.EnclaveKey,
	logger gethlog.Logger,
) ObsValidator

type Sequencer

type Sequencer interface {
	// CreateBatch - creates a new head batch for the latest known L1 head block.
	CreateBatch(ctx context.Context, skipBatchIfEmpty bool) error

	// CreateRollup - creates a new rollup from the latest recorded rollup in the head l1 chain
	// and adds as many batches to it as possible.
	CreateRollup(ctx context.Context, lastBatchNo uint64) (*common.ExtRollup, error)

	NodeType
}

func NewSequencer

func NewSequencer(
	blockProcessor components.L1BlockProcessor,
	batchExecutor components.BatchExecutor,
	registry components.BatchRegistry,
	rollupProducer components.RollupProducer,
	rollupConsumer components.RollupConsumer,
	rollupCompression *components.RollupCompression,
	gethEncodingService gethencoding.EncodingService,
	logger gethlog.Logger,
	chainConfig *params.ChainConfig,
	enclavePrivateKey *crypto.EnclaveKey,
	mempool *txpool.TxPool,
	storage storage.Storage,
	dataEncryptionService crypto.DataEncryptionService,
	dataCompressionService compression.DataCompressionService,
	settings SequencerSettings,
	blockchain *ethchainadapter.EthChainAdapter,
) Sequencer

type SequencerSettings

type SequencerSettings struct {
	MaxBatchSize      uint64
	MaxRollupSize     uint64
	GasPaymentAddress gethcommon.Address
	BatchGasLimit     uint64
	BaseFee           *big.Int
}

Jump to

Keyboard shortcuts

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