Rename traceInfo.data to traceInfo.dataIfExists

This commit is contained in:
Leonid Logvinov 2019-02-25 12:40:10 -08:00
parent 379eab19ad
commit 4169a41eda
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
3 changed files with 6 additions and 6 deletions

View File

@ -14,11 +14,11 @@ const G_COPY = 3;
export const costUtils = {
reportCallDataCost(traceInfo: TraceInfo): number {
if (_.isUndefined(traceInfo.data)) {
if (_.isUndefined(traceInfo.dataIfExists)) {
// No call data to report
return 0;
}
const callData = traceInfo.data;
const callData = traceInfo.dataIfExists;
const callDataBuf = Buffer.from(stripHexPrefix(callData), 'hex');
const { true: zeroBytesCountIfExist, false: nonZeroBytesCountIfExist } = _.countBy(
callDataBuf,

View File

@ -15,7 +15,7 @@ export abstract class TraceInfoSubprovider extends TraceCollectionSubprovider {
protected async _handleTraceInfoAsync(_traceInfo: TraceInfo): Promise<void> {
return Promise.resolve(undefined);
}
protected async _recordTxTraceAsync(address: string, data: string | undefined, txHash: string): Promise<void> {
protected async _recordTxTraceAsync(address: string, dataIfExists: string | undefined, txHash: string): Promise<void> {
await this._web3Wrapper.awaitTransactionMinedAsync(txHash, 0);
const nodeType = await this._web3Wrapper.getNodeTypeAsync();
let trace;
@ -73,7 +73,7 @@ export abstract class TraceInfoSubprovider extends TraceCollectionSubprovider {
const traceInfo = {
trace,
address,
data,
dataIfExists,
txHash,
};
await this._handleTraceInfoAsync(traceInfo);
@ -90,7 +90,7 @@ export abstract class TraceInfoSubprovider extends TraceCollectionSubprovider {
subtrace: traceForThatSubcall,
txHash,
address: subcallAddress,
bytecode: data as string,
bytecode: dataIfExists as string,
};
} else {
const runtimeBytecode = await this._web3Wrapper.getContractCodeAsync(subcallAddress);

View File

@ -117,7 +117,7 @@ export interface TraceInfo {
trace: TransactionTrace;
txHash: string;
address: string;
data: string | undefined;
dataIfExists: string | undefined;
}
export enum BlockParamLiteral {