Skip to content

Commit 0a89739

Browse files
author
ci-bot
committed
linting
1 parent 0bde110 commit 0a89739

File tree

2 files changed

+25
-38
lines changed

2 files changed

+25
-38
lines changed

libs/remix-debug/test/decoder/localsTests/callTypes.ts

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@ import { NestedScope } from '@remix-project/remix-debug'
33
import * as helper from './helper'
44

55
module.exports = async function (st, privateKey, contractBytecode, compilationResult, contractCode) {
6+
// Traverse the call tree to verify call types
7+
let callCount = 0
8+
let staticCallCount = 0
9+
let delegateCallCount = 0
10+
let contractBFunctionTotalCount = 0
11+
let contractCFunctionTotalCount = 0
12+
function traverseScopes(scope: NestedScope, parent?: NestedScope) {
13+
if (scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) contractBFunctionTotalCount++
14+
if (scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractCFunction')) contractCFunctionTotalCount++
15+
16+
if (parent && parent.opcodeInfo.op === 'CALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) {
17+
callCount++
18+
} else if (parent && parent.opcodeInfo.op === 'STATICCALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractCFunction')) {
19+
staticCallCount++
20+
} else if (parent && parent.opcodeInfo.op === 'DELEGATECALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) {
21+
delegateCallCount++
22+
}
23+
24+
if (scope.children) {
25+
scope.children.forEach(child => traverseScopes(child, scope))
26+
}
27+
}
628
try {
729
// Deploy the contract first (constructor deployment)
830
const { traceManager: deployTraceManager, callTree: deployCallTree, waitForCallTree: waitForDeployCallTree } = await helper.setupDebugger(privateKey, contractBytecode, compilationResult, contractCode)
@@ -24,29 +46,6 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
2446
// Get the nested JSON representation of scopes
2547
const nestedScopes: NestedScope[] = callTree.getScopesAsNestedJSON()
2648

27-
// Traverse the call tree to verify call types
28-
let callCount = 0
29-
let staticCallCount = 0
30-
let delegateCallCount = 0
31-
let contractBFunctionTotalCount = 0
32-
let contractCFunctionTotalCount = 0
33-
function traverseScopes(scope: NestedScope, parent?: NestedScope) {
34-
if (scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) contractBFunctionTotalCount++
35-
if (scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractCFunction')) contractCFunctionTotalCount++
36-
37-
if (parent && parent.opcodeInfo.op === 'CALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) {
38-
callCount++
39-
} else if (parent && parent.opcodeInfo.op === 'STATICCALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractCFunction')) {
40-
staticCallCount++
41-
} else if (parent && parent.opcodeInfo.op === 'DELEGATECALL' && scope.functionDefinition && scope.functionDefinition.name && scope.functionDefinition.name.includes('contractBFunction')) {
42-
delegateCallCount++
43-
}
44-
45-
if (scope.children) {
46-
scope.children.forEach(child => traverseScopes(child, scope))
47-
}
48-
}
49-
5049
traverseScopes(nestedScopes[0])
5150

5251
// Verify we found the expected call types

libs/remix-debug/test/decoder/localsTests/helper.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,27 +98,15 @@ export async function decodeLocals (st, index, traceManager, callTree, verifier)
9898
try {
9999
// Convert traceManager methods to async but keep callback compatibility
100100
const getStackAt = async (stepIndex) => {
101-
try {
102-
return traceManager.getStackAt(stepIndex)
103-
} catch (error) {
104-
throw error
105-
}
101+
return traceManager.getStackAt(stepIndex)
106102
}
107103

108104
const getMemoryAt = async (stepIndex) => {
109-
try {
110-
return traceManager.getMemoryAt(stepIndex)
111-
} catch (error) {
112-
throw error
113-
}
105+
return traceManager.getMemoryAt(stepIndex)
114106
}
115107

116108
const getCallDataAt = async (stepIndex) => {
117-
try {
118-
return traceManager.getCallDataAt(stepIndex)
119-
} catch (error) {
120-
throw error
121-
}
109+
return traceManager.getCallDataAt(stepIndex)
122110
}
123111

124112
// Execute all operations in parallel

0 commit comments

Comments
 (0)