envs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0, MIT Imports: 24 Imported by: 0

README

E2E envs

The different E2E envs found on this directory have been generated using the snapshot feature.

op-pp

This network has a single OP PP network.

  • Kurtosis commit 566ac102b9098f40475c6cc306f03e9750f2ff97
  • Kurtosis config file:
args:
  l1_electra_fork_epoch: 0
  l1_fulu_fork_epoch: 18446744073709551615

  sequencer_type: op-geth
  consensus_contract_type: ecdsa-multisig
  aggkit_image: ghcr.io/agglayer/aggkit:0.8.0

  # aggsender-validator related params (required for aggkit 0.8.0)
  use_agg_sender_validator: True
  agg_sender_validator_total_number: 1
  agg_sender_multisig_threshold: 1

  # Override additional_services to exclude bridge_spammer
  additional_services:
    - agglogger

  optimism_package:
    chains:
      "001":
        proposer_params:
          enabled: false  # ✅ No state root proposals
        batcher_params:
          max_channel_duration: 999999  # ✅ Delays batching ~11 days

Debug

In order to debug (VS Code):

  1. Run make build-docker-debug (from the root of the repo)
  2. Uncomment the commented aggkit-001 of the docker-compose.yml and comment the uncommented one
  3. Run the E2E test
  4. You will need to start the debugger every single time that the aggkit docker starts. It doesn't run otherwise. Add the following content to your .vscode/launch.json:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to aggkit in Docker (dlv)",
            "type": "go",
            "request": "attach",
            "mode": "remote",
            "host": "127.0.0.1",
            "port": 40000,
            "apiVersion": 2,
            "showLog": true
        }
    ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindEnvsDir

func FindEnvsDir() (string, error)

FindEnvsDir finds the envs directory dynamically Works when running from repo root (Makefile) or from test package directory (IDE)

Types

type ClientsConfig

type ClientsConfig struct {
	L1            *ethclient.Client
	L2            *ethclient.Client
	BridgeService *client.Client
	// BridgeServiceProxy is the aggkit-proxy REST client of the envs that publish one, nil
	// otherwise. The proxy serves the same /bridge/v1/* API as a bridge service and routes every
	// request to the right per-network bridge service by the network_id parameter, so one client
	// stands in for each of the per-L2 BridgeService clients above.
	BridgeServiceProxy *client.Client
	// BridgeServiceProxyURL is the external REST URL behind BridgeServiceProxy ("" when absent).
	BridgeServiceProxyURL string
}

ClientsConfig contains RPC clients

type ENVName

type ENVName string

ENVName represents a valid E2E test environment name

const (
	// EnvOpPP is a testing env that has a single OP-PP network deployed
	EnvOpPP ENVName = "op-pp"

	// EnvOpPP2Chains is a testing env that has two OP-PP L2 networks deployed (L2A + L2B)
	EnvOpPP2Chains ENVName = "op-pp-2chains"

	// EnvAnvil2Chains is a testing env that has two anvil-backed L2 networks deployed (L2A + L2B),
	// settling against an anvil L1, sourced from a kurtosis-cdk anvil snapshot bundle.
	EnvAnvil2Chains ENVName = "anvil-2chains"
)

type Env

type Env struct {
	L1 L1Config
	L2 L2Config
	// L2B is the secondary L2 network (L2B). It is nil for single-chain envs (EnvOpPP)
	// and populated for multi-chain envs (EnvOpPP2Chains).
	L2B             *L2Config
	Clients         ClientsConfig
	Keys            KeysConfig
	EnvDir          string
	AggsenderRPCURL string // External URL of the aggsender JSON-RPC endpoint
	// contains filtered or unexported fields
}

Env represents a loaded E2E test environment

func LoadEnv

func LoadEnv(ctx context.Context, envName ENVName) (*Env, error)

LoadEnv loads an E2E test environment by name

func (*Env) CheckEnv

func (e *Env) CheckEnv(ctx context.Context) error

CheckEnv validates that the environment is correctly configured and all services are accessible. It is intended to be called as a pre-test sanity check in TestMain after loading the environment.

