From 01a2340d354df3a6092d04262be5f0f67bc036be Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Wed, 4 Mar 2020 15:02:00 -0500 Subject: [PATCH 01/11] Add snapshot and revert endpoints --- .../src/app/web3-rpc-handler.ts | 16 ++++++ .../src/types/web3-rpc-handler.ts | 2 + .../rollup-full-node/test/app/handler.spec.ts | 50 ++++++++++++++++++- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/rollup-full-node/src/app/web3-rpc-handler.ts b/packages/rollup-full-node/src/app/web3-rpc-handler.ts index 7b60e13ae025..a434f2e37f47 100644 --- a/packages/rollup-full-node/src/app/web3-rpc-handler.ts +++ b/packages/rollup-full-node/src/app/web3-rpc-handler.ts @@ -138,6 +138,14 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler { this.assertParameters(params, 0) response = await this.networkVersion() break + case Web3RpcMethods.snapshot: + this.assertParameters(params, 0) + response = await this.snapshot() + break + case Web3RpcMethods.revert: + args = this.assertParameters(params, 1) + response = await this.revert(args[0]) + break default: const msg: string = `Method / params [${method} / ${JSON.stringify( params @@ -348,6 +356,14 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler { return response.toString() } + public async snapshot(): Promise { + return this.provider.send(Web3RpcMethods.snapshot, []) + } + + public async revert(snapShotId: string): Promise { + return this.provider.send(Web3RpcMethods.revert, [snapShotId]) + } + public async sendRawTransaction(rawOvmTx: string): Promise { // lock here because the mapOmTxHash... tx and the sendRawTransaction tx need to be in order because of nonces. return this.lock.acquire(lockKey, async () => { diff --git a/packages/rollup-full-node/src/types/web3-rpc-handler.ts b/packages/rollup-full-node/src/types/web3-rpc-handler.ts index 2c0afcea7715..9024eba674d3 100644 --- a/packages/rollup-full-node/src/types/web3-rpc-handler.ts +++ b/packages/rollup-full-node/src/types/web3-rpc-handler.ts @@ -37,6 +37,8 @@ export enum Web3RpcMethods { getTransactionReceipt = 'eth_getTransactionReceipt', networkVersion = 'net_version', sendRawTransaction = 'eth_sendRawTransaction', + snapshot = 'evm_snapshot', + revert = 'evm_revert', // Test methods: increaseTimestamp = 'evm_increaseTime', diff --git a/packages/rollup-full-node/test/app/handler.spec.ts b/packages/rollup-full-node/test/app/handler.spec.ts index c6ff0c15840a..01dcd36131ef 100644 --- a/packages/rollup-full-node/test/app/handler.spec.ts +++ b/packages/rollup-full-node/test/app/handler.spec.ts @@ -1,6 +1,6 @@ import '../setup' /* External Imports */ -import { getLogger } from '@eth-optimism/core-utils' +import { getLogger, remove0x } from '@eth-optimism/core-utils' /* Internal Imports */ import { FullnodeRpcServer, DefaultWeb3Handler } from '../../src/app' @@ -82,4 +82,52 @@ describe('Web3Handler', () => { res.should.equal(storageValue) }) }) + + describe.only('snapshot and revert', () => { + it('should revert state', async () => { + const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) + const executionManagerAddress = await httpProvider.send( + 'ovm_getExecutionManagerAddress', + [] + ) + const privateKey = '0x' + '60'.repeat(32) + const wallet = new ethers.Wallet(privateKey, httpProvider) + log.debug('Wallet address:', wallet.address) + const factory = new ContractFactory( + SimpleStorage.abi, + SimpleStorage.bytecode, + wallet + ) + + const simpleStorage = await factory.deploy() + const deploymentTxReceipt = await wallet.provider.getTransactionReceipt( + simpleStorage.deployTransaction.hash + ) + + const storageKey = '0x' + '01'.repeat(32) + const storageValue = '0x' + '02'.repeat(32) + const storageValue2 = '0x' + '03'.repeat(32) + // Set storage with our new storage elements + const networkInfo = await httpProvider.getNetwork() + const tx = await simpleStorage.setStorage( + executionManagerAddress, + storageKey, + storageValue + ) + const snapShotId = await httpProvider.send('evm_snapshot', []) + const tx2 = await simpleStorage.setStorage( + executionManagerAddress, + storageKey, + storageValue2 + ) + const receipt = await httpProvider.getTransactionReceipt(tx.hash) + const receipt2 = await httpProvider.getTransactionReceipt(tx2.hash) + const response2 = await httpProvider.send('evm_revert', [snapShotId]) + const res = await simpleStorage.getStorage( + executionManagerAddress, + storageKey + ) + res.should.equal(storageValue) + }) + }) }) From c69e2d644772053247bb331c1fa4c3eba6b7d694 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 19:03:05 -0400 Subject: [PATCH 02/11] Move snapshot and revert functionality to the TestHandler snapshot and revert should only be used in tests --- .../rollup-full-node/src/app/block-builder.ts | 6 +- .../src/app/block-submitter.ts | 2 +- .../src/app/test-web3-rpc-handler.ts | 44 +++++++++---- .../src/app/web3-rpc-handler.ts | 18 +----- .../rollup-full-node/test/app/handler.spec.ts | 2 +- .../test/app/test-handler.spec.ts | 63 ++++++++++++++++++- 6 files changed, 101 insertions(+), 34 deletions(-) diff --git a/packages/rollup-full-node/src/app/block-builder.ts b/packages/rollup-full-node/src/app/block-builder.ts index 35bacdf9f162..9aba3b1693c3 100644 --- a/packages/rollup-full-node/src/app/block-builder.ts +++ b/packages/rollup-full-node/src/app/block-builder.ts @@ -149,7 +149,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { this.tree = await SparseMerkleTreeImpl.create(this.db, treeRoot, 16) this.subtrees = new Map() - const promises: Array> = [] + const promises: Promise[] = [] for (let i = 1; i <= transactionCount; i++) { promises.push( this.db.get(DefaultRollupBlockBuilder.getTransactionKey(i)) @@ -334,7 +334,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { // Update all contract storage slots const modifiedContractAddresses: Set
= new Set() - const storagePromises: Array> = [] + const storagePromises: Promise[] = [] for (const modifiedStorage of modifiedStorageMap.values()) { storagePromises.push(this.updateStorageSlot(modifiedStorage)) modifiedContractAddresses.add(modifiedStorage.contractAddress) @@ -348,7 +348,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { log.debug(`updateStorageSlot promises completed`) // Update the base contract tree with the roots of all subtrees - const blockPromises: Array> = [] + const blockPromises: Promise[] = [] for (const address of modifiedContractAddresses.keys()) { blockPromises.push(this.updateContractSlot(address)) } diff --git a/packages/rollup-full-node/src/app/block-submitter.ts b/packages/rollup-full-node/src/app/block-submitter.ts index f94083bca337..e0273f729138 100644 --- a/packages/rollup-full-node/src/app/block-submitter.ts +++ b/packages/rollup-full-node/src/app/block-submitter.ts @@ -90,7 +90,7 @@ export class DefaultRollupBlockSubmitter implements RollupBlockSubmitter { // We need to populate the queue from storage if (this.lastConfirmed !== this.lastQueued) { let i: number = this.lastConfirmed + 1 - const promises: Array> = [] + const promises: Promise[] = [] for (; i <= this.lastQueued; i++) { promises.push(this.db.get(DefaultRollupBlockSubmitter.getBlockKey(i))) } diff --git a/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts b/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts index af96d8091a89..581ea0c65a17 100644 --- a/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts +++ b/packages/rollup-full-node/src/app/test-web3-rpc-handler.ts @@ -55,18 +55,24 @@ export class TestWeb3Handler extends DefaultWeb3Handler { * Override to add some test RPC methods. */ public async handleRequest(method: string, params: any[]): Promise { - if (method === Web3RpcMethods.increaseTimestamp) { - this.assertParameters(params, 1) - this.increaseTimestamp(params[0]) - log.debug(`Set increased timestamp by ${params[0]} seconds.`) - return TestWeb3Handler.successString + switch (method) { + case Web3RpcMethods.increaseTimestamp: + this.assertParameters(params, 1) + this.increaseTimestamp(params[0]) + log.debug(`Set increased timestamp by ${params[0]} seconds.`) + return TestWeb3Handler.successString + case Web3RpcMethods.getTimestamp: + this.assertParameters(params, 0) + return add0x(this.getTimestamp().toString(16)) + case Web3RpcMethods.snapshot: + this.assertParameters(params, 0) + return this.snapshot() + case Web3RpcMethods.revert: + this.assertParameters(params, 1) + return this.revert(params[0]) + default: + return super.handleRequest(method, params) } - if (method === Web3RpcMethods.getTimestamp) { - this.assertParameters(params, 0) - return add0x(this.getTimestamp().toString(16)) - } - - return super.handleRequest(method, params) } /** @@ -94,4 +100,20 @@ export class TestWeb3Handler extends DefaultWeb3Handler { throw new UnsupportedMethodError(msg) } } + + /** + * Takes a snapshot of the current node state. + * @returns The snapshot id that can be used as an parameter of the revert endpoint + */ + private async snapshot(): Promise { + return this.provider.send(Web3RpcMethods.snapshot, []) + } + + /** + * Reverts state to the specified snapshot + * @param The snapshot id of the snapshot to restore + */ + private async revert(snapShotId: string): Promise { + return this.provider.send(Web3RpcMethods.revert, [snapShotId]) + } } diff --git a/packages/rollup-full-node/src/app/web3-rpc-handler.ts b/packages/rollup-full-node/src/app/web3-rpc-handler.ts index a434f2e37f47..9b7f431a9591 100644 --- a/packages/rollup-full-node/src/app/web3-rpc-handler.ts +++ b/packages/rollup-full-node/src/app/web3-rpc-handler.ts @@ -63,7 +63,7 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler { } protected constructor( - private readonly provider: Web3Provider, + protected readonly provider: Web3Provider, private readonly wallet: Wallet, private readonly executionManager: Contract ) { @@ -138,14 +138,6 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler { this.assertParameters(params, 0) response = await this.networkVersion() break - case Web3RpcMethods.snapshot: - this.assertParameters(params, 0) - response = await this.snapshot() - break - case Web3RpcMethods.revert: - args = this.assertParameters(params, 1) - response = await this.revert(args[0]) - break default: const msg: string = `Method / params [${method} / ${JSON.stringify( params @@ -356,14 +348,6 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler { return response.toString() } - public async snapshot(): Promise { - return this.provider.send(Web3RpcMethods.snapshot, []) - } - - public async revert(snapShotId: string): Promise { - return this.provider.send(Web3RpcMethods.revert, [snapShotId]) - } - public async sendRawTransaction(rawOvmTx: string): Promise { // lock here because the mapOmTxHash... tx and the sendRawTransaction tx need to be in order because of nonces. return this.lock.acquire(lockKey, async () => { diff --git a/packages/rollup-full-node/test/app/handler.spec.ts b/packages/rollup-full-node/test/app/handler.spec.ts index 01dcd36131ef..0b1c426d36c4 100644 --- a/packages/rollup-full-node/test/app/handler.spec.ts +++ b/packages/rollup-full-node/test/app/handler.spec.ts @@ -83,7 +83,7 @@ describe('Web3Handler', () => { }) }) - describe.only('snapshot and revert', () => { + describe('snapshot and revert', () => { it('should revert state', async () => { const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) const executionManagerAddress = await httpProvider.send( diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index b8881c59cfbf..7bd342c126be 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -1,15 +1,25 @@ import '../setup' /* External Imports */ import { add0x, getLogger, remove0x } from '@eth-optimism/core-utils' +import { ethers, ContractFactory } from 'ethers' +import * as SimpleStorage from '../contracts/build/SimpleStorage.json' /* Internal Imports */ -import { Web3RpcMethods, TestWeb3Handler } from '../../src' +import { + Web3RpcMethods, + TestWeb3Handler, + FullnodeRpcServer, + DefaultWeb3Handler, +} from '../../src' const log = getLogger('test-web3-handler', true) const secondsSinceEopch = (): number => { return Math.round(Date.now() / 1000) } +const host = '0.0.0.0' +const port = 9999 +const baseUrl = `http://${host}:${port}` describe('TestHandler', () => { let testHandler: TestWeb3Handler @@ -60,4 +70,55 @@ describe('TestHandler', () => { ) }) }) + + describe('Snapshot and revert', () => { + it.only('should revert state', async () => { + const testRpcServer = new FullnodeRpcServer(testHandler, host, port) + + testRpcServer.listen() + const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) + const executionManagerAddress = await httpProvider.send( + 'ovm_getExecutionManagerAddress', + [] + ) + const privateKey = '0x' + '60'.repeat(32) + const wallet = new ethers.Wallet(privateKey, httpProvider) + log.debug('Wallet address:', wallet.address) + const factory = new ContractFactory( + SimpleStorage.abi, + SimpleStorage.bytecode, + wallet + ) + + const simpleStorage = await factory.deploy() + const deploymentTxReceipt = await wallet.provider.getTransactionReceipt( + simpleStorage.deployTransaction.hash + ) + + const storageKey = '0x' + '01'.repeat(32) + const storageValue = '0x' + '02'.repeat(32) + const storageValue2 = '0x' + '03'.repeat(32) + // Set storage with our new storage elements + const networkInfo = await httpProvider.getNetwork() + const tx = await simpleStorage.setStorage( + executionManagerAddress, + storageKey, + storageValue + ) + const snapShotId = await httpProvider.send('evm_snapshot', []) + const tx2 = await simpleStorage.setStorage( + executionManagerAddress, + storageKey, + storageValue2 + ) + const receipt = await httpProvider.getTransactionReceipt(tx.hash) + const receipt2 = await httpProvider.getTransactionReceipt(tx2.hash) + const response2 = await httpProvider.send('evm_revert', [snapShotId]) + const res = await simpleStorage.getStorage( + executionManagerAddress, + storageKey + ) + res.should.equal(storageValue) + }) + }) }) From 057b72caff997b37e003aa083d3926194f452933 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 19:10:29 -0400 Subject: [PATCH 03/11] Remove unnecessary changes --- packages/rollup-full-node/src/app/block-builder.ts | 6 +++--- packages/rollup-full-node/src/app/block-submitter.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/rollup-full-node/src/app/block-builder.ts b/packages/rollup-full-node/src/app/block-builder.ts index 9aba3b1693c3..35bacdf9f162 100644 --- a/packages/rollup-full-node/src/app/block-builder.ts +++ b/packages/rollup-full-node/src/app/block-builder.ts @@ -149,7 +149,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { this.tree = await SparseMerkleTreeImpl.create(this.db, treeRoot, 16) this.subtrees = new Map() - const promises: Promise[] = [] + const promises: Array> = [] for (let i = 1; i <= transactionCount; i++) { promises.push( this.db.get(DefaultRollupBlockBuilder.getTransactionKey(i)) @@ -334,7 +334,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { // Update all contract storage slots const modifiedContractAddresses: Set
= new Set() - const storagePromises: Promise[] = [] + const storagePromises: Array> = [] for (const modifiedStorage of modifiedStorageMap.values()) { storagePromises.push(this.updateStorageSlot(modifiedStorage)) modifiedContractAddresses.add(modifiedStorage.contractAddress) @@ -348,7 +348,7 @@ export class DefaultRollupBlockBuilder implements RollupBlockBuilder { log.debug(`updateStorageSlot promises completed`) // Update the base contract tree with the roots of all subtrees - const blockPromises: Promise[] = [] + const blockPromises: Array> = [] for (const address of modifiedContractAddresses.keys()) { blockPromises.push(this.updateContractSlot(address)) } diff --git a/packages/rollup-full-node/src/app/block-submitter.ts b/packages/rollup-full-node/src/app/block-submitter.ts index e0273f729138..f94083bca337 100644 --- a/packages/rollup-full-node/src/app/block-submitter.ts +++ b/packages/rollup-full-node/src/app/block-submitter.ts @@ -90,7 +90,7 @@ export class DefaultRollupBlockSubmitter implements RollupBlockSubmitter { // We need to populate the queue from storage if (this.lastConfirmed !== this.lastQueued) { let i: number = this.lastConfirmed + 1 - const promises: Promise[] = [] + const promises: Array> = [] for (; i <= this.lastQueued; i++) { promises.push(this.db.get(DefaultRollupBlockSubmitter.getBlockKey(i))) } From 35702bafe189ce79b6de86647569b421397f22b1 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 20:22:41 -0400 Subject: [PATCH 04/11] Test that snapshot and revert are only available in tests --- .../rollup-full-node/test/app/handler.spec.ts | 37 +++++++++++-------- .../test/app/test-handler.spec.ts | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/rollup-full-node/test/app/handler.spec.ts b/packages/rollup-full-node/test/app/handler.spec.ts index 0b1c426d36c4..04872aca250a 100644 --- a/packages/rollup-full-node/test/app/handler.spec.ts +++ b/packages/rollup-full-node/test/app/handler.spec.ts @@ -84,7 +84,7 @@ describe('Web3Handler', () => { }) describe('snapshot and revert', () => { - it('should revert state', async () => { + it('should fail (snapshot and revert should only be available in the TestHandler)', async () => { const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) const executionManagerAddress = await httpProvider.send( 'ovm_getExecutionManagerAddress', @@ -114,20 +114,27 @@ describe('Web3Handler', () => { storageKey, storageValue ) - const snapShotId = await httpProvider.send('evm_snapshot', []) - const tx2 = await simpleStorage.setStorage( - executionManagerAddress, - storageKey, - storageValue2 - ) - const receipt = await httpProvider.getTransactionReceipt(tx.hash) - const receipt2 = await httpProvider.getTransactionReceipt(tx2.hash) - const response2 = await httpProvider.send('evm_revert', [snapShotId]) - const res = await simpleStorage.getStorage( - executionManagerAddress, - storageKey - ) - res.should.equal(storageValue) + + await new Promise((resolve, reject) => { + httpProvider.send('evm_snapshot', []).catch((error) => { + error.message.should.equal('Method not found') + resolve() + }) + }) + + await new Promise((resolve, reject) => { + httpProvider.send('evm_snapshot', []).catch((error) => { + error.message.should.equal('Method not found') + resolve() + }) + }) + + await new Promise((resolve, reject) => { + httpProvider.send('evm_revert', ['0x01']).catch((error) => { + error.message.should.equal('Method not found') + resolve() + }) + }) }) }) }) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index 7bd342c126be..b7bb5948b256 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -72,7 +72,7 @@ describe('TestHandler', () => { }) describe('Snapshot and revert', () => { - it.only('should revert state', async () => { + it('should revert state', async () => { const testRpcServer = new FullnodeRpcServer(testHandler, host, port) testRpcServer.listen() From ad0b1ec693bdf4a58bfaafcc0c24b5db3ff221bd Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 20:24:10 -0400 Subject: [PATCH 05/11] remove unused parts of test --- .../rollup-full-node/test/app/handler.spec.ts | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/packages/rollup-full-node/test/app/handler.spec.ts b/packages/rollup-full-node/test/app/handler.spec.ts index 04872aca250a..dfd7a95afa2e 100644 --- a/packages/rollup-full-node/test/app/handler.spec.ts +++ b/packages/rollup-full-node/test/app/handler.spec.ts @@ -85,36 +85,6 @@ describe('Web3Handler', () => { describe('snapshot and revert', () => { it('should fail (snapshot and revert should only be available in the TestHandler)', async () => { - const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) - const executionManagerAddress = await httpProvider.send( - 'ovm_getExecutionManagerAddress', - [] - ) - const privateKey = '0x' + '60'.repeat(32) - const wallet = new ethers.Wallet(privateKey, httpProvider) - log.debug('Wallet address:', wallet.address) - const factory = new ContractFactory( - SimpleStorage.abi, - SimpleStorage.bytecode, - wallet - ) - - const simpleStorage = await factory.deploy() - const deploymentTxReceipt = await wallet.provider.getTransactionReceipt( - simpleStorage.deployTransaction.hash - ) - - const storageKey = '0x' + '01'.repeat(32) - const storageValue = '0x' + '02'.repeat(32) - const storageValue2 = '0x' + '03'.repeat(32) - // Set storage with our new storage elements - const networkInfo = await httpProvider.getNetwork() - const tx = await simpleStorage.setStorage( - executionManagerAddress, - storageKey, - storageValue - ) - await new Promise((resolve, reject) => { httpProvider.send('evm_snapshot', []).catch((error) => { error.message.should.equal('Method not found') From e7f6c8275c5d812e16f64a937771f761151826b4 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 20:32:07 -0400 Subject: [PATCH 06/11] Lint --- packages/rollup-full-node/test/app/handler.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rollup-full-node/test/app/handler.spec.ts b/packages/rollup-full-node/test/app/handler.spec.ts index dfd7a95afa2e..367e04a2a472 100644 --- a/packages/rollup-full-node/test/app/handler.spec.ts +++ b/packages/rollup-full-node/test/app/handler.spec.ts @@ -1,6 +1,6 @@ import '../setup' /* External Imports */ -import { getLogger, remove0x } from '@eth-optimism/core-utils' +import { getLogger } from '@eth-optimism/core-utils' /* Internal Imports */ import { FullnodeRpcServer, DefaultWeb3Handler } from '../../src/app' @@ -85,6 +85,7 @@ describe('Web3Handler', () => { describe('snapshot and revert', () => { it('should fail (snapshot and revert should only be available in the TestHandler)', async () => { + const httpProvider = new ethers.providers.JsonRpcProvider(baseUrl) await new Promise((resolve, reject) => { httpProvider.send('evm_snapshot', []).catch((error) => { error.message.should.equal('Method not found') From 8e065607d4a160cfaf7d9139ae78ce7ae5d63a19 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 21:40:20 -0400 Subject: [PATCH 07/11] Skip TestHandler SimpleStorage test --- .../rollup-full-node/test/app/test-handler.spec.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index b7bb5948b256..10dc7a4dfaf0 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -2,7 +2,7 @@ import '../setup' /* External Imports */ import { add0x, getLogger, remove0x } from '@eth-optimism/core-utils' import { ethers, ContractFactory } from 'ethers' -import * as SimpleStorage from '../contracts/build/SimpleStorage.json' +// import * as SimpleStorage from '../contracts/build/SimpleStorage.json' /* Internal Imports */ import { @@ -72,7 +72,7 @@ describe('TestHandler', () => { }) describe('Snapshot and revert', () => { - it('should revert state', async () => { + it.skip('should revert state', async () => { const testRpcServer = new FullnodeRpcServer(testHandler, host, port) testRpcServer.listen() @@ -85,8 +85,10 @@ describe('TestHandler', () => { const wallet = new ethers.Wallet(privateKey, httpProvider) log.debug('Wallet address:', wallet.address) const factory = new ContractFactory( - SimpleStorage.abi, - SimpleStorage.bytecode, + null, + null, + // SimpleStorage.abi, + // SimpleStorage.bytecode, wallet ) From 5ea7d8620876ac6845fcab0d2e8d1894486f91cf Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 21:46:06 -0400 Subject: [PATCH 08/11] Don't skip TestHandler SimpleStorage test --- .../rollup-full-node/test/app/test-handler.spec.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index 10dc7a4dfaf0..5361226c8dd0 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -2,7 +2,6 @@ import '../setup' /* External Imports */ import { add0x, getLogger, remove0x } from '@eth-optimism/core-utils' import { ethers, ContractFactory } from 'ethers' -// import * as SimpleStorage from '../contracts/build/SimpleStorage.json' /* Internal Imports */ import { @@ -11,6 +10,7 @@ import { FullnodeRpcServer, DefaultWeb3Handler, } from '../../src' +import * as SimpleStorage from '../contracts/build/SimpleStorage.json' const log = getLogger('test-web3-handler', true) @@ -72,7 +72,7 @@ describe('TestHandler', () => { }) describe('Snapshot and revert', () => { - it.skip('should revert state', async () => { + it('should revert state', async () => { const testRpcServer = new FullnodeRpcServer(testHandler, host, port) testRpcServer.listen() @@ -85,10 +85,8 @@ describe('TestHandler', () => { const wallet = new ethers.Wallet(privateKey, httpProvider) log.debug('Wallet address:', wallet.address) const factory = new ContractFactory( - null, - null, - // SimpleStorage.abi, - // SimpleStorage.bytecode, + SimpleStorage.abi, + SimpleStorage.bytecode, wallet ) From f3003d6b3b0f36f7555a70b5b1a4b330ade7ce27 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 21:50:04 -0400 Subject: [PATCH 09/11] Fix path to SimpleStorage --- packages/rollup-full-node/test/app/test-handler.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index 5361226c8dd0..3b20cea48c2e 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -10,7 +10,7 @@ import { FullnodeRpcServer, DefaultWeb3Handler, } from '../../src' -import * as SimpleStorage from '../contracts/build/SimpleStorage.json' +import * as SimpleStorage from './test/contracts/build/SimpleStorage.json' const log = getLogger('test-web3-handler', true) From 1a9a05045035481ca5af5c1256f99c57bb4ed472 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 21:56:30 -0400 Subject: [PATCH 10/11] Fix path to SimpleStorage --- packages/rollup-full-node/test/app/test-handler.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index 3b20cea48c2e..fdd255feb3db 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -10,7 +10,7 @@ import { FullnodeRpcServer, DefaultWeb3Handler, } from '../../src' -import * as SimpleStorage from './test/contracts/build/SimpleStorage.json' +import * as SimpleStorage from '../../test/contracts/build/SimpleStorage.json' const log = getLogger('test-web3-handler', true) From cf17ece3ef096adf970cf01f7c18b27986d33f66 Mon Sep 17 00:00:00 2001 From: Mason Fischer Date: Mon, 9 Mar 2020 22:03:16 -0400 Subject: [PATCH 11/11] Fix path to SimpleStorage --- packages/rollup-full-node/test/app/test-handler.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rollup-full-node/test/app/test-handler.spec.ts b/packages/rollup-full-node/test/app/test-handler.spec.ts index fdd255feb3db..5361226c8dd0 100644 --- a/packages/rollup-full-node/test/app/test-handler.spec.ts +++ b/packages/rollup-full-node/test/app/test-handler.spec.ts @@ -10,7 +10,7 @@ import { FullnodeRpcServer, DefaultWeb3Handler, } from '../../src' -import * as SimpleStorage from '../../test/contracts/build/SimpleStorage.json' +import * as SimpleStorage from '../contracts/build/SimpleStorage.json' const log = getLogger('test-web3-handler', true)