diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-10 18:21:05 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-10 18:21:05 +0800 |
commit | 7ae9e79235ed3b7eb110b0a1e88338b3965f44da (patch) | |
tree | 5339e9548142eb6ec3e7a7e4288cb5e5b1a582cc /packages/sol-tracing-utils/src/types.ts | |
parent | 15c9479ebeca57e7c275cd2e73ca3daad03a412f (diff) | |
download | dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar.gz dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar.bz2 dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar.lz dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar.xz dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.tar.zst dexon-sol-tools-7ae9e79235ed3b7eb110b0a1e88338b3965f44da.zip |
Rename sol-trace-based-tools-common to sol-tracing-utils
Diffstat (limited to 'packages/sol-tracing-utils/src/types.ts')
-rw-r--r-- | packages/sol-tracing-utils/src/types.ts | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/packages/sol-tracing-utils/src/types.ts b/packages/sol-tracing-utils/src/types.ts new file mode 100644 index 000000000..54ade0400 --- /dev/null +++ b/packages/sol-tracing-utils/src/types.ts @@ -0,0 +1,126 @@ +import { StructLog } from 'ethereum-types'; +import * as Parser from 'solidity-parser-antlr'; + +export interface LineColumn { + line: number; + column: number; +} + +export interface SourceRange { + location: SingleFileSourceRange; + fileName: string; +} + +export interface SingleFileSourceRange { + start: LineColumn; + end: LineColumn; +} + +export interface LocationByOffset { + [offset: number]: LineColumn; +} + +export interface FunctionDescription { + name: string; + line: number; + loc: SingleFileSourceRange; + skip?: boolean; +} + +export type StatementDescription = SingleFileSourceRange; + +export interface BranchDescription { + line: number; + type: 'if' | 'switch' | 'cond-expr' | 'binary-expr'; + locations: SingleFileSourceRange[]; +} + +export interface FnMap { + [functionId: string]: FunctionDescription; +} + +export interface BranchMap { + [branchId: string]: BranchDescription; +} + +export interface StatementMap { + [statementId: string]: StatementDescription; +} + +export interface LineCoverage { + [lineNo: number]: number; +} + +export interface FunctionCoverage { + [functionId: string]: number; +} + +export interface StatementCoverage { + [statementId: string]: number; +} + +export interface BranchCoverage { + [branchId: string]: number[]; +} + +export interface Coverage { + [fineName: string]: { + l?: LineCoverage; + f: FunctionCoverage; + s: StatementCoverage; + b: BranchCoverage; + fnMap: FnMap; + branchMap: BranchMap; + statementMap: StatementMap; + path: string; + }; +} + +export interface ContractData { + bytecode: string; + sourceMap: string; + runtimeBytecode: string; + sourceMapRuntime: string; + sourceCodes: string[]; + sources: string[]; +} + +// Part of the trace executed within the same context +export type Subtrace = StructLog[]; + +export interface TraceInfoBase { + subtrace: Subtrace; + txHash: string; +} + +export interface TraceInfoNewContract extends TraceInfoBase { + address: 'NEW_CONTRACT'; + bytecode: string; +} + +export interface TraceInfoExistingContract extends TraceInfoBase { + address: string; + runtimeBytecode: string; +} + +export type TraceInfo = TraceInfoNewContract | TraceInfoExistingContract; + +export enum BlockParamLiteral { + Latest = 'latest', +} + +export interface EvmCallStackEntry { + structLog: StructLog; + address: string; +} + +export type EvmCallStack = EvmCallStackEntry[]; + +export interface SourceSnippet { + source: string; + fileName: string; + type: string; + node: Parser.ASTNode; + name: string | null; + range: SingleFileSourceRange; +} |