l1

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoNextBlock = errors.New("no next block")
)

Functions

This section is empty.

Types

type BlobResolver added in v0.28.0

type BlobResolver interface {
	// FetchBlobs Fetches the blob data using beacon chain APIs
	FetchBlobs(ctx context.Context, b *types.Header, hashes []gethcommon.Hash) ([]*kzg4844.Blob, error)
	// StoreBlobs is used to store blobs for the in-memory testing nodes
	StoreBlobs(slot uint64, blobs []*kzg4844.Blob) error
}

BlobResolver is an interface for fetching blobs

func NewBlobResolver added in v0.28.0

func NewBlobResolver(beaconClient *ethadapter.L1BeaconClient) BlobResolver

type CrossChainStateMachine added in v0.25.0

type CrossChainStateMachine interface {
	GetRollupData(number RollupNumber) (RollupInfo, error)
	Synchronize() error
	PublishNextBundle() error
	host.Service
}

func NewCrossChainStateMachine added in v0.25.0

func NewCrossChainStateMachine(
	publisher host.L1Publisher,
	mgmtContractLib mgmtcontractlib.MgmtContractLib,
	ethClient ethadapter.EthClient,
	enclaveClient common.Enclave,
	logger gethlog.Logger,
	hostStopper *stopcontrol.StopControl,
) CrossChainStateMachine

type ForkUniqueID added in v0.25.0

type ForkUniqueID = gethcommon.Hash

type Publisher

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

func NewL1Publisher

func NewL1Publisher(
	hostData host.Identity,
	hostWallet wallet.Wallet,
	client ethadapter.EthClient,
	mgmtContract mgmtcontractlib.MgmtContractLib,
	repository host.L1BlockRepository,
	blobResolver BlobResolver,
	hostStopper *stopcontrol.StopControl,
	logger gethlog.Logger,
	maxWaitForL1Receipt time.Duration,
	retryIntervalForL1Receipt time.Duration,
	storage storage.Storage,
) *Publisher

func (*Publisher) ExtractRelevantTenTransactions added in v0.28.0

func (p *Publisher) ExtractRelevantTenTransactions(block *types.Block, receipts types.Receipts) ([]*common.TxAndReceiptAndBlobs, []*ethadapter.L1RollupTx, []*ethadapter.L1SetImportantContractsTx)

ExtractRelevantTenTransactions will extract any transactions from the block that are relevant to TEN todo (#2495) we should monitor for relevant L1 events instead of scanning every transaction in the block

func (*Publisher) FetchLatestSeqNo

func (p *Publisher) FetchLatestSeqNo() (*big.Int, error)

func (*Publisher) FindSecretResponseTx added in v0.28.0

func (p *Publisher) FindSecretResponseTx(block *types.Block) []*ethadapter.L1RespondSecretTx

FindSecretResponseTx will scan the block for any secret response transactions. This is separate from the above method as we do not require the receipts for these transactions.

func (*Publisher) GetBundleRangeFromManagementContract added in v0.24.1

func (p *Publisher) GetBundleRangeFromManagementContract(lastRollupNumber *big.Int, lastRollupUID gethcommon.Hash) (*gethcommon.Hash, *big.Int, *big.Int, error)

func (*Publisher) GetImportantContracts

func (p *Publisher) GetImportantContracts() map[string]gethcommon.Address

func (*Publisher) HealthStatus

func (p *Publisher) HealthStatus(context.Context) host.HealthStatus

func (*Publisher) InitializeSecret

func (p *Publisher) InitializeSecret(attestation *common.AttestationReport, encSecret common.EncryptedSharedEnclaveSecret) error

func (*Publisher) PublishCrossChainBundle added in v0.24.1

func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle, rollupNum *big.Int, forkID gethcommon.Hash) error

func (*Publisher) PublishRollup

func (p *Publisher) PublishRollup(producedRollup *common.ExtRollup)

func (*Publisher) PublishSecretResponse

func (p *Publisher) PublishSecretResponse(secretResponse *common.ProducedSecretResponse) error

func (*Publisher) RequestSecret

func (p *Publisher) RequestSecret(attestation *common.AttestationReport) (gethcommon.Hash, error)

func (*Publisher) ResyncImportantContracts

func (p *Publisher) ResyncImportantContracts() error

ResyncImportantContracts will fetch the latest important contracts from the management contract and update the cached map Note: this should be run in a goroutine as it makes L1 transactions in series and will block. Cache is not overwritten until it completes.

func (*Publisher) Start

func (p *Publisher) Start() error

func (*Publisher) Stop

func (p *Publisher) Stop() error

type Repository

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

Repository is a host service for subscribing to new blocks and looking up L1 data

func NewL1Repository

func NewL1Repository(ethClient ethadapter.EthClient, obscuroRelevantContracts []gethcommon.Address, logger gethlog.Logger) *Repository

func (*Repository) FetchBlockByHeight

func (r *Repository) FetchBlockByHeight(height *big.Int) (*types.Block, error)

func (*Repository) FetchNextBlock

func (r *Repository) FetchNextBlock(prevBlockHash gethcommon.Hash) (*types.Block, bool, error)

FetchNextBlock calculates the next canonical block that should be sent to requester after a given hash. It returns the block and a bool for whether it is the latest known head

func (*Repository) FetchObscuroReceipts

func (r *Repository) FetchObscuroReceipts(block *common.L1Block) (types.Receipts, error)

FetchObscuroReceipts returns all obscuro-relevant receipts for an L1 block

func (*Repository) HealthStatus

func (r *Repository) HealthStatus(context.Context) host.HealthStatus

func (*Repository) Start

func (r *Repository) Start() error

func (*Repository) Stop

func (r *Repository) Stop() error

func (*Repository) Subscribe

func (r *Repository) Subscribe(handler host.L1BlockHandler) func()

Subscribe will register a new block handler to receive new blocks as they arrive, returns unsubscribe func

type RollupInfo added in v0.25.0

type RollupInfo struct {
	ForkUID ForkUniqueID
	Number  RollupNumber
}

type RollupNumber added in v0.25.0

type RollupNumber = uint64

Jump to

Keyboard shortcuts

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