Skip to content

Commit

Permalink
perf(arbToGno): used concurently in deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurMongia committed Sep 13, 2024
1 parent 34d6de6 commit aba723d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
11 changes: 8 additions & 3 deletions contracts/deploy/01-outbox/01-arb-to-gnosis-outbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const paramsByChainId = {
sequencerLimit: 86400, // 24 hours
},
HARDHAT: {
deposit: parseEther("10"), // 120 xDAI budget for timeout
deposit: parseEther("10"), //
// Average happy path wait time is 22.5 mins, assume no censorship
epochPeriod: 600, // 10 min
minChallengePeriod: 600, // 10 min (assume no sequencer backdating)
Expand All @@ -56,7 +56,12 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { providers } = ethers;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
const [namedAccounts, defaultSigner] = await Promise.all([
getNamedAccounts(),
hre.ethers.getSigners().then((signers) => signers[0]),
]);

const deployer = namedAccounts.deployer ?? defaultSigner.address;
const chainId = Number(await getChainId());
console.log("deploying to chainId %s with deployer %s", chainId, deployer);

Expand Down Expand Up @@ -89,7 +94,7 @@ const deployOutbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
console.log("calculated future router for nonce %d: %s", nonce + 10, routerAddress);

const senderGatewayAddress = getContractAddress(deployer, nonce + 6); // with the current order of transaction ,nonce for sender gateway would be 14.
console.log("calculated future SenderGatewayToGnosis address for nonce %d: %s", nonce, senderGatewayAddress);
console.log("calculated future SenderGatewayToGnosis address for nonce %d: %s", nonce + 6, senderGatewayAddress);

const ambMock = await deploy("MockAMB", {
from: deployer,
Expand Down
2 changes: 1 addition & 1 deletion contracts/deploy/02-inbox/02-arb-to-gnosis-inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const paramsByChainId = {
};

const deployInbox: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

// fallback to hardhat node signers on local network
Expand Down
16 changes: 11 additions & 5 deletions contracts/deploy/03-routers/03-arb-to-gnosis-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ const deployRouter: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const chainId = Number(await getChainId());

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
const [namedAccounts, defaultSigner] = await Promise.all([
getNamedAccounts(),
hre.ethers.getSigners().then((signers) => signers[0]),
]);

const deployer = namedAccounts.deployer ?? defaultSigner.address;
console.log("deployer: %s", deployer);

const { arbitrumBridge, amb } = paramsByChainId[RouterChains[chainId]];

// ----------------------------------------------------------------------------------------------
const hardhatDeployer = async () => {
const veaOutbox = await deployments.get("VeaOutboxArbToGnosis");
const veaInbox = await deployments.get("VeaInboxArbToGnosis");
const amb = await deployments.get("MockAMB");
//const ArbSysMock = await deployments.get('arbSysMock');
const [veaOutbox, veaInbox, amb] = await Promise.all([
deployments.get("VeaOutboxArbToGnosis"),
deployments.get("VeaInboxArbToGnosis"),
deployments.get("MockAMB"),
]);

const sequencerInbox = await deploy("SequencerInboxMock", {
from: deployer,
Expand Down

0 comments on commit aba723d

Please sign in to comment.