bridge

package
v0.0.0-...-4547e52 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxBatchAppendedEventName = "TxBatchAppended"
	// ISequencerInbox.sol functions
	AppendTxBatchFnName = "appendTxBatch"
	// IRollup.sol functions
	StakeFnName                           = "stake"
	AdvanceStakeFnName                    = "advanceStake"
	CreateAssertionFnName                 = "createAssertion"
	ConfirmFirstUnresolvedAssertionFnName = "confirmFirstUnresolvedAssertion"
	RejectFirstUnresolvedAssertionFnName  = "rejectFirstUnresolvedAssertion"

	// IRollup.sol errors (TODO: figure out a work-around to hardcoding)
	NoUnresolvedAssertionErr     = "Error: VM Exception while processing transaction: reverted with custom error 'NoUnresolvedAssertion()'"
	ConfirmationPeriodPendingErr = "Error: VM Exception while processing transaction: reverted with custom error 'ConfirmationPeriodPending()'"

	MethodNumBytes = 4
)

Variables

This section is empty.

Functions

func ChallengeABIMethods

func ChallengeABIMethods() map[string]abi.Method

func InboxABIMethods

func InboxABIMethods() map[string]abi.Method

func InboxEvent

func InboxEvent(name string) abi.Event

func RollupABIMethods

func RollupABIMethods() map[string]abi.Method

func TxMethodID

func TxMethodID(tx *types.Transaction) string

func UnpackAppendTxBatchInput

func UnpackAppendTxBatchInput(tx *types.Transaction) ([]any, error)

func UnpackBisectExecutionInput

func UnpackBisectExecutionInput(tx *types.Transaction) ([]any, error)

func UnpackCreateAssertionInput

func UnpackCreateAssertionInput(tx *types.Transaction) (common.Hash, *big.Int, error)

Types

type BridgeClient

type BridgeClient struct {
	*bindings.ISequencerInbox
	*bindings.IRollup
}

func DialWithRetry

func DialWithRetry(ctx context.Context, cfg L1Config) (*BridgeClient, error)

func NewBridgeClient

func NewBridgeClient(backend bind.ContractBackend, cfg L1Config) (*BridgeClient, error)

func (*BridgeClient) GetAssertion

func (c *BridgeClient) GetAssertion(ctx context.Context, assertionID *big.Int) (bindings.IRollupAssertion, error)

func (*BridgeClient) GetLastConfirmedAssertionID

func (c *BridgeClient) GetLastConfirmedAssertionID(ctx context.Context) (*big.Int, error)

func (*BridgeClient) GetRequiredStakeAmount

func (c *BridgeClient) GetRequiredStakeAmount(ctx context.Context) (*big.Int, error)

func (*BridgeClient) GetStaker

func (*BridgeClient) RequireFirstUnresolvedAssertionIsConfirmable

func (c *BridgeClient) RequireFirstUnresolvedAssertionIsConfirmable(ctx context.Context) error

type EthTxManager

type EthTxManager interface {
	Send(ctx context.Context, candidate txmgr.TxCandidate) (*types.Receipt, error)
}

type L1Config

type L1Config interface {
	GetEndpoint() string
	GetSequencerInboxAddr() common.Address
	GetRollupAddr() common.Address
}

type TxManager

type TxManager struct {
	EthTxManager
	// contains filtered or unexported fields
}

Adds bridge contract method bindings to EthTxManager.

func NewTxManager

func NewTxManager(txMgr EthTxManager, cfg bridgeConfig) (*TxManager, error)

func (*TxManager) AdvanceStake

func (m *TxManager) AdvanceStake(ctx context.Context, assertionID *big.Int) (*types.Receipt, error)

func (*TxManager) AppendTxBatch

func (m *TxManager) AppendTxBatch(
	ctx context.Context,
	contexts,
	txLengths []*big.Int,
	firstL2BlockNumber *big.Int,
	txBatchVersion *big.Int,
	txs []byte,
) (*types.Receipt, error)

func (*TxManager) ConfirmFirstUnresolvedAssertion

func (m *TxManager) ConfirmFirstUnresolvedAssertion(ctx context.Context) (*types.Receipt, error)

func (*TxManager) CreateAssertion

func (m *TxManager) CreateAssertion(ctx context.Context, vmHash common.Hash, inboxSize *big.Int) (*types.Receipt, error)

func (*TxManager) RejectFirstUnresolvedAssertion

func (m *TxManager) RejectFirstUnresolvedAssertion(ctx context.Context, stakerAddress common.Address) (*types.Receipt, error)

func (*TxManager) Stake

func (m *TxManager) Stake(ctx context.Context, stakeAmount *big.Int) (*types.Receipt, error)

Jump to

Keyboard shortcuts

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