e2e

package
v1.0.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 68 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DummyHashSepolia = "0xaf01bc158f9b35867aea1517e84cf67eedc6a397c0df380b4b139eb570ddb2fc"
	DummyHashDev     = "0xa1235b834d6f1f78f78bc4db856fbc49302cce2c519921347600693021e087f7"
)

Variables

View Source
var (
	// ErrForkChoiceUpdatedNotValid is returned when a forkChoiceUpdated returns a status other than Valid
	ErrForkChoiceUpdatedNotValid = errors.New("forkChoiceUpdated status was not valid")
	// ErrNewPayloadNotValid is returned when a newPayload call returns a status other than Valid, indicating the new block is invalid
	ErrNewPayloadNotValid = errors.New("newPayload status was not valid")
)

Functions

This section is empty.

Types

type DepositContractConfig

type DepositContractConfig struct {
	L2Oracle           common.Address
	FinalizationPeriod *big.Int
}

type FnTracer

type FnTracer struct {
	OnNewL1HeadFn        func(ctx context.Context, sig eth.L1BlockRef)
	OnUnsafeL2PayloadFn  func(ctx context.Context, from peer.ID, payload *eth.ExecutionPayload)
	OnPublishL2PayloadFn func(ctx context.Context, payload *eth.ExecutionPayload)
}

func (*FnTracer) OnNewL1Head

func (n *FnTracer) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)

func (*FnTracer) OnPublishL2Payload

func (n *FnTracer) OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayload)

func (*FnTracer) OnUnsafeL2Payload

func (n *FnTracer) OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayload)

type GethOption

type GethOption func(ethCfg *ethconfig.Config, nodeCfg *node.Config) error

type KromaGeth

type KromaGeth struct {
	L2Client      *ethclient.Client
	SystemConfig  eth.SystemConfig
	L1ChainConfig *params.ChainConfig
	L2ChainConfig *params.ChainConfig
	L1Head        eth.BlockInfo
	L2Head        *eth.ExecutionPayload
	// contains filtered or unexported fields
}

KromaGeth is an actor that functions as a l2 kroma-geth node It provides useful functions for advancing and querying the chain

func NewKromaGeth

func NewKromaGeth(t *testing.T, ctx context.Context, cfg *SystemConfig) (*KromaGeth, error)

func (*KromaGeth) AddL2Block

func (d *KromaGeth) AddL2Block(ctx context.Context, txs ...*types.Transaction) (*eth.ExecutionPayload, error)

AddL2Block Appends a new L2 block to the current chain including the specified transactions The L1Info transaction is automatically prepended to the created block

func (*KromaGeth) Close

func (d *KromaGeth) Close()

func (*KromaGeth) CreatePayloadAttributes

func (d *KromaGeth) CreatePayloadAttributes(txs ...*types.Transaction) (*eth.PayloadAttributes, error)

CreatePayloadAttributes creates a valid PayloadAttributes containing a L1Info deposit transaction followed by the supplied transactions.

func (*KromaGeth) StartBlockBuilding

func (d *KromaGeth) StartBlockBuilding(ctx context.Context, attrs *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)

StartBlockBuilding begins block building for the specified PayloadAttributes by sending a engine_forkChoiceUpdated call. The current L2Head is used as the parent of the new block. ErrForkChoiceUpdatedNotValid is returned if the forkChoiceUpdate call returns a status other than valid.

type System

type System struct {
	RollupConfig *rollup.Config

	L2GenesisCfg *core.Genesis

	// Connections to running nodes
	Nodes       map[string]*node.Node
	Backends    map[string]*geth_eth.Ethereum
	Clients     map[string]*ethclient.Client
	RollupNodes map[string]*rollupNode.KromaNode
	Validator   *validator.Validator
	Challenger  *validator.Validator
	Batcher     *batcher.Batcher
	Mocknet     mocknet.Mocknet
	// contains filtered or unexported fields
}

func (*System) Close

func (sys *System) Close()

type SystemConfig

type SystemConfig struct {
	Secrets                *e2eutils.Secrets
	L1InfoPredeployAddress common.Address

	DeployConfig *genesis.DeployConfig

	JWTFilePath string
	JWTSecret   [32]byte

	Premine         map[common.Address]*big.Int
	Nodes           map[string]*rollupNode.Config // Per node config. Don't use populate rollup.Config
	Loggers         map[string]log.Logger
	GethOptions     map[string][]GethOption
	ValidatorLogger log.Logger
	BatcherLogger   log.Logger

	// map of outbound connections to other nodes. Node names prefixed with "~" are unconnected but linked.
	// A nil map disables P2P completely.
	// Any node name not in the topology will not have p2p enabled.
	P2PTopology map[string][]string

	// Enables req-resp sync in the P2P nodes
	P2PReqRespSync bool

	// If the validator can make outputs for L2 blocks derived from L1 blocks which are not finalized on L1 yet.
	NonFinalizedOutputs bool

	// Explicitly disable batcher, for tests that rely on unsafe L2 payloads
	DisableBatcher bool

	// TODO(0xHansLee): temporal flag for malicious validator. If it is set true, the validator acts as a malicious one
	EnableMaliciousValidator bool

	EnableGuardian bool
}

func DefaultSystemConfig

func DefaultSystemConfig(t *testing.T) SystemConfig

func (SystemConfig) DepositValidatorPool

func (cfg SystemConfig) DepositValidatorPool(l1Client *ethclient.Client, priv *ecdsa.PrivateKey, value *big.Int) error

func (SystemConfig) L1ChainIDBig

func (cfg SystemConfig) L1ChainIDBig() *big.Int

func (SystemConfig) L2ChainIDBig

func (cfg SystemConfig) L2ChainIDBig() *big.Int

func (SystemConfig) SendTransferTx

func (cfg SystemConfig) SendTransferTx(l2Seq *ethclient.Client, l2Sync *ethclient.Client) (*types.Receipt, error)

func (SystemConfig) Start

func (cfg SystemConfig) Start(_opts ...SystemConfigOption) (*System, error)

type SystemConfigOption

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

type SystemConfigOptions

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

func NewSystemConfigOptions

func NewSystemConfigOptions(_opts []SystemConfigOption) (SystemConfigOptions, error)

func (*SystemConfigOptions) Get

func (s *SystemConfigOptions) Get(key, role string) (systemConfigHook, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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