chainlistener

package
v0.7.4-0...-66d0465 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PruneSizeLimit = 120
)

Variables

This section is empty.

Functions

func LogChallengeResult

func LogChallengeResult(err error)

func MakeAssertion

func MakeAssertion(
	ctx context.Context,
	rollup arbbridge.ArbRollup,
	prepared *PreparedAssertion,
	proof []common.Hash,
) ([]arbbridge.Event, error)

Types

type AnnouncerListener

type AnnouncerListener struct {
	Prefix string
}

func (*AnnouncerListener) AddedToChain

func (al *AnnouncerListener) AddedToChain(context.Context, []*structures.Node)

func (*AnnouncerListener) AdvancedKnownNode

func (*AnnouncerListener) CompletedChallenge

func (al *AnnouncerListener) CompletedChallenge(
	ctx context.Context,
	ng *nodegraph.StakedNodeGraph,
	event arbbridge.ChallengeCompletedEvent,
)

func (*AnnouncerListener) ConfirmableNodes

func (*AnnouncerListener) ConfirmedNode

func (al *AnnouncerListener) ConfirmedNode(ctx context.Context, ev arbbridge.ConfirmedEvent)

func (*AnnouncerListener) MessageDelivered

func (al *AnnouncerListener) MessageDelivered(_ context.Context, ev arbbridge.MessageDeliveredEvent)

func (*AnnouncerListener) MootableStakes

func (*AnnouncerListener) OldStakes

func (*AnnouncerListener) PrunableLeafs

func (*AnnouncerListener) PrunedLeaf

func (al *AnnouncerListener) PrunedLeaf(ctx context.Context, ev arbbridge.PrunedEvent)

func (*AnnouncerListener) RestartingFromLatestValid

func (al *AnnouncerListener) RestartingFromLatestValid(context.Context, *structures.Node)

func (*AnnouncerListener) ResumedChallenge

func (*AnnouncerListener) SawAssertion

func (al *AnnouncerListener) SawAssertion(ctx context.Context, ev arbbridge.AssertedEvent)

func (*AnnouncerListener) StakeCreated

func (*AnnouncerListener) StakeMoved

func (*AnnouncerListener) StakeRemoved

func (al *AnnouncerListener) StakeRemoved(ctx context.Context, ev arbbridge.StakeRefundedEvent)

func (*AnnouncerListener) StartedChallenge

type ChainListener

type ChainListener interface {
	// This function is called when a ChainListener is added to a ChainObserver
	AddedToChain(context.Context, []*structures.Node)

	// This function is called every time ChainObserver starts running. This
	// includes both the initial run, and after a reorg. The third parameter
	// is the current calculated valid node
	RestartingFromLatestValid(context.Context, *structures.Node)
	StakeCreated(context.Context, *nodegraph.StakedNodeGraph, arbbridge.StakeCreatedEvent)
	StakeRemoved(context.Context, arbbridge.StakeRefundedEvent)
	StakeMoved(context.Context, *nodegraph.StakedNodeGraph, arbbridge.StakeMovedEvent)
	StartedChallenge(
		context.Context,
		*structures.MessageStack,
		*nodegraph.Challenge)
	ResumedChallenge(
		context.Context,
		*structures.MessageStack,
		*nodegraph.Challenge)
	CompletedChallenge(context.Context, *nodegraph.StakedNodeGraph, arbbridge.ChallengeCompletedEvent)
	SawAssertion(context.Context, arbbridge.AssertedEvent)
	ConfirmedNode(context.Context, arbbridge.ConfirmedEvent)
	PrunedLeaf(context.Context, arbbridge.PrunedEvent)
	MessageDelivered(context.Context, arbbridge.MessageDeliveredEvent)
	AssertionPrepared(
		context.Context,
		valprotocol.ChainParams,
		*nodegraph.StakedNodeGraph,
		*structures.Node,
		*PreparedAssertion)
	ConfirmableNodes(context.Context, *valprotocol.ConfirmOpportunity)
	PrunableLeafs(context.Context, []valprotocol.PruneParams)
	MootableStakes(context.Context, []nodegraph.RecoverStakeMootedParams)
	OldStakes(context.Context, []nodegraph.RecoverStakeOldParams)

	AdvancedKnownNode(context.Context, *nodegraph.StakedNodeGraph, *structures.Node)
}

type NoopListener

type NoopListener struct{}

func (*NoopListener) AddedToChain

func (nl *NoopListener) AddedToChain(context.Context, []*structures.Node)

func (NoopListener) AdvancedKnownNode

func (NoopListener) ConfirmableNodes

func (NoopListener) ConfirmedNode

func (NoopListener) MessageDelivered

func (NoopListener) MootableStakes

func (NoopListener) OldStakes

func (NoopListener) PrunableLeafs

func (NoopListener) PrunedLeaf

func (*NoopListener) RestartingFromLatestValid

func (nl *NoopListener) RestartingFromLatestValid(context.Context, *structures.Node)

func (NoopListener) ResumedChallenge

func (NoopListener) SawAssertion

func (NoopListener) StakeRemoved

func (NoopListener) StartedChallenge

type PreparedAssertion

type PreparedAssertion struct {
	Prev          *structures.Node
	BeforeState   *valprotocol.VMProtoData
	Params        *valprotocol.AssertionParams
	AssertionStub *valprotocol.ExecutionAssertionStub
	Assertion     *protocol.ExecutionAssertion
	Machine       machine.Machine
	ValidBlock    *common.BlockId
}

func (*PreparedAssertion) Clone

func (pa *PreparedAssertion) Clone() *PreparedAssertion

func (*PreparedAssertion) GetAssertionParams

func (prep *PreparedAssertion) GetAssertionParams() [8][32]byte

func (*PreparedAssertion) GetAssertionParams2

func (prep *PreparedAssertion) GetAssertionParams2() [5]*big.Int

func (*PreparedAssertion) String

func (pa *PreparedAssertion) String() string

type StakingKey

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

type ValidatorChainListener

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

func NewValidatorChainListener

func NewValidatorChainListener(
	ctx context.Context,
	rollupAddress common.Address,
	actor arbbridge.ArbRollup,
) *ValidatorChainListener

func (*ValidatorChainListener) AddStaker

func (lis *ValidatorChainListener) AddStaker(client arbbridge.ArbAuthClient) error

func (*ValidatorChainListener) AddedToChain

func (lis *ValidatorChainListener) AddedToChain(context.Context, []*structures.Node)

func (*ValidatorChainListener) AdvancedKnownNode

func (lis *ValidatorChainListener) AdvancedKnownNode(
	ctx context.Context,
	nodeGraph *nodegraph.StakedNodeGraph,
	node *structures.Node)

func (*ValidatorChainListener) AssertionPrepared

func (lis *ValidatorChainListener) AssertionPrepared(
	ctx context.Context,
	_ valprotocol.ChainParams,
	nodeGraph *nodegraph.StakedNodeGraph,
	nodeLocation *structures.Node,
	prepared *PreparedAssertion,
)

func (*ValidatorChainListener) CompletedChallenge

func (lis *ValidatorChainListener) CompletedChallenge(
	ctx context.Context,
	nodeGraph *nodegraph.StakedNodeGraph,
	ev arbbridge.ChallengeCompletedEvent,
)

func (*ValidatorChainListener) ConfirmableNodes

func (lis *ValidatorChainListener) ConfirmableNodes(ctx context.Context, conf *valprotocol.ConfirmOpportunity)

func (*ValidatorChainListener) ConfirmedNode

func (*ValidatorChainListener) MessageDelivered

func (*ValidatorChainListener) MootableStakes

func (lis *ValidatorChainListener) MootableStakes(ctx context.Context, params []nodegraph.RecoverStakeMootedParams)

func (*ValidatorChainListener) OldStakes

func (*ValidatorChainListener) PrunableLeafs

func (lis *ValidatorChainListener) PrunableLeafs(ctx context.Context, params []valprotocol.PruneParams)

func (*ValidatorChainListener) PrunedLeaf

func (*ValidatorChainListener) RestartingFromLatestValid

func (lis *ValidatorChainListener) RestartingFromLatestValid(context.Context, *structures.Node)

func (*ValidatorChainListener) ResumedChallenge

func (lis *ValidatorChainListener) ResumedChallenge(
	ctx context.Context,
	msgStack *structures.MessageStack,
	chal *nodegraph.Challenge)

func (*ValidatorChainListener) SawAssertion

func (*ValidatorChainListener) StakeCreated

func (*ValidatorChainListener) StakeMoved

func (*ValidatorChainListener) StakeRemoved

func (*ValidatorChainListener) StartedChallenge

func (lis *ValidatorChainListener) StartedChallenge(
	ctx context.Context,
	msgStack *structures.MessageStack,
	chal *nodegraph.Challenge)

Jump to

Keyboard shortcuts

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