aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-07-03 09:44:37 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-07-03 09:57:33 +0800
commit5b64b3ea937326978b5742ec1b3692ebe5c41991 (patch)
tree34f4029b1985295490479d3da93cae62de5396d1 /packages/dev-utils
parentb1dc20bbb35e8fb6370820a94d6f56306453fc4d (diff)
downloaddexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar.gz
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar.bz2
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar.lz
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar.xz
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.tar.zst
dexon-sol-tools-5b64b3ea937326978b5742ec1b3692ebe5c41991.zip
Improve robustness of revert reason assertions
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/src/blockchain_lifecycle.ts22
1 files changed, 3 insertions, 19 deletions
diff --git a/packages/dev-utils/src/blockchain_lifecycle.ts b/packages/dev-utils/src/blockchain_lifecycle.ts
index 587332f1a..abca6d386 100644
--- a/packages/dev-utils/src/blockchain_lifecycle.ts
+++ b/packages/dev-utils/src/blockchain_lifecycle.ts
@@ -1,11 +1,5 @@
import { logUtils } from '@0xproject/utils';
-import { uniqueVersionIds, Web3Wrapper } from '@0xproject/web3-wrapper';
-import { includes } from 'lodash';
-
-enum NodeType {
- Geth = 'GETH',
- Ganache = 'GANACHE',
-}
+import { NodeType, Web3Wrapper } from '@0xproject/web3-wrapper';
// HACK(albrow): 🐉 We have to do this so that debug.setHead works correctly.
// (Geth does not seem to like debug.setHead(0), so by sending some transactions
@@ -23,7 +17,7 @@ export class BlockchainLifecycle {
this._snapshotIdsStack = [];
}
public async startAsync(): Promise<void> {
- const nodeType = await this._getNodeTypeAsync();
+ const nodeType = await this._web3Wrapper.getNodeTypeAsync();
switch (nodeType) {
case NodeType.Ganache:
const snapshotId = await this._web3Wrapper.takeSnapshotAsync();
@@ -44,7 +38,7 @@ export class BlockchainLifecycle {
}
}
public async revertAsync(): Promise<void> {
- const nodeType = await this._getNodeTypeAsync();
+ const nodeType = await this._web3Wrapper.getNodeTypeAsync();
switch (nodeType) {
case NodeType.Ganache:
const snapshotId = this._snapshotIdsStack.pop() as number;
@@ -61,16 +55,6 @@ export class BlockchainLifecycle {
throw new Error(`Unknown node type: ${nodeType}`);
}
}
- private async _getNodeTypeAsync(): Promise<NodeType> {
- const version = await this._web3Wrapper.getNodeVersionAsync();
- if (includes(version, uniqueVersionIds.geth)) {
- return NodeType.Geth;
- } else if (includes(version, uniqueVersionIds.ganache)) {
- return NodeType.Ganache;
- } else {
- throw new Error(`Unknown client version: ${version}`);
- }
- }
private async _mineMinimumBlocksAsync(): Promise<void> {
logUtils.warn('WARNING: minimum block number for tests not met. Mining additional blocks...');
if (this._addresses.length === 0) {