Skip to content

Commit

Permalink
fix(core): execution gas cost estimation bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman committed Dec 5, 2022
1 parent 76c3bb1 commit 65bc432
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/dull-adults-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@chugsplash/core': patch
'@chugsplash/executor': patch
---

Execution gas cost estimation bug fixes
12 changes: 7 additions & 5 deletions packages/core/src/fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,21 @@ export const estimateExecutionGas = async (
.map(async (action: DeployImplementationAction) =>
ethers.BigNumber.from(350_000).add(
await provider.estimateGas({
to: ethers.constants.AddressZero,
data: action.code,
})
)
)

const resolvedDeploymentPromises = await Promise.all(
const resolvedContractDeploymentPromises = await Promise.all(
deployedProxyPromises.concat(deployedImplementationPromises)
)

estimatedGas = estimatedGas.add(
resolvedDeploymentPromises.reduce((a, b) => a.add(b))
)
const estimatedContractDeploymentGas =
resolvedContractDeploymentPromises.length > 0
? resolvedContractDeploymentPromises.reduce((a, b) => a.add(b))
: ethers.BigNumber.from(0)

estimatedGas = estimatedGas.add(estimatedContractDeploymentGas)

return estimatedGas
}
Expand Down
4 changes: 2 additions & 2 deletions packages/executor/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class ChugSplashExecutor extends BaseServiceV2<Options, Metrics, State> {
)
} else {
this.logger.info(
`Etherscan config not detected for: ${this.options.network}. Skipped verifying ChugSplash contracts.`
`Skipped verifying ChugSplash contracts. Reason: Etherscan config not detected for: ${this.options.network}.`
)
}
}
Expand Down Expand Up @@ -297,7 +297,7 @@ export class ChugSplashExecutor extends BaseServiceV2<Options, Metrics, State> {
)
} else {
this.logger.info(
`Etherscan config not detected for network: ${this.options.network}. Skipped verifying project: ${projectName}.`
`Skipped verifying project: ${projectName}. Reason: Etherscan config not detected for network: ${this.options.network}.`
)
}
} catch (e) {
Expand Down

0 comments on commit 65bc432

Please sign in to comment.