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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IntType, TypeNode } from "solc-typed-ast";
|
|
2
|
+
import { Stack, StackLocation } from "..";
|
|
3
|
+
export declare function st_decodeInt(typ: IntType, loc: StackLocation, stack: Stack): undefined | bigint;
|
|
4
|
+
/**
|
|
5
|
+
* Decode a single value from a stack location. All values in the stack span exactly
|
|
6
|
+
* one slot (32 bytes). Returns the decoded value or undefined (if it failed decoding for some reason)
|
|
7
|
+
*/
|
|
8
|
+
export declare function st_decodeValue(typ: TypeNode, loc: StackLocation, stack: Stack): any;
|
|
9
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/debug/decoding/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAQH,OAAO,EAEP,QAAQ,EAGX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAO1C,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAqB/F;AA0CD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,GAAG,CAuCnF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.st_decodeValue = exports.st_decodeInt = void 0;
|
|
4
|
+
const solc_typed_ast_1 = require("solc-typed-ast");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
function fetchStackWord(offsetFromTop, stack) {
|
|
7
|
+
return stack.length <= offsetFromTop ? undefined : stack[stack.length - offsetFromTop - 1];
|
|
8
|
+
}
|
|
9
|
+
function st_decodeInt(typ, loc, stack) {
|
|
10
|
+
const word = fetchStackWord(loc.offsetFromTop, stack);
|
|
11
|
+
if (word === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
let res = (0, utils_1.bigEndianBufToBigint)(word);
|
|
15
|
+
if (typ.signed && (res & (BigInt(1) << BigInt(typ.nBits - 1))) !== BigInt(0)) {
|
|
16
|
+
// Mask out any 1's above the number's size
|
|
17
|
+
res = res & ((BigInt(1) << BigInt(typ.nBits)) - BigInt(1));
|
|
18
|
+
res = -((BigInt(1) << BigInt(typ.nBits)) - res);
|
|
19
|
+
}
|
|
20
|
+
// Convert signed negative 2's complement values
|
|
21
|
+
(0, solc_typed_ast_1.assert)((0, utils_1.fits)(res, typ), `Decoded value ${res} from ${loc} doesn't fit in expected type ${typ.pp()}`);
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
exports.st_decodeInt = st_decodeInt;
|
|
25
|
+
function st_decodeAddress(loc, stack) {
|
|
26
|
+
const addrWord = fetchStackWord(loc.offsetFromTop, stack);
|
|
27
|
+
if (addrWord === undefined) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return (0, utils_1.wordToAddress)(addrWord);
|
|
31
|
+
}
|
|
32
|
+
function st_decodeFixedBytes(typ, loc, stack) {
|
|
33
|
+
const addrWord = fetchStackWord(loc.offsetFromTop, stack);
|
|
34
|
+
if (addrWord === undefined) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return addrWord.slice(0, typ.size);
|
|
38
|
+
}
|
|
39
|
+
function st_decodeBool(loc, stack) {
|
|
40
|
+
const addrWord = fetchStackWord(loc.offsetFromTop, stack);
|
|
41
|
+
if (addrWord === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
return (0, utils_1.bigEndianBufToBigint)(addrWord) !== BigInt(0);
|
|
45
|
+
}
|
|
46
|
+
function st_decodeEnum(def, loc, stack) {
|
|
47
|
+
const intType = (0, solc_typed_ast_1.enumToIntType)(def);
|
|
48
|
+
return st_decodeInt(intType, loc, stack);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Decode a single value from a stack location. All values in the stack span exactly
|
|
52
|
+
* one slot (32 bytes). Returns the decoded value or undefined (if it failed decoding for some reason)
|
|
53
|
+
*/
|
|
54
|
+
function st_decodeValue(typ, loc, stack) {
|
|
55
|
+
//console.error(`st_decodeValue(${typ.pp()}, ${ppLoc(loc)})`);
|
|
56
|
+
if (typ instanceof solc_typed_ast_1.IntType) {
|
|
57
|
+
return st_decodeInt(typ, loc, stack);
|
|
58
|
+
}
|
|
59
|
+
if (typ instanceof solc_typed_ast_1.AddressType) {
|
|
60
|
+
return st_decodeAddress(loc, stack);
|
|
61
|
+
}
|
|
62
|
+
if (typ instanceof solc_typed_ast_1.FixedBytesType) {
|
|
63
|
+
return st_decodeFixedBytes(typ, loc, stack);
|
|
64
|
+
}
|
|
65
|
+
if (typ instanceof solc_typed_ast_1.BoolType) {
|
|
66
|
+
return st_decodeBool(loc, stack);
|
|
67
|
+
}
|
|
68
|
+
if (typ instanceof solc_typed_ast_1.UserDefinedType) {
|
|
69
|
+
const def = typ.definition;
|
|
70
|
+
if (def instanceof solc_typed_ast_1.EnumDefinition) {
|
|
71
|
+
return st_decodeEnum(def, loc, stack);
|
|
72
|
+
}
|
|
73
|
+
if (def instanceof solc_typed_ast_1.ContractDefinition) {
|
|
74
|
+
return st_decodeAddress(loc, stack);
|
|
75
|
+
}
|
|
76
|
+
if (def instanceof solc_typed_ast_1.UserDefinedValueTypeDefinition) {
|
|
77
|
+
const underlyingType = (0, solc_typed_ast_1.typeNameToTypeNode)(def.underlyingType);
|
|
78
|
+
return st_decodeValue(underlyingType, loc, stack);
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`NYI decoding user defined type ${typ.pp()} from the stack`);
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`NYI decoding ${typ.pp()} from the stack`);
|
|
83
|
+
}
|
|
84
|
+
exports.st_decodeValue = st_decodeValue;
|
|
85
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@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AAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AA+bhE,wBAAgB,gBAAgB,CAC5B,GAAG,EAAE,QAAQ,EACb,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,OAAO,GACjB,SAAS,GAAG,CAAC,GAAG,EAAE,eAAe,CAAC,CAsDpC"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stor_decodeValue = void 0;
|
|
4
|
+
const ethereumjs_util_1 = require("ethereumjs-util");
|
|
5
|
+
const solc_typed_ast_1 = require("solc-typed-ast");
|
|
6
|
+
const __1 = require("..");
|
|
7
|
+
const __2 = require("../..");
|
|
8
|
+
/**
|
|
9
|
+
* Helper to fetch the word residing at key `key` from `storage`. Note that
|
|
10
|
+
* this always succeeds as all uninitialized values in storage are defined to
|
|
11
|
+
* contain 0.
|
|
12
|
+
*/
|
|
13
|
+
function fetchWord(key, storage) {
|
|
14
|
+
const keyHash = (0, __2.bigEndianBufToBigint)((0, ethereumjs_util_1.keccak256)((0, __2.bigIntToBuf)(key, 32, "big")));
|
|
15
|
+
const res = storage.get(keyHash);
|
|
16
|
+
if (res === undefined) {
|
|
17
|
+
return Buffer.alloc(32, 0);
|
|
18
|
+
}
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Helper to fetch `numBytes` bytes from `storage` starting at offset `off`.
|
|
23
|
+
* Note that this always succeeds as all uninitialized values in storage are
|
|
24
|
+
* defined to contain 0.
|
|
25
|
+
*/
|
|
26
|
+
function fetchBytes(wordOff, offInWord, numBytes, storage) {
|
|
27
|
+
let curBuf = fetchWord(wordOff, storage);
|
|
28
|
+
const res = Buffer.alloc(numBytes, 0);
|
|
29
|
+
for (let i = 0; i < numBytes; i++) {
|
|
30
|
+
res[i] = curBuf[offInWord];
|
|
31
|
+
offInWord = (offInWord + 1) % 32;
|
|
32
|
+
if (offInWord === 0 && i < numBytes - 1) {
|
|
33
|
+
wordOff++;
|
|
34
|
+
curBuf = fetchWord(wordOff, storage);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return res;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Decode a single integer of type `typ` from location `loc` in `storage`.
|
|
41
|
+
* Returns pair `[bigint, number]` containing the decoded number and its size
|
|
42
|
+
* in bytes in storage. Note: Always succeed as we can decode a valid integer
|
|
43
|
+
* in any location in storage.
|
|
44
|
+
*/
|
|
45
|
+
function stor_decodeInt(typ, loc, storage) {
|
|
46
|
+
const size = typ.nBits / 8;
|
|
47
|
+
(0, solc_typed_ast_1.assert)(loc.endOffsetInWord >= size, `Internal Error: Can't decode {0} starting at offset {1} in word {2}`, typ, loc.endOffsetInWord, loc.address);
|
|
48
|
+
const rawBytes = fetchBytes(loc.address, loc.endOffsetInWord - size, size, storage);
|
|
49
|
+
let res = (0, __2.bigEndianBufToBigint)(rawBytes);
|
|
50
|
+
//console.error(`stor_decodeInt rawBytes=${rawBytes.toString(`hex`)} res=${res}`);
|
|
51
|
+
// Convert signed negative 2's complement values
|
|
52
|
+
if (typ.signed && (res & (BigInt(1) << BigInt(typ.nBits - 1))) !== BigInt(0)) {
|
|
53
|
+
// Mask out any 1's above the number's size
|
|
54
|
+
res = res & ((BigInt(1) << BigInt(typ.nBits)) - BigInt(1));
|
|
55
|
+
res = -((BigInt(1) << BigInt(typ.nBits)) - res);
|
|
56
|
+
}
|
|
57
|
+
(0, solc_typed_ast_1.assert)((0, __2.fits)(res, typ), `Decoded value ${res} from ${loc} doesn't fit in expected type ${typ.pp()}`);
|
|
58
|
+
const nextEndOff = loc.endOffsetInWord - size;
|
|
59
|
+
const nextLoc = {
|
|
60
|
+
kind: loc.kind,
|
|
61
|
+
endOffsetInWord: nextEndOff === 0 ? 32 : nextEndOff,
|
|
62
|
+
address: nextEndOff === 0 ? loc.address + BigInt(1) : loc.address
|
|
63
|
+
};
|
|
64
|
+
return [res, nextLoc];
|
|
65
|
+
}
|
|
66
|
+
const byte1 = new solc_typed_ast_1.IntType(8, false);
|
|
67
|
+
/**
|
|
68
|
+
* Decode a boolean from the given location in storage
|
|
69
|
+
*/
|
|
70
|
+
function stor_decodeBool(loc, storage) {
|
|
71
|
+
const [val, nextLoc] = stor_decodeInt(byte1, loc, storage);
|
|
72
|
+
return [val !== BigInt(0), nextLoc];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Decode an enum value from storage
|
|
76
|
+
*/
|
|
77
|
+
function stor_decodeEnum(def, loc, storage) {
|
|
78
|
+
const typ = (0, solc_typed_ast_1.enumToIntType)(def);
|
|
79
|
+
return stor_decodeInt(typ, loc, storage);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Decode a boolean from the given location in storage
|
|
83
|
+
*/
|
|
84
|
+
function stor_decodeFixedBytes(typ, loc, storage) {
|
|
85
|
+
(0, solc_typed_ast_1.assert)(loc.endOffsetInWord >= typ.size, `Internal Error: Can't decode {0} starting at offset {1} in word {2}`, typ, loc.endOffsetInWord, loc.address);
|
|
86
|
+
const bytes = fetchBytes(loc.address, loc.endOffsetInWord - typ.size, typ.size, storage);
|
|
87
|
+
const nextEndOff = loc.endOffsetInWord - typ.size;
|
|
88
|
+
const nextLoc = {
|
|
89
|
+
kind: loc.kind,
|
|
90
|
+
endOffsetInWord: nextEndOff === 0 ? 32 : nextEndOff,
|
|
91
|
+
address: nextEndOff === 0 ? loc.address + BigInt(1) : loc.address
|
|
92
|
+
};
|
|
93
|
+
return [bytes, nextLoc];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Decode a boolean from the given location in storage
|
|
97
|
+
*/
|
|
98
|
+
function stor_decodeAddress(loc, storage) {
|
|
99
|
+
(0, solc_typed_ast_1.assert)(loc.endOffsetInWord >= 20, `Internal Error: Can't decode address starting at offset {0} in word {1}`, loc.endOffsetInWord, loc.address);
|
|
100
|
+
const bytes = fetchBytes(loc.address, loc.endOffsetInWord - 20, 20, storage);
|
|
101
|
+
const nextEndOff = loc.endOffsetInWord - 20;
|
|
102
|
+
const nextLoc = {
|
|
103
|
+
kind: loc.kind,
|
|
104
|
+
endOffsetInWord: nextEndOff === 0 ? 32 : nextEndOff,
|
|
105
|
+
address: nextEndOff === 0 ? loc.address + BigInt(1) : loc.address
|
|
106
|
+
};
|
|
107
|
+
return [new ethereumjs_util_1.Address(bytes), nextLoc];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compute the 'static' size that a variable of type `typ` would take up in storage
|
|
111
|
+
*/
|
|
112
|
+
function typeStaticStorSize(typ) {
|
|
113
|
+
if (typ instanceof solc_typed_ast_1.IntType) {
|
|
114
|
+
return typ.nBits / 8;
|
|
115
|
+
}
|
|
116
|
+
if (typ instanceof solc_typed_ast_1.FixedBytesType) {
|
|
117
|
+
return typ.size;
|
|
118
|
+
}
|
|
119
|
+
if (typ instanceof solc_typed_ast_1.BoolType) {
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
if (typ instanceof solc_typed_ast_1.AddressType) {
|
|
123
|
+
return 20;
|
|
124
|
+
}
|
|
125
|
+
if (typ instanceof solc_typed_ast_1.UserDefinedType) {
|
|
126
|
+
if (typ.definition instanceof solc_typed_ast_1.EnumDefinition) {
|
|
127
|
+
return (0, solc_typed_ast_1.enumToIntType)(typ.definition).nBits / 8;
|
|
128
|
+
}
|
|
129
|
+
if (typ.definition instanceof solc_typed_ast_1.UserDefinedValueTypeDefinition) {
|
|
130
|
+
return typeStaticStorSize((0, solc_typed_ast_1.typeNameToTypeNode)(typ.definition.underlyingType));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
throw new Error(`NYI typStaticStorSize(${typ.pp()})`);
|
|
134
|
+
}
|
|
135
|
+
function typeFitsInLoc(typ, loc) {
|
|
136
|
+
if (typ instanceof solc_typed_ast_1.PointerType) {
|
|
137
|
+
if (typ.to instanceof solc_typed_ast_1.ArrayType ||
|
|
138
|
+
typ.to instanceof solc_typed_ast_1.BytesType ||
|
|
139
|
+
typ.to instanceof solc_typed_ast_1.StringType ||
|
|
140
|
+
(typ.to instanceof solc_typed_ast_1.UserDefinedType && typ.to.definition instanceof solc_typed_ast_1.StructDefinition) ||
|
|
141
|
+
typ.to instanceof solc_typed_ast_1.MappingType) {
|
|
142
|
+
return loc.endOffsetInWord === 32;
|
|
143
|
+
}
|
|
144
|
+
throw new Error(`NYI firstLocationOfTypeAfter(${typ.pp()},...)`);
|
|
145
|
+
}
|
|
146
|
+
const size = typeStaticStorSize(typ);
|
|
147
|
+
(0, solc_typed_ast_1.assert)(size <= 32, `Unexpected type ${typ.pp()} spanning more than a single word`);
|
|
148
|
+
return size <= loc.endOffsetInWord;
|
|
149
|
+
}
|
|
150
|
+
function nextWord(loc) {
|
|
151
|
+
return {
|
|
152
|
+
kind: loc.kind,
|
|
153
|
+
endOffsetInWord: 32,
|
|
154
|
+
address: loc.address + BigInt(1)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function roundLocToType(loc, typ) {
|
|
158
|
+
if (typeFitsInLoc(typ, loc)) {
|
|
159
|
+
return loc;
|
|
160
|
+
}
|
|
161
|
+
return nextWord(loc);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Decode a struct of type `typ` from location `loc` in `storage`.
|
|
165
|
+
* Returns undefined when it fails decoding, otherwise a pair `[any, number]`
|
|
166
|
+
* containing an object with the decoded fields and its size in bytes in storage.
|
|
167
|
+
*/
|
|
168
|
+
function stor_decodeStruct(typ, loc, storage) {
|
|
169
|
+
const def = typ.definition;
|
|
170
|
+
(0, solc_typed_ast_1.assert)(def instanceof solc_typed_ast_1.StructDefinition, `stor_decodeStruct expects a struct, not {0}`, typ);
|
|
171
|
+
(0, solc_typed_ast_1.assert)(loc.endOffsetInWord === 32, `Internal Error: Location of struct of type {0} doesn't start at the end of word {1} - instead at off {2}`, typ, loc.address, loc.endOffsetInWord);
|
|
172
|
+
const res = {};
|
|
173
|
+
for (const field of def.vMembers) {
|
|
174
|
+
let fieldGenT;
|
|
175
|
+
try {
|
|
176
|
+
fieldGenT = (0, solc_typed_ast_1.variableDeclarationToTypeNode)(field);
|
|
177
|
+
}
|
|
178
|
+
catch (e) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
const fieldT = (0, __1.changeToLocation)(fieldGenT, solc_typed_ast_1.DataLocation.Storage);
|
|
182
|
+
loc = roundLocToType(loc, fieldT);
|
|
183
|
+
const fieldVal = stor_decodeValue(fieldT, loc, storage);
|
|
184
|
+
if (fieldVal === undefined) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
[res[field.name], loc] = fieldVal;
|
|
188
|
+
}
|
|
189
|
+
return [res, loc];
|
|
190
|
+
}
|
|
191
|
+
function keccakOfAddr(addr) {
|
|
192
|
+
const addrBuf = (0, __2.bigIntToBuf)(addr, 32, "big");
|
|
193
|
+
const hashBuf = (0, ethereumjs_util_1.keccak256)(addrBuf);
|
|
194
|
+
return (0, __2.bigEndianBufToBigint)(hashBuf);
|
|
195
|
+
}
|
|
196
|
+
function stor_decodeBytes(loc, storage) {
|
|
197
|
+
(0, solc_typed_ast_1.assert)(loc.endOffsetInWord === 32, `Internal Error: Decoding bytes in the middle (off {0}) of word {1}`, loc.endOffsetInWord, loc.address);
|
|
198
|
+
const word = fetchWord(loc.address, storage);
|
|
199
|
+
const lByte = word[31];
|
|
200
|
+
if (lByte % 2 === 0) {
|
|
201
|
+
/// Less than 31 bytes - length * 2 stored in lowest byte
|
|
202
|
+
const len = lByte / 2;
|
|
203
|
+
(0, solc_typed_ast_1.assert)(len <= 31, `Unexpected length of more than 31`);
|
|
204
|
+
return [word.slice(0, len), nextWord(loc)];
|
|
205
|
+
}
|
|
206
|
+
let [len] = stor_decodeInt(__2.uint256, loc, storage);
|
|
207
|
+
len = (len - BigInt(1)) / BigInt(2);
|
|
208
|
+
if (len > __2.MAX_ARR_DECODE_LIMIT) {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
const numLen = Number(len);
|
|
212
|
+
const addr = keccakOfAddr(loc.address);
|
|
213
|
+
const res = fetchBytes(addr, 0, numLen, storage);
|
|
214
|
+
return [res, nextWord(loc)];
|
|
215
|
+
}
|
|
216
|
+
function stor_decodeString(loc, storage) {
|
|
217
|
+
const res = stor_decodeBytes(loc, storage);
|
|
218
|
+
if (res === undefined) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
const str = res[0].toString("utf-8");
|
|
222
|
+
return [str, res[1]];
|
|
223
|
+
}
|
|
224
|
+
function stor_decodeArray(typ, loc, storage) {
|
|
225
|
+
let numLen;
|
|
226
|
+
let contentsLoc;
|
|
227
|
+
const res = [];
|
|
228
|
+
if (typ.size === undefined) {
|
|
229
|
+
const [len] = stor_decodeInt(__2.uint256, loc, storage);
|
|
230
|
+
//console.error(`stor_decodeArray: Decoded len ${len} at loc ${ppLoc(loc)}`);
|
|
231
|
+
if (len > __2.MAX_ARR_DECODE_LIMIT) {
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
numLen = Number(len);
|
|
235
|
+
contentsLoc = {
|
|
236
|
+
kind: loc.kind,
|
|
237
|
+
address: keccakOfAddr(loc.address),
|
|
238
|
+
endOffsetInWord: 32
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
if (typ.size > __2.MAX_ARR_DECODE_LIMIT) {
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
numLen = Number(typ.size);
|
|
246
|
+
contentsLoc = loc;
|
|
247
|
+
}
|
|
248
|
+
for (let i = 0; i < numLen; i++) {
|
|
249
|
+
const elRes = stor_decodeValue(typ.elementT, contentsLoc, storage);
|
|
250
|
+
if (elRes === undefined) {
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
res.push(elRes[0]);
|
|
254
|
+
contentsLoc = roundLocToType(elRes[1], typ.elementT);
|
|
255
|
+
}
|
|
256
|
+
return [res, nextWord(loc)];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Decode a pointer of type `typ` from location `loc` in `storage`.
|
|
260
|
+
* Returns undefined when it fails decoding, otherwise a pair `[any, number]`
|
|
261
|
+
* containing the decoded value and its size in bytes in storage.
|
|
262
|
+
*
|
|
263
|
+
* Pointers are a little tricky in storage, as you never really store pointers in storage.
|
|
264
|
+
* Instead the 'pointed to' location is computed depending on the type, and some data or empty values may live
|
|
265
|
+
* at the actual poitner location. Here are the possible cases:
|
|
266
|
+
*
|
|
267
|
+
* 1. Pointer to array - the length of the array is stored at the pointer location, the actual array lives at keccak256(loc.address)
|
|
268
|
+
* 2. Pointer to fixed sized array - TODO????
|
|
269
|
+
* 3. Pointer to bytes/string - if shorter than 32 bytes, 2*len is stored in the lowest byte of loc.address and the string/bytes in the upper 31 bytes
|
|
270
|
+
* Otherwise 2*len+1 is stored at loc.address (TODO little endian? big endian encoded?) and the contents are at keccak256(loc.address)
|
|
271
|
+
* 3. Pointer to struct - the struct fields themselves directly starts at the loc.address
|
|
272
|
+
*/
|
|
273
|
+
function stor_decodePointer(typ, loc, storage) {
|
|
274
|
+
if (typ.to instanceof solc_typed_ast_1.BytesType) {
|
|
275
|
+
return stor_decodeBytes(loc, storage);
|
|
276
|
+
}
|
|
277
|
+
if (typ.to instanceof solc_typed_ast_1.StringType) {
|
|
278
|
+
return stor_decodeString(loc, storage);
|
|
279
|
+
}
|
|
280
|
+
if (typ.to instanceof solc_typed_ast_1.UserDefinedType) {
|
|
281
|
+
if (typ.to.definition instanceof solc_typed_ast_1.StructDefinition) {
|
|
282
|
+
return stor_decodeStruct(typ.to, loc, storage);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (typ.to instanceof solc_typed_ast_1.ArrayType) {
|
|
286
|
+
return stor_decodeArray(typ.to, loc, storage);
|
|
287
|
+
}
|
|
288
|
+
throw new Error(`NYI stor_decodePointer(${typ.pp()},...)`);
|
|
289
|
+
}
|
|
290
|
+
function stor_decodeValue(typ, loc, storage) {
|
|
291
|
+
if (typ instanceof solc_typed_ast_1.IntType) {
|
|
292
|
+
return stor_decodeInt(typ, loc, storage);
|
|
293
|
+
}
|
|
294
|
+
if (typ instanceof solc_typed_ast_1.BoolType) {
|
|
295
|
+
return stor_decodeBool(loc, storage);
|
|
296
|
+
}
|
|
297
|
+
if (typ instanceof solc_typed_ast_1.FixedBytesType) {
|
|
298
|
+
return stor_decodeFixedBytes(typ, loc, storage);
|
|
299
|
+
}
|
|
300
|
+
if (typ instanceof solc_typed_ast_1.AddressType) {
|
|
301
|
+
return stor_decodeAddress(loc, storage);
|
|
302
|
+
}
|
|
303
|
+
if (typ instanceof solc_typed_ast_1.PointerType) {
|
|
304
|
+
return stor_decodePointer(typ, loc, storage);
|
|
305
|
+
}
|
|
306
|
+
if (typ instanceof solc_typed_ast_1.BytesType) {
|
|
307
|
+
return stor_decodeBytes(loc, storage);
|
|
308
|
+
}
|
|
309
|
+
if (typ instanceof solc_typed_ast_1.StringType) {
|
|
310
|
+
return stor_decodeString(loc, storage);
|
|
311
|
+
}
|
|
312
|
+
if (typ instanceof solc_typed_ast_1.ArrayType) {
|
|
313
|
+
return stor_decodeArray(typ, loc, storage);
|
|
314
|
+
}
|
|
315
|
+
if (typ instanceof solc_typed_ast_1.UserDefinedType) {
|
|
316
|
+
if (typ.definition instanceof solc_typed_ast_1.StructDefinition) {
|
|
317
|
+
return stor_decodeStruct(typ, loc, storage);
|
|
318
|
+
}
|
|
319
|
+
if (typ.definition instanceof solc_typed_ast_1.ContractDefinition) {
|
|
320
|
+
return stor_decodeAddress(loc, storage);
|
|
321
|
+
}
|
|
322
|
+
if (typ.definition instanceof solc_typed_ast_1.EnumDefinition) {
|
|
323
|
+
return stor_decodeEnum(typ.definition, loc, storage);
|
|
324
|
+
}
|
|
325
|
+
if (typ.definition instanceof solc_typed_ast_1.UserDefinedValueTypeDefinition) {
|
|
326
|
+
const underlyingType = (0, solc_typed_ast_1.typeNameToTypeNode)(typ.definition.underlyingType);
|
|
327
|
+
return stor_decodeValue(underlyingType, loc, storage);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
throw new Error(`NYI storage decode for type ${typ.pp()}`);
|
|
331
|
+
}
|
|
332
|
+
exports.stor_decodeValue = stor_decodeValue;
|
|
333
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/debug/decoding/storage.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,mDAqBwB;AACxB,0BAAgE;AAChE,6BAA+F;AAE/F;;;;GAIG;AACH,SAAS,SAAS,CAAC,GAAW,EAAE,OAAgB;IAC5C,MAAM,OAAO,GAAG,IAAA,wBAAoB,EAAC,IAAA,2BAAS,EAAC,IAAA,eAAW,EAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEjC,IAAI,GAAG,KAAK,SAAS,EAAE;QACnB,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;KAC9B;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CACf,OAAe,EACf,SAAiB,EACjB,QAAgB,EAChB,OAAgB;IAEhB,IAAI,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAEtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;QAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAE3B,SAAS,GAAG,CAAC,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CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./abi"), exports);
|
|
18
|
+
__exportStar(require("./artifact_manager"), exports);
|
|
19
|
+
__exportStar(require("./decoding"), exports);
|
|
20
|
+
__exportStar(require("./opcodes"), exports);
|
|
21
|
+
__exportStar(require("./sol_debugger"), exports);
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,qDAAmC;AACnC,6CAA2B;AAC3B,4CAA0B;AAC1B,iDAA+B;AAC/B,0CAAwB"}
|