helpers

package
v1.16.5 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Regolith = &Hardfork{Name: string(forks.Regolith), Precedence: 1}
	Canyon   = &Hardfork{Name: string(forks.Canyon), Precedence: 2}
	Delta    = &Hardfork{Name: string(forks.Delta), Precedence: 3}
	Ecotone  = &Hardfork{Name: string(forks.Ecotone), Precedence: 4}
	Fjord    = &Hardfork{Name: string(forks.Fjord), Precedence: 5}
	Granite  = &Hardfork{Name: string(forks.Granite), Precedence: 6}
	Holocene = &Hardfork{Name: string(forks.Holocene), Precedence: 7}
	Isthmus  = &Hardfork{Name: string(forks.Isthmus), Precedence: 8}
	Jovian   = &Hardfork{Name: string(forks.Jovian), Precedence: 9}
)

Hardfork definitions

View Source
var (
	Hardforks      = ForkMatrix{Regolith, Canyon, Delta, Ecotone, Fjord, Granite, Holocene, Isthmus, Jovian}
	LatestFork     = Hardforks[len(Hardforks)-1]
	LatestForkOnly = ForkMatrix{LatestFork}
)

Functions

func CreateInprocessPrefetcher added in v1.11.0

func CreateInprocessPrefetcher(
	t helpers.Testing,
	ctx context.Context,
	logger log.Logger,
	l1 *helpers.L1Miner,
	kv kvstore.KV,
	cfg *config.Config,
	fixtureInputs *FixtureInputs,
) (hostcommon.Prefetcher, error)

func IsKonaConfigured

func IsKonaConfigured() bool

func NewBatcherCfg

func NewBatcherCfg(params ...BatcherCfgParam) *helpers.BatcherCfg

func NewDeployParams

func NewDeployParams(t helpers.Testing, tp *e2eutils.TestParams, params ...DeployParam) *e2eutils.DeployParams

func NewOpProgramCfg

func NewOpProgramCfg(
	fi *FixtureInputs,
) *config.Config

func NewTestParams

func NewTestParams(params ...TestParam) *e2eutils.TestParams

func RunFaultProofProgram added in v1.11.0

func RunFaultProofProgram(t helpers.Testing, logger log.Logger, l1 *helpers.L1Miner, checkResult CheckResult, fixtureInputParams ...FixtureInputParam)

RunFaultProofProgram runs the fault proof program for the transition to the given L2 block number from the preceding one.

func RunKonaNative

func RunKonaNative(
	t helpers.Testing,
	workDir string,
	rollupCfgs []*rollup.Config,
	l1chainConfig *params.ChainConfig,
	l1Rpc string,
	l1BeaconRpc string,
	l2Rpcs []string,
	fixtureInputs FixtureInputs,
) error

Types

type BatcherCfgParam

type BatcherCfgParam func(c *helpers.BatcherCfg)

type CheckResult

type CheckResult func(helpers.Testing, error)

func ExpectError

func ExpectError(expectedErr error) CheckResult

func ExpectNoError

func ExpectNoError() CheckResult

type DeployConfigOverride added in v1.16.0

type DeployConfigOverride func(*genesis.DeployConfig)

type DeployParam

type DeployParam func(p *e2eutils.DeployParams)

type FaultProofProgramL2Source added in v1.11.0

type FaultProofProgramL2Source struct {
	Node        *helpers.L2Verifier
	Engine      *helpers.L2Engine
	ChainConfig *params.ChainConfig
}

type FixtureInputParam

type FixtureInputParam func(f *FixtureInputs)

func WithL1Head added in v1.11.0

func WithL1Head(head common.Hash) FixtureInputParam

func WithL2BlockNumber added in v1.9.5

func WithL2BlockNumber(num uint64) FixtureInputParam

func WithL2Claim

func WithL2Claim(claim common.Hash) FixtureInputParam

func WithPreInteropDefaults added in v1.11.0

func WithPreInteropDefaults(t helpers.Testing, l2ClaimBlockNum uint64, l2 *helpers.L2Verifier, l2Eng *helpers.L2Engine) FixtureInputParam

type FixtureInputs

type FixtureInputs struct {
	L2BlockNumber  uint64                            `toml:"l2-block-number"`
	L2Claim        common.Hash                       `toml:"l2-claim"`
	L2Head         common.Hash                       `toml:"l2-head"`
	L2OutputRoot   common.Hash                       `toml:"l2-output-root"`
	L2ChainID      eth.ChainID                       `toml:"l2-chain-id"`
	L1Head         common.Hash                       `toml:"l1-head"`
	AgreedPrestate []byte                            `toml:"agreed-prestate"`
	DependencySet  *depset.StaticConfigDependencySet `toml:"dependency-set"`
	InteropEnabled bool                              `toml:"use-interop"`

	L2Sources []*FaultProofProgramL2Source
}

type ForkMatrix

type ForkMatrix = []*Hardfork

func FaultProofForks added in v1.13.3

func FaultProofForks() ForkMatrix

