recon-generate 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cfg/builder.d.ts +89 -0
- package/dist/cfg/builder.js +1295 -0
- package/dist/cfg/edge-mapper.d.ts +103 -0
- package/dist/cfg/edge-mapper.js +297 -0
- package/dist/cfg/emitter.d.ts +11 -0
- package/dist/cfg/emitter.js +492 -0
- package/dist/cfg/index.d.ts +35 -0
- package/dist/cfg/index.js +77 -0
- package/dist/cfg/sourcemap.d.ts +169 -0
- package/dist/cfg/sourcemap.js +605 -0
- package/dist/cfg/types.d.ts +270 -0
- package/dist/cfg/types.js +41 -0
- package/dist/cfg/unified-coverage.d.ts +87 -0
- package/dist/cfg/unified-coverage.js +248 -0
- package/dist/index.js +19 -0
- package/dist/info.js +0 -13
- package/dist/sourcemap.d.ts +14 -0
- package/dist/sourcemap.js +317 -0
- package/dist/types.d.ts +5 -0
- package/package.json +2 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CFG Builder - Transforms Solidity AST into Control Flow Graph
|
|
3
|
+
*
|
|
4
|
+
* Key features:
|
|
5
|
+
* - Enumerates ALL paths (for "n total, m covered" tracking)
|
|
6
|
+
* - Each branch creates a CoverageEdge
|
|
7
|
+
* - External calls marked for oracle integration
|
|
8
|
+
* - Supports forward/backward/mid-point solving
|
|
9
|
+
*/
|
|
10
|
+
import { ContractDefinition, FunctionDefinition } from 'solc-typed-ast';
|
|
11
|
+
import { ContractModule, FunctionCFG } from './types';
|
|
12
|
+
import { CallTree, CallTreeData } from '../types';
|
|
13
|
+
export declare class CFGBuilder {
|
|
14
|
+
private ctx;
|
|
15
|
+
private blocks;
|
|
16
|
+
private edges;
|
|
17
|
+
private paths;
|
|
18
|
+
private externalCalls;
|
|
19
|
+
private ternaryEdges;
|
|
20
|
+
private loops;
|
|
21
|
+
private hasKeccak;
|
|
22
|
+
private inUnchecked;
|
|
23
|
+
private currentFunction;
|
|
24
|
+
private contract;
|
|
25
|
+
private ternaryCounter;
|
|
26
|
+
private loopCounter;
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Build CFG for a contract from CallTreeData
|
|
30
|
+
*/
|
|
31
|
+
buildContract(contract: ContractDefinition, callTrees: CallTreeData[]): ContractModule;
|
|
32
|
+
/**
|
|
33
|
+
* Try to extract a constant value from an expression
|
|
34
|
+
*/
|
|
35
|
+
private tryExtractConstantValue;
|
|
36
|
+
/**
|
|
37
|
+
* Get number of storage slots a type uses
|
|
38
|
+
*/
|
|
39
|
+
private getTypeSlots;
|
|
40
|
+
/**
|
|
41
|
+
* Build variable roles map from functions and state variables
|
|
42
|
+
*/
|
|
43
|
+
private buildVarRoles;
|
|
44
|
+
/**
|
|
45
|
+
* Build CFG for a single function
|
|
46
|
+
*/
|
|
47
|
+
buildFunction(func: FunctionDefinition, callTree: CallTree): FunctionCFG;
|
|
48
|
+
/**
|
|
49
|
+
* Process a block of statements, returns exit block ID
|
|
50
|
+
*/
|
|
51
|
+
private processBlock;
|
|
52
|
+
/**
|
|
53
|
+
* Process a single statement, returns the block ID to continue from
|
|
54
|
+
*/
|
|
55
|
+
private processStatement;
|
|
56
|
+
private processIf;
|
|
57
|
+
private processWhile;
|
|
58
|
+
private processFor;
|
|
59
|
+
private processReturn;
|
|
60
|
+
private processVarDecl;
|
|
61
|
+
private processExprStmt;
|
|
62
|
+
private processAssignment;
|
|
63
|
+
private processFunctionCall;
|
|
64
|
+
private processUnaryOp;
|
|
65
|
+
private exprToSym;
|
|
66
|
+
private functionCallToSym;
|
|
67
|
+
/**
|
|
68
|
+
* Enumerate all paths from entry to any terminal block (return/revert)
|
|
69
|
+
*/
|
|
70
|
+
private enumeratePaths;
|
|
71
|
+
private andConditions;
|
|
72
|
+
private addEdge;
|
|
73
|
+
private isExternalCall;
|
|
74
|
+
private extractCallTarget;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve super.method() to actual contract name using C3 linearization
|
|
77
|
+
*/
|
|
78
|
+
private resolveSuperTarget;
|
|
79
|
+
private getCallType;
|
|
80
|
+
private extractInternalCalls;
|
|
81
|
+
private computeSelector;
|
|
82
|
+
private solOpToBinOp;
|
|
83
|
+
private compoundOpToBinOp;
|
|
84
|
+
private solOpToUnOp;
|
|
85
|
+
private isSigned;
|
|
86
|
+
private getEnvType;
|
|
87
|
+
private extractRevertReason;
|
|
88
|
+
private extractStringLiteral;
|
|
89
|
+
}
|