mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 20:27:58 -05:00
* feat: run e2e tests in paralell + refactor test setup * fix: open handle issue * fix: sequencer finalized tag test issue + clean l2.spec tests * fix: refactor config structure * fix: genesis path issue * fix: pnpm lock file issue * fix: make each test run concurrently * fix: remove nested describes in tests * fix: refactor coordinator tests + add global L2 traffic generation * fix: change l2 genesis file for getting whale accounts + refactor utils function * fix: refactor coordinator restart util function * fix: remove conflation e2e tests * fix: add environment variable in e2e test ci workflowk * fix: coordinator restart test issue * fix: instanciate account manager only once per test file * fix: add restart option to zkbesu shomei and postman in docker compose file * fix: remove getAndIncreaseFeeData function and unsed utils functions * fix: increase messaging L2 to l1 timeout
98 lines
2.4 KiB
TypeScript
98 lines
2.4 KiB
TypeScript
import { JsonRpcProvider, Wallet } from "ethers";
|
|
import { Config } from "./types";
|
|
import {
|
|
DummyContract,
|
|
DummyContract__factory,
|
|
L2MessageService,
|
|
L2MessageService__factory,
|
|
LineaRollup,
|
|
LineaRollup__factory,
|
|
} from "../../typechain";
|
|
import { AccountManager } from "./accounts/account-manager";
|
|
|
|
export default class TestSetup {
|
|
constructor(private readonly config: Config) {}
|
|
|
|
public getL1Provider(): JsonRpcProvider {
|
|
return new JsonRpcProvider(this.config.L1.rpcUrl.toString());
|
|
}
|
|
|
|
public getL2Provider(): JsonRpcProvider {
|
|
return new JsonRpcProvider(this.config.L2.rpcUrl.toString());
|
|
}
|
|
|
|
public getL1ChainId(): number {
|
|
return this.config.L1.chainId;
|
|
}
|
|
|
|
public getL2ChainId(): number {
|
|
return this.config.L2.chainId;
|
|
}
|
|
|
|
public getShomeiEndpoint(): URL | undefined {
|
|
return this.config.L2.shomeiEndpoint;
|
|
}
|
|
|
|
public getShomeiFrontendEndpoint(): URL | undefined {
|
|
return this.config.L2.shomeiFrontendEndpoint;
|
|
}
|
|
|
|
public getSequencerEndpoint(): URL | undefined {
|
|
return this.config.L2.sequencerEndpoint;
|
|
}
|
|
|
|
public getLineaRollupContract(signer?: Wallet): LineaRollup {
|
|
const lineaRollup: LineaRollup = LineaRollup__factory.connect(
|
|
this.config.L1.lineaRollupAddress,
|
|
this.getL1Provider(),
|
|
);
|
|
|
|
if (signer) {
|
|
return lineaRollup.connect(signer);
|
|
}
|
|
|
|
return lineaRollup;
|
|
}
|
|
|
|
public getL2MessageServiceContract(signer?: Wallet): L2MessageService {
|
|
const l2MessageService: L2MessageService = L2MessageService__factory.connect(
|
|
this.config.L2.l2MessageServiceAddress,
|
|
this.getL2Provider(),
|
|
);
|
|
|
|
if (signer) {
|
|
return l2MessageService.connect(signer);
|
|
}
|
|
|
|
return l2MessageService;
|
|
}
|
|
|
|
public getL1DummyContract(signer?: Wallet): DummyContract {
|
|
const dummyContract = DummyContract__factory.connect(this.config.L1.dummyContractAddress, this.getL1Provider());
|
|
|
|
if (signer) {
|
|
return dummyContract.connect(signer);
|
|
}
|
|
|
|
return dummyContract;
|
|
}
|
|
|
|
public getL2DummyContract(signer?: Wallet): DummyContract {
|
|
const dummyContract = DummyContract__factory.connect(this.config.L2.dummyContractAddress, this.getL2Provider());
|
|
|
|
if (signer) {
|
|
return dummyContract.connect(signer);
|
|
}
|
|
|
|
return dummyContract;
|
|
}
|
|
|
|
public getL1AccountManager(): AccountManager {
|
|
return this.config.L1.accountManager;
|
|
}
|
|
|
|
public getL2AccountManager(): AccountManager {
|
|
return this.config.L2.accountManager;
|
|
}
|
|
}
|