crosschain

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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageBusABI, _       = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI))
	CrossChainEventName    = "LogMessagePublished"
	CrossChainEventID      = MessageBusABI.Events[CrossChainEventName].ID
	ValueTransferEventName = "ValueTransfer"
	ValueTransferEventID   = MessageBusABI.Events["ValueTransfer"].ID
)

Functions

This section is empty.

Types

type BlockMessageExtractor

type BlockMessageExtractor interface {
	// StoreCrossChainMessages - Verifies receipts belong to block and saves the relevant cross chain messages from the receipts
	StoreCrossChainMessages(block *common.L1Block, receipts common.L1Receipts) error

	StoreCrossChainValueTransfers(block *common.L1Block, receipts common.L1Receipts) error

	// GetBusAddress - Returns the L1 message bus address.
	GetBusAddress() *common.L1Address

	// Enabled - Returns true if there is a configured message bus, otherwise it is considered disabled
	Enabled() bool
}

func NewBlockMessageExtractor

func NewBlockMessageExtractor(
	busAddress *common.L1Address,
	storage storage.Storage,
	logger gethlog.Logger,
) BlockMessageExtractor

type EVMExecutorFunc

type EVMExecutorFunc = func(common.L2Transactions) map[common.TxHash]interface{}

type EVMExecutorResponse

type EVMExecutorResponse = map[common.TxHash]interface{}

type Manager

type Manager interface {
	// IsSyntheticTransaction - Determines if a given L2 transaction is coming from the synthetic owner address.
	IsSyntheticTransaction(transaction common.L2Tx) bool

	// GetOwner - Returns the address of the identity owning the message bus.
	GetOwner() common.L2Address

	// GetBusAddress - Returns the L2 address of the message bus contract.
	GetBusAddress() *common.L2Address

	// DeriveOwner - Generates the key pair that will be used to transact with the L2 message bus.
	// todo (#1549) - implement with cryptography epic.
	DeriveOwner(seed []byte) (*common.L2Address, error)

	// GenerateMessageBusDeployTx - Returns a signed message bus deployment transaction.
	GenerateMessageBusDeployTx() (*common.L2Tx, error)

	// ExtractOutboundMessages - Finds relevant logs in the receipts and converts them to cross chain messages.
	ExtractOutboundMessages(receipts common.L2Receipts) (common.CrossChainMessages, error)

	ExtractOutboundTransfers(receipts common.L2Receipts) (common.ValueTransferEvents, error)

	CreateSyntheticTransactions(messages common.CrossChainMessages, rollupState *state.StateDB) common.L2Transactions

	ExecuteValueTransfers(transfers common.ValueTransferEvents, rollupState *state.StateDB)

	RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, rollupState *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents)
}

func NewObscuroMessageBusManager

func NewObscuroMessageBusManager(
	storage storage.Storage,
	chainID *big.Int,
	logger gethlog.Logger,
) Manager

type MessageBusManager

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

func (*MessageBusManager) CreateSyntheticTransactions

func (m *MessageBusManager) CreateSyntheticTransactions(messages common.CrossChainMessages, rollupState *state.StateDB) common.L2Transactions

CreateSyntheticTransactions - generates transactions that the enclave should execute internally for the messages.

func (*MessageBusManager) DeriveOwner

func (m *MessageBusManager) DeriveOwner(_ []byte) (*common.L2Address, error)

DeriveOwner - Generates the key pair that will be used to transact with the L2 message bus.

func (*MessageBusManager) ExecuteValueTransfers

func (m *MessageBusManager) ExecuteValueTransfers(transfers common.ValueTransferEvents, rollupState *state.StateDB)

func (*MessageBusManager) ExtractOutboundMessages

func (m *MessageBusManager) ExtractOutboundMessages(receipts common.L2Receipts) (common.CrossChainMessages, error)

ExtractLocalMessages - Finds relevant logs in the receipts and converts them to cross chain messages.

func (*MessageBusManager) ExtractOutboundTransfers

func (m *MessageBusManager) ExtractOutboundTransfers(receipts common.L2Receipts) (common.ValueTransferEvents, error)

ExtractLocalMessages - Finds relevant logs in the receipts and converts them to cross chain messages.

func (*MessageBusManager) GenerateMessageBusDeployTx

func (m *MessageBusManager) GenerateMessageBusDeployTx() (*common.L2Tx, error)

GenerateMessageBusDeployTx - Returns a signed message bus deployment transaction.

func (*MessageBusManager) GetBusAddress

func (m *MessageBusManager) GetBusAddress() *common.L2Address

GetBusAddress - Returns the L2 address of the message bus contract. todo - figure out how to expose the deployed contract to the external world. Perhaps extract event from contract construction?

func (*MessageBusManager) GetOwner

func (m *MessageBusManager) GetOwner() common.L2Address

GetOwner - Returns the address of the identity owning the message bus.

func (*MessageBusManager) IsSyntheticTransaction

func (m *MessageBusManager) IsSyntheticTransaction(transaction common.L2Tx) bool

func (*MessageBusManager) RetrieveInboundMessages

func (m *MessageBusManager) RetrieveInboundMessages(fromBlock *common.L1Block, toBlock *common.L1Block, _ *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents)

RetrieveInboundMessages - Retrieves the cross chain messages between two blocks. todo (@stefan) - fix ordering of messages, currently it is irrelevant. todo (@stefan) - do not extract messages below their consistency level. Irrelevant security wise. todo (@stefan) - surface errors

type ObsCallEVMFunc

type ObsCallEVMFunc = func(core.Message) (*core.ExecutionResult, error)

type Processors

type Processors struct {
	Local  Manager
	Remote BlockMessageExtractor
}

Processors - contains the cross chain related structures.

func New

func New(
	l1BusAddress *gethcommon.Address,
	storage storage.Storage,
	chainID *big.Int,
	logger gethlog.Logger,
) *Processors

func (*Processors) Enabled

func (c *Processors) Enabled() bool

func (*Processors) GetL2MessageBusAddress

func (c *Processors) GetL2MessageBusAddress() (gethcommon.Address, common.SystemError)

Jump to

Keyboard shortcuts

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