Skip to content

Commit 1162f8d

Browse files
authored
Fix nonce synchronization issues in EVM deployments by adding slow flag to forge (wormhole-foundation#647)
* add slow flag to evm deployments with the cli to prevent issues with the local nonce * add slow flag to the upgradeEvm function as well * extract Mezo slow flag logic into dedicated function
1 parent 2aaa82b commit 1162f8d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli/src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,14 +1464,15 @@ async function upgradeEvm<N extends Network, C extends EvmChains>(
14641464
}
14651465

14661466
console.log("Upgrading manager...");
1467+
const slowFlag = getSlowFlag(ctx.chain);
14671468
await withCustomEvmDeployerScript(pwd, async () => {
14681469
execSync(
14691470
`forge script --via-ir script/DeployWormholeNtt.s.sol \
14701471
--rpc-url ${ctx.config.rpc} \
14711472
--sig "upgrade(address)" \
14721473
${ntt.managerAddress} \
14731474
${signerArgs} \
1474-
--broadcast \
1475+
--broadcast ${slowFlag} \
14751476
${verifyArgs} | tee last-run.stdout`, {
14761477
cwd: `${pwd}/evm`,
14771478
stdio: "inherit"
@@ -1594,6 +1595,7 @@ async function deployEvm<N extends Network, C extends Chain>(
15941595
console.log("Deploying manager...");
15951596
const deploy = async (simulate: boolean): Promise<string> => {
15961597
const simulateArg = simulate ? "" : "--skip-simulation";
1598+
const slowFlag = getSlowFlag(ch.chain);
15971599
const effectiveRelayer = relayer || "0x0000000000000000000000000000000000000000";
15981600
await withCustomEvmDeployerScript(pwd, async () => {
15991601
try {
@@ -1602,7 +1604,7 @@ forge script --via-ir script/DeployWormholeNtt.s.sol \
16021604
--rpc-url ${rpc} \
16031605
${simulateArg} \
16041606
--sig "${sig}" ${wormhole} ${token} ${effectiveRelayer} ${specialRelayer} ${decimals} ${modeUint} \
1605-
--broadcast ${verifyArgs.join(' ')} ${signerArgs} 2>&1 | tee last-run.stdout`, {
1607+
--broadcast ${slowFlag} ${verifyArgs.join(' ')} ${signerArgs} 2>&1 | tee last-run.stdout`, {
16061608
cwd: `${pwd}/evm`,
16071609
encoding: 'utf8',
16081610
stdio: 'inherit'
@@ -2409,6 +2411,10 @@ function searchHexInBinary(binaryPath: string, searchHex: string) {
24092411
return found;
24102412
}
24112413

2414+
function getSlowFlag(chain: Chain): string {
2415+
return chain === "Mezo" ? "--slow" : "";
2416+
}
2417+
24122418
export function ensureNttRoot(pwd: string = ".") {
24132419
if (!fs.existsSync(`${pwd}/evm/foundry.toml`) || !fs.existsSync(`${pwd}/solana/Anchor.toml`)) {
24142420
console.error("Run this command from the root of an NTT project.");

0 commit comments

Comments
 (0)