aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/src/trace.ts4
-rw-r--r--packages/sol-cov/test/trace_test.ts2
2 files changed, 4 insertions, 2 deletions
diff --git a/packages/sol-cov/src/trace.ts b/packages/sol-cov/src/trace.ts
index feebaaab5..389bd8309 100644
--- a/packages/sol-cov/src/trace.ts
+++ b/packages/sol-cov/src/trace.ts
@@ -27,7 +27,9 @@ export function getTracesByContractAddress(structLogs: StructLog[], startAddress
const currentAddress = _.last(callStack) as string;
const jumpAddressOffset = structLog.op === OpCode.DelegateCall ? 4 : 2;
const newAddress = addressUtils.padZeros(
- new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset])).toString(16),
+ new BigNumber(addHexPrefix(structLog.stack[structLog.stack.length - jumpAddressOffset - 1])).toString(
+ 16,
+ ),
);
if (structLog === _.last(structLogs)) {
throw new Error('CALL-like opcode can not be the last one');
diff --git a/packages/sol-cov/test/trace_test.ts b/packages/sol-cov/test/trace_test.ts
index 2d6697ce5..93696b04a 100644
--- a/packages/sol-cov/test/trace_test.ts
+++ b/packages/sol-cov/test/trace_test.ts
@@ -32,7 +32,7 @@ describe('Trace', () => {
const trace = [
{
op: OpCode.DelegateCall,
- stack: ['0x', '0x', '0x', '0x', delegateCallAddress],
+ stack: [delegateCallAddress, '0x', '0x', '0x', '0x'],
depth: 0,
},
{