services

package
v0.0.0-...-5cda5f8 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NODE_SCHEDULER = "scheduler"
	NODE_VERIFIER  = "verifier"
)

Variables

This section is empty.

Functions

func BuildVerificationContext

func BuildVerificationContext(ctx context.Context, proofBackend proof.Backend, state *proof.ExecutionState) (*bindings.VerificationContextContext, error)

func MidLen

func MidLen(segLen uint64) uint64

MidLen middle index with ceil

func MidLenWithMod

func MidLenWithMod(segLen uint64) uint64

MidLenWithMod middle index with ceil

func MidState

func MidState(states []*proof.ExecutionState, segStart, segLen uint64) common.Hash

MidState mid-states with floor index

func RespondBisection

func RespondBisection(
	b *BaseService,
	challengeSession *bindings.ChallengeSession,
	ev *bindings.ChallengeBisected,
	states []*proof.ExecutionState,
) error

Responder -> startStateHash, endStateHash

func SubmitOneStepProof

func SubmitOneStepProof(
	challengeSession *bindings.ChallengeSession,
	proofBackend proof.Backend,
	ctx context.Context,
	state *proof.ExecutionState,
	challengedStepIndex *big.Int,
	prevChallengedSegmentStart *big.Int,
	prevChallengedSegmentLength *big.Int,
) error

Types

type Backend

type Backend interface {
	BlockChain() *core.BlockChain
	TxPool() *core.TxPool
	StateAtBlock(block *types.Block, reexec uint64, base *state.StateDB, checkLive bool, preferDisk bool) (statedb *state.StateDB, err error)
}

Required interface for interacting with Ethereum instance

type BaseService

type BaseService struct {
	Config *Config

	Eth          Backend
	ProofBackend proof.Backend
	Chain        *core.BlockChain
	L1           *ethclient.Client
	TransactOpts *bind.TransactOpts
	Rollup       *bindings.RollupSession
	AssertionMap *bindings.AssertionMapCallerSession

	Ctx    context.Context
	Cancel context.CancelFunc
	Wg     sync.WaitGroup
}

func NewBaseService

func NewBaseService(eth Backend, proofBackend proof.Backend, cfg *Config, auth *bind.TransactOpts) (*BaseService, error)

func (*BaseService) Start

func (b *BaseService) Start(cleanL1, stake bool) *types.Block

type Config

type Config struct {
	Node            string         // Rollup node type, either sequencer or validator
	Passphrase      string         // The passphrase of the coinbase account
	L1Endpoint      string         // L1 API endpoint
	L1ChainID       uint64         // L1 chain ID
	L1Confirmations uint64         // L1 confirmation block number
	SequencerAddr   common.Address // Validator only
	RollupAddr      common.Address // L1 Rollup contract address
	StakeAddr       common.Address // The account used for rollup assertion stake
	StakeAmount     uint64         // Amount of stake
	ChallengeVerify bool
	EnableHsm       bool
	HsmAPIName      string
	HsmCreden       string
	HsmAddress      string
}

Config is the configuration of rollup services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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