diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-08-03 19:42:05 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-08-03 19:42:05 +0800 |
commit | c94168981c13de52ed0334bac5fee2e0ea14a4ef (patch) | |
tree | 6680d41f8a07e3548c0c9b77939bf9389a5277a5 /packages/sol-cov | |
parent | 749ec0cefe095805f76dca2f81025ebfbd98de2a (diff) | |
download | dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar.gz dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar.bz2 dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar.lz dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar.xz dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.tar.zst dexon-sol-tools-c94168981c13de52ed0334bac5fee2e0ea14a4ef.zip |
Use CallDataRPC in subprovider
Diffstat (limited to 'packages/sol-cov')
-rw-r--r-- | packages/sol-cov/src/trace_collection_subprovider.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 0aa592bd5..b6486e6f7 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -1,7 +1,7 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { Callback, ErrorCallback, NextCallback, Subprovider } from '@0xproject/subproviders'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { CallData, JSONRPCRequestPayload, Provider, TxData } from 'ethereum-types'; +import { CallDataRPC, marshaller, Web3Wrapper } from '@0xproject/web3-wrapper'; +import { JSONRPCRequestPayload, Provider, TxData } from 'ethereum-types'; import * as _ from 'lodash'; import { Lock } from 'semaphore-async-await'; @@ -152,7 +152,7 @@ export abstract class TraceCollectionSubprovider extends Subprovider { cb(); } private async _onCallOrGasEstimateExecutedAsync( - callData: Partial<CallData>, + callData: Partial<CallDataRPC>, _err: Error | null, _callResult: string, cb: Callback, @@ -160,20 +160,21 @@ export abstract class TraceCollectionSubprovider extends Subprovider { await this._recordCallOrGasEstimateTraceAsync(callData); cb(); } - private async _recordCallOrGasEstimateTraceAsync(callData: Partial<CallData>): Promise<void> { + private async _recordCallOrGasEstimateTraceAsync(callData: Partial<CallDataRPC>): Promise<void> { // We don't want other transactions to be exeucted during snashotting period, that's why we lock the // transaction execution for all transactions except our fake ones. await this._lock.acquire(); const blockchainLifecycle = new BlockchainLifecycle(this._web3Wrapper); await blockchainLifecycle.startAsync(); - const fakeTxData: MaybeFakeTxData = { - gas: BLOCK_GAS_LIMIT, + const fakeTxData = { + gas: BLOCK_GAS_LIMIT.toString(16), // tslint:disable-line:custom-no-magic-numbers isFakeTransaction: true, // This transaction (and only it) is allowed to come through when the lock is locked ...callData, from: callData.from || this._defaultFromAddress, }; try { - const txHash = await this._web3Wrapper.sendTransactionAsync(fakeTxData); + const txData = marshaller.unmarshalTxData(fakeTxData); + const txHash = await this._web3Wrapper.sendTransactionAsync(txData); await this._web3Wrapper.awaitTransactionMinedAsync(txHash, 0); } catch (err) { // TODO(logvinov) Check that transaction failed and not some other exception |