func (*Env) ClaimBridgeService added in v0.11.0

func (e *Env) ClaimBridgeService(direct *client.Client) *client.Client

ClaimBridgeService returns the client the bridge/claim helpers should read bridge and claim proof data from: this env's aggkit-proxy when it publishes one, and direct otherwise (the per-L2 bridge service the caller would have used). Routing through the proxy exercises the path production uses for a proxy-fronted deployment, and works for every network a helper queries because the proxy resolves the network_id of each request itself.

func (*Env) ComposeServices added in v0.11.0

func (e *Env) ComposeServices(ctx context.Context) ([]string, error)

ComposeServices returns every service name defined in this environment's docker-compose.yml, by shelling out to "docker compose config --services". This is used instead of a hardcoded per-env service list (which cannot stay in sync across envs, and summary.json's schema has no key for services like beacon/validator/op-node) so log collection covers every service in any env, present or future, with zero per-env code.

func (*Env) DockerComposeLogs added in v0.10.0

func (e *Env) DockerComposeLogs(ctx context.Context, args ...string) ([]byte, error)

DockerComposeLogs runs "docker compose logs" with the given extra args for this environment, injecting AGGKIT_DATA_DIR so compose can resolve the bind-mount variable.

func (*Env) GetAggkitConfigPath added in v0.10.0

func (e *Env) GetAggkitConfigPath() string

GetAggkitConfigPath returns the path to the aggkit config file on the host.

func (*Env) GetAggkitConfigPathForNetwork added in v0.11.0

func (e *Env) GetAggkitConfigPathForNetwork(networkKey string) string

GetAggkitConfigPathForNetwork returns the host path to the aggkit config file for the given L2 network key ("001", "002"). GetAggkitConfigPath is the "001" special case kept for callers that only ever target the primary network.

func (*Env) GetAggkitDataDir added in v0.10.0

func (e *Env) GetAggkitDataDir() string

GetAggkitDataDir returns the host path of the aggkit container's /tmp bind-mount directory. Files written by the container to /tmp (e.g. aggsender.sqlite, certificates/) are accessible at this path on the host.

func (*Env) GetAggkitProxyConfigPath added in v0.11.0

func (e *Env) GetAggkitProxyConfigPath() string

GetAggkitProxyConfigPath returns the host path of the aggkit-proxy config file, bind-mounted read-only into the aggkit-proxy container.

func (*Env) GetAggsenderDBPath added in v0.10.0

func (e *Env) GetAggsenderDBPath() string

GetAggsenderDBPath returns the host path to the aggsender SQLite database file. This is accessible because the aggkit container's /tmp is bind-mounted to the host.

func (*Env) RestartAggkitProxyWithConfig added in v0.11.0

func (e *Env) RestartAggkitProxyWithConfig(ctx context.Context, editFn func(configPath string) error) error

RestartAggkitProxyWithConfig rewrites the aggkit-proxy config with editFn and restarts the aggkit-proxy service so it picks the change up. It does not wait for readiness: callers poll the tracker health endpoint (see waitForTrackerReady in the e2e test package).

func (*Env) RestartAggkitServiceWithConfig added in v0.11.0

func (e *Env) RestartAggkitServiceWithConfig(
	ctx context.Context, networkKey string, editFn func(configPath string) error,
) error

RestartAggkitServiceWithConfig stops the given L2 network's aggkit node, calls editFn to rewrite its config, then starts it and waits for its bridge service. Generalizes RestartAggkitWithConfig to any L2 network in a multi-chain env.

func (*Env) RestartAggkitWithConfig added in v0.10.0

func (e *Env) RestartAggkitWithConfig(ctx context.Context, editFn func(configPath string) error) error

RestartAggkitWithConfig stops aggkit, calls editFn to modify the config, then starts aggkit. Waits for the bridge service to be ready before returning.

func (*Env) RestartService added in v0.11.0

func (e *Env) RestartService(ctx context.Context, service string) error

