helpers

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Regolith = &Hardfork{Name: "Regolith", Precedence: 1}
	Canyon   = &Hardfork{Name: "Canyon", Precedence: 2}
	Delta    = &Hardfork{Name: "Delta", Precedence: 3}
	Ecotone  = &Hardfork{Name: "Ecotone", Precedence: 4}
	Fjord    = &Hardfork{Name: "Fjord", Precedence: 5}
	Granite  = &Hardfork{Name: "Granite", Precedence: 6}
	Holocene = &Hardfork{Name: "Holocene", Precedence: 7}
)

Hardfork definitions

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

Functions

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(
	t helpers.Testing,
	env *L2FaultProofEnv,
	fi *FixtureInputs,
	params ...OpProgramCfgParam,
) *config.Config

func NewTestParams

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

func RunKonaNative

func RunKonaNative(
	t helpers.Testing,
	workDir string,
	env *L2FaultProofEnv,
	l1Rpc string,
	l1BeaconRpc string,
	l2Rpc 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 DeployParam

type DeployParam func(p *e2eutils.DeployParams)

type FixtureInputParam

type FixtureInputParam func(f *FixtureInputs)

func WithL2BlockNumber added in v1.9.5

func WithL2BlockNumber(num uint64) FixtureInputParam

func WithL2Claim

func WithL2Claim(claim common.Hash) 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     uint64      `toml:"l2-chain-id"`
	L1Head        common.Hash `toml:"l1-head"`
}

type ForkMatrix

type ForkMatrix = []*Hardfork

func NewForkMatrix

func NewForkMatrix(forks ...*Hardfork) ForkMatrix

type Hardfork

type Hardfork struct {
	Name       string
	Precedence int
}

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) RunFaultProofProgram

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

type OpProgramCfgParam

type OpProgramCfgParam func(p *config.Config)

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
}

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]) 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