mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 20:27:58 -05:00
* fix: add mutex in account manager to avoid nonce issue * fix: optimize global setup * Limiting number of concurrent traces API requests for the local stack to avoid occasional OOM-s * Limiting number of verticles for Traces API node * Add E2E TokenBridge tests * fixing test and adding concurency * fixing test and adding concurency * fixing test and adding concurency * fixing test and adding concurency * fixing nonce management * deploying l2token for the L2 -> L1 test * adjusting accounts for L2->L1 test * adjusting l2TestContractAddress * use nonce management for L1->L2 test * adjusting the TestERC20 contract and tests * rebasing with fix/133-improve-e2e-tests-performance * fix: update jest config to exit even if there are open handles * Trying out Besu untuned and raising limit per endpoint to 2 for traces * Trying out Besu untuned and raising limit per endpoint to 2 for traces and Shomei node * Using besu untuned for arithmetization as well * Compile once and parallelise setRemoteTokenBridge * feat: deploy smart contracts from artifacts + change e2e tests setup * fix: update pnpm * fix: remove compile contracts gradle task * fix: remove compileContracts gradle task * fix: refactor genesis generator dockerfile + downgrade l1-el-node besu version * fix: move abi from e2e folder to contract folder + refactor contracts deployments scripts * feat: add deployment script from artifacts for LineaRollupV6 * update pnpm version in get-started.md * fix: update console log in deployment scripts * fix: update besu version + fix deployment scripts * correct addresses * fix import * use abi and bytecode for deployments * use upgradable beacon for BridgedToken ABI deploys * use saved abi and bytecode for TestERC20 deploy * correct deployBridgedTokenAndTokenBridge casing * optimize token bridge e2e calls * use explicit message event data * use precomputed nonces for e2e stack --------- Co-authored-by: VGau <victorien.gauch@consensys.net> Co-authored-by: Victorien Gauch <85494462+VGau@users.noreply.github.com> Co-authored-by: Roman <4833306+Filter94@users.noreply.github.com> Co-authored-by: thedarkjester <grant.southey@consensys.net> Co-authored-by: The Dark Jester <thedarkjester@users.noreply.github.com>
110 lines
3.2 KiB
TypeScript
110 lines
3.2 KiB
TypeScript
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
import fs from "fs";
|
|
import { ethers } from "hardhat";
|
|
import { DeploymentsExtension } from "hardhat-deploy/types";
|
|
import path from "path";
|
|
const editJsonFile = require("edit-json-file");
|
|
|
|
export const tryStoreAddress = async (
|
|
networkName: string,
|
|
contractName: string,
|
|
address: string,
|
|
transactionHash: string,
|
|
) => {
|
|
if (process.env.SAVE_ADDRESS) {
|
|
const network = await ethers.provider.getNetwork();
|
|
|
|
const ContractFactory = await ethers.getContractFactory(contractName);
|
|
const dirPath = path.join(__dirname, "..", "..", "deployments", `${networkName}`);
|
|
|
|
if (!fs.existsSync(dirPath)) {
|
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
}
|
|
|
|
const chainIdFile = path.join(dirPath, ".chainId");
|
|
// if .chainId does not exist, add it
|
|
if (!fs.existsSync(chainIdFile)) {
|
|
fs.writeFileSync(chainIdFile, network.chainId.toString());
|
|
}
|
|
|
|
fs.writeFileSync(
|
|
path.join(dirPath, `${contractName}.json`),
|
|
JSON.stringify(
|
|
{
|
|
address: address,
|
|
abi: ContractFactory.interface.formatJson(),
|
|
transactionHash: transactionHash,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
}
|
|
};
|
|
|
|
export const tryStoreProxyAdminAddress = async (networkName: string, contractName: string, address: string) => {
|
|
if (process.env.SAVE_ADDRESS) {
|
|
const network = await ethers.provider.getNetwork();
|
|
|
|
const dirPath = path.join(__dirname, "..", "deployments", `${networkName}`);
|
|
|
|
if (!fs.existsSync(dirPath)) {
|
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
}
|
|
|
|
const chainIdFile = path.join(dirPath, ".chainId");
|
|
// if .chainId does not exist, add it
|
|
if (!fs.existsSync(chainIdFile)) {
|
|
fs.writeFileSync(chainIdFile, network.chainId.toString());
|
|
}
|
|
|
|
fs.writeFileSync(
|
|
path.join(dirPath, `${contractName}ProxyAdmin.json`),
|
|
JSON.stringify(
|
|
{
|
|
address: address,
|
|
abi: null,
|
|
transactionHash: null,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
}
|
|
};
|
|
|
|
export const storeConstructorArgs = async (contractName: string, args: unknown[]): Promise<string> => {
|
|
const filename = `./${contractName}ConstructorArgs.js`;
|
|
console.log(`Generating constructor arguments file ${filename}`);
|
|
|
|
const file = editJsonFile(filename);
|
|
file.write(`module.exports = ${JSON.stringify(args)}`);
|
|
|
|
return filename;
|
|
};
|
|
|
|
export const deleteConstructorArgs = (filePath: string) => {
|
|
console.log(`Deleting constructor arguments file ${filePath}`);
|
|
fs.unlink(filePath, function (err) {
|
|
if (err) throw err;
|
|
// if no error, file has been deleted successfully
|
|
console.log("File deleted!");
|
|
});
|
|
};
|
|
|
|
export const getDeployedContractAddress = async (
|
|
contractName: string,
|
|
deployments: DeploymentsExtension,
|
|
): Promise<string | undefined> => {
|
|
const { get } = deployments;
|
|
try {
|
|
const deploymentDetails = await get(contractName);
|
|
console.log(`Existing ${contractName} contract found.`, deploymentDetails.address);
|
|
return deploymentDetails.address;
|
|
} catch {
|
|
// log error - existing contract not found
|
|
console.log("Existing deployment not found for ", contractName);
|
|
}
|
|
return undefined;
|
|
};
|