[Chore] -Remove unused validation and standardize fields (#387)

* remove unused validation and standardize fields

* rename to L2MESSAGESERVICE_ADDRESS for consistency

* add  missing Makefile change
This commit is contained in:
The Dark Jester
2024-12-03 18:09:43 +00:00
committed by GitHub
parent df30415898
commit 5fa9eb9bc4
19 changed files with 30 additions and 76 deletions

View File

@@ -112,7 +112,7 @@ deploy-token-bridge-l1:
REMOTE_CHAIN_ID=1337 \
TOKEN_BRIDGE_L1=true \
TOKEN_BRIDGE_SECURITY_COUNCIL=0x90F79bf6EB2c4f870365E785982E1f101E93b906 \
L2_MESSAGE_SERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
L2MESSAGESERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
LINEA_ROLLUP_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
npx ts-node local-deployments-artifacts/deployBridgedTokenAndTokenBridge.ts
@@ -125,7 +125,7 @@ deploy-token-bridge-l2:
REMOTE_CHAIN_ID=31648428 \
TOKEN_BRIDGE_L1=false \
TOKEN_BRIDGE_SECURITY_COUNCIL=0xf17f52151EbEF6C7334FAD080c5704D77216b732 \
L2_MESSAGE_SERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
L2MESSAGESERVICE_ADDRESS=0xe537D669CA013d86EBeF1D64e40fC74CADC91987 \
LINEA_ROLLUP_ADDRESS=0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9 \
npx ts-node local-deployments-artifacts/deployBridgedTokenAndTokenBridge.ts

View File

@@ -2,17 +2,10 @@ import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployFromFactory } from "../scripts/hardhat/utils";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = getRequiredEnvVar("PLONKVERIFIER_NAME");
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -8,12 +8,10 @@ import {
getRequiredEnvVar,
tryStoreAddress,
tryVerifyContractWithConstructorArgs,
validateDeployBranchAndTags,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "TimeLock";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -1,16 +1,10 @@
import { ethers, upgrades } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
getDeployedContractAddress,
getRequiredEnvVar,
tryVerifyContract,
validateDeployBranchAndTags,
} from "../common/helpers";
import { getDeployedContractAddress, getRequiredEnvVar, tryVerifyContract } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = getRequiredEnvVar("CONTRACT_NAME");
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -8,7 +8,6 @@ import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
} from "../common/helpers";
import {
LINEA_ROLLUP_INITIALIZE_SIGNATURE,
@@ -20,7 +19,6 @@ import {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "LineaRollup";
const verifierName = "PlonkVerifier";

View File

@@ -6,12 +6,10 @@ import {
getRequiredEnvVar,
tryStoreAddress,
tryVerifyContract,
validateDeployBranchAndTags,
} from "contracts/common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "LineaRollupV5";
const verifierName = "PlonkVerifier";

View File

@@ -8,7 +8,6 @@ import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
} from "../common/helpers";
import {
L1_L2_MESSAGE_SETTER_ROLE,
@@ -20,7 +19,6 @@ import {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "L2MessageService";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -1,11 +1,10 @@
import { ethers, upgrades } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { validateDeployBranchAndTags, tryVerifyContract, getDeployedContractAddress } from "../common/helpers";
import { tryVerifyContract, getDeployedContractAddress } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "L2MessageService";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -4,18 +4,11 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import path from "path";
import { deployUpgradableWithAbiAndByteCode } from "../scripts/hardhat/utils";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
import { abi, bytecode } from "./V1/L2MessageServiceV1Deployed.json";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const mainnetDeployedL2MessageServiceCacheFolder = path.resolve("./deploy/V1/L2MessageServiceV1Cache/");

View File

@@ -40,7 +40,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const contractName = "L2MessageService";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);
const proxyAddress = getRequiredEnvVar("L2_MESSAGE_SERVICE_ADDRESS");
const proxyAddress = getRequiredEnvVar("L2MESSAGESERVICE_ADDRESS");
const factory = await ethers.getContractFactory(contractName);

View File

@@ -2,16 +2,10 @@ import { ethers, network, upgrades } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { BridgedToken } from "../typechain-types";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
} from "../common/helpers";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "BridgedToken";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -13,28 +13,24 @@ import {
getDeployedContractAddress,
tryStoreAddress,
tryStoreProxyAdminAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "TokenBridge";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);
const l2MessageServiceName = "L2MessageService";
const lineaRollupName = "LineaRollup";
let l2MessageServiceAddress = process.env.L2_MESSAGE_SERVICE_ADDRESS;
let l2MessageServiceAddress = process.env.L2MESSAGESERVICE_ADDRESS;
let lineaRollupAddress = process.env.LINEA_ROLLUP_ADDRESS;
const remoteChainId = getRequiredEnvVar("REMOTE_CHAIN_ID");
const tokenBridgeSecurityCouncil = getRequiredEnvVar("TOKEN_BRIDGE_SECURITY_COUNCIL");
const pauseTypeRoles = getEnvVarOrDefault("TOKEN_BRIDGE_PAUSE_TYPES_ROLES", TOKEN_BRIDGE_PAUSE_TYPES_ROLES);
const unpauseTypeRoles = getEnvVarOrDefault("TOKEN_BRIDGE_UNPAUSE_TYPES_ROLES", TOKEN_BRIDGE_UNPAUSE_TYPES_ROLES);
const defaultRoleAddresses = generateRoleAssignments(TOKEN_BRIDGE_ROLES, tokenBridgeSecurityCouncil, []);
const roleAddresses = getEnvVarOrDefault("TOKEN_BRIDGE_ROLE_ADDRESSES", defaultRoleAddresses);
let securityCouncilAddress;
const chainId = (await ethers.provider.getNetwork()).chainId;
@@ -60,6 +56,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
: [];
if (process.env.TOKEN_BRIDGE_L1 === "true") {
securityCouncilAddress = getRequiredEnvVar("L1_TOKEN_BRIDGE_SECURITY_COUNCIL");
console.log(
`TOKEN_BRIDGE_L1=${process.env.TOKEN_BRIDGE_L1}. Deploying TokenBridge on L1, using L1_RESERVED_TOKEN_ADDRESSES environment variable`,
);
@@ -68,11 +65,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
? process.env.L1_RESERVED_TOKEN_ADDRESSES.split(",")
: [];
} else {
securityCouncilAddress = getRequiredEnvVar("L2_TOKEN_BRIDGE_SECURITY_COUNCIL");
console.log(
`TOKEN_BRIDGE_L1=${process.env.TOKEN_BRIDGE_L1}. Deploying TokenBridge on L2, using L2_RESERVED_TOKEN_ADDRESSES environment variable`,
);
}
const defaultRoleAddresses = generateRoleAssignments(TOKEN_BRIDGE_ROLES, securityCouncilAddress, []);
const roleAddresses = getEnvVarOrDefault("TOKEN_BRIDGE_ROLE_ADDRESSES", defaultRoleAddresses);
let bridgedTokenAddress = await getDeployedContractAddress("BridgedToken", deployments);
if (bridgedTokenAddress === undefined) {
console.log(`Using environment variable for BridgedToken , ${process.env.BRIDGED_TOKEN_ADDRESS}`);

View File

@@ -25,7 +25,13 @@ import {
} from "contracts/common/constants";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const securityCouncilAddress = getRequiredEnvVar("TOKENBRIDGE_SECURITY_COUNCIL");
let securityCouncilAddress;
if (process.env.TOKEN_BRIDGE_L1 === "true") {
securityCouncilAddress = getRequiredEnvVar("L1_TOKEN_BRIDGE_SECURITY_COUNCIL");
} else {
securityCouncilAddress = getRequiredEnvVar("L2_TOKEN_BRIDGE_SECURITY_COUNCIL");
}
const newRoles = [
PAUSE_ALL_ROLE,

View File

@@ -7,13 +7,11 @@ import {
tryVerifyContractWithConstructorArgs,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "LineaVoyageXP";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -7,13 +7,11 @@ import {
tryVerifyContractWithConstructorArgs,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "LineaSurgeXP";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -2,17 +2,10 @@ import { ethers, network } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { deployUpgradableFromFactory } from "../scripts/hardhat/utils";
import {
tryVerifyContract,
getDeployedContractAddress,
tryStoreAddress,
validateDeployBranchAndTags,
getRequiredEnvVar,
} from "../common/helpers";
import { tryVerifyContract, getDeployedContractAddress, tryStoreAddress, getRequiredEnvVar } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "CustomBridgedToken";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -1,17 +1,10 @@
import { ethers, network } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
getRequiredEnvVar,
tryVerifyContract,
tryStoreAddress,
validateDeployBranchAndTags,
getDeployedContractAddress,
} from "../common/helpers";
import { getRequiredEnvVar, tryVerifyContract, tryStoreAddress, getDeployedContractAddress } from "../common/helpers";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments } = hre;
validateDeployBranchAndTags(hre.network.name);
const contractName = "TestERC20";
const existingContractAddress = await getDeployedContractAddress(contractName, deployments);

View File

@@ -289,7 +289,7 @@ Parameters that should be filled either in .env or passed as CLI arguments:
| \**PRIVATE_KEY* | true | key | Network-specific private key used when deploying the contract. |
| \**BLOCK_EXPLORER_API_KEY* | false | key | Network-specific Block Explorer API Key used for verifying deployed contracts. |
| INFURA_API_KEY | true | key | Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
| L2_MESSAGE_SERVICE_ADDRESS | true | address | L2 Message Service address used when deploying TokenBridge. |
| L2MESSAGESERVICE_ADDRESS | true | address | L2 Message Service address used when deploying TokenBridge. |
| LINEA_ROLLUP_ADDRESS | true | address | L1 Rollup address used when deploying Token Bridge. |
| REMOTE_CHAIN_ID | true | uint256 | ChainID of the remote (target) network |
| TOKEN_BRIDGE_L1 | false |true\|false| If Token Bridge is deployed on L1, TOKEN_BRIDGE_L1 should be set to `true`. Otherwise it should be `false`|
@@ -305,7 +305,7 @@ npx hardhat deploy --network linea_sepolia --tags TokenBridge
Base command with cli arguments:
```shell
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_SEPOLIA_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2_MESSAGE_SERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_sepolia --tags TokenBridge
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_SEPOLIA_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2MESSAGESERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_sepolia --tags TokenBridge
```
(make sure to replace `<value>` `<key>` `<address>` with actual values)
@@ -413,7 +413,7 @@ This will run the script that deploys the TokenBridge and BridgedToken contracts
| \**PRIVATE_KEY* | true | key | Network-specific private key used when deploying the contract. |
| \**BLOCK_EXPLORER_API_KEY* | false | key | Network-specific Block Explorer API Key used for verifying deployed contracts. |
| INFURA_API_KEY | true | key | Infura API Key. This is required only when deploying contracts to a live network, not required when deploying on a local dev network. |
| L2_MESSAGE_SERVICE_ADDRESS | true | address | L2 Message Service address used when deploying TokenBridge. |
| L2MESSAGESERVICE_ADDRESS | true | address | L2 Message Service address used when deploying TokenBridge. |
| LINEA_ROLLUP_ADDRESS | true | address | L1 Rollup address used when deploying Token Bridge. |
| REMOTE_CHAIN_ID | true | uint256 | ChainID of the remote (target) network |
| TOKEN_BRIDGE_L1 | false |true\|false| If Token Bridge is deployed on L1, TOKEN_BRIDGE_L1 should be set to `true`. Otherwise it should be `false`|
@@ -428,7 +428,7 @@ npx hardhat deploy --network linea_sepolia --tags BridgedToken,TokenBridge
Base command with cli arguments:
```shell
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_SEPOLIA_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2_MESSAGE_SERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_sepolia --tags BridgedToken,TokenBridge
SAVE_ADDRESS=true VERIFY_CONTRACT=true LINEASCAN_API_KEY=<key> LINEA_SEPOLIA_PRIVATE_KEY=<key> INFURA_API_KEY=<key> REMOTE_CHAIN_ID=<uint256> TOKEN_BRIDGE_L1=true L1_RESERVED_TOKEN_ADDRESSES=<address> L2MESSAGESERVICE_ADDRESS=<address> LINEA_ROLLUP_ADDRESS=<address> npx hardhat deploy --network linea_sepolia --tags BridgedToken,TokenBridge
```
(make sure to replace `<value>` `<key>` `<address>` with actual values)

View File

@@ -26,7 +26,7 @@ async function main() {
const bridgedTokenName = "BridgedToken";
const tokenBridgeName = "TokenBridge";
const l2MessageServiceAddress = process.env.L2_MESSAGE_SERVICE_ADDRESS;
const l2MessageServiceAddress = process.env.L2MESSAGESERVICE_ADDRESS;
const lineaRollupAddress = process.env.LINEA_ROLLUP_ADDRESS;
const remoteChainId = getRequiredEnvVar("REMOTE_CHAIN_ID");