ethbridge

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 24 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForBalance

func WaitForBalance(ctx context.Context, client ethutils.EthClient, tokenAddress common.Address, userAddress common.Address) error

func WaitForReceiptWithResults

func WaitForReceiptWithResults(ctx context.Context, client ethutils.EthClient, from ethcommon.Address, tx *types.Transaction, methodName string) (*types.Receipt, error)

func WaitForReceiptWithResultsSimple

func WaitForReceiptWithResultsSimple(ctx context.Context, client ethutils.ReceiptFetcher, txHash ethcommon.Hash) (*types.Receipt, error)

Types

type ArbAddresses

type ArbAddresses struct {
	ArbFactory string `json:"ArbFactory"`
}

func (ArbAddresses) ArbFactoryAddress

func (a ArbAddresses) ArbFactoryAddress() common.Address

type Bridge

type Bridge struct {
	*BridgeWatcher
	// contains filtered or unexported fields
}

func NewBridge

func NewBridge(address ethcommon.Address, client ethutils.EthClient, auth *TransactAuth) (*Bridge, error)

func (*Bridge) SendL2MessageFromOrigin

func (b *Bridge) SendL2MessageFromOrigin()

type BridgeWatcher

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

func NewBridgeWatcher

func NewBridgeWatcher(address ethcommon.Address, client ethutils.EthClient) (*BridgeWatcher, error)

func (*BridgeWatcher) CurrentBlockHeight

func (r *BridgeWatcher) CurrentBlockHeight(ctx context.Context) (*big.Int, error)

func (*BridgeWatcher) LookupMessageBlock

func (r *BridgeWatcher) LookupMessageBlock(ctx context.Context, messageNum *big.Int) (*common.BlockId, error)

func (*BridgeWatcher) LookupMessagesInRange

func (r *BridgeWatcher) LookupMessagesInRange(ctx context.Context, from, to *big.Int) ([]*DeliveredInboxMessage, error)

type BuilderBackend

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

func NewBuilderBackend

func NewBuilderBackend(wallet *ValidatorWallet) (*BuilderBackend, error)

func (*BuilderBackend) CallContract

func (b *BuilderBackend) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*BuilderBackend) ClearTransactions

func (b *BuilderBackend) ClearTransactions()

func (*BuilderBackend) CodeAt

func (b *BuilderBackend) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

func (*BuilderBackend) EstimateGas

func (b *BuilderBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

func (*BuilderBackend) FilterLogs

func (b *BuilderBackend) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*BuilderBackend) PendingCodeAt

func (b *BuilderBackend) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*BuilderBackend) PendingNonceAt

func (b *BuilderBackend) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*BuilderBackend) SendTransaction

func (b *BuilderBackend) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*BuilderBackend) SubscribeFilterLogs

func (b *BuilderBackend) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*BuilderBackend) SuggestGasPrice

func (b *BuilderBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*BuilderBackend) TransactionCount

func (b *BuilderBackend) TransactionCount() int

type Challenge

type Challenge struct {
	*ChallengeWatcher
	*BuilderBackend
	// contains filtered or unexported fields
}

func NewChallenge

func NewChallenge(address ethcommon.Address, client ethutils.EthClient, builder *BuilderBackend) (*Challenge, error)

func (*Challenge) BisectExecution

func (c *Challenge) BisectExecution(
	ctx context.Context,
	prevBisection *core.Bisection,
	segmentToChallenge int,
	challengedSegment *core.ChallengeSegment,
	subCuts []core.Cut,
) error

func (*Challenge) OneStepProveExecution

func (c *Challenge) OneStepProveExecution(
	ctx context.Context,
	prevBisection *core.Bisection,
	segmentToChallenge int,
	challengedSegment *core.ChallengeSegment,
	beforeCut *core.ExecutionState,
	executionProof []byte,
	bufferProof []byte,
	opcode uint8,
) error

func (*Challenge) ProveContinuedExecution

