sol-dbg 0.0.0
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/LICENSE +201 -0
- package/README.md +105 -0
- package/dist/artifacts/helpers.d.ts +14 -0
- package/dist/artifacts/helpers.d.ts.map +1 -0
- package/dist/artifacts/helpers.js +111 -0
- package/dist/artifacts/helpers.js.map +1 -0
- package/dist/artifacts/index.d.ts +3 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +19 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/artifacts/solc.d.ts +44 -0
- package/dist/artifacts/solc.d.ts.map +1 -0
- package/dist/artifacts/solc.js +3 -0
- package/dist/artifacts/solc.js.map +1 -0
- package/dist/debug/abi.d.ts +30 -0
- package/dist/debug/abi.d.ts.map +1 -0
- package/dist/debug/abi.js +183 -0
- package/dist/debug/abi.js.map +1 -0
- package/dist/debug/artifact_manager.d.ts +68 -0
- package/dist/debug/artifact_manager.d.ts.map +1 -0
- package/dist/debug/artifact_manager.js +182 -0
- package/dist/debug/artifact_manager.js.map +1 -0
- package/dist/debug/decoding/calldata.d.ts +6 -0
- package/dist/debug/decoding/calldata.d.ts.map +1 -0
- package/dist/debug/decoding/calldata.js +228 -0
- package/dist/debug/decoding/calldata.js.map +1 -0
- package/dist/debug/decoding/general.d.ts +9 -0
- package/dist/debug/decoding/general.d.ts.map +1 -0
- package/dist/debug/decoding/general.js +114 -0
- package/dist/debug/decoding/general.js.map +1 -0
- package/dist/debug/decoding/index.d.ts +6 -0
- package/dist/debug/decoding/index.d.ts.map +1 -0
- package/dist/debug/decoding/index.js +22 -0
- package/dist/debug/decoding/index.js.map +1 -0
- package/dist/debug/decoding/memory.d.ts +4 -0
- package/dist/debug/decoding/memory.d.ts.map +1 -0
- package/dist/debug/decoding/memory.js +216 -0
- package/dist/debug/decoding/memory.js.map +1 -0
- package/dist/debug/decoding/stack.d.ts +9 -0
- package/dist/debug/decoding/stack.d.ts.map +1 -0
- package/dist/debug/decoding/stack.js +85 -0
- package/dist/debug/decoding/stack.js.map +1 -0
- package/dist/debug/decoding/storage.d.ts +4 -0
- package/dist/debug/decoding/storage.d.ts.map +1 -0
- package/dist/debug/decoding/storage.js +333 -0
- package/dist/debug/decoding/storage.js.map +1 -0
- package/dist/debug/index.d.ts +7 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +23 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/opcodes.d.ts +302 -0
- package/dist/debug/opcodes.d.ts.map +1 -0
- package/dist/debug/opcodes.js +2909 -0
- package/dist/debug/opcodes.js.map +1 -0
- package/dist/debug/sol_debugger.d.ts +247 -0
- package/dist/debug/sol_debugger.d.ts.map +1 -0
- package/dist/debug/sol_debugger.js +443 -0
- package/dist/debug/sol_debugger.js.map +1 -0
- package/dist/debug/types.d.ts +33 -0
- package/dist/debug/types.d.ts.map +1 -0
- package/dist/debug/types.js +3 -0
- package/dist/debug/types.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/immutable_map.d.ts +13 -0
- package/dist/utils/immutable_map.d.ts.map +1 -0
- package/dist/utils/immutable_map.js +56 -0
- package/dist/utils/immutable_map.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +48 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/misc.js +221 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/srcmap.d.ts +8 -0
- package/dist/utils/srcmap.d.ts.map +1 -0
- package/dist/utils/srcmap.js +28 -0
- package/dist/utils/srcmap.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2020-present, ConsenSys Software Inc
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
[](https://github.com/ConsenSys/sol-dbg/actions/workflows/node.js.yml)
|
|
2
|
+
[](./LICENSE)
|
|
3
|
+
|
|
4
|
+
# sol-dbg
|
|
5
|
+
|
|
6
|
+
[WIP] Small Solidity-level source debugger built around EthereumJS. This is largely inspired by the remix-debugger. The main difference is that its built to work with incomplete debugging information, and it uses the [solc-typed-ast](https://github.com/ConsenSys/solc-typed-ast) library for dealing with ASTs.
|
|
7
|
+
|
|
8
|
+
Warning: This is still a work in progress, so expect bugs!
|
|
9
|
+
|
|
10
|
+
Currently the debugger gets a trace from the EthereumJS VM, and for each step of the trace tries to compute:
|
|
11
|
+
|
|
12
|
+
0. Code currently executing and metadata hash for the currently executing code (including creation bytecodes)
|
|
13
|
+
1. The current contract compilation artifact (if one is available).
|
|
14
|
+
2. The source location corresponding to the current step (if a source map is available for the given contract).
|
|
15
|
+
3. The exact AST node that maps to the current step (if ASTs are given).
|
|
16
|
+
4. Whether any event is emitted at this step.
|
|
17
|
+
5. The solidity-level stack trace corresponding to the current step. Note that this stack trace will include both internal and external functions. If we don't have information for some contract in the current call stack, then for that contract we will specify a single "external" call frame, and skip any internal functions. The stack trace contains the decoded function arguments as well.
|
|
18
|
+
|
|
19
|
+
The main part missing to make this a full-fledged debugger is stack-map inference and computing the values of locals.
|
|
20
|
+
|
|
21
|
+
# Quckstart
|
|
22
|
+
|
|
23
|
+
To use the debugger you need 3 things:
|
|
24
|
+
|
|
25
|
+
1. The state of the EthereumJS before the problematic transaction. This can be obtained by calling `vm.stateManager.copy()` right before its executed. For example on keeping track of this state check out the [VMTestRunner](https://github.com/ConsenSys/sol-dbg/blob/main/test/utils/test_runner.ts#L81) class.
|
|
26
|
+
|
|
27
|
+
2. The actual failing `Transaction` and the `Block` in which you wish it to be replayed. These can be built by calling(where the ... are standard JSON descriptions of the tx/block):
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
const tx = new Transaction({....});
|
|
31
|
+
const block = Block.fromBlockData({...});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. Call the debugger to obtain a trace of the steps, and then work with the trace:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// Call debugTx to get the computed high-level trace
|
|
38
|
+
const trace = await solDbg.debugTx(tx, block, stateBefore);
|
|
39
|
+
|
|
40
|
+
// Print the stack trace at each step:
|
|
41
|
+
for (const step of trace) {
|
|
42
|
+
console.log(`Stack trace at pc ${step.pc}:`);
|
|
43
|
+
|
|
44
|
+
for(const frame of step) {
|
|
45
|
+
const funName = frame.callee instanceof FunctionDefinition ? frame.callee.name : "<unknown-function>";
|
|
46
|
+
|
|
47
|
+
console.log(`${step.address.toString()}:${funName}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
# Step Info
|
|
53
|
+
|
|
54
|
+
The type of each step of the trace is `StepState`, and contains the following information:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
export interface StepState {
|
|
58
|
+
// The raw EVM stack
|
|
59
|
+
evmStack: Stack;
|
|
60
|
+
// The current state of the memory (as a Buffer)
|
|
61
|
+
memory: Memory;
|
|
62
|
+
// The current storage
|
|
63
|
+
storage: Storage;
|
|
64
|
+
// Information about the current op (opcode, mnemonic, etc)
|
|
65
|
+
op: EVMOpInfo;
|
|
66
|
+
// Current PC
|
|
67
|
+
pc: number;
|
|
68
|
+
// Gas cost of the current instruction
|
|
69
|
+
gasCost: bigint;
|
|
70
|
+
// Dynamic gas cost of the current instruction
|
|
71
|
+
dynamicGasCost: bigint;
|
|
72
|
+
// Remaining gas
|
|
73
|
+
gas: bigint;
|
|
74
|
+
// The external call depth of the stack
|
|
75
|
+
depth: number;
|
|
76
|
+
// Address of the currently executing contract
|
|
77
|
+
address: Address;
|
|
78
|
+
// Address of the CODE which is currently executing (different from address in the case of DELEGATECALL)
|
|
79
|
+
codeAddress: Address;
|
|
80
|
+
// The code that is currently executing
|
|
81
|
+
code: Buffer;
|
|
82
|
+
// Hash of the metadata embedded by the Solidity compiler in the end of the bytecode
|
|
83
|
+
codeHash: HexString;
|
|
84
|
+
// The solidity-level stack trace
|
|
85
|
+
stack: DbgStack;
|
|
86
|
+
// The source code location corresponding to the current opcode
|
|
87
|
+
src: DecodedBytecodeSourceMapEntry | undefined;
|
|
88
|
+
// The AST node corresponding to the current instruction (if ASTs are present)
|
|
89
|
+
astNode: ASTNode | undefined;
|
|
90
|
+
// If an event is emitted by this instruction, the event payload and topics
|
|
91
|
+
emittedEvent: EventDesc | undefined;
|
|
92
|
+
// General information about the given contract (if we have a compiler artifact for it). May contain name, code , sourcemaps, ASTs, metadata /// hash, etc.
|
|
93
|
+
contractInfo: ContractInfo | undefined;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
# Stack Traces
|
|
98
|
+
|
|
99
|
+
A stack trace is a list of stack frames. There are 2 kinds of stack frames - an `ExternalFrame` and an `InternalCallFrame`. As the name suggests, an `ExternalCall` frame corresponds to an external call, and an `InternalCallFrame` corresponds to a call for an internal function in a contract.
|
|
100
|
+
|
|
101
|
+
All frames have an optional `callee` field, which is either an `ASTNode` or `undefined`. `callee` is `undefined` when we don't have enough debugging information to determine the target of this call. Otherwise its the `ASTNode` that corresponds to this call. This is usually a `FunctionDefinition`, but can sometimes be other nodes. For example when calling a public state variable getter the `callee` is a `VariableDeclaration`. When calling an implicit constructor of a contract, the `callee` will be a `ContractDefinition`. Also we are planning on adding support for recognizing compiler-generated functions, in which case the `callee` will be a `YulFunctionDefinition`.
|
|
102
|
+
|
|
103
|
+
All frames have an optional `arguments` field, with any decoded Solidity-level arguments. Note that the debugger will do its best to decode as many arguments as possible, and will attempt to decode an argument even if some other arguments fail. Arguments decoding may fail due to missing debugging information, in which case either the whole `arguments` array, or some entries in it may be undefined.
|
|
104
|
+
|
|
105
|
+
Finally note that for a given external call `Contract.Function()` we will have both an `ExternalFrame` for `Contract.Function()` and an internal frame for `Contract.Function()` (if we have enough debug info). Its up to the users of this library to filter out those duplicates.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { HexString, PartialSolcOutput, UnprefixedHexString } from "./solc";
|
|
3
|
+
export declare function getCodeHash(deplBytecode: UnprefixedHexString | Buffer): HexString | undefined;
|
|
4
|
+
export declare function getCreationCodeHash(creationBytecode: UnprefixedHexString | Buffer): HexString | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Given a standard solc JSON output `artifact` find the compiler version used
|
|
7
|
+
* to compute the contracts. We do this by walking over all of the bytecodes in
|
|
8
|
+
* the artifact, and decoding the CBOR-encoded metadata at the end of each
|
|
9
|
+
* contract. If all contracts in the artifact agree on the version they report,
|
|
10
|
+
* we return that.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getArtifactCompilerVersion(artifact: PartialSolcOutput): string | undefined;
|
|
13
|
+
export declare function isPartialSolcOutput(arg: any): arg is PartialSolcOutput;
|
|
14
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/artifacts/helpers.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AA6F3E,wBAAgB,WAAW,CAAC,YAAY,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAa7F;AAED,wBAAgB,mBAAmB,CAC/B,gBAAgB,EAAE,mBAAmB,GAAG,MAAM,GAC/C,SAAS,GAAG,SAAS,CAiBvB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAmB1F;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB,CAEtE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPartialSolcOutput = exports.getArtifactCompilerVersion = exports.getCreationCodeHash = exports.getCodeHash = void 0;
|
|
4
|
+
const cbor_1 = require("cbor");
|
|
5
|
+
const solc_typed_ast_1 = require("solc-typed-ast");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
function getBytecodeMdInfoHacky(bytecode) {
|
|
8
|
+
let rawMd;
|
|
9
|
+
if (typeof bytecode === "string") {
|
|
10
|
+
const off = bytecode.lastIndexOf("a264");
|
|
11
|
+
if (off === -1) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
rawMd = cbor_1.Decoder.decodeAllSync(bytecode.slice(off), { encoding: "hex" })[0];
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
let off;
|
|
18
|
+
for (off = bytecode.length - 2; off >= 0 && !(bytecode[off] === 0xa2 && bytecode[off + 1] === 0x64); off--)
|
|
19
|
+
;
|
|
20
|
+
if (off < 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
rawMd = cbor_1.Decoder.decodeAllSync(bytecode.slice(off), {})[0];
|
|
24
|
+
}
|
|
25
|
+
const res = {};
|
|
26
|
+
if (rawMd.hasOwnProperty("ipfs")) {
|
|
27
|
+
res.ipfs = (0, __1.toHexString)(rawMd.ipfs);
|
|
28
|
+
}
|
|
29
|
+
if (rawMd.hasOwnProperty("bzzr0")) {
|
|
30
|
+
res.bzzr0 = (0, __1.toHexString)(rawMd.bzzr);
|
|
31
|
+
}
|
|
32
|
+
if (rawMd.hasOwnProperty("solc")) {
|
|
33
|
+
res.solc = `${rawMd.solc[0]}.${rawMd.solc[1]}.${rawMd.solc[2]}`;
|
|
34
|
+
}
|
|
35
|
+
return res;
|
|
36
|
+
}
|
|
37
|
+
function getDeployedBytecodeMdInfo(deployedBytecode) {
|
|
38
|
+
const len = deployedBytecode.length;
|
|
39
|
+
let rawMd;
|
|
40
|
+
if (typeof deployedBytecode === "string") {
|
|
41
|
+
const off = parseInt(deployedBytecode.substring(len - 4), 16);
|
|
42
|
+
const mdHex = deployedBytecode.substring(len - 4 - off * 2, len - 4);
|
|
43
|
+
rawMd = cbor_1.Decoder.decodeAllSync(mdHex, { encoding: "hex" })[0];
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const off = deployedBytecode.readInt16BE(deployedBytecode.length - 2);
|
|
47
|
+
rawMd = cbor_1.Decoder.decodeAllSync(deployedBytecode.slice(deployedBytecode.length - 2 - off, deployedBytecode.length - 2), {})[0];
|
|
48
|
+
}
|
|
49
|
+
const res = {};
|
|
50
|
+
if (rawMd.hasOwnProperty("ipfs")) {
|
|
51
|
+
res.ipfs = (0, __1.toHexString)(rawMd.ipfs);
|
|
52
|
+
}
|
|
53
|
+
if (rawMd.hasOwnProperty("bzzr0")) {
|
|
54
|
+
res.bzzr0 = (0, __1.toHexString)(rawMd.bzzr);
|
|
55
|
+
}
|
|
56
|
+
if (rawMd.hasOwnProperty("solc")) {
|
|
57
|
+
res.solc = `${rawMd.solc[0]}.${rawMd.solc[1]}.${rawMd.solc[2]}`;
|
|
58
|
+
}
|
|
59
|
+
return res;
|
|
60
|
+
}
|
|
61
|
+
function getCodeHash(deplBytecode) {
|
|
62
|
+
const md = getDeployedBytecodeMdInfo(deplBytecode);
|
|
63
|
+
// TODO: Should we prefix the hash with the hash type? bzzr0/ipfs
|
|
64
|
+
if (md.bzzr0 !== undefined) {
|
|
65
|
+
return md.bzzr0;
|
|
66
|
+
}
|
|
67
|
+
if (md.ipfs !== undefined) {
|
|
68
|
+
return md.ipfs;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
exports.getCodeHash = getCodeHash;
|
|
73
|
+
function getCreationCodeHash(creationBytecode) {
|
|
74
|
+
const md = getBytecodeMdInfoHacky(creationBytecode);
|
|
75
|
+
if (md === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
// TODO: Should we prefix the hash with the hash type? bzzr0/ipfs
|
|
79
|
+
if (md.bzzr0 !== undefined) {
|
|
80
|
+
return md.bzzr0;
|
|
81
|
+
}
|
|
82
|
+
if (md.ipfs !== undefined) {
|
|
83
|
+
return md.ipfs;
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
exports.getCreationCodeHash = getCreationCodeHash;
|
|
88
|
+
/**
|
|
89
|
+
* Given a standard solc JSON output `artifact` find the compiler version used
|
|
90
|
+
* to compute the contracts. We do this by walking over all of the bytecodes in
|
|
91
|
+
* the artifact, and decoding the CBOR-encoded metadata at the end of each
|
|
92
|
+
* contract. If all contracts in the artifact agree on the version they report,
|
|
93
|
+
* we return that.
|
|
94
|
+
*/
|
|
95
|
+
function getArtifactCompilerVersion(artifact) {
|
|
96
|
+
let res;
|
|
97
|
+
for (const fileName in artifact.contracts) {
|
|
98
|
+
for (const contractName in artifact.contracts[fileName]) {
|
|
99
|
+
const version = getDeployedBytecodeMdInfo(artifact.contracts[fileName][contractName].evm.deployedBytecode.object).solc;
|
|
100
|
+
(0, solc_typed_ast_1.assert)(!(version !== undefined && res !== undefined && version !== res), `Unexpected different compiler versions in the same artifact: ${version} and ${res}`);
|
|
101
|
+
res = version;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return res;
|
|
105
|
+
}
|
|
106
|
+
exports.getArtifactCompilerVersion = getArtifactCompilerVersion;
|
|
107
|
+
function isPartialSolcOutput(arg) {
|
|
108
|
+
return arg.hasOwnProperty("contracts") && arg.hasOwnProperty("sources");
|
|
109
|
+
}
|
|
110
|
+
exports.isPartialSolcOutput = isPartialSolcOutput;
|
|
111
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/artifacts/helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./helpers"), exports);
|
|
18
|
+
__exportStar(require("./solc"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A type alias for 0x-prefixed hex strings. Used for documentation purposes.
|
|
3
|
+
*/
|
|
4
|
+
export declare type HexString = string;
|
|
5
|
+
/**
|
|
6
|
+
* A type alias for hex strings without 0x prefix. Used for documentation purposes.
|
|
7
|
+
*/
|
|
8
|
+
export declare type UnprefixedHexString = string;
|
|
9
|
+
export declare type RawAST = any;
|
|
10
|
+
/**
|
|
11
|
+
* Interface describing the source description in the `"sources"` field of the solc output,
|
|
12
|
+
* as well as in the `contracts.evm.{bytecode, deployedBytecode}.generatedSources array.
|
|
13
|
+
* Some of the optional fields (language, name, contents) are for the generatedSources.
|
|
14
|
+
*/
|
|
15
|
+
export interface SourceDescription {
|
|
16
|
+
id: number;
|
|
17
|
+
ast: RawAST;
|
|
18
|
+
fileIndex: number;
|
|
19
|
+
language?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
contents?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PartialBytecodeDescription {
|
|
24
|
+
object: UnprefixedHexString;
|
|
25
|
+
sourceMap: string;
|
|
26
|
+
generatedSources?: SourceDescription[];
|
|
27
|
+
}
|
|
28
|
+
export interface PartialCompiledContract {
|
|
29
|
+
evm: {
|
|
30
|
+
bytecode: PartialBytecodeDescription;
|
|
31
|
+
deployedBytecode: PartialBytecodeDescription;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface PartialSolcOutput {
|
|
35
|
+
sources: {
|
|
36
|
+
[fileName: string]: SourceDescription;
|
|
37
|
+
};
|
|
38
|
+
contracts: {
|
|
39
|
+
[fileName: string]: {
|
|
40
|
+
[contractName: string]: PartialCompiledContract;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=solc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solc.d.ts","sourceRoot":"","sources":["../../src/artifacts/solc.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,oBAAY,mBAAmB,GAAG,MAAM,CAAC;AAEzC,oBAAY,MAAM,GAAG,GAAG,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,0BAA0B;IACvC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE;QACD,QAAQ,EAAE,0BAA0B,CAAC;QACrC,gBAAgB,EAAE,0BAA0B,CAAC;KAChD,CAAC;CACL;AAED,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE;QACL,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAAC;KACzC,CAAC;IAEF,SAAS,EAAE;QACP,CAAC,QAAQ,EAAE,MAAM,GAAG;YAChB,CAAC,YAAY,EAAE,MAAM,GAAG,uBAAuB,CAAC;SACnD,CAAC;KACL,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solc.js","sourceRoot":"","sources":["../../src/artifacts/solc.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { DataLocation as SolDataLocation, FunctionDefinition, TypeNode, VariableDeclaration } from "solc-typed-ast";
|
|
3
|
+
import { ABIEncoderVersion } from "solc-typed-ast/dist/types/abi";
|
|
4
|
+
import { DataLocationKind, DataView } from ".";
|
|
5
|
+
export declare function changeToLocation(typ: TypeNode, newLoc: SolDataLocation): TypeNode;
|
|
6
|
+
/**
|
|
7
|
+
* An ABI-decoder implementation that is resilient to failures in some arguments decoding.
|
|
8
|
+
* This function will return partial decoding results. This is needed since the fuzzer may not
|
|
9
|
+
* always produce inputs that decode in their entirety.
|
|
10
|
+
*
|
|
11
|
+
* TODO: (dimo): The name of this function is bad. Its not doing any decoding - just building 'DataView' elements
|
|
12
|
+
* into msg.data that match a specific function signature. Also this should be moved into sol_debugger, in the same place
|
|
13
|
+
* where `SolTxDebugger.decodeFunArgs` lives.
|
|
14
|
+
*/
|
|
15
|
+
export declare function decodeMsgData(callee: FunctionDefinition | VariableDeclaration, data: Buffer, kind: DataLocationKind.Memory | DataLocationKind.CallData, encoderVersion: ABIEncoderVersion): Array<[string, DataView | undefined]>;
|
|
16
|
+
/**
|
|
17
|
+
* Convert an internal TypeNode to the external TypeNode that would correspond to it
|
|
18
|
+
* after ABI-encoding with encoder version `encoderVersion`. Follows the following rules:
|
|
19
|
+
*
|
|
20
|
+
* 1. Contract definitions turned to address.
|
|
21
|
+
* 2. Enum definitions turned to uint of minimal fitting size.
|
|
22
|
+
* 3. Any storage pointer types are converted to memory pointer types.
|
|
23
|
+
* 4. Throw an error on any nested mapping types.
|
|
24
|
+
* 5. Fixed-size arrays with fixed-sized element types are encoded as inlined tuples
|
|
25
|
+
* 6. Structs with fixed-sized elements are encoded as inlined tuples
|
|
26
|
+
*
|
|
27
|
+
* @see https://docs.soliditylang.org/en/latest/abi-spec.html
|
|
28
|
+
*/
|
|
29
|
+
export declare function toABIEncodedType(type: TypeNode, encoderVersion: ABIEncoderVersion): TypeNode;
|
|
30
|
+
//# sourceMappingURL=abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../src/debug/abi.ts"],"names":[],"mappings":";AAAA,OAAO,EAOH,YAAY,IAAI,eAAe,EAI/B,kBAAkB,EAQlB,QAAQ,EAGR,mBAAmB,EAEtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,GAAG,QAAQ,CAmCjF;AA4CD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CACzB,MAAM,EAAE,kBAAkB,GAAG,mBAAmB,EAChD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,QAAQ,EACzD,cAAc,EAAE,iBAAiB,GAClC,KAAK,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC,CAuCvC;AA2CD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,GAAG,QAAQ,CAuD5F"}
|