@@ -315,6 +315,10 @@ const options = {
315315 type : "boolean" ,
316316 default : false ,
317317 } ,
318+ gasEstimateMultiplier : {
319+ describe : "Gas estimate multiplier for EVM deployments (e.g., 200 for 2x)" ,
320+ type : "number" ,
321+ } ,
318322 payer : {
319323 describe : "Path to the payer json file (Solana)" ,
320324 type : "string" ,
@@ -508,6 +512,7 @@ yargs(hideBin(process.argv))
508512 } )
509513 . option ( "signer-type" , options . signerType )
510514 . option ( "skip-verify" , options . skipVerify )
515+ . option ( "gas-estimate-multiplier" , options . gasEstimateMultiplier )
511516 . option ( "ver" , options . version )
512517 . option ( "latest" , options . latest )
513518 . option ( "local" , options . local )
@@ -580,7 +585,7 @@ yargs(hideBin(process.argv))
580585 const ch = wh . getChain ( chain ) ;
581586
582587 // TODO: make manager configurable
583- const deployedManager = await deploy ( version , mode , ch , token , signerType , ! argv [ "skip-verify" ] , argv [ "yes" ] , argv [ "executor" ] , argv [ "payer" ] , argv [ "program-key" ] , argv [ "binary" ] , argv [ "solana-priority-fee" ] , argv [ "sui-gas-budget" ] , argv [ "sui-package-path" ] , argv [ "sui-wormhole-state" ] , argv [ "sui-treasury-cap" ] ) ;
588+ const deployedManager = await deploy ( version , mode , ch , token , signerType , ! argv [ "skip-verify" ] , argv [ "yes" ] , argv [ "executor" ] , argv [ "payer" ] , argv [ "program-key" ] , argv [ "binary" ] , argv [ "solana-priority-fee" ] , argv [ "sui-gas-budget" ] , argv [ "sui-package-path" ] , argv [ "sui-wormhole-state" ] , argv [ "sui-treasury-cap" ] , argv [ "gas-estimate-multiplier" ] ) ;
584589
585590 const [ config , _ctx , _ntt , decimals ] =
586591 await pullChainConfig ( network , deployedManager , overrides ) ;
@@ -620,6 +625,7 @@ yargs(hideBin(process.argv))
620625 describe : "Path to program binary (.so file -- Solana)" ,
621626 type : "string" ,
622627 } )
628+ . option ( "gas-estimate-multiplier" , options . gasEstimateMultiplier )
623629 . example ( "$0 upgrade Ethereum --latest" , "Upgrade the Ethereum contract to the latest version" )
624630 . example ( "$0 upgrade Solana --ver 1.1.0" , "Upgrade the Solana contract to version 1.1.0" )
625631 . example ( "$0 upgrade Polygon --local --skip-verify" , "Upgrade the Polygon contract using the local version, skipping explorer bytecode verification" ) ,
@@ -674,7 +680,8 @@ yargs(hideBin(process.argv))
674680 ! argv [ "skip-verify" ] ,
675681 argv [ "payer" ] ,
676682 argv [ "program-key" ] ,
677- argv [ "binary" ]
683+ argv [ "binary" ] ,
684+ argv [ "gas-estimate-multiplier" ]
678685 ) ;
679686
680687 // reinit the ntt object to get the new version
@@ -2161,7 +2168,8 @@ async function upgrade<N extends Network, C extends Chain>(
21612168 evmVerify : boolean ,
21622169 solanaPayer ?: string ,
21632170 solanaProgramKeyPath ?: string ,
2164- solanaBinaryPath ?: string
2171+ solanaBinaryPath ?: string ,
2172+ gasEstimateMultiplier ?: number
21652173) : Promise < void > {
21662174 // TODO: check that fromVersion is safe to upgrade to toVersion from
21672175 const platform = chainToPlatform ( ctx . chain ) ;
@@ -2170,7 +2178,7 @@ async function upgrade<N extends Network, C extends Chain>(
21702178 case "Evm" :
21712179 const evmNtt = ntt as EvmNtt < N , EvmChains > ;
21722180 const evmCtx = ctx as ChainContext < N , EvmChains > ;
2173- return upgradeEvm ( worktree , evmNtt , evmCtx , signerType , evmVerify ) ;
2181+ return upgradeEvm ( worktree , evmNtt , evmCtx , signerType , evmVerify , gasEstimateMultiplier ) ;
21742182 case "Solana" :
21752183 if ( solanaPayer === undefined || ! fs . existsSync ( solanaPayer ) ) {
21762184 console . error ( "Payer not found. Specify with --payer" ) ;
@@ -2193,7 +2201,8 @@ async function upgradeEvm<N extends Network, C extends EvmChains>(
21932201 ntt : EvmNtt < N , C > ,
21942202 ctx : ChainContext < N , C > ,
21952203 signerType : SignerType ,
2196- evmVerify : boolean
2204+ evmVerify : boolean ,
2205+ gasEstimateMultiplier ?: number
21972206) : Promise < void > {
21982207 ensureNttRoot ( pwd ) ;
21992208
@@ -2216,14 +2225,15 @@ async function upgradeEvm<N extends Network, C extends EvmChains>(
22162225
22172226 console . log ( "Upgrading manager..." ) ;
22182227 const slowFlag = getSlowFlag ( ctx . chain ) ;
2228+ const gasMultiplier = getGasMultiplier ( gasEstimateMultiplier ) ;
22192229 await withCustomEvmDeployerScript ( pwd , async ( ) => {
22202230 execSync (
22212231 `forge script --via-ir script/DeployWormholeNtt.s.sol \
22222232--rpc-url ${ ctx . config . rpc } \
22232233--sig "upgrade(address)" \
22242234${ ntt . managerAddress } \
22252235${ signerArgs } \
2226- --broadcast ${ slowFlag } \
2236+ --broadcast ${ slowFlag } ${ gasMultiplier } \
22272237${ verifyArgs } | tee last-run.stdout`, {
22282238 cwd : `${ pwd } /evm` ,
22292239 stdio : "inherit"
@@ -2447,7 +2457,8 @@ async function deploy<N extends Network, C extends Chain>(
24472457 suiGasBudget ?: number ,
24482458 suiPackagePath ?: string ,
24492459 suiWormholeState ?: string ,
2450- suiTreasuryCap ?: string
2460+ suiTreasuryCap ?: string ,
2461+ gasEstimateMultiplier ?: number
24512462) : Promise < ChainAddress < C > | SuiDeploymentResult < C > > {
24522463 if ( version === null ) {
24532464 await warnLocalDeployment ( yes ) ;
@@ -2456,7 +2467,7 @@ async function deploy<N extends Network, C extends Chain>(
24562467 const worktree = version ? createWorkTree ( platform , version ) : "." ;
24572468 switch ( platform ) {
24582469 case "Evm" :
2459- return await deployEvm ( worktree , mode , ch , token , signerType , evmVerify , executor ) ;
2470+ return await deployEvm ( worktree , mode , ch , token , signerType , evmVerify , executor , gasEstimateMultiplier ) ;
24602471 case "Solana" :
24612472 if ( solanaPayer === undefined || ! fs . existsSync ( solanaPayer ) ) {
24622473 console . error ( "Payer not found. Specify with --payer" ) ;
@@ -2480,6 +2491,7 @@ async function deployEvm<N extends Network, C extends Chain>(
24802491 signerType : SignerType ,
24812492 verify : boolean ,
24822493 executor : boolean ,
2494+ gasEstimateMultiplier ?: number
24832495) : Promise < ChainAddress < C > > {
24842496 ensureNttRoot ( pwd ) ;
24852497
@@ -2531,6 +2543,7 @@ async function deployEvm<N extends Network, C extends Chain>(
25312543 const deploy = async ( simulate : boolean ) : Promise < string > => {
25322544 const simulateArg = simulate ? "" : "--skip-simulation" ;
25332545 const slowFlag = getSlowFlag ( ch . chain ) ;
2546+ const gasMultiplier = getGasMultiplier ( gasEstimateMultiplier ) ;
25342547 const effectiveRelayer = relayer || "0x0000000000000000000000000000000000000000" ;
25352548 await withCustomEvmDeployerScript ( pwd , async ( ) => {
25362549 try {
@@ -2539,7 +2552,7 @@ forge script --via-ir script/DeployWormholeNtt.s.sol \
25392552--rpc-url ${ rpc } \
25402553${ simulateArg } \
25412554--sig "${ sig } " ${ wormhole } ${ token } ${ effectiveRelayer } ${ specialRelayer } ${ decimals } ${ modeUint } \
2542- --broadcast ${ slowFlag } ${ verifyArgs . join ( ' ' ) } ${ signerArgs } 2>&1 | tee last-run.stdout` , {
2555+ --broadcast ${ slowFlag } ${ gasMultiplier } ${ verifyArgs . join ( ' ' ) } ${ signerArgs } 2>&1 | tee last-run.stdout` , {
25432556 cwd : `${ pwd } /evm` ,
25442557 encoding : 'utf8' ,
25452558 stdio : 'inherit'
@@ -3982,7 +3995,15 @@ function searchBufferInBinary(binaryPath: string, searchBuffer: Buffer): boolean
39823995}
39833996
39843997function getSlowFlag ( chain : Chain ) : string {
3985- return chain === "Mezo" || chain === "HyperEVM" || chain == "XRPLEVM" ? "--slow" : "" ;
3998+ return chain === "Mezo" || chain === "HyperEVM" || chain == "XRPLEVM" || chain === "CreditCoin" ? "--slow" : "" ;
3999+ }
4000+
4001+ function getGasMultiplier ( userMultiplier ?: number ) : string {
4002+ if ( userMultiplier !== undefined ) {
4003+ return `--gas-estimate-multiplier ${ userMultiplier } ` ;
4004+ }
4005+
4006+ return "" ;
39864007}
39874008
39884009export function ensureNttRoot ( pwd : string = "." ) {
0 commit comments