func (c *Challenge) ProveContinuedExecution(
	ctx context.Context,
	prevBisection *core.Bisection,
	segmentToChallenge int,
	challengedSegment *core.ChallengeSegment,
	beforeCut *core.ExecutionState,
) error

type ChallengeTurn

type ChallengeTurn uint8
const (
	NONE ChallengeTurn = iota
	ASSERTER_TURN
	CHALLENGER_TURN
)

type ChallengeWatcher

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

func NewChallengeWatcher

func NewChallengeWatcher(address ethcommon.Address, client ethutils.EthClient) (*ChallengeWatcher, error)

func (*ChallengeWatcher) Address

func (c *ChallengeWatcher) Address() common.Address

func (*ChallengeWatcher) Asserter

func (c *ChallengeWatcher) Asserter(ctx context.Context) (common.Address, error)

func (*ChallengeWatcher) ChallengeState

func (c *ChallengeWatcher) ChallengeState(ctx context.Context) (common.Hash, error)

func (*ChallengeWatcher) Challenger

func (c *ChallengeWatcher) Challenger(ctx context.Context) (common.Address, error)

func (*ChallengeWatcher) CurrentResponder

func (c *ChallengeWatcher) CurrentResponder(ctx context.Context) (common.Address, error)

func (*ChallengeWatcher) LookupBisection

func (c *ChallengeWatcher) LookupBisection(ctx context.Context, challengeState common.Hash) (*core.Bisection, error)

func (*ChallengeWatcher) Turn

type ConfirmType

type ConfirmType uint8
const (
	CONFIRM_TYPE_NONE ConfirmType = iota
	CONFIRM_TYPE_VALID
	CONFIRM_TYPE_INVALID
)

type ConflictType

type ConflictType uint8
const (
	CONFLICT_TYPE_NONE ConflictType = iota
	CONFLICT_TYPE_FOUND
	CONFLICT_TYPE_INDETERMINATE
	CONFLICT_TYPE_INCOMPLETE
)

type DeliveredInboxMessage

type DeliveredInboxMessage struct {
	BlockHash      common.Hash
	BeforeInboxAcc common.Hash
	Message        inbox.InboxMessage
}

func (*DeliveredInboxMessage) AfterInboxAcc

func (d *DeliveredInboxMessage) AfterInboxAcc() common.Hash

func (*DeliveredInboxMessage) Block

func (d *DeliveredInboxMessage) Block() *common.BlockId

type DeliveredInboxMessageList

type DeliveredInboxMessageList []*DeliveredInboxMessage

func (DeliveredInboxMessageList) Len

func (DeliveredInboxMessageList) Less

func (d DeliveredInboxMessageList) Less(i, j int) bool

func (DeliveredInboxMessageList) Swap

func (d DeliveredInboxMessageList) Swap(i, j int)

type InboxMessageGetter

type InboxMessageGetter interface {
	// contains filtered or unexported methods
}

type NodeWatcher

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

func NewNodeWatcher

func NewNodeWatcher(address ethcommon.Address, client ethutils.EthClient) (*NodeWatcher, error)

func (*NodeWatcher) DeadlineBlock

func (n *NodeWatcher) DeadlineBlock(ctx context.Context) (*big.Int, error)

func (*NodeWatcher) Prev

func (n *NodeWatcher) Prev(ctx context.Context) (*big.Int, error)

func (*NodeWatcher) StakerCount

func (n *NodeWatcher) StakerCount(ctx context.Context) (*big.Int, error)

type RawTransaction

type RawTransaction struct {
	Data   []byte
	Dest   ethcommon.Address
	Amount *big.Int
}

type Rollup

type Rollup struct {
	*RollupWatcher
	*BuilderBackend
	// contains filtered or unexported fields
}

func NewRollup

func NewRollup(address ethcommon.Address, client ethutils.EthClient, builder *BuilderBackend) (*Rollup, error)

func (*Rollup) AddToDeposit

func (r *Rollup) AddToDeposit(ctx context.Context, address common.Address, amount *big.Int) error

func (*Rollup) ConfirmNextNode

