sol-dbg 0.7.16 → 0.8.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/dist/debug/abi.d.ts +10 -3
- package/dist/debug/abi.d.ts.map +1 -1
- package/dist/debug/abi.js +5 -4
- package/dist/debug/abi.js.map +1 -1
- package/dist/debug/artifact_manager/artifact_manager.d.ts +5 -2
- package/dist/debug/artifact_manager/artifact_manager.d.ts.map +1 -1
- package/dist/debug/artifact_manager/artifact_manager.js +24 -6
- package/dist/debug/artifact_manager/artifact_manager.js.map +1 -1
- package/dist/debug/decoding/calldata/view.d.ts +15 -16
- package/dist/debug/decoding/calldata/view.d.ts.map +1 -1
- package/dist/debug/decoding/calldata/view.js +47 -47
- package/dist/debug/decoding/calldata/view.js.map +1 -1
- package/dist/debug/decoding/index.d.ts +1 -2
- package/dist/debug/decoding/index.d.ts.map +1 -1
- package/dist/debug/decoding/index.js +2 -2
- package/dist/debug/decoding/index.js.map +1 -1
- package/dist/debug/decoding/memory/view.d.ts +16 -17
- package/dist/debug/decoding/memory/view.d.ts.map +1 -1
- package/dist/debug/decoding/memory/view.js +36 -36
- package/dist/debug/decoding/memory/view.js.map +1 -1
- package/dist/debug/decoding/stack/view.d.ts +4 -4
- package/dist/debug/decoding/stack/view.d.ts.map +1 -1
- package/dist/debug/decoding/stack/view.js +20 -19
- package/dist/debug/decoding/stack/view.js.map +1 -1
- package/dist/debug/decoding/storage/view.d.ts +18 -19
- package/dist/debug/decoding/storage/view.d.ts.map +1 -1
- package/dist/debug/decoding/storage/view.js +67 -65
- package/dist/debug/decoding/storage/view.js.map +1 -1
- package/dist/debug/decoding/utils.d.ts +20 -2
- package/dist/debug/decoding/utils.d.ts.map +1 -1
- package/dist/debug/decoding/utils.js +119 -3
- package/dist/debug/decoding/utils.js.map +1 -1
- package/dist/debug/decoding/view.d.ts +11 -6
- package/dist/debug/decoding/view.d.ts.map +1 -1
- package/dist/debug/index.d.ts +1 -0
- package/dist/debug/index.d.ts.map +1 -1
- package/dist/debug/index.js +1 -0
- package/dist/debug/index.js.map +1 -1
- package/dist/debug/layout.d.ts.map +1 -1
- package/dist/debug/layout.js +2 -1
- package/dist/debug/layout.js.map +1 -1
- package/dist/debug/runtime_types/ast/address_type.d.ts +5 -0
- package/dist/debug/runtime_types/ast/address_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/address_type.js +11 -0
- package/dist/debug/runtime_types/ast/address_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/array_type.d.ts +8 -0
- package/dist/debug/runtime_types/ast/array_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/array_type.js +16 -0
- package/dist/debug/runtime_types/ast/array_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/base_type.d.ts +16 -0
- package/dist/debug/runtime_types/ast/base_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/base_type.js +19 -0
- package/dist/debug/runtime_types/ast/base_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/bool_type.d.ts +5 -0
- package/dist/debug/runtime_types/ast/bool_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/bool_type.js +11 -0
- package/dist/debug/runtime_types/ast/bool_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/bytes_type.d.ts +5 -0
- package/dist/debug/runtime_types/ast/bytes_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/bytes_type.js +11 -0
- package/dist/debug/runtime_types/ast/bytes_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/fixed_bytes_type.d.ts +7 -0
- package/dist/debug/runtime_types/ast/fixed_bytes_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/fixed_bytes_type.js +15 -0
- package/dist/debug/runtime_types/ast/fixed_bytes_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/function_type.d.ts +11 -0
- package/dist/debug/runtime_types/ast/function_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/function_type.js +22 -0
- package/dist/debug/runtime_types/ast/function_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/index.d.ts +16 -0
- package/dist/debug/runtime_types/ast/index.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/index.js +32 -0
- package/dist/debug/runtime_types/ast/index.js.map +1 -0
- package/dist/debug/runtime_types/ast/int_type.d.ts +10 -0
- package/dist/debug/runtime_types/ast/int_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/int_type.js +24 -0
- package/dist/debug/runtime_types/ast/int_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/mapping_type.d.ts +8 -0
- package/dist/debug/runtime_types/ast/mapping_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/mapping_type.js +16 -0
- package/dist/debug/runtime_types/ast/mapping_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/missing_type.d.ts +11 -0
- package/dist/debug/runtime_types/ast/missing_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/missing_type.js +19 -0
- package/dist/debug/runtime_types/ast/missing_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/pointer_type.d.ts +9 -0
- package/dist/debug/runtime_types/ast/pointer_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/pointer_type.js +51 -0
- package/dist/debug/runtime_types/ast/pointer_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/string_type.d.ts +5 -0
- package/dist/debug/runtime_types/ast/string_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/string_type.js +11 -0
- package/dist/debug/runtime_types/ast/string_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/struct_type.d.ts +8 -0
- package/dist/debug/runtime_types/ast/struct_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/struct_type.js +16 -0
- package/dist/debug/runtime_types/ast/struct_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/tuple_type.d.ts +7 -0
- package/dist/debug/runtime_types/ast/tuple_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/tuple_type.js +15 -0
- package/dist/debug/runtime_types/ast/tuple_type.js.map +1 -0
- package/dist/debug/runtime_types/ast/type_type.d.ts +12 -0
- package/dist/debug/runtime_types/ast/type_type.d.ts.map +1 -0
- package/dist/debug/runtime_types/ast/type_type.js +19 -0
- package/dist/debug/runtime_types/ast/type_type.js.map +1 -0
- package/dist/debug/runtime_types/index.d.ts +3 -0
- package/dist/debug/runtime_types/index.d.ts.map +1 -0
- package/dist/debug/runtime_types/index.js +19 -0
- package/dist/debug/runtime_types/index.js.map +1 -0
- package/dist/debug/runtime_types/utils.d.ts +32 -0
- package/dist/debug/runtime_types/utils.d.ts.map +1 -0
- package/dist/debug/runtime_types/utils.js +213 -0
- package/dist/debug/runtime_types/utils.js.map +1 -0
- package/dist/debug/tracers/transformers/int_stack.d.ts.map +1 -1
- package/dist/debug/tracers/transformers/int_stack.js +4 -2
- package/dist/debug/tracers/transformers/int_stack.js.map +1 -1
- package/dist/debug/tracers/transformers/ret_info.js +2 -2
- package/dist/debug/tracers/transformers/ret_info.js.map +1 -1
- package/dist/utils/misc.d.ts +5 -1
- package/dist/utils/misc.d.ts.map +1 -1
- package/dist/utils/misc.js +20 -9
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/pp.d.ts.map +1 -1
- package/dist/utils/pp.js +13 -12
- package/dist/utils/pp.js.map +1 -1
- package/dist/utils/solidity.d.ts +1 -0
- package/dist/utils/solidity.d.ts.map +1 -1
- package/dist/utils/solidity.js +8 -0
- package/dist/utils/solidity.js.map +1 -1
- package/package.json +1 -1
- package/dist/debug/decoding/exp_types.d.ts +0 -46
- package/dist/debug/decoding/exp_types.d.ts.map +0 -1
- package/dist/debug/decoding/exp_types.js +0 -202
- package/dist/debug/decoding/exp_types.js.map +0 -1
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PointerStackView = exports.FixedBytesStackView = exports.SingleByteStackView = exports.AddressStackView = exports.BoolStackView = exports.IntStackView = exports.BaseStackView = void 0;
|
|
4
4
|
exports.makeStackView = makeStackView;
|
|
5
|
-
const solc_typed_ast_1 = require("solc-typed-ast");
|
|
6
5
|
const value_1 = require("../value");
|
|
7
6
|
const view_1 = require("../view");
|
|
8
7
|
const utils_1 = require("../../../utils");
|
|
9
8
|
const storage_1 = require("../storage");
|
|
10
9
|
const utils_2 = require("../utils");
|
|
11
10
|
const view_2 = require("../calldata/view");
|
|
12
|
-
const memory_1 = require("../memory");
|
|
13
11
|
const view_3 = require("../storage/view");
|
|
14
12
|
const view_4 = require("../memory/view");
|
|
13
|
+
const runtime_types_1 = require("../../runtime_types");
|
|
14
|
+
const solc_typed_ast_1 = require("solc-typed-ast");
|
|
15
15
|
class BaseStackView extends view_1.View {
|
|
16
16
|
fetchStackWord(offsetFromTop, state) {
|
|
17
17
|
const len = state.length;
|
|
@@ -27,10 +27,10 @@ class BaseStackView extends view_1.View {
|
|
|
27
27
|
}
|
|
28
28
|
let res = (0, utils_1.bigEndianBufToBigint)(word);
|
|
29
29
|
// Convert signed negative 2's complement values
|
|
30
|
-
if (typ.signed && (res & (BigInt(1) << BigInt(typ.
|
|
30
|
+
if (typ.signed && (res & (BigInt(1) << BigInt(typ.numBits - 1))) !== BigInt(0)) {
|
|
31
31
|
// Mask out any 1's above the number's size
|
|
32
|
-
res = res & ((BigInt(1) << BigInt(typ.
|
|
33
|
-
res = -((BigInt(1) << BigInt(typ.
|
|
32
|
+
res = res & ((BigInt(1) << BigInt(typ.numBits)) - BigInt(1));
|
|
33
|
+
res = -((BigInt(1) << BigInt(typ.numBits)) - res);
|
|
34
34
|
}
|
|
35
35
|
if (!(0, utils_1.fits)(res, typ)) {
|
|
36
36
|
return new value_1.DecodingFailure(`${res} doesnt fit in type ${typ.pp()}`);
|
|
@@ -44,7 +44,7 @@ class BaseStackView extends view_1.View {
|
|
|
44
44
|
if (state.length <= offsetFromTop) {
|
|
45
45
|
throw new view_1.EncodingError(`OoB access at ${offsetFromTop} in stack`);
|
|
46
46
|
}
|
|
47
|
-
(0, utils_1.encodeBigintInBigEndianBuf)(value, state[offsetFromTop], type.
|
|
47
|
+
(0, utils_1.encodeBigintInBigEndianBuf)(value, state[offsetFromTop], type.numBits / 8);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.BaseStackView = BaseStackView;
|
|
@@ -83,7 +83,7 @@ class AddressStackView extends BaseStackView {
|
|
|
83
83
|
exports.AddressStackView = AddressStackView;
|
|
84
84
|
class SingleByteStackView extends BaseStackView {
|
|
85
85
|
constructor(loc, byteOffset) {
|
|
86
|
-
super(
|
|
86
|
+
super(utils_1.byte, loc);
|
|
87
87
|
this.byteOffset = byteOffset;
|
|
88
88
|
}
|
|
89
89
|
decode(state) {
|
|
@@ -105,7 +105,7 @@ exports.SingleByteStackView = SingleByteStackView;
|
|
|
105
105
|
class FixedBytesStackView extends BaseStackView {
|
|
106
106
|
decode(state) {
|
|
107
107
|
const w = this.fetchStackWord(this.loc, state);
|
|
108
|
-
return (0, utils_2.isFailure)(w) ? w : w.slice(0, this.type.
|
|
108
|
+
return (0, utils_2.isFailure)(w) ? w : w.slice(0, this.type.numBytes);
|
|
109
109
|
}
|
|
110
110
|
encode(value, state) {
|
|
111
111
|
const w = this.fetchStackWord(this.loc, state);
|
|
@@ -115,10 +115,10 @@ class FixedBytesStackView extends BaseStackView {
|
|
|
115
115
|
w.set(value);
|
|
116
116
|
}
|
|
117
117
|
size() {
|
|
118
|
-
return BigInt(this.type.
|
|
118
|
+
return BigInt(this.type.numBytes);
|
|
119
119
|
}
|
|
120
120
|
indexView(key) {
|
|
121
|
-
if (!(0, utils_2.inRange)(key, 0, this.type.
|
|
121
|
+
if (!(0, utils_2.inRange)(key, 0, this.type.numBytes - 1)) {
|
|
122
122
|
return new value_1.DecodingFailure(`Invalid index ${key} in ${this.type.pp()}`);
|
|
123
123
|
}
|
|
124
124
|
return new SingleByteStackView(this.loc, Number(key));
|
|
@@ -137,17 +137,18 @@ class PointerStackView extends BaseStackView {
|
|
|
137
137
|
if ((0, utils_2.isFailure)(len)) {
|
|
138
138
|
return len;
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
// This cast is weird...
|
|
141
|
+
return new view_2.ArraySliceCalldataView(this.type.toType, off, len);
|
|
141
142
|
}
|
|
142
143
|
if (this.type.location === solc_typed_ast_1.DataLocation.CallData) {
|
|
143
|
-
return (0, view_2.makeCalldataView)(this.type.
|
|
144
|
+
return (0, view_2.makeCalldataView)(this.type.toType, 0n, off);
|
|
144
145
|
}
|
|
145
146
|
if (this.type.location === solc_typed_ast_1.DataLocation.Memory) {
|
|
146
|
-
return (0,
|
|
147
|
+
return (0, view_4.makeMemoryView)(this.type.toType, off);
|
|
147
148
|
}
|
|
148
149
|
if (this.type.location === solc_typed_ast_1.DataLocation.Storage ||
|
|
149
150
|
this.type.location === solc_typed_ast_1.DataLocation.Transient) {
|
|
150
|
-
return (0, storage_1.makeStorageView)(this.type.
|
|
151
|
+
return (0, storage_1.makeStorageView)(this.type.toType, [off, 32]);
|
|
151
152
|
}
|
|
152
153
|
(0, utils_1.nyi)(`Stack pointer to ${this.type.location}`);
|
|
153
154
|
}
|
|
@@ -166,19 +167,19 @@ class PointerStackView extends BaseStackView {
|
|
|
166
167
|
}
|
|
167
168
|
exports.PointerStackView = PointerStackView;
|
|
168
169
|
function makeStackView(type, loc) {
|
|
169
|
-
if (type instanceof
|
|
170
|
+
if (type instanceof runtime_types_1.IntType) {
|
|
170
171
|
return new IntStackView(type, loc);
|
|
171
172
|
}
|
|
172
|
-
if (type instanceof
|
|
173
|
+
if (type instanceof runtime_types_1.AddressType) {
|
|
173
174
|
return new AddressStackView(type, loc);
|
|
174
175
|
}
|
|
175
|
-
if (type instanceof
|
|
176
|
+
if (type instanceof runtime_types_1.FixedBytesType) {
|
|
176
177
|
return new FixedBytesStackView(type, loc);
|
|
177
178
|
}
|
|
178
|
-
if (type instanceof
|
|
179
|
+
if (type instanceof runtime_types_1.BoolType) {
|
|
179
180
|
return new BoolStackView(type, loc);
|
|
180
181
|
}
|
|
181
|
-
if (type instanceof
|
|
182
|
+
if (type instanceof runtime_types_1.PointerType) {
|
|
182
183
|
return new PointerStackView(type, loc);
|
|
183
184
|
}
|
|
184
185
|
(0, utils_1.nyi)(`makeStackView(${type.pp()}, ${loc})`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/debug/decoding/stack/view.ts"],"names":[],"mappings":";;;AA6OA,
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/debug/decoding/stack/view.ts"],"names":[],"mappings":";;;AA6OA,sCAyBC;AArQD,oCAAkD;AAClD,kCAA6D;AAC7D,0CASwB;AAExB,wCAA6C;AAC7C,oCAAmE;AACnE,2CAA8F;AAC9F,0CAAkD;AAClD,yCAAgE;AAChE,uDAQ6B;AAC7B,mDAA8C;AAE9C,MAAsB,aAA+D,SAAQ,WAK5F;IACG,cAAc,CAAC,aAAqB,EAAE,KAAY;QAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;QAEzB,IAAI,GAAG,IAAI,aAAa,EAAE,CAAC;YACvB,OAAO,IAAI,uBAAe,CAAC,GAAG,aAAa,2BAA2B,GAAG,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,OAAO,KAAK,CAAC,GAAG,GAAG,aAAa,GAAG,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,WAAW,CAAC,aAAqB,EAAE,GAAY,EAAE,KAAY;QACzD,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAEvD,IAAI,IAAA,iBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,GAAG,GAAG,IAAA,4BAAoB,EAAC,IAAI,CAAC,CAAC;QACrC,gDAAgD;QAChD,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,MA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CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { AddressType, ArrayType, BoolType, BytesType, FixedBytesType, IntType, MappingType, PointerType, StringType, TypeNode } from "solc-typed-ast";
|
|
2
1
|
import { DecodingFailure, Struct, Value } from "../value";
|
|
3
2
|
import { ArrayLikeView, IndexableView, PointerView, StructView, View } from "../view";
|
|
4
3
|
import { Storage } from "../../types";
|
|
5
4
|
import { Address } from "@ethereumjs/util";
|
|
6
|
-
import { ExpStructType, MissingType } from "../exp_types";
|
|
7
5
|
import { MapKeys } from "../../tracers";
|
|
8
|
-
|
|
6
|
+
import { AddressType, ArrayType, BaseRuntimeType, BoolType, BytesType, FixedBytesType, IntType, MappingType, MissingType, PointerType, StringType, StructType } from "../../runtime_types";
|
|
7
|
+
interface ArrayLikeStorageView<ValViewT extends BaseStorageView<Value, BaseRuntimeType>> extends ArrayLikeView<Storage, ValViewT> {
|
|
9
8
|
}
|
|
10
9
|
type StorageLocation = [bigint, number];
|
|
11
|
-
export declare function isArrayLikeStorageView(v: any): v is ArrayLikeStorageView<BaseStorageView<Value,
|
|
12
|
-
export declare abstract class BaseStorageView<Val extends Value, Type extends
|
|
10
|
+
export declare function isArrayLikeStorageView(v: any): v is ArrayLikeStorageView<BaseStorageView<Value, BaseRuntimeType>>;
|
|
11
|
+
export declare abstract class BaseStorageView<Val extends Value, Type extends BaseRuntimeType = BaseRuntimeType> extends View<Storage, Val, [bigint, number], Type> {
|
|
13
12
|
key: bigint;
|
|
14
13
|
endOffsetInWord: number;
|
|
15
14
|
constructor(type: Type, loc: [bigint, number]);
|
|
@@ -66,15 +65,15 @@ export declare class FixedBytesStorageView extends BaseStorageView<Uint8Array, F
|
|
|
66
65
|
nextLoc(): StorageLocation;
|
|
67
66
|
size(): bigint | DecodingFailure;
|
|
68
67
|
}
|
|
69
|
-
export declare class PointerStorageView extends BaseStorageView<Value, PointerType> implements PointerView<Storage, BaseStorageView<Value,
|
|
70
|
-
innerView: BaseStorageView<Value,
|
|
68
|
+
export declare class PointerStorageView extends BaseStorageView<Value, PointerType> implements PointerView<Storage, BaseStorageView<Value, BaseRuntimeType>> {
|
|
69
|
+
innerView: BaseStorageView<Value, BaseRuntimeType>;
|
|
71
70
|
constructor(type: PointerType, loc: [bigint, number]);
|
|
72
71
|
decode(state: Storage, mapKeys?: MapKeys): Value;
|
|
73
72
|
encode(value: Value, state: Storage): Storage;
|
|
74
73
|
nextLoc(): StorageLocation | undefined;
|
|
75
|
-
toView(): BaseStorageView<Value,
|
|
74
|
+
toView(): BaseStorageView<Value, BaseRuntimeType>;
|
|
76
75
|
}
|
|
77
|
-
export declare class ArrayStorageView extends BaseStorageView<Value[], ArrayType> implements ArrayLikeStorageView<BaseStorageView<Value,
|
|
76
|
+
export declare class ArrayStorageView extends BaseStorageView<Value[], ArrayType> implements ArrayLikeStorageView<BaseStorageView<Value, BaseRuntimeType>> {
|
|
78
77
|
private _nextLoc;
|
|
79
78
|
/**
|
|
80
79
|
* Helper to compute how many words elements "take". This is not straightforward, as we may pack multiple
|
|
@@ -82,31 +81,31 @@ export declare class ArrayStorageView extends BaseStorageView<Value[], ArrayType
|
|
|
82
81
|
* I.e. we state that we can fit `nEls` elements in `nWords`, where this is the smalles "package" possible.
|
|
83
82
|
* @param elT
|
|
84
83
|
*/
|
|
85
|
-
static computeElmentSize(elT:
|
|
84
|
+
static computeElmentSize(elT: BaseRuntimeType): [bigint, bigint] | undefined;
|
|
86
85
|
constructor(type: ArrayType, loc: [bigint, number]);
|
|
87
86
|
nextLoc(): StorageLocation | undefined;
|
|
88
87
|
decode(state: Storage, mapKeys?: MapKeys): Value[] | DecodingFailure;
|
|
89
88
|
encode(value: Value[], state: Storage): Storage;
|
|
90
|
-
indexView(key: bigint, state: Storage): DecodingFailure | BaseStorageView<Value,
|
|
89
|
+
indexView(key: bigint, state: Storage): DecodingFailure | BaseStorageView<Value, BaseRuntimeType>;
|
|
91
90
|
size(state: Storage): bigint | DecodingFailure;
|
|
92
91
|
}
|
|
93
|
-
export declare class StructStorageView extends BaseStorageView<Struct,
|
|
94
|
-
fieldViews: Array<[string, BaseStorageView<Value,
|
|
92
|
+
export declare class StructStorageView extends BaseStorageView<Struct, StructType> implements StructView<Storage, BaseStorageView<Value, BaseRuntimeType>> {
|
|
93
|
+
fieldViews: Array<[string, BaseStorageView<Value, BaseRuntimeType>]>;
|
|
95
94
|
private _nextLoc;
|
|
96
|
-
constructor(type:
|
|
95
|
+
constructor(type: StructType, loc: StorageLocation);
|
|
97
96
|
nextLoc(): StorageLocation | undefined;
|
|
98
97
|
decode(state: Storage, mapKeys?: MapKeys): Struct;
|
|
99
98
|
encode(value: Struct, state: Storage): Storage;
|
|
100
|
-
fieldView(name: string): BaseStorageView<Value,
|
|
99
|
+
fieldView(name: string): BaseStorageView<Value, BaseRuntimeType> | DecodingFailure;
|
|
101
100
|
}
|
|
102
|
-
export declare class MapStorageView extends BaseStorageView<Map<Value, Value>, MappingType> implements IndexableView<Value, Storage, BaseStorageView<Value,
|
|
101
|
+
export declare class MapStorageView extends BaseStorageView<Map<Value, Value>, MappingType> implements IndexableView<Value, Storage, BaseStorageView<Value, BaseRuntimeType>> {
|
|
103
102
|
constructor(type: MappingType, loc: StorageLocation);
|
|
104
103
|
nextLoc(): StorageLocation;
|
|
105
104
|
decode(state: Storage, mapKeys?: MapKeys): Map<Value, Value>;
|
|
106
105
|
encode(value: Map<Value, Value>, state: Storage): Storage;
|
|
107
|
-
indexView(key: Value): DecodingFailure | BaseStorageView<Value,
|
|
106
|
+
indexView(key: Value): DecodingFailure | BaseStorageView<Value, BaseRuntimeType>;
|
|
108
107
|
}
|
|
109
|
-
export declare abstract class PackedArrayStorageView<V extends Value, T extends
|
|
108
|
+
export declare abstract class PackedArrayStorageView<V extends Value, T extends BaseRuntimeType> extends BaseStorageView<V, T> {
|
|
110
109
|
nextLoc(): StorageLocation;
|
|
111
110
|
protected getSize(state: Storage): bigint | DecodingFailure;
|
|
112
111
|
decodeBytes(state: Storage): Uint8Array | DecodingFailure;
|
|
@@ -129,6 +128,6 @@ export declare class MissingStorageView extends BaseStorageView<DecodingFailure,
|
|
|
129
128
|
nextLoc(): StorageLocation | undefined;
|
|
130
129
|
}
|
|
131
130
|
export declare function nextWord(loc: StorageLocation): StorageLocation;
|
|
132
|
-
export declare function makeStorageView(type:
|
|
131
|
+
export declare function makeStorageView(type: BaseRuntimeType, loc: StorageLocation): BaseStorageView<Value, BaseRuntimeType>;
|
|
133
132
|
export {};
|
|
134
133
|
//# sourceMappingURL=view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../../src/debug/decoding/storage/view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../../src/debug/decoding/storage/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EACH,aAAa,EAEb,aAAa,EACb,WAAW,EACX,UAAU,EACV,IAAI,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBtC,OAAO,EAAE,OAAO,EAA4B,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC,OAAO,EACH,WAAW,EACX,SAAS,EACT,eAAe,EACf,QAAQ,EACR,SAAS,EACT,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACb,MAAM,qBAAqB,CAAC;AAE7B,UAAU,oBAAoB,CAAC,QAAQ,SAAS,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,CACnF,SAAQ,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC;CAAG;AAC/C,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExC,wBAAgB,sBAAsB,CA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AQ,eAAe,CAAC,eAAe,EAAE,WAAW,CAAC;gBACrE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,eAAe;IAcnD,MAAM,IAAI,eAAe;IAKzB,MAAM,IAAI,OAAO;IAIjB,OAAO,IAAI,eAAe,GAAG,SAAS;CAazC;AAqBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,eAAe,CAE9D;AAoDD,wBAAgB,eAAe,CAC3B,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,eAAe,GACrB,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,CAwDzC"}
|
|
@@ -10,11 +10,11 @@ const view_1 = require("../view");
|
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
11
|
const keccak_1 = require("ethereum-cryptography/keccak");
|
|
12
12
|
const util_1 = require("@ethereumjs/util");
|
|
13
|
-
const exp_types_1 = require("../exp_types");
|
|
14
13
|
const memory_1 = require("../memory");
|
|
15
14
|
const utils_2 = require("../utils");
|
|
16
15
|
const view_2 = require("../memory/view");
|
|
17
16
|
const utils_3 = require("ethereum-cryptography/utils");
|
|
17
|
+
const runtime_types_1 = require("../../runtime_types");
|
|
18
18
|
function isArrayLikeStorageView(v) {
|
|
19
19
|
return (v instanceof FixedBytesStorageView ||
|
|
20
20
|
v instanceof ArrayStorageView ||
|
|
@@ -72,17 +72,17 @@ class BaseStorageView extends view_1.View {
|
|
|
72
72
|
* Helper to decode an int type at a given location in storage.
|
|
73
73
|
*/
|
|
74
74
|
decodeIntAt(key, endOffsetInWord, type, state) {
|
|
75
|
-
const size = type.
|
|
75
|
+
const size = type.numBits / 8;
|
|
76
76
|
if (endOffsetInWord < size) {
|
|
77
77
|
return new value_1.DecodingFailure(`Internal Error: Can't decode ${type.pp()} starting at offset ${endOffsetInWord} in word ${key}`);
|
|
78
78
|
}
|
|
79
79
|
const rawBytes = this.fetchBytes(key, endOffsetInWord - size, size, state);
|
|
80
80
|
let res = (0, utils_1.bigEndianBufToBigint)(rawBytes);
|
|
81
81
|
// Convert signed negative 2's complement values
|
|
82
|
-
if (type.signed && (res & (BigInt(1) << BigInt(type.
|
|
82
|
+
if (type.signed && (res & (BigInt(1) << BigInt(type.numBits - 1))) !== BigInt(0)) {
|
|
83
83
|
// Mask out any 1's above the number's size
|
|
84
|
-
res = res & ((BigInt(1) << BigInt(type.
|
|
85
|
-
res = -((BigInt(1) << BigInt(type.
|
|
84
|
+
res = res & ((BigInt(1) << BigInt(type.numBits)) - BigInt(1));
|
|
85
|
+
res = -((BigInt(1) << BigInt(type.numBits)) - res);
|
|
86
86
|
}
|
|
87
87
|
if (!(0, utils_1.fits)(res, type)) {
|
|
88
88
|
return new value_1.DecodingFailure(`Decoded value ${res} from ${[key, endOffsetInWord]} doesn't fit in expected typee ${type.pp()}`);
|
|
@@ -90,7 +90,7 @@ class BaseStorageView extends view_1.View {
|
|
|
90
90
|
return res;
|
|
91
91
|
}
|
|
92
92
|
encodeIntAt(val, key, endOffsetInWord, type, state) {
|
|
93
|
-
const size = type.
|
|
93
|
+
const size = type.numBits / 8;
|
|
94
94
|
if (endOffsetInWord < size) {
|
|
95
95
|
throw new view_1.EncodingError(`Internal Error: Can't decode ${type.pp()} starting at offset ${endOffsetInWord} in word ${key}`);
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@ class BaseStorageView extends view_1.View {
|
|
|
98
98
|
throw new view_1.EncodingError(`Decoded value ${val} from ${[key, endOffsetInWord]} doesn't fit in expected typee ${type.pp()}`);
|
|
99
99
|
}
|
|
100
100
|
const word = this.fetchWord(key, state);
|
|
101
|
-
(0, utils_1.encodeBigintInBigEndianBuf)(val, word, type.
|
|
101
|
+
(0, utils_1.encodeBigintInBigEndianBuf)(val, word, type.numBits / 8, endOffsetInWord);
|
|
102
102
|
return this.setWord(key, word, state);
|
|
103
103
|
}
|
|
104
104
|
pp() {
|
|
@@ -111,7 +111,7 @@ class IntStorageView extends BaseStorageView {
|
|
|
111
111
|
return this.decodeIntAt(this.key, this.endOffsetInWord, this.type, state);
|
|
112
112
|
}
|
|
113
113
|
nextLoc() {
|
|
114
|
-
return move(this.loc, this.type.
|
|
114
|
+
return move(this.loc, this.type.numBits / 8);
|
|
115
115
|
}
|
|
116
116
|
encode(value, state) {
|
|
117
117
|
return this.encodeIntAt(value, this.key, this.endOffsetInWord, this.type, state);
|
|
@@ -160,13 +160,13 @@ exports.AddressStorageView = AddressStorageView;
|
|
|
160
160
|
*/
|
|
161
161
|
class SingleByteStorageView extends BaseStorageView {
|
|
162
162
|
constructor(loc) {
|
|
163
|
-
super(
|
|
163
|
+
super(utils_1.byte, loc);
|
|
164
164
|
}
|
|
165
165
|
decode(state) {
|
|
166
|
-
if (this.endOffsetInWord < this.type.
|
|
166
|
+
if (this.endOffsetInWord < this.type.numBytes) {
|
|
167
167
|
return new value_1.DecodingFailure(`Unalighed Read: Can't decode ${this.type.pp()} starting at offset ${this.endOffsetInWord} in word ${this.key}`);
|
|
168
168
|
}
|
|
169
|
-
const byte = this.fetchBytes(this.key, this.endOffsetInWord - this.type.
|
|
169
|
+
const byte = this.fetchBytes(this.key, this.endOffsetInWord - this.type.numBytes, this.type.numBytes, state);
|
|
170
170
|
return BigInt(byte[0]);
|
|
171
171
|
}
|
|
172
172
|
encode(value, state) {
|
|
@@ -174,50 +174,50 @@ class SingleByteStorageView extends BaseStorageView {
|
|
|
174
174
|
if (!(0, utils_2.inRange)(value, 0, 255)) {
|
|
175
175
|
throw new view_1.EncodingError(`${value} not in byte range [0, 255]`);
|
|
176
176
|
}
|
|
177
|
-
word[this.endOffsetInWord - this.type.
|
|
177
|
+
word[this.endOffsetInWord - this.type.numBytes] = Number(value);
|
|
178
178
|
return this.setWord(this.key, word, state);
|
|
179
179
|
}
|
|
180
180
|
nextLoc() {
|
|
181
|
-
return move(this.loc, this.type.
|
|
181
|
+
return move(this.loc, this.type.numBytes);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
exports.SingleByteStorageView = SingleByteStorageView;
|
|
185
185
|
class FixedBytesStorageView extends BaseStorageView {
|
|
186
186
|
decode(state) {
|
|
187
|
-
if (this.endOffsetInWord < this.type.
|
|
187
|
+
if (this.endOffsetInWord < this.type.numBytes) {
|
|
188
188
|
return new value_1.DecodingFailure(`Unalighed Read: Can't decode ${this.type.pp()} starting at offset ${this.endOffsetInWord} in word ${this.key}`);
|
|
189
189
|
}
|
|
190
|
-
return this.fetchBytes(this.key, this.endOffsetInWord - this.type.
|
|
190
|
+
return this.fetchBytes(this.key, this.endOffsetInWord - this.type.numBytes, this.type.numBytes, state);
|
|
191
191
|
}
|
|
192
192
|
encode(value, state) {
|
|
193
|
-
if (this.endOffsetInWord < this.type.
|
|
193
|
+
if (this.endOffsetInWord < this.type.numBytes) {
|
|
194
194
|
throw new view_1.EncodingError(`Unalighed read: Can't decode ${this.type.pp()} starting at offset ${this.endOffsetInWord} in word ${this.key}`);
|
|
195
195
|
}
|
|
196
196
|
const word = this.fetchWord(this.key, state);
|
|
197
|
-
word.set(value, this.endOffsetInWord - this.type.
|
|
197
|
+
word.set(value, this.endOffsetInWord - this.type.numBytes);
|
|
198
198
|
return this.setWord(this.key, word, state);
|
|
199
199
|
}
|
|
200
200
|
indexView(key) {
|
|
201
|
-
if (!(0, utils_2.inRange)(key, 0, this.type.
|
|
201
|
+
if (!(0, utils_2.inRange)(key, 0, this.type.numBytes)) {
|
|
202
202
|
return new value_1.DecodingFailure(`Invalid index ${key} in ${this.type.pp()}`);
|
|
203
203
|
}
|
|
204
204
|
return new SingleByteStorageView([
|
|
205
205
|
this.key,
|
|
206
|
-
this.endOffsetInWord - this.type.
|
|
206
|
+
this.endOffsetInWord - this.type.numBytes + Number(key) + 1
|
|
207
207
|
]);
|
|
208
208
|
}
|
|
209
209
|
nextLoc() {
|
|
210
|
-
return move(this.loc, this.type.
|
|
210
|
+
return move(this.loc, this.type.numBytes);
|
|
211
211
|
}
|
|
212
212
|
size() {
|
|
213
|
-
return BigInt(this.type.
|
|
213
|
+
return BigInt(this.type.numBytes);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
exports.FixedBytesStorageView = FixedBytesStorageView;
|
|
217
217
|
class PointerStorageView extends BaseStorageView {
|
|
218
218
|
constructor(type, loc) {
|
|
219
219
|
super(type, loc);
|
|
220
|
-
this.innerView = makeStorageView(type.
|
|
220
|
+
this.innerView = makeStorageView(type.toType, loc);
|
|
221
221
|
}
|
|
222
222
|
decode(state, mapKeys) {
|
|
223
223
|
return this.innerView.decode(state, mapKeys);
|
|
@@ -388,7 +388,7 @@ class StructStorageView extends BaseStorageView {
|
|
|
388
388
|
let fieldLoc = this.loc;
|
|
389
389
|
for (const [name, fieldT] of this.type.fields) {
|
|
390
390
|
const fieldView = fieldLoc === undefined
|
|
391
|
-
? new MissingStorageView(new
|
|
391
|
+
? new MissingStorageView(new runtime_types_1.MissingType(undefined), [-1n, 32])
|
|
392
392
|
: makeStorageView(fieldT, fieldLoc);
|
|
393
393
|
this.fieldViews.push([name, fieldView]);
|
|
394
394
|
fieldLoc = fieldView.nextLoc();
|
|
@@ -427,17 +427,19 @@ class StructStorageView extends BaseStorageView {
|
|
|
427
427
|
}
|
|
428
428
|
exports.StructStorageView = StructStorageView;
|
|
429
429
|
function decodeMapRefKey(type, data) {
|
|
430
|
-
if (!(type instanceof
|
|
430
|
+
if (!(type instanceof runtime_types_1.StringType || type instanceof runtime_types_1.BytesType)) {
|
|
431
431
|
throw new Error(`Invalid map reference key type ${type.pp()}`);
|
|
432
432
|
}
|
|
433
|
-
return type instanceof
|
|
433
|
+
return type instanceof runtime_types_1.StringType ? (0, util_1.bytesToUtf8)(data) : (0, utils_3.bytesToHex)(data);
|
|
434
434
|
}
|
|
435
435
|
function encodeMapKey(keyT, value) {
|
|
436
|
-
if (keyT instanceof
|
|
437
|
-
if (!(keyT.
|
|
436
|
+
if (keyT instanceof runtime_types_1.PointerType) {
|
|
437
|
+
if (!(keyT.toType instanceof runtime_types_1.StringType || keyT.toType instanceof runtime_types_1.BytesType)) {
|
|
438
438
|
throw new Error(`Invalid map reference key type ${keyT.pp()}`);
|
|
439
439
|
}
|
|
440
|
-
return keyT.
|
|
440
|
+
return keyT.toType instanceof runtime_types_1.StringType
|
|
441
|
+
? (0, utils_3.utf8ToBytes)(value)
|
|
442
|
+
: value;
|
|
441
443
|
}
|
|
442
444
|
const buf = new Uint8Array(32);
|
|
443
445
|
const keyV = (0, memory_1.makeMemoryView)(keyT, 0n);
|
|
@@ -461,7 +463,7 @@ class MapStorageView extends BaseStorageView {
|
|
|
461
463
|
return res;
|
|
462
464
|
}
|
|
463
465
|
let keyView;
|
|
464
|
-
if (!(this.type.keyType instanceof
|
|
466
|
+
if (!(this.type.keyType instanceof runtime_types_1.PointerType)) {
|
|
465
467
|
keyView = (0, memory_1.makeMemoryView)(this.type.keyType, 0n);
|
|
466
468
|
}
|
|
467
469
|
// @todo(dimo) Would it be better here to check that `candidateSlot` is an explicitly defined in storage, and not just a 0 by default?
|
|
@@ -471,7 +473,7 @@ class MapStorageView extends BaseStorageView {
|
|
|
471
473
|
decodedKey = keyView.decode(candidateKey);
|
|
472
474
|
}
|
|
473
475
|
else {
|
|
474
|
-
decodedKey = decodeMapRefKey(this.type.keyType.
|
|
476
|
+
decodedKey = decodeMapRefKey(this.type.keyType.toType, candidateKey);
|
|
475
477
|
}
|
|
476
478
|
const valueView = makeStorageView(this.type.valueType, [candidateSlot, 32]);
|
|
477
479
|
const decodedValue = valueView.decode(state, mapKeys);
|
|
@@ -619,24 +621,24 @@ exports.StringStorageView = StringStorageView;
|
|
|
619
621
|
class MissingStorageView extends BaseStorageView {
|
|
620
622
|
constructor(type, loc) {
|
|
621
623
|
super(type, loc);
|
|
622
|
-
if (this.type.
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
(0, solc_typed_ast_1.assert)(this.endOffsetInWord === 32, `Unexpected non-word aligned {0} in storage`, typeString);
|
|
624
|
+
if (this.type.typeString !== undefined) {
|
|
625
|
+
if ((0, utils_2.isTypeStringStatic32BytesInStorage)(this.type.typeString)) {
|
|
626
|
+
(0, solc_typed_ast_1.assert)(this.endOffsetInWord === 32, `Unexpected non-word aligned {0} in storage`, this.type.typeString);
|
|
626
627
|
}
|
|
627
628
|
}
|
|
628
629
|
}
|
|
629
630
|
decode() {
|
|
630
|
-
|
|
631
|
+
const typeStr = this.type.typeString;
|
|
632
|
+
return new value_1.DecodingFailure(`missing ${typeStr ? typeStr : "<unknown>"}`);
|
|
631
633
|
}
|
|
632
634
|
encode() {
|
|
633
635
|
throw new view_1.EncodingError(`Cannot encode a missing value`);
|
|
634
636
|
}
|
|
635
637
|
nextLoc() {
|
|
636
|
-
if (this.type.
|
|
638
|
+
if (this.type.typeString === undefined) {
|
|
637
639
|
return undefined;
|
|
638
640
|
}
|
|
639
|
-
const typeString = this.type.
|
|
641
|
+
const typeString = this.type.typeString;
|
|
640
642
|
// If we can guess this is a dynamic array or mapping from the typestring, then we know the nextLoc
|
|
641
643
|
if ((0, utils_2.isTypeStringStatic32BytesInStorage)(typeString)) {
|
|
642
644
|
return nextWord(this.loc);
|
|
@@ -665,10 +667,10 @@ function nextWord(loc) {
|
|
|
665
667
|
return [loc[0] + 1n, 32];
|
|
666
668
|
}
|
|
667
669
|
function typeStartsInNewWord(t) {
|
|
668
|
-
if (t instanceof
|
|
669
|
-
return typeStartsInNewWord(t.
|
|
670
|
+
if (t instanceof runtime_types_1.PointerType) {
|
|
671
|
+
return typeStartsInNewWord(t.toType);
|
|
670
672
|
}
|
|
671
|
-
return t instanceof
|
|
673
|
+
return t instanceof runtime_types_1.ArrayType || t instanceof runtime_types_1.MappingType || t instanceof runtime_types_1.StructType;
|
|
672
674
|
}
|
|
673
675
|
/**
|
|
674
676
|
* Compute the 'static' size that a variable of primitive type `typ` would take
|
|
@@ -677,35 +679,35 @@ function typeStartsInNewWord(t) {
|
|
|
677
679
|
* starts in own word too).
|
|
678
680
|
*/
|
|
679
681
|
function staticSize(typ) {
|
|
680
|
-
if (typ instanceof
|
|
681
|
-
return typ.
|
|
682
|
+
if (typ instanceof runtime_types_1.IntType) {
|
|
683
|
+
return typ.numBits / 8;
|
|
682
684
|
}
|
|
683
|
-
if (typ instanceof
|
|
684
|
-
return typ.
|
|
685
|
+
if (typ instanceof runtime_types_1.FixedBytesType) {
|
|
686
|
+
return typ.numBytes;
|
|
685
687
|
}
|
|
686
|
-
if (typ instanceof
|
|
688
|
+
if (typ instanceof runtime_types_1.BoolType) {
|
|
687
689
|
return 1;
|
|
688
690
|
}
|
|
689
|
-
if (typ instanceof
|
|
691
|
+
if (typ instanceof runtime_types_1.AddressType) {
|
|
690
692
|
return 20;
|
|
691
693
|
}
|
|
692
|
-
if (typ instanceof
|
|
694
|
+
if (typ instanceof runtime_types_1.BytesType || typ instanceof runtime_types_1.StringType) {
|
|
693
695
|
return 32;
|
|
694
696
|
}
|
|
695
|
-
if (typ instanceof
|
|
696
|
-
return staticSize(typ.
|
|
697
|
+
if (typ instanceof runtime_types_1.PointerType) {
|
|
698
|
+
return staticSize(typ.toType);
|
|
697
699
|
}
|
|
698
|
-
if (typ instanceof
|
|
699
|
-
typ.
|
|
700
|
-
(0, utils_2.isTypeStringStatic32BytesInStorage)(typ.
|
|
700
|
+
if (typ instanceof runtime_types_1.MissingType &&
|
|
701
|
+
typ.typeString !== undefined &&
|
|
702
|
+
(0, utils_2.isTypeStringStatic32BytesInStorage)(typ.typeString)) {
|
|
701
703
|
return 32;
|
|
702
704
|
}
|
|
703
705
|
(0, utils_1.nyi)(`NYI staticSize(${typ.pp()})`);
|
|
704
706
|
}
|
|
705
707
|
function makeStorageView(type, loc) {
|
|
706
|
-
if (type instanceof
|
|
707
|
-
if (type.
|
|
708
|
-
if ((0, utils_2.isTypeStringStatic32BytesInStorage)(type.
|
|
708
|
+
if (type instanceof runtime_types_1.MissingType) {
|
|
709
|
+
if (type.typeString !== undefined) {
|
|
710
|
+
if ((0, utils_2.isTypeStringStatic32BytesInStorage)(type.typeString)) {
|
|
709
711
|
loc = loc[1] === 32 ? loc : nextWord(loc);
|
|
710
712
|
}
|
|
711
713
|
}
|
|
@@ -714,34 +716,34 @@ function makeStorageView(type, loc) {
|
|
|
714
716
|
if (!typeFitsInLoc(type, loc)) {
|
|
715
717
|
loc = nextWord(loc);
|
|
716
718
|
}
|
|
717
|
-
if (type instanceof
|
|
719
|
+
if (type instanceof runtime_types_1.IntType) {
|
|
718
720
|
return new IntStorageView(type, loc);
|
|
719
721
|
}
|
|
720
|
-
if (type instanceof
|
|
722
|
+
if (type instanceof runtime_types_1.BoolType) {
|
|
721
723
|
return new BoolStorageView(utils_1.bool, loc);
|
|
722
724
|
}
|
|
723
|
-
if (type instanceof
|
|
725
|
+
if (type instanceof runtime_types_1.AddressType) {
|
|
724
726
|
return new AddressStorageView(utils_1.address, loc);
|
|
725
727
|
}
|
|
726
|
-
if (type instanceof
|
|
728
|
+
if (type instanceof runtime_types_1.FixedBytesType) {
|
|
727
729
|
return new FixedBytesStorageView(type, loc);
|
|
728
730
|
}
|
|
729
|
-
if (type instanceof
|
|
731
|
+
if (type instanceof runtime_types_1.BytesType) {
|
|
730
732
|
return new BytesStorageView(type, loc);
|
|
731
733
|
}
|
|
732
|
-
if (type instanceof
|
|
734
|
+
if (type instanceof runtime_types_1.StringType) {
|
|
733
735
|
return new StringStorageView(type, loc);
|
|
734
736
|
}
|
|
735
|
-
if (type instanceof
|
|
737
|
+
if (type instanceof runtime_types_1.ArrayType) {
|
|
736
738
|
return new ArrayStorageView(type, loc);
|
|
737
739
|
}
|
|
738
|
-
if (type instanceof
|
|
740
|
+
if (type instanceof runtime_types_1.PointerType) {
|
|
739
741
|
return new PointerStorageView(type, loc);
|
|
740
742
|
}
|
|
741
|
-
if (type instanceof
|
|
743
|
+
if (type instanceof runtime_types_1.StructType) {
|
|
742
744
|
return new StructStorageView(type, loc);
|
|
743
745
|
}
|
|
744
|
-
if (type instanceof
|
|
746
|
+
if (type instanceof runtime_types_1.MappingType) {
|
|
745
747
|
return new MapStorageView(type, loc);
|
|
746
748
|
}
|
|
747
749
|
(0, utils_1.nyi)(`makeStoragView(${type.pp()})`);
|