L1

package
v0.0.0-...-00d0827 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIv3

type APIv3 interface {
	api_v3.Querier
	api_v3.NetworkService
	api_v3.Submitter
}

type App

type App interface {
	// Init returns the app configuration.
	Init() (*AppConfig, error)

	// ShouldExecute determines if L1 should execute or should skip this block.
	// This is where the app should pull accounts with the light client.
	ShouldExecute(*AppContext) (bool, error)

	// Execute returns a list of transactions that should be executed.
	Execute(*AppContext) ([]*protocol.Transaction, error)
}

type AppConfig

type AppConfig struct {
	Validators *url.URL
}

type AppContext

type AppContext struct {
	context.Context
	Light    *light.Client
	Block    BlockInfo
	Previous BlockInfo
	AppData  any
}

type Begin

type Begin struct{}

type BlockInfo

type BlockInfo struct {
	Index uint64
	Time  time.Time
	Major uint64
}

type Context

type Context struct {
	AppContext
	Executor        *Executor
	Validator       bool
	Leader          bool
	Actions         []*protocol.Transaction
	Pending         map[[32]byte]*protocol.Transaction
	BlockHash       [32]byte
	Attempts        int
	ProtocolVersion protocol.ExecutorVersion
}

func (*Context) Fatal

func (c *Context) Fatal(code errors.Status) stateErrorBuilder

func (*Context) TryAgain

func (c *Context) TryAgain(code errors.Status) stateErrorBuilder

type Delegate

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

type DidInitiateTxn

type DidInitiateTxn struct{}

type DidSignTxn

type DidSignTxn struct{}

type ExecuteApp

type ExecuteApp struct{}

type Executor

type Executor struct {
	App    App
	Key    ed25519.PrivateKey
	Config *AppConfig
	API    APIv3

	CurrentState Delegate
	LastError    error
}

type FatalError

type FatalError struct{}

type InitiateTxn

type InitiateTxn struct{}

type Reset

type Reset struct{}

type SelectLeader

type SelectLeader struct{}

type SignTxn

type SignTxn struct{}

type State

type State int
const StateBegin State = 1

StateBegin .

const StateDidInitiateTxn State = 5

StateDidInitiateTxn .

const StateDidSignTxn State = 7

StateDidSignTxn .

const StateExecuteApp State = 3

StateExecuteApp .

const StateFatalError State = 201

StateFatalError .

const StateInitiateTxn State = 4

StateInitiateTxn .

const StateReset State = 8

StateReset .

const StateSelectLeader State = 2

StateSelectLeader .

const StateSignTxn State = 6

StateSignTxn .

const StateTryAgainError State = 202

StateTryAgainError .

func StateByName

func StateByName(name string) (State, bool)

StateByName returns the named State.

func (State) GetEnumValue

func (v State) GetEnumValue() uint64

GetEnumValue returns the value of the State

func (State) MarshalJSON

func (v State) MarshalJSON() ([]byte, error)

MarshalJSON marshals the State to JSON as a string.

func (*State) SetEnumValue

func (v *State) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (State) String

func (v State) String() string

String returns the name of the State.

func (*State) UnmarshalJSON

func (v *State) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the State from JSON as a string.

type TryAgainError

type TryAgainError struct{}

Jump to

Keyboard shortcuts

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