Skip to content

Commit

Permalink
fix(core): assert that the block gas limit is at least 15 million
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman committed Apr 29, 2023
1 parent d7f82d7 commit 7ee54af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-brooms-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/core': patch
---

Assert that the block gas limit is at least 15 million
7 changes: 7 additions & 0 deletions packages/core/src/languages/solidity/predeploys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ export const initializeChugSplash = async (
executors: string[],
logger?: Logger
): Promise<void> => {
// Check that the block gas limit is reasonably high on this network. Although we can lower 15M to
// 10M or less, we err on the side of safety for now. This number should never be lower than 6M
// because it costs ~5.3M gas to deploy the ChugSplashManager V1, which is at the contract size
// limit.
const { gasLimit: blockGasLimit } = await provider.getBlock('latest')
assert(blockGasLimit.gte(15_000_000), `Block gas limit is too low.`)

const chugsplashConstructorArgs = getChugSplashConstructorArgs()

logger?.info('[ChugSplash]: deploying DefaultCreate2...')
Expand Down

0 comments on commit 7ee54af

Please sign in to comment.