l1

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 22 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 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,
	hostStopper *stopcontrol.StopControl,
	logger gethlog.Logger,
	maxWaitForL1Receipt time.Duration,
	retryIntervalForL1Receipt time.Duration,
) *Publisher

func (*Publisher) ExtractObscuroRelevantTransactions

func (p *Publisher) ExtractObscuroRelevantTransactions(block *types.Block) ([]*ethadapter.L1RespondSecretTx, []*ethadapter.L1RollupTx, []*ethadapter.L1SetImportantContractsTx)

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

func (*Publisher) FetchLatestPeersList

func (p *Publisher) FetchLatestPeersList() ([]string, error)

func (*Publisher) FetchLatestSeqNo

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

func (*Publisher) GetImportantContracts

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

func (*Publisher) HealthStatus

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

func (*Publisher) InitializeSecret

func (p *Publisher) InitializeSecret(attestation *common.AttestationReport, encSecret common.EncryptedSharedEnclaveSecret) 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() 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

Jump to

Keyboard shortcuts

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