func NewForkMatrix

func NewForkMatrix(forks ...*Hardfork) ForkMatrix

type Hardfork

type Hardfork struct {
	Name       string
	Precedence int
}

type L1 added in v1.11.0

type L1 interface {
}

type L2 added in v1.11.0

type L2 interface {
	RollupClient() *sources.RollupClient
}

type L2FaultProofEnv

type L2FaultProofEnv struct {
	Logs      *testlog.CapturingHandler
	Batcher   *helpers.L2Batcher
	Sequencer *helpers.L2Sequencer
	Engine    *helpers.L2Engine

	Sd    *e2eutils.SetupData
	Dp    *e2eutils.DeployParams
	Miner *helpers.L1Miner
	Alice *helpers.CrossLayerUser
	Bob   *helpers.CrossLayerUser
	// contains filtered or unexported fields
}

L2FaultProofEnv is a test harness for a fault provable L2 chain.

func NewL2FaultProofEnv

func NewL2FaultProofEnv[c any](t helpers.Testing, testCfg *TestCfg[c], tp *e2eutils.TestParams, batcherCfg *helpers.BatcherCfg, deployConfigOverrides ...DeployConfigOverride) *L2FaultProofEnv

func (*L2FaultProofEnv) BatchAndMine added in v1.12.0

func (env *L2FaultProofEnv) BatchAndMine(t helpers.Testing)

BatchAndMine batches the current unsafe chain to L1 and mines the L1 block containing the batcher transaction.

func (*L2FaultProofEnv) BatchMineAndSync added in v1.12.2

func (env *L2FaultProofEnv) BatchMineAndSync(t helpers.Testing) eth.L2BlockRef

BatchMineAndSync calls env.BatchAndMine and then has the sequencer derive up to the l1 head. Returns the L2 Safe Block Reference

func (*L2FaultProofEnv) RunFaultProofProgram

func (env *L2FaultProofEnv) RunFaultProofProgram(t helpers.Testing, l2ClaimBlockNum uint64, checkResult CheckResult, fixtureInputParams ...FixtureInputParam)

RunFaultProofProgram runs the fault proof program for a single state transition, from the provided l2 block num - 1 to the provided l2 block num.

func (*L2FaultProofEnv) RunFaultProofProgramFromGenesis added in v1.13.1

func (env *L2FaultProofEnv) RunFaultProofProgramFromGenesis(t helpers.Testing, finalL2BlockNum uint64, checkResult CheckResult, fixtureInputParams ...FixtureInputParam)

RunFaultProofProgram runs the fault proof program for each state transition from genesis up to the provided l2 block num.

type RunTest

type RunTest[cfg any] func(t *testing.T, testCfg *TestCfg[cfg])

type TestCase

type TestCase[cfg any] struct {
	Name        string
	Cfg         cfg
	ForkMatrix  ForkMatrix
	RunTest     RunTest[cfg]
	InputParams []FixtureInputParam
	CheckResult CheckResult
}

type TestCfg

type TestCfg[cfg any] struct {
	Hardfork    *Hardfork
	CheckResult CheckResult
	InputParams []FixtureInputParam
	Custom      cfg
	Allocs      *e2eutils.AllocParams
}

type TestFixture

type TestFixture struct {
	Name           string        `toml:"name"`
	ExpectedStatus uint8         `toml:"expected-status"`
	Inputs         FixtureInputs `toml:"inputs"`
}

type TestMatrix

type TestMatrix[cfg any] struct {
	CommonInputParams []FixtureInputParam
	TestCases         []TestCase[cfg]
}

func NewMatrix

func NewMatrix[cfg any]() *TestMatrix[cfg]

func (*TestMatrix[cfg]) AddDefaultTestCases added in v1.12.0

func (ts *TestMatrix[cfg]) AddDefaultTestCases(
	testCfg cfg,
	forkMatrix ForkMatrix,
	runTest RunTest[cfg],
) *TestMatrix[cfg]

func (*TestMatrix[cfg]) AddDefaultTestCasesWithName added in v1.12.1

func (ts *TestMatrix[cfg]) AddDefaultTestCasesWithName(
	name string,
	testCfg cfg,
	forkMatrix ForkMatrix,
	runTest RunTest[cfg],
) *TestMatrix[cfg]

func (*TestMatrix[cfg]) AddTestCase

func (ts *TestMatrix[cfg]) AddTestCase(
	name string,
	testCfg cfg,
	forkMatrix ForkMatrix,
	runTest RunTest[cfg],
	checkResult CheckResult,
	inputParams ...FixtureInputParam,
) *TestMatrix[cfg]

func (*TestMatrix[cfg]) Run

func (suite *TestMatrix[cfg]) Run(t *testing.T)

func (*TestMatrix[cfg]) WithCommonInputParams

func (ts *TestMatrix[cfg]) WithCommonInputParams(params ...FixtureInputParam) *TestMatrix[cfg]

type TestParam

type TestParam func(p *e2eutils.TestParams)

Jump to

Keyboard shortcuts

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