Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertLogsToValueTransfers(logs []types.Log, eventName string, messageBusABI abi.ABI) (common.ValueTransferEvents, error)
- type BlockMessageExtractor
- type EVMExecutorFunc
- type EVMExecutorResponse
- type Manager
- type MerkleBatches
- type MessageBusManager
- func (m *MessageBusManager) CreateSyntheticTransactions(ctx context.Context, messages common.CrossChainMessages, ...) common.L2Transactions
- func (m *MessageBusManager) DeriveOwner(_ []byte) (*common.L2Address, error)
- func (m *MessageBusManager) ExecuteValueTransfers(ctx context.Context, transfers common.ValueTransferEvents, ...)
- func (m *MessageBusManager) ExtractOutboundMessages(ctx context.Context, receipts common.L2Receipts) (common.CrossChainMessages, error)
- func (m *MessageBusManager) ExtractOutboundTransfers(_ context.Context, receipts common.L2Receipts) (common.ValueTransferEvents, error)
- func (m *MessageBusManager) GenerateMessageBusDeployTx() (*common.L2Tx, error)
- func (m *MessageBusManager) GetBusAddress() *common.L2Address
- func (m *MessageBusManager) GetOwner() common.L2Address
- func (m *MessageBusManager) IsSyntheticTransaction(transaction *common.L2Tx) bool
- func (m *MessageBusManager) RetrieveInboundMessages(ctx context.Context, fromBlock *common.L1Block, toBlock *common.L1Block, ...) (common.CrossChainMessages, common.ValueTransferEvents)
- type MessageStructs
- type ObsCallEVMFunc
- type Processors
- type ValueTransfers
Constants ¶
const BalanceIncreaseXChainValueTransfer tracing.BalanceChangeReason = 110
Variables ¶
var (
MessageBusABI, _ = abi.JSON(strings.NewReader(MessageBus.MessageBusMetaData.ABI))
CrossChainEventName = "LogMessagePublished"
CrossChainEventID = MessageBusABI.Events[CrossChainEventName].ID
ValueTransferEventName = "ValueTransfer"
ValueTransferEventID = MessageBusABI.Events["ValueTransfer"].ID
)
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 *common.L1Block, receipts common.L1Receipts) error StoreCrossChainValueTransfers(ctx context.Context, 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 }
type EVMExecutorFunc ¶
type EVMExecutorFunc = func(common.L2Transactions) map[common.TxHash]interface{}
type EVMExecutorResponse ¶
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(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 *common.L1Block, toBlock *common.L1Block, rollupState *state.StateDB) (common.CrossChainMessages, common.ValueTransferEvents) }
type MerkleBatches ¶ added in v0.24.1
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) 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(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) IsSyntheticTransaction ¶
func (m *MessageBusManager) IsSyntheticTransaction(transaction *common.L2Tx) bool
func (*MessageBusManager) RetrieveInboundMessages ¶
func (m *MessageBusManager) RetrieveInboundMessages(ctx context.Context, 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 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