func (r *Rollup) ConfirmNextNode(ctx context.Context, assertion *core.Assertion, sends [][]byte) error

func (*Rollup) CreateChallenge

func (r *Rollup) CreateChallenge(
	ctx context.Context,
	staker1 common.Address,
	node1 *core.NodeInfo,
	staker2 common.Address,
	node2 *core.NodeInfo,
) error

func (*Rollup) NewStake

func (r *Rollup) NewStake(ctx context.Context, amount *big.Int) error

func (*Rollup) ReduceDeposit

func (r *Rollup) ReduceDeposit(ctx context.Context, amount *big.Int) error

func (*Rollup) RejectNextNode

func (r *Rollup) RejectNextNode(ctx context.Context, staker common.Address) error

func (*Rollup) RemoveOldZombies

func (r *Rollup) RemoveOldZombies(ctx context.Context, startIndex *big.Int) error

func (*Rollup) RemoveZombie

func (r *Rollup) RemoveZombie(ctx context.Context, zombieNum *big.Int, maxNodes *big.Int) error

func (*Rollup) ReturnOldDeposit

func (r *Rollup) ReturnOldDeposit(ctx context.Context, staker common.Address) error

func (*Rollup) StakeOnExistingNode

func (r *Rollup) StakeOnExistingNode(ctx context.Context, nodeNumber core.NodeID, nodeHash [32]byte) error

func (*Rollup) StakeOnNewNode

func (r *Rollup) StakeOnNewNode(
	ctx context.Context,
	nodeHash [32]byte,
	assertion *core.Assertion,
	prevProposedBlock *big.Int,
	prevInboxMaxCount *big.Int,
) error

type RollupConfig

type RollupConfig struct {
	ConfirmPeriodBlocks      *big.Int
	ExtraChallengeTimeBlocks *big.Int
	ArbGasSpeedLimitPerBlock *big.Int
	BaseStake                *big.Int
	StakeToken               common.Address
}

type RollupWatcher

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

func NewRollupWatcher

func NewRollupWatcher(address ethcommon.Address, client ethutils.EthClient) (*RollupWatcher, error)

func (*RollupWatcher) ArbGasSpeedLimitPerBlock

func (r *RollupWatcher) ArbGasSpeedLimitPerBlock(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) BaseStake

func (r *RollupWatcher) BaseStake(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) Bridge

func (r *RollupWatcher) Bridge(ctx context.Context) (common.Address, error)

func (*RollupWatcher) ConfirmPeriodBlocks

func (r *RollupWatcher) ConfirmPeriodBlocks(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) CurrentRequiredStake

func (r *RollupWatcher) CurrentRequiredStake(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) FirstUnresolvedNode

func (r *RollupWatcher) FirstUnresolvedNode(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) GetNode

func (r *RollupWatcher) GetNode(ctx context.Context, node core.NodeID) (*NodeWatcher, error)

func (*RollupWatcher) LatestConfirmedNode

func (r *RollupWatcher) LatestConfirmedNode(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) LatestNodeCreated

func (r *RollupWatcher) LatestNodeCreated(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) LookupChallengedNode

func (r *RollupWatcher) LookupChallengedNode(ctx context.Context, address common.Address) (*big.Int, error)

func (*RollupWatcher) LookupCreation

func (*RollupWatcher) LookupNode

func (r *RollupWatcher) LookupNode(ctx context.Context, number *big.Int) (*core.NodeInfo, error)

func (*RollupWatcher) LookupNodeChildren

func (r *RollupWatcher) LookupNodeChildren(ctx context.Context, parentHash [32]byte, fromBlock *big.Int) ([]*core.NodeInfo, error)

func (*RollupWatcher) MinimumAssertionPeriod

func (r *RollupWatcher) MinimumAssertionPeriod(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) StakeToken

func (r *RollupWatcher) StakeToken(ctx context.Context) (common.Address, error)

func (*RollupWatcher) StakerCount

func (r *RollupWatcher) StakerCount(ctx context.Context) (*big.Int, error)

func (*RollupWatcher) StakerInfo

func (r *RollupWatcher) StakerInfo(ctx context.Context, staker common.Address) (*StakerInfo, error)

type StakerInfo

type StakerInfo struct {
	Index            *big.Int
	LatestStakedNode *big.Int
	AmountStaked     *big.Int
	CurrentChallenge *common.Address
}

type StandardInbox

type StandardInbox struct {
	*StandardInboxWatcher
	// contains filtered or unexported fields
}

func NewStandardInbox

func NewStandardInbox(address ethcommon.Address, client ethutils.EthClient, auth *TransactAuth) (*StandardInbox, error)

func (*StandardInbox) SendL2MessageFromOrigin

func (s *StandardInbox) SendL2MessageFromOrigin(ctx context.Context, data []byte) (common.Hash, error)

type StandardInboxWatcher

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

func NewStandardInboxWatcher

func NewStandardInboxWatcher(address ethcommon.Address, client ethutils.EthClient) (*StandardInboxWatcher, error)

type TransactAuth

type TransactAuth struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTransactAuth

func NewTransactAuth(auth *bind.TransactOpts) *TransactAuth

type ValidatorUtils

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

func NewValidatorUtils

func NewValidatorUtils(address, rollupAddress ethcommon.Address, client ethutils.EthClient) (*ValidatorUtils, error)

func (*ValidatorUtils) AreUnresolvedNodesLinear

func (v *ValidatorUtils) AreUnresolvedNodesLinear(ctx context.Context) (bool, error)

func (*ValidatorUtils) CheckDecidableNextNode

func (v *ValidatorUtils) CheckDecidableNextNode(ctx context.Context) (ConfirmType, error)

func (*ValidatorUtils) FindStakerConflict

func (v *ValidatorUtils) FindStakerConflict(ctx context.Context, staker1, staker2 common.Address) (ConflictType, *big.Int, *big.Int, error)

func (*ValidatorUtils) GetConfig

func (v *ValidatorUtils) GetConfig(ctx context.Context) (*RollupConfig, error)

func (*ValidatorUtils) GetStakers

func (v *ValidatorUtils) GetStakers(ctx context.Context) ([]common.Address, error)

func (*ValidatorUtils) LatestStaked

func (v *ValidatorUtils) LatestStaked(ctx context.Context, staker common.Address) (*big.Int, [32]byte, error)

func (*ValidatorUtils) RefundableStakers

func (v *ValidatorUtils) RefundableStakers(ctx context.Context) ([]common.Address, error)

func (*ValidatorUtils) StakedNodes

func (v *ValidatorUtils) StakedNodes(ctx context.Context, staker common.Address) ([]*big.Int, error)

func (*ValidatorUtils) TimedOutChallenges

func (v *ValidatorUtils) TimedOutChallenges(ctx context.Context, max int) ([]common.Address, error)

type ValidatorWallet

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

func NewValidator

func NewValidator(address, rollupAddress ethcommon.Address, client ethutils.EthClient, auth *TransactAuth) (*ValidatorWallet, error)

func (*ValidatorWallet) Address

func (v *ValidatorWallet) Address() common.Address

func (*ValidatorWallet) ExecuteTransactions

func (v *ValidatorWallet) ExecuteTransactions(ctx context.Context, builder *BuilderBackend) (*types.Transaction, error)

func (*ValidatorWallet) From

func (v *ValidatorWallet) From() common.Address

func (*ValidatorWallet) ReturnOldDeposits

func (v *ValidatorWallet) ReturnOldDeposits(ctx context.Context, stakers []common.Address) (*types.Transaction, error)

func (*ValidatorWallet) RollupAddress

func (v *ValidatorWallet) RollupAddress() common.Address

func (*ValidatorWallet) TimeoutChallenges

func (v *ValidatorWallet) TimeoutChallenges(ctx context.Context, challenges []common.Address) (*types.Transaction, error)

Jump to

Keyboard shortcuts

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