Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Buidler OVM node plugin to work within tasks #238

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this change do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it so that it uses the normal compiler by default, doesn't use the OVM unless the --ovm flag is set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh ok makes sense, cool!

},
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