Commit 09e8dedb authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1879 from ethereum-optimism/feat/forkmode

feat: hardhat fork mode
parents dd3e79a3 50e2f6ff
---
'@eth-optimism/hardhat-node': patch
---
Add fork mode config to ethereumoptimism/hardhat docker image
---
'@eth-optimism/hardhat-node': patch
---
Update to hardhat@2.7.0
...@@ -7,6 +7,8 @@ services: ...@@ -7,6 +7,8 @@ services:
build: build:
context: ./docker/hardhat context: ./docker/hardhat
dockerfile: Dockerfile dockerfile: Dockerfile
env_file:
- ./envs/l1_chain.env
ports: ports:
# expose the service to the host for integration testing # expose the service to the host for integration testing
- ${L1CHAIN_HTTP_PORT:-9545}:8545 - ${L1CHAIN_HTTP_PORT:-9545}:8545
......
module.exports = { const isForkModeEnabled = !!process.env.FORK_URL
const forkUrl = process.env.FORK_URL
const forkStartingBlock = parseInt(process.env.FORK_STARTING_BLOCK) || undefined
const gasPrice = parseInt(process.env.GAS_PRICE) || 0
const config = {
networks: { networks: {
hardhat: { hardhat: {
gasPrice: 0, gasPrice,
initialBaseFeePerGas: 0 initialBaseFeePerGas: 0
}, },
}, },
analytics: { enabled: false }, analytics: { enabled: false },
} }
if (isForkModeEnabled) {
console.log(`Running hardhat in a fork mode! URL: ${forkUrl}`)
if (forkStartingBlock) {
console.log(`Starting block: ${forkStartingBlock}`)
}
config.networks.hardhat.forking = {
url: forkUrl,
blockNumber: forkStartingBlock,
}
} else {
console.log('Running with a fresh state...')
}
module.exports = config
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"hardhat": "^2.6.5" "hardhat": "^2.7.0"
} }
} }
FORK_URL=
FORK_STARTING_BLOCK=
...@@ -2639,6 +2639,13 @@ ...@@ -2639,6 +2639,13 @@
dependencies: dependencies:
antlr4ts "^0.5.0-alpha.4" antlr4ts "^0.5.0-alpha.4"
"@solidity-parser/parser@^0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.0.tgz#d51f074efb0acce0e953ec48133561ed710cebc0"
integrity sha512-cX0JJRcmPtNUJpzD2K7FdA7qQsTOk1UZnFx2k7qAg9ZRvuaH5NBe5IEdBMXGlmf2+FmjhqbygJ26H8l2SV7aKQ==
dependencies:
antlr4ts "^0.5.0-alpha.4"
"@szmarczak/http-timer@^1.1.2": "@szmarczak/http-timer@^1.1.2":
version "1.1.2" version "1.1.2"
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421"
...@@ -8456,10 +8463,10 @@ hardhat@^2.3.0: ...@@ -8456,10 +8463,10 @@ hardhat@^2.3.0:
uuid "^3.3.2" uuid "^3.3.2"
ws "^7.4.6" ws "^7.4.6"
hardhat@^2.6.5: hardhat@^2.7.0:
version "2.6.5" version "2.7.0"
resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.6.5.tgz#61d3e22da34e1b175bbe599f77396b32f9788b58" resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.7.0.tgz#d8f01bc07bdd88ccaa00719ddb18618bc59a73b5"
integrity sha512-sBhREWZjQTtR/KMMp2F3ySuDqL0norjNq68geR3nlXRHXYKuNKeL7xqVsmldekt3sVB5Wh1WX7xDX79kvUr+fA== integrity sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g==
dependencies: dependencies:
"@ethereumjs/block" "^3.4.0" "@ethereumjs/block" "^3.4.0"
"@ethereumjs/blockchain" "^5.4.0" "@ethereumjs/blockchain" "^5.4.0"
...@@ -8468,7 +8475,7 @@ hardhat@^2.6.5: ...@@ -8468,7 +8475,7 @@ hardhat@^2.6.5:
"@ethereumjs/vm" "^5.5.2" "@ethereumjs/vm" "^5.5.2"
"@ethersproject/abi" "^5.1.2" "@ethersproject/abi" "^5.1.2"
"@sentry/node" "^5.18.1" "@sentry/node" "^5.18.1"
"@solidity-parser/parser" "^0.11.0" "@solidity-parser/parser" "^0.14.0"
"@types/bn.js" "^5.1.0" "@types/bn.js" "^5.1.0"
"@types/lru-cache" "^5.1.0" "@types/lru-cache" "^5.1.0"
abort-controller "^3.0.0" abort-controller "^3.0.0"
...@@ -8506,7 +8513,7 @@ hardhat@^2.6.5: ...@@ -8506,7 +8513,7 @@ hardhat@^2.6.5:
stacktrace-parser "^0.1.10" stacktrace-parser "^0.1.10"
"true-case-path" "^2.2.1" "true-case-path" "^2.2.1"
tsort "0.0.1" tsort "0.0.1"
uuid "^3.3.2" uuid "^8.3.2"
ws "^7.4.6" ws "^7.4.6"
has-ansi@^2.0.0: has-ansi@^2.0.0:
...@@ -15513,6 +15520,11 @@ uuid@^3.3.2, uuid@^3.3.3: ...@@ -15513,6 +15520,11 @@ uuid@^3.3.2, uuid@^3.3.3:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
v8-compile-cache@^2.0.3: v8-compile-cache@^2.0.3:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment