diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 04:44:48 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 06:27:17 +0800 |
commit | 9740199870d83dc999079883754ec512c1ff544b (patch) | |
tree | 0b46e10e53924f385d12e1e03684ab7e4c7ee43f /packages | |
parent | 06be580d2cbe7e3543d8c4deeb4d1c22b325e6a7 (diff) | |
download | dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar.gz dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar.bz2 dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar.lz dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar.xz dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.tar.zst dexon-sol-tools-9740199870d83dc999079883754ec512c1ff544b.zip |
Fix sol-cov tests
Diffstat (limited to 'packages')
-rw-r--r-- | packages/sol-cov/src/trace.ts | 4 | ||||
-rw-r--r-- | packages/sol-cov/test/trace_test.ts | 2 |
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, }, { |