crosschain

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

Documentation

Index

Constants

View Source
const BalanceIncreaseXChainValueTransfer tracing.BalanceChangeReason = 110

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
)
View Source
var CrossChainEncodings = []string{smt.SOL_STRING, smt.SOL_BYTES32}

Functions

func ConvertLogsToValueTransfers added in v0.24.1

func ConvertLogsToValueTransfers(logs []types.Log, eventName string, messageBusABI abi.ABI) (common.ValueTransferEvents, error)

convertLogsToMessages - converts the logs of the event to messages. The logs should be filtered, otherwise fails.

Types

type BlockMessageExtractor

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

	StoreCrossChainValueTransfers(ctx context.Context, block *types.Header, 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

	// Initialize - Derives the address of the message bus contract.
	Initialize(systemAddresses system.SystemContractAddresses) 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(ctx context.Context, receipts common.L2Receipts) (common.CrossChainMessages, error)

	ExtractOutboundTransfers(ctx context.Context, receipts common.L2Receipts) (common.ValueTransferEvents, error)

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

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

	RetrieveInboundMessages(ctx context.Context, fromBlock *types.Header, toBlock *types.Header, rollupState *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents)

	system.SystemContractsInitializable
}

func NewObscuroMessageBusManager

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

type MerkleBatches added in v0.24.1

type MerkleBatches []*core.Batch

func (MerkleBatches) EncodeIndex added in v0.24.1

func (mb MerkleBatches) EncodeIndex(index int, w *bytes.Buffer)

func (MerkleBatches) ForMerkleTree added in v0.24.1

func (mb MerkleBatches) ForMerkleTree() [][]interface{}

func (MerkleBatches) Len added in v0.24.1

func (mb MerkleBatches) Len() int

type MessageBusManager

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

func (*MessageBusManager) CreateSyntheticTransactions

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

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

func (*MessageBusManager) ExecuteValueTransfers

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

func (*MessageBusManager) ExtractOutboundMessages

func (m *MessageBusManager) ExtractOutboundMessages(ctx context.Context, 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(_ context.Context, receipts common.L2Receipts) (common.ValueTransferEvents, error)

ExtractOutboundTransfers - 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) Initialize added in v0.28.0

func (m *MessageBusManager) Initialize(systemAddresses system.SystemContractAddresses) error

DeriveMessageBusAddress - Derives the address of the message bus contract.

func (*MessageBusManager) IsSyntheticTransaction

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

func (*MessageBusManager) RetrieveInboundMessages

func (m *MessageBusManager) RetrieveInboundMessages(ctx context.Context, fromBlock *types.Header, toBlock *types.Header, rollupState *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 MessageStructs added in v0.24.1

type MessageStructs []MessageBus.StructsCrossChainMessage

func (MessageStructs) EncodeIndex added in v0.24.1

func (ms MessageStructs) EncodeIndex(index int, w *bytes.Buffer)

func (MessageStructs) ForMerkleTree added in v0.24.1

func (ms MessageStructs) ForMerkleTree() [][]interface{}

func (MessageStructs) HashPacked added in v0.24.1

func (ms MessageStructs) HashPacked(index int) gethcommon.Hash

func (MessageStructs) Len added in v0.24.1

func (ms MessageStructs) Len() int

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)

type ValueTransfers added in v0.24.1

type ValueTransfers []common.ValueTransferEvent

func (ValueTransfers) EncodeIndex added in v0.24.1

func (vt ValueTransfers) EncodeIndex(index int, w *bytes.Buffer)

func (ValueTransfers) ForMerkleTree added in v0.24.1

func (vt ValueTransfers) ForMerkleTree() [][]interface{}

func (ValueTransfers) HashPacked added in v0.24.1

func (vt ValueTransfers) HashPacked(index int) gethcommon.Hash

func (ValueTransfers) Len added in v0.24.1

func (vt ValueTransfers) Len() int

Jump to

Keyboard shortcuts

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