RestartService restarts a single compose service of this environment. It does not wait for the service to become ready; the caller polls whatever readiness endpoint applies.

func (*Env) StartAggkit

func (e *Env) StartAggkit(ctx context.Context) error

StartAggkit starts the aggkit service and waits for the bridge service to be ready.

func (*Env) StartAggkitService added in v0.11.0

func (e *Env) StartAggkitService(ctx context.Context, networkKey string) error

StartAggkitService starts the aggkit node of the given L2 network key and waits for that network's bridge service to be ready. Generalizes StartAggkit (which targets "001").

func (*Env) Stop

func (e *Env) Stop(ctx context.Context) error

Stop stops the E2E test environment by running docker compose down

func (*Env) StopAggkit

func (e *Env) StopAggkit(ctx context.Context) error

StopAggkit stops only the aggkit service so the test can use the aggoracle key without conflicting with the running aggkit.

func (*Env) StopAggkitAndEditConfig added in v0.10.0

func (e *Env) StopAggkitAndEditConfig(ctx context.Context, editFn func(configPath string) error) error

StopAggkitAndEditConfig stops aggkit and calls editFn with the config file path. The caller is responsible for restarting aggkit after editing the config.

func (*Env) StopAggkitService added in v0.11.0

func (e *Env) StopAggkitService(ctx context.Context, networkKey string) error

StopAggkitService stops only the aggkit node of the given L2 network key so a test can rewrite its config without racing the running process. Generalizes StopAggkit (which targets "001").

type KeyPool

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

KeyPool is a mutex-guarded pool of pre-funded private keys for parallel tests

func (*KeyPool) Checkout

func (p *KeyPool) Checkout() (*bind.TransactOpts, *ecdsa.PrivateKey, error)

Checkout removes a key from the pool and returns transact opts and the key; caller must Return the key when done

func (*KeyPool) Return

func (p *KeyPool) Return(key *ecdsa.PrivateKey)

Return returns a key to the pool so it can be checked out again

type KeysConfig

type KeysConfig struct {
	L1Keys         *KeyPool
	L2Keys         *KeyPool
	AggOracle      *ecdsa.PrivateKey
	SovereignAdmin *ecdsa.PrivateKey
}

KeysConfig exposes key pools and special keys for tests

type L1Config

type L1Config struct {
	ChainID    *big.Int
	Contracts  L1Contracts
	Transactor *bind.TransactOpts
}

L1Config contains L1 network configuration

type L1Contracts

type L1Contracts struct {
	RollupManager *agglayermanager.Agglayermanager
	Bridge        *agglayerbridge.Agglayerbridge
}

L1Contracts contains initialized L1 contract bindings

type L2Config

type L2Config struct {
	ChainID    *big.Int
	NetworkID  uint32
	Contracts  L2Contracts
	Transactor *bind.TransactOpts
	// Client is the ethclient dialed against this L2's op-geth RPC. For the primary
	// network (L2A) this is the same client stored in Env.Clients.L2. It is set here
	// so each L2 (including L2B) carries its own client for multi-chain tests.
	Client *ethclient.Client
	// BridgeService is the bridge-service REST client scoped to this L2 network.
	// In op-pp envs all networks may share a single bridge service; this field lets
	// each L2 reference the correct endpoint.
	BridgeService *client.Client
	// BridgeServiceURL is the external REST URL of this L2's bridge service.
	BridgeServiceURL string
	// Keys is the pool of pre-funded keys for this L2 network.
	Keys *KeyPool
	// AggsenderRPCURL is the external aggsender JSON-RPC URL for this L2 network.
	AggsenderRPCURL string
}

L2Config contains L2 network configuration

type L2Contracts

type L2Contracts struct {
	L2Bridge             *agglayerbridgel2.Agglayerbridgel2
	L2BridgeAddress      common.Address
	GlobalExitRoot       *agglayergerl2.Agglayergerl2
	MintableERC20        *mintableerc20.Mintableerc20
	MintableERC20Address common.Address
}

L2Contracts contains initialized L2 contract bindings

Jump to

Keyboard shortcuts

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