processor

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Standard ABI types copied from golang ABI tests
	Uint256Type, _ = abi.NewType("uint256", "", nil)
	BytesType, _   = abi.NewType("bytes", "", nil)
	AddressType, _ = abi.NewType("address", "", nil)

	LegacyCrossDomainMessengerRelayMessageMethod = abi.NewMethod(
		"relayMessage",
		"relayMessage",
		abi.Function,
		"external",
		false,
		true,
		abi.Arguments{
			{Name: "sender", Type: AddressType},
			{Name: "target", Type: AddressType},
			{Name: "data", Type: BytesType},
			{Name: "nonce", Type: Uint256Type},
		},
		abi.Arguments{},
	)
)

Functions

func CrossDomainMessageHash added in v1.1.4

func CrossDomainMessageHash(abi *abi.ABI, sentMsg *bindings.CrossDomainMessengerSentMessage, value *big.Int) (common.Hash, error)

Replica of `Hashing.sol#hashCrossDomainMessage` solidity implementation

func DecodeVersionedNonce added in v1.1.4

func DecodeVersionedNonce(nonce *big.Int) (uint16, *big.Int)

DecodeVersionNonce is an re-implementation of Encoding.sol#decodeVersionedNonce. If the nonce is greater than 32 bytes (solidity uint256), bytes [32:] are ignored

func UnpackLog

func UnpackLog(out interface{}, log *types.Log, name string, contractAbi *abi.ABI) error

Types

type CrossDomainMessengerRelayedMessageEvent added in v1.1.4

type CrossDomainMessengerRelayedMessageEvent struct {
	*bindings.CrossDomainMessengerRelayedMessage
	Event *database.ContractEvent
}

func CrossDomainMessengerRelayedMessageEvents added in v1.1.4

func CrossDomainMessengerRelayedMessageEvents(events *ProcessedContractEvents) ([]CrossDomainMessengerRelayedMessageEvent, error)

type CrossDomainMessengerSentMessageEvent added in v1.1.4

type CrossDomainMessengerSentMessageEvent struct {
	*bindings.CrossDomainMessengerSentMessage

	Value       *big.Int
	MessageHash common.Hash
	Event       *database.ContractEvent
}

func CrossDomainMessengerSentMessageEvents added in v1.1.4

func CrossDomainMessengerSentMessageEvents(events *ProcessedContractEvents) ([]CrossDomainMessengerSentMessageEvent, error)

type L1Processor

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

func NewL1Processor

func NewL1Processor(logger log.Logger, ethClient node.EthClient, db *database.DB, l1Contracts config.L1Contracts) (*L1Processor, error)

func (L1Processor) LatestProcessedHeader

func (p L1Processor) LatestProcessedHeader() *types.Header

func (*L1Processor) PauseForTest

func (p *L1Processor) PauseForTest()

func (*L1Processor) ResumeForTest

func (p *L1Processor) ResumeForTest()

func (*L1Processor) Start

func (p *L1Processor) Start(ctx context.Context) error

Start kicks off the processing loop. This is a block operation unless the processor encountering an error, abrupting the loop, or the supplied context is cancelled.

type L2Contracts

type L2Contracts struct {
	L2CrossDomainMessenger common.Address
	L2StandardBridge       common.Address
	L2ERC721Bridge         common.Address
	L2ToL1MessagePasser    common.Address
}

func L2ContractPredeploys

func L2ContractPredeploys() L2Contracts

func (L2Contracts) ToSlice

func (c L2Contracts) ToSlice() []common.Address

type L2Processor

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

func NewL2Processor

func NewL2Processor(logger log.Logger, ethClient node.EthClient, db *database.DB, l2Contracts L2Contracts) (*L2Processor, error)

func (L2Processor) LatestProcessedHeader

func (p L2Processor) LatestProcessedHeader() *types.Header

func (*L2Processor) PauseForTest

func (p *L2Processor) PauseForTest()

func (*L2Processor) ResumeForTest

func (p *L2Processor) ResumeForTest()

func (*L2Processor) Start

func (p *L2Processor) Start(ctx context.Context) error

Start kicks off the processing loop. This is a block operation unless the processor encountering an error, abrupting the loop, or the supplied context is cancelled.

type L2ToL1MessagePasserMessagePassed added in v1.1.4

type L2ToL1MessagePasserMessagePassed struct {
	*bindings.L2ToL1MessagePasserMessagePassed
	Event *database.ContractEvent
}

func L2ToL1MessagePasserMessagesPassed added in v1.1.4

func L2ToL1MessagePasserMessagesPassed(events *ProcessedContractEvents) ([]L2ToL1MessagePasserMessagePassed, error)

type OptimismPortalProvenWithdrawal

type OptimismPortalProvenWithdrawal struct {
	OutputRoot    [32]byte
	Timestamp     *big.Int
	L2OutputIndex *big.Int
}

type OptimismPortalTransactionDepositEvent added in v1.1.4

type OptimismPortalTransactionDepositEvent struct {
	*bindings.OptimismPortalTransactionDeposited
	DepositTx *types.DepositTx
	Event     *database.ContractEvent
}

func OptimismPortalTransactionDepositEvents added in v1.1.4

func OptimismPortalTransactionDepositEvents(events *ProcessedContractEvents) ([]OptimismPortalTransactionDepositEvent, error)

type OptimismPortalWithdrawalFinalizedEvent added in v1.1.4

type OptimismPortalWithdrawalFinalizedEvent struct {
	*bindings.OptimismPortalWithdrawalFinalized
	Event *database.ContractEvent
}

func OptimismPortalWithdrawalFinalizedEvents added in v1.1.4

func OptimismPortalWithdrawalFinalizedEvents(events *ProcessedContractEvents) ([]OptimismPortalWithdrawalFinalizedEvent, error)

type OptimismPortalWithdrawalProvenEvent

type OptimismPortalWithdrawalProvenEvent struct {
	*bindings.OptimismPortalWithdrawalProven
	Event *database.ContractEvent
}

type ProcessFn

type ProcessFn func(*database.DB, []*types.Header) error

ProcessFn is the the entrypoint for processing a batch of headers. In the event of failure, database operations are rolled back

type ProcessedContractEventLogIndexKey

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

type ProcessedContractEvents

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

func NewProcessedContractEvents

func NewProcessedContractEvents() *ProcessedContractEvents

func (*ProcessedContractEvents) AddLog

type StandardBridgeFinalizedEvent

type StandardBridgeFinalizedEvent struct {
	// We hardcode to ERC20 since ETH can be pseudo-represented as an ERC20 utilizing
	// the hardcoded ETH address
	*bindings.StandardBridgeERC20BridgeFinalized

	CrossDomainMessageHash common.Hash
	Event                  *database.ContractEvent
}

func StandardBridgeFinalizedEvents

func StandardBridgeFinalizedEvents(events *ProcessedContractEvents) ([]StandardBridgeFinalizedEvent, error)

StandardBridgeFinalizedEvents extracts all finalization bridge events from the contracts that follow the StandardBridge ABI. The correlated CrossDomainMessenger nonce is also parsed by looking at the parameters of the corresponding relayMessage transaction data.

type StandardBridgeInitiatedEvent

type StandardBridgeInitiatedEvent struct {
	// We hardcode to ERC20 since ETH can be pseudo-represented as an ERC20 utilizing
	// the hardcoded ETH address
	*bindings.StandardBridgeERC20BridgeInitiated

	CrossDomainMessageHash common.Hash
	Event                  *database.ContractEvent
}

func StandardBridgeInitiatedEvents

func StandardBridgeInitiatedEvents(events *ProcessedContractEvents) ([]StandardBridgeInitiatedEvent, error)

StandardBridgeInitiatedEvents extracts all initiated bridge events from the contracts that follow the StandardBridge ABI. The correlated CrossDomainMessenger nonce is also parsed from the associated messenger events.

Jump to

Keyboard shortcuts

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