fault

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotInSync = errors.New("local node too far behind")

Functions

This section is empty.

Types

type Agent

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

func NewAgent

func NewAgent(
	m metrics.Metricer,
	systemClock clock.Clock,
	l1Clock types.ClockReader,
	loader ClaimLoader,
	maxDepth types.Depth,
	maxClockDuration time.Duration,
	trace types.TraceAccessor,
	responder Responder,
	log log.Logger,
	selective bool,
	claimants []common.Address,
) *Agent

func (*Agent) Act

func (a *Agent) Act(ctx context.Context) error

Act iterates the game & performs all of the next actions.

type ClaimLoader

type ClaimLoader interface {
	GetAllClaims(ctx context.Context, block rpcblock.Block) ([]types.Claim, error)
	IsL2BlockNumberChallenged(ctx context.Context, block rpcblock.Block) (bool, error)
}

type CloseFunc added in v1.4.2

type CloseFunc func()

func RegisterGameTypes added in v1.4.2

func RegisterGameTypes(
	ctx context.Context,
	systemClock clock.Clock,
	l1Clock faultTypes.ClockReader,
	logger log.Logger,
	m metrics.Metricer,
	cfg *config.Config,
	registry Registry,
	oracles OracleRegistry,
	rollupClient RollupClient,
	txSender TxSender,
	gameFactory *contracts.DisputeGameFactoryContract,
	caller *batching.MultiCaller,
	l1HeaderSource L1HeaderSource,
	selective bool,
	claimants []common.Address,
) (CloseFunc, error)

type GameContract added in v1.4.2

type GameInfo

type GameInfo interface {
	GetStatus(context.Context) (gameTypes.GameStatus, error)
	GetClaimCount(context.Context) (uint64, error)
}

type GamePlayer

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

func NewGamePlayer

func NewGamePlayer(
	ctx context.Context,
	systemClock clock.Clock,
	l1Clock types.ClockReader,
	logger log.Logger,
	m metrics.Metricer,
	dir string,
	addr common.Address,
	txSender TxSender,
	loader GameContract,
	syncValidator SyncValidator,
	validators []Validator,
	creator resourceCreator,
	l1HeaderSource L1HeaderSource,
	selective bool,
	claimants []common.Address,
) (*GamePlayer, error)

func (*GamePlayer) ProgressGame

func (g *GamePlayer) ProgressGame(ctx context.Context) gameTypes.GameStatus

func (*GamePlayer) Status

func (g *GamePlayer) Status() gameTypes.GameStatus

func (*GamePlayer) ValidatePrestate added in v1.4.2

func (g *GamePlayer) ValidatePrestate(ctx context.Context) error

type L1HeaderSource added in v1.7.0

type L1HeaderSource interface {
	HeaderByHash(context.Context, common.Hash) (*gethTypes.Header, error)
}

type OracleRegistry added in v1.7.2

type OracleRegistry interface {
	RegisterOracle(oracle keccakTypes.LargePreimageOracle)
}

type PrestateLoader

type PrestateLoader = func(ctx context.Context) (common.Hash, error)

type PrestateSource added in v1.7.6

type PrestateSource interface {
	// PrestatePath returns the path to the prestate file to use for the game.
	// The provided prestateHash may be used to differentiate between different states but no guarantee is made that
	// the returned prestate matches the supplied hash.
	PrestatePath(ctx context.Context, prestateHash common.Hash) (string, error)
}

type PrestateValidator added in v1.4.2

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

func NewPrestateValidator added in v1.4.2

func NewPrestateValidator(valueName string, contractProvider PrestateLoader, localProvider types.PrestateProvider) *PrestateValidator

func (*PrestateValidator) Validate added in v1.4.2

func (v *PrestateValidator) Validate(ctx context.Context) error

type RegisterTask added in v1.9.1

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

func NewAlphabetRegisterTask added in v1.9.1

func NewAlphabetRegisterTask(gameType faultTypes.GameType) *RegisterTask

func NewAsteriscKonaRegisterTask added in v1.9.3

func NewAsteriscKonaRegisterTask(gameType faultTypes.GameType, cfg *config.Config, m caching.Metrics, serverExecutor vm.OracleServerExecutor) *RegisterTask

func NewAsteriscRegisterTask added in v1.9.1

func NewAsteriscRegisterTask(gameType faultTypes.GameType, cfg *config.Config, m caching.Metrics, serverExecutor vm.OracleServerExecutor) *RegisterTask

func NewCannonRegisterTask added in v1.9.1

func NewCannonRegisterTask(gameType faultTypes.GameType, cfg *config.Config, m caching.Metrics, serverExecutor vm.OracleServerExecutor) *RegisterTask

func (*RegisterTask) Register added in v1.9.1

func (e *RegisterTask) Register(
	ctx context.Context,
	registry Registry,
	oracles OracleRegistry,
	systemClock clock.Clock,
	l1Clock faultTypes.ClockReader,
	logger log.Logger,
	m metrics.Metricer,
	syncValidator SyncValidator,
	rollupClient outputs.OutputRollupClient,
	txSender TxSender,
	gameFactory *contracts.DisputeGameFactoryContract,
	caller *batching.MultiCaller,
	l2Client utils.L2HeaderSource,
	l1HeaderSource L1HeaderSource,
	selective bool,
	claimants []common.Address) error

type Registry added in v1.4.2

type Registry interface {
	RegisterGameType(gameType faultTypes.GameType, creator scheduler.PlayerCreator)
	RegisterBondContract(gameType faultTypes.GameType, creator claims.BondContractCreator)
}

type Responder

type Responder interface {
	CallResolve(ctx context.Context) (gameTypes.GameStatus, error)
	Resolve() error
	CallResolveClaim(ctx context.Context, claimIdx uint64) error
	ResolveClaims(claimIdx ...uint64) error
	PerformAction(ctx context.Context, action types.Action) error
}

Responder takes a response action & executes. For full op-challenger this means executing the transaction on chain.

type RollupClient added in v1.7.0

type RollupClient interface {
	outputs.OutputRollupClient
	SyncStatusProvider
}

type SyncStatusProvider added in v1.7.0

type SyncStatusProvider interface {
	SyncStatus(context.Context) (*eth.SyncStatus, error)
}

type SyncValidator added in v1.7.0

type SyncValidator interface {
	ValidateNodeSynced(ctx context.Context, gameL1Head eth.BlockID) error
}

type TxSender added in v1.7.3

type TxSender interface {
	From() common.Address
	SendAndWaitSimple(txPurpose string, txs ...txmgr.TxCandidate) error
}

type Validator added in v1.4.2

type Validator interface {
	Validate(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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