diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-09 04:27:55 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-09 05:56:45 +0800 |
commit | 1c3dc757c3332dad39f47e25cbbbdc60ce2540da (patch) | |
tree | f7cca8c6a29bafc79f7f3fd5438c15907f799647 /packages | |
parent | 25866095dbc7ae7e08f1f44939c7cf1910d50b6b (diff) | |
download | dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar.gz dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar.bz2 dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar.lz dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar.xz dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.tar.zst dexon-sol-tools-1c3dc757c3332dad39f47e25cbbbdc60ce2540da.zip |
Fix typos
Diffstat (limited to 'packages')
-rw-r--r-- | packages/migrations/CHANGELOG.json | 2 | ||||
-rw-r--r-- | packages/sol-cov/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/sol-cov/src/trace_collection_subprovider.ts | 11 | ||||
-rw-r--r-- | packages/sol-cov/src/utils.ts | 2 | ||||
-rw-r--r-- | packages/web3-wrapper/src/web3_wrapper.ts | 11 |
5 files changed, 23 insertions, 7 deletions
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json index c6acf1511..50fe6885a 100644 --- a/packages/migrations/CHANGELOG.json +++ b/packages/migrations/CHANGELOG.json @@ -3,7 +3,7 @@ "version": "0.0.7", "changes": [ { - "note": "Use AssetproxyOwner instead of MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress", + "note": "Use AssetProxyOwner instead of MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress", "pr": 675 } ] diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index b92220a14..36f8e1a7d 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -15,7 +15,7 @@ "pr": 675 }, { - "note": "Use `BlockchainLifecycle` to support reverst on Geth", + "note": "Use `BlockchainLifecycle` to support reverts on Geth", "pr": 675 }, { @@ -35,7 +35,7 @@ "pr": 675 }, { - "note": "Skip interface artifacts with the warning instead of failing", + "note": "Skip interface artifacts with a warning instead of failing", "pr": 675 } ] diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index ffa33ad41..a6af7d4d2 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -132,19 +132,22 @@ export class TraceCollectionSubprovider extends Subprovider { // And we don't want it to be executed within a snapshotting period await this._lock.acquire(); } + const NULL_ADDRESS = '0x0'; if (_.isNull(err)) { - const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to; + const toAddress = + _.isUndefined(txData.to) || txData.to === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to; await this._recordTxTraceAsync(toAddress, txData.data, txHash as string); } else { const latestBlock = await this._web3Wrapper.getBlockWithTransactionDataAsync(BlockParamLiteral.Latest); const transactions = latestBlock.transactions; for (const transaction of transactions) { - const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to; + const toAddress = + _.isUndefined(txData.to) || txData.to === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to; await this._recordTxTraceAsync(toAddress, transaction.input, transaction.hash); } } if (!txData.isFakeTransaction) { - // This transaction is a usual ttransaction. Not a call executed as one. + // This transaction is a usual transaction. Not a call executed as one. // And we don't want it to be executed within a snapshotting period this._lock.release(); } @@ -230,6 +233,7 @@ export class TraceCollectionSubprovider extends Subprovider { await this._web3Wrapper.awaitTransactionMinedAsync(txHash); } catch (err) { // Even if this transaction failed - we've already recorded it's trace. + _.noop(); } await blockchainLifecycle.revertAsync(); this._lock.release(); @@ -251,6 +255,7 @@ export class TraceCollectionSubprovider extends Subprovider { await this._web3Wrapper.awaitTransactionMinedAsync(txHash); } catch (err) { // Even if this transaction failed - we've already recorded it's trace. + _.noop(); } await blockchainLifecycle.revertAsync(); this._lock.release(); diff --git a/packages/sol-cov/src/utils.ts b/packages/sol-cov/src/utils.ts index 7333b2f4d..0b32df02e 100644 --- a/packages/sol-cov/src/utils.ts +++ b/packages/sol-cov/src/utils.ts @@ -24,7 +24,7 @@ export const utils = { .replace(/.{86}$/, '') // Libraries contain their own address at the beginning of the code and it's impossible to know it in advance .replace(/^0x730000000000000000000000000000000000000000/, '0x73........................................'); - // HACK: Node regexes can't be longer that 32767 characters. Contracts bytecode can. We jsut truncate the regexes. It's safe in practice. + // HACK: Node regexes can't be longer that 32767 characters. Contracts bytecode can. We just truncate the regexes. It's safe in practice. const MAX_REGEX_LENGTH = 32767; const truncatedBytecodeRegex = bytecodeRegex.slice(0, MAX_REGEX_LENGTH); return truncatedBytecodeRegex; diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index ecb400656..780695091 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -195,10 +195,21 @@ export class Web3Wrapper { const isCodeEmpty = /^0x0{0,40}$/i.test(code); return !isCodeEmpty; } + /** + * Gets the contract code by address + * @param address Address of the contract + * @return Code of the contract + */ public async getContractCodeAsync(address: string): Promise<string> { const code = await promisify<string>(this._web3.eth.getCode)(address); return code; } + /** + * Gets the debug trace of a transaction + * @param txHash Hash of the transactuon to get a trace for + * @param traceParams Config object allowing you to specify if you need memory/storage/stack traces. + * @return Transaction trace + */ public async getTransactionTraceAsync(txHash: string, traceParams: TraceParams): Promise<TransactionTrace> { const trace = await this._sendRawPayloadAsync<TransactionTrace>({ method: 'debug_traceTransaction', |