aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-tracing-utils/src/utils.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-18 19:53:04 +0800
committerGitHub <noreply@github.com>2019-01-18 19:53:04 +0800
commitc8212f1d4d255120e5e683664b86f1830fb45ae6 (patch)
tree73f1528a36b8fc8a0778e164b1579eb5865d944a /packages/sol-tracing-utils/src/utils.ts
parent7d166dc7da23c30540fb554727a955015073286f (diff)
parentbef30e4209b26c8d4f443f8672e9acb9471c6a37 (diff)
downloaddexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar.gz
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar.bz2
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar.lz
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar.xz
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.tar.zst
dexon-0x-contracts-c8212f1d4d255120e5e683664b86f1830fb45ae6.zip
Merge branch 'development' into feature/bignumber-8.0
Diffstat (limited to 'packages/sol-tracing-utils/src/utils.ts')
-rw-r--r--packages/sol-tracing-utils/src/utils.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/sol-tracing-utils/src/utils.ts b/packages/sol-tracing-utils/src/utils.ts
index 644321f32..89c158ee7 100644
--- a/packages/sol-tracing-utils/src/utils.ts
+++ b/packages/sol-tracing-utils/src/utils.ts
@@ -8,6 +8,7 @@ import { ContractData, LineColumn, SingleFileSourceRange } from './types';
// This is the minimum length of valid contract bytecode. The Solidity compiler
// metadata is 86 bytes. If you add the '0x' prefix, we get 88.
const MIN_CONTRACT_BYTECODE_LENGTH = 88;
+const STATICCALL_GAS_COST = 40;
export const utils = {
compareLineColumn(lhs: LineColumn, rhs: LineColumn): number {
@@ -76,10 +77,17 @@ export const utils = {
normalizeStructLogs(structLogs: StructLog[]): StructLog[] {
if (structLogs[0].depth === 1) {
// Geth uses 1-indexed depth counter whilst ganache starts from 0
- const newStructLogs = _.map(structLogs, structLog => ({
- ...structLog,
- depth: structLog.depth - 1,
- }));
+ const newStructLogs = _.map(structLogs, structLog => {
+ const newStructLog = {
+ ...structLog,
+ depth: structLog.depth - 1,
+ };
+ if (newStructLog.op === 'STATICCALL') {
+ // HACK(leo): Geth traces sometimes returns those gas costs incorrectly as very big numbers so we manually fix them.
+ newStructLog.gasCost = STATICCALL_GAS_COST;
+ }
+ return newStructLog;
+ });
return newStructLogs;
}
return structLogs;