Skip to content

Commit

Permalink
update buidler ovm node plugin (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Ho authored Aug 28, 2020
1 parent 94ba72b commit 02136ed
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions packages/ovm-toolchain/buidler.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import path from 'path'
import { usePlugin } from '@nomiclabs/buidler/config'
import { usePlugin, task } from '@nomiclabs/buidler/config'

usePlugin('@nomiclabs/buidler-ethers')
usePlugin('@nomiclabs/buidler-waffle')

import './src/buidler-plugins/buidler-ovm-compiler'
import './src/buidler-plugins/buidler-ovm-node'

task('test')
.addFlag('ovm', 'Run tests on the OVM using a custom OVM provider')
.setAction(async (taskArguments, bre: any, runSuper) => {
if (taskArguments.ovm) {
console.log('Compiling and running tests in the OVM...')
bre.config.solc = {
path: path.resolve(__dirname, '../../node_modules/@eth-optimism/solc'),
}
await bre.config.startOvmNode()
}
await runSuper(taskArguments)
})

const config: any = {
networks: {
buidlerevm: {
Expand All @@ -23,9 +36,8 @@ const config: any = {
timeout: 50000,
},
solc: {
path: path.resolve(__dirname, '../../node_modules/@eth-optimism/solc'),
version: '0.5.16',
},
useOvm: true,
}

export default config
4 changes: 2 additions & 2 deletions packages/ovm-toolchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"build:waffle": "waffle \"test/config/waffle-config.json\"",
"build:typescript": "tsc -p .",
"clean": "rimraf build/",
"test": "yarn run test:truffle && yarn run test:waffle-v2",
"test": "yarn run test:truffle && yarn run test:waffle-v2 && yarn run test:buidler",
"test:truffle": "truffle test \"test/test-truffle/erc20.spec.js\" --config \"test/config/truffle-config.js\"",
"test:waffle-v2": "waffle \"test/config/waffle-config.json\" && mocha --require source-map-support/register --require ts-node/register \"test/test-waffle-v2/**/*.spec.ts\" --timeout 10000",
"test:buidler": "buidler test"
"test:buidler": "buidler test --ovm"
},
"keywords": [
"optimistic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const BN = require('bn.js')

extendEnvironment(async (bre) => {
const config: any = bre.config
if (config.useOvm) {
config.startOvmNode = async (): Promise<void> => {
const gasLimit = 100_000_000

// Initialize the provider so it has a VM instance ready to copy.
Expand Down

0 comments on commit 02136ed

Please sign in to comment.