@typeberry/lib 0.4.0-d185014 → 0.4.0-da92f56
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/index.cjs +11 -80
- package/index.d.ts +13 -487
- package/index.js +11 -80
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -19,7 +19,11 @@ var TestSuite;
|
|
|
19
19
|
})(TestSuite || (TestSuite = {}));
|
|
20
20
|
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
21
21
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Current version is set to track the jam-conformance testing.
|
|
24
|
+
* Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
|
|
25
|
+
*/
|
|
26
|
+
const DEFAULT_VERSION = GpVersion.V0_7_1;
|
|
23
27
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
24
28
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
25
29
|
let CURRENT_SUITE = parseCurrentSuite(env$1.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
@@ -78,8 +82,8 @@ class Compatibility {
|
|
|
78
82
|
/**
|
|
79
83
|
* Allows selecting different values for different Gray Paper versions from one record.
|
|
80
84
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
85
|
+
* fallback The default value to return if no value is found for the current.
|
|
86
|
+
* versions A record mapping versions to values, checking if the version is greater or equal to the current version.
|
|
83
87
|
* @returns The value for the current version, or the default value.
|
|
84
88
|
*/
|
|
85
89
|
static selectIfGreaterOrEqual({ fallback, versions, }) {
|
|
@@ -239,7 +243,7 @@ const workspacePathFix = env.NODE_ENV === "development"
|
|
|
239
243
|
: () => (p) => p;
|
|
240
244
|
|
|
241
245
|
/**
|
|
242
|
-
*
|
|
246
|
+
* `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
243
247
|
* specified unique token Token. It means that base type cannot be assigned to unique type by accident.
|
|
244
248
|
* Good examples of opaque types include:
|
|
245
249
|
* - JWTs or other tokens - these are special kinds of string used for authorization purposes.
|
|
@@ -6712,6 +6716,8 @@ var index$m = /*#__PURE__*/Object.freeze({
|
|
|
6712
6716
|
SEGMENT_BYTES: SEGMENT_BYTES,
|
|
6713
6717
|
TicketsMarker: TicketsMarker,
|
|
6714
6718
|
ValidatorKeys: ValidatorKeys,
|
|
6719
|
+
W_E: W_E,
|
|
6720
|
+
W_S: W_S,
|
|
6715
6721
|
assurances: assurances,
|
|
6716
6722
|
codecPerEpochBlock: codecPerEpochBlock,
|
|
6717
6723
|
codecPerValidator: codecPerValidator,
|
|
@@ -10376,7 +10382,6 @@ class LeafNode {
|
|
|
10376
10382
|
/**
|
|
10377
10383
|
* Get the byte length of embedded value.
|
|
10378
10384
|
*
|
|
10379
|
-
* @remark
|
|
10380
10385
|
* Note in case this node only contains hash this is going to be 0.
|
|
10381
10386
|
*/
|
|
10382
10387
|
getValueLength() {
|
|
@@ -10387,7 +10392,6 @@ class LeafNode {
|
|
|
10387
10392
|
/**
|
|
10388
10393
|
* Returns the embedded value.
|
|
10389
10394
|
*
|
|
10390
|
-
* @remark
|
|
10391
10395
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
10392
10396
|
*/
|
|
10393
10397
|
getValue() {
|
|
@@ -10397,7 +10401,6 @@ class LeafNode {
|
|
|
10397
10401
|
/**
|
|
10398
10402
|
* Returns contained value hash.
|
|
10399
10403
|
*
|
|
10400
|
-
* @remark
|
|
10401
10404
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
10402
10405
|
*/
|
|
10403
10406
|
getValueHash() {
|
|
@@ -17719,79 +17722,7 @@ class DebuggerAdapter {
|
|
|
17719
17722
|
|
|
17720
17723
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17721
17724
|
__proto__: null,
|
|
17722
|
-
|
|
17723
|
-
ArgsDecoder: ArgsDecoder,
|
|
17724
|
-
get ArgumentType () { return ArgumentType; },
|
|
17725
|
-
BasicBlocks: BasicBlocks,
|
|
17726
|
-
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
17727
|
-
get EjectError () { return EjectError; },
|
|
17728
|
-
ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
|
|
17729
|
-
get ForgetPreimageError () { return ForgetPreimageError; },
|
|
17730
|
-
HostCallMemory: HostCallMemory,
|
|
17731
|
-
HostCallRegisters: HostCallRegisters,
|
|
17732
|
-
HostCallResult: HostCallResult,
|
|
17733
|
-
ImmediateDecoder: ImmediateDecoder,
|
|
17734
|
-
InsufficientFundsError: InsufficientFundsError,
|
|
17735
|
-
MachineInstance: MachineInstance,
|
|
17736
|
-
Mask: Mask,
|
|
17737
|
-
get MemoryOperation () { return MemoryOperation; },
|
|
17738
|
-
MemorySegment: MemorySegment,
|
|
17739
|
-
NO_OF_REGISTERS: NO_OF_REGISTERS$1,
|
|
17740
|
-
get NewServiceError () { return NewServiceError; },
|
|
17741
|
-
NibblesDecoder: NibblesDecoder,
|
|
17742
|
-
NoMachineError: NoMachineError,
|
|
17743
|
-
OK: OK,
|
|
17744
|
-
get PagesError () { return PagesError; },
|
|
17745
|
-
PartiallyUpdatedState: PartiallyUpdatedState,
|
|
17746
|
-
get PeekPokeError () { return PeekPokeError; },
|
|
17747
|
-
PendingTransfer: PendingTransfer,
|
|
17748
|
-
get PreimageStatusKind () { return PreimageStatusKind; },
|
|
17749
|
-
Program: Program,
|
|
17750
|
-
ProgramDecoder: ProgramDecoder,
|
|
17751
|
-
get ProvidePreimageError () { return ProvidePreimageError; },
|
|
17752
|
-
Pvm: DebuggerAdapter,
|
|
17753
|
-
Registers: Registers,
|
|
17754
|
-
get RequestPreimageError () { return RequestPreimageError; },
|
|
17755
|
-
Result: Result$1,
|
|
17756
|
-
SERVICE_ID_BYTES: SERVICE_ID_BYTES,
|
|
17757
|
-
SegmentExportError: SegmentExportError,
|
|
17758
|
-
SpiMemory: SpiMemory,
|
|
17759
|
-
SpiProgram: SpiProgram,
|
|
17760
|
-
TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
|
|
17761
|
-
get TransferError () { return TransferError; },
|
|
17762
|
-
UnprivilegedError: UnprivilegedError,
|
|
17763
|
-
get UpdatePrivilegesError () { return UpdatePrivilegesError; },
|
|
17764
|
-
WithDebug: WithDebug,
|
|
17765
|
-
get ZeroVoidError () { return ZeroVoidError; },
|
|
17766
|
-
asOpaqueType: asOpaqueType,
|
|
17767
|
-
assertEmpty: assertEmpty,
|
|
17768
|
-
assertNever: assertNever,
|
|
17769
|
-
block: index$m,
|
|
17770
|
-
bytes: index$t,
|
|
17771
|
-
check: check,
|
|
17772
|
-
clampU64ToU32: clampU64ToU32,
|
|
17773
|
-
createResults: createResults,
|
|
17774
|
-
decodeStandardProgram: decodeStandardProgram,
|
|
17775
|
-
emptyRegistersBuffer: emptyRegistersBuffer,
|
|
17776
|
-
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
17777
|
-
getServiceId: getServiceId,
|
|
17778
|
-
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
17779
|
-
hash: index$p,
|
|
17780
|
-
hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
|
|
17781
|
-
inspect: inspect,
|
|
17782
|
-
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
17783
|
-
interpreter: index$8,
|
|
17784
|
-
isBrowser: isBrowser,
|
|
17785
|
-
lazyInspect: lazyInspect,
|
|
17786
|
-
measure: measure,
|
|
17787
|
-
numbers: index$s,
|
|
17788
|
-
resultToString: resultToString,
|
|
17789
|
-
seeThrough: seeThrough,
|
|
17790
|
-
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
17791
|
-
toMemoryOperation: toMemoryOperation,
|
|
17792
|
-
tryAsMachineId: tryAsMachineId,
|
|
17793
|
-
tryAsProgramCounter: tryAsProgramCounter,
|
|
17794
|
-
writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
|
|
17725
|
+
Pvm: DebuggerAdapter
|
|
17795
17726
|
});
|
|
17796
17727
|
|
|
17797
17728
|
const ENTROPY_BYTES = 32;
|
package/index.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ declare enum TestSuite {
|
|
|
13
13
|
declare const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
14
14
|
|
|
15
15
|
declare const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Current version is set to track the jam-conformance testing.
|
|
18
|
+
* Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
|
|
19
|
+
*/
|
|
20
|
+
declare const DEFAULT_VERSION = GpVersion.V0_7_1;
|
|
17
21
|
declare let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
|
|
18
22
|
declare let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
19
23
|
|
|
@@ -85,8 +89,8 @@ declare class Compatibility {
|
|
|
85
89
|
/**
|
|
86
90
|
* Allows selecting different values for different Gray Paper versions from one record.
|
|
87
91
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
92
|
+
* fallback The default value to return if no value is found for the current.
|
|
93
|
+
* versions A record mapping versions to values, checking if the version is greater or equal to the current version.
|
|
90
94
|
* @returns The value for the current version, or the default value.
|
|
91
95
|
*/
|
|
92
96
|
static selectIfGreaterOrEqual<T>({
|
|
@@ -274,7 +278,7 @@ declare const workspacePathFix =
|
|
|
274
278
|
: () => (p: string) => p;
|
|
275
279
|
|
|
276
280
|
/**
|
|
277
|
-
*
|
|
281
|
+
* `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
278
282
|
* specified unique token Token. It means that base type cannot be assigned to unique type by accident.
|
|
279
283
|
* Good examples of opaque types include:
|
|
280
284
|
* - JWTs or other tokens - these are special kinds of string used for authorization purposes.
|
|
@@ -2435,10 +2439,10 @@ type ClassConstructor<T> = {
|
|
|
2435
2439
|
type Codec<T> = Encode<T> & Decode<T>;
|
|
2436
2440
|
|
|
2437
2441
|
/** A codec descriptor with extra view. */
|
|
2438
|
-
|
|
2442
|
+
interface CodecWithView<T, V> extends Codec<T> {
|
|
2439
2443
|
/** encoded data view codec. */
|
|
2440
2444
|
View: Codec<V>;
|
|
2441
|
-
}
|
|
2445
|
+
}
|
|
2442
2446
|
|
|
2443
2447
|
/**
|
|
2444
2448
|
* Type descriptor definition.
|
|
@@ -8695,7 +8699,6 @@ declare class LeafNode {
|
|
|
8695
8699
|
/**
|
|
8696
8700
|
* Get the byte length of embedded value.
|
|
8697
8701
|
*
|
|
8698
|
-
* @remark
|
|
8699
8702
|
* Note in case this node only contains hash this is going to be 0.
|
|
8700
8703
|
*/
|
|
8701
8704
|
getValueLength(): number {
|
|
@@ -8707,7 +8710,6 @@ declare class LeafNode {
|
|
|
8707
8710
|
/**
|
|
8708
8711
|
* Returns the embedded value.
|
|
8709
8712
|
*
|
|
8710
|
-
* @remark
|
|
8711
8713
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
8712
8714
|
*/
|
|
8713
8715
|
getValue(): BytesBlob {
|
|
@@ -8718,7 +8720,6 @@ declare class LeafNode {
|
|
|
8718
8720
|
/**
|
|
8719
8721
|
* Returns contained value hash.
|
|
8720
8722
|
*
|
|
8721
|
-
* @remark
|
|
8722
8723
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
8723
8724
|
*/
|
|
8724
8725
|
getValueHash(): ValueHash {
|
|
@@ -14547,8 +14548,6 @@ interface IMemory {
|
|
|
14547
14548
|
read(address: U32, result: Uint8Array): Result$2<OK, PageFault$1>;
|
|
14548
14549
|
}
|
|
14549
14550
|
|
|
14550
|
-
declare const NO_OF_REGISTERS$1 = 13;
|
|
14551
|
-
|
|
14552
14551
|
/** Allow to set and get all registers encoded into little-endian bytes. */
|
|
14553
14552
|
interface IRegisters {
|
|
14554
14553
|
/**
|
|
@@ -15722,38 +15721,6 @@ declare class ImmediateDecoder {
|
|
|
15722
15721
|
}
|
|
15723
15722
|
}
|
|
15724
15723
|
|
|
15725
|
-
declare class NibblesDecoder {
|
|
15726
|
-
private byte = new Int8Array(1);
|
|
15727
|
-
|
|
15728
|
-
setByte(byte: number) {
|
|
15729
|
-
this.byte[0] = byte;
|
|
15730
|
-
}
|
|
15731
|
-
|
|
15732
|
-
getHighNibble() {
|
|
15733
|
-
return (this.byte[0] & 0xf0) >>> 4;
|
|
15734
|
-
}
|
|
15735
|
-
|
|
15736
|
-
getLowNibble() {
|
|
15737
|
-
return this.byte[0] & 0x0f;
|
|
15738
|
-
}
|
|
15739
|
-
|
|
15740
|
-
getHighNibbleAsRegisterIndex() {
|
|
15741
|
-
return Math.min(this.getHighNibble(), MAX_REGISTER_INDEX);
|
|
15742
|
-
}
|
|
15743
|
-
|
|
15744
|
-
getLowNibbleAsRegisterIndex() {
|
|
15745
|
-
return Math.min(this.getLowNibble(), MAX_REGISTER_INDEX);
|
|
15746
|
-
}
|
|
15747
|
-
|
|
15748
|
-
getHighNibbleAsLength() {
|
|
15749
|
-
return Math.min(this.getHighNibble(), MAX_LENGTH);
|
|
15750
|
-
}
|
|
15751
|
-
|
|
15752
|
-
getLowNibbleAsLength() {
|
|
15753
|
-
return Math.min(this.getLowNibble(), MAX_LENGTH);
|
|
15754
|
-
}
|
|
15755
|
-
}
|
|
15756
|
-
|
|
15757
15724
|
type EmptyArgs = {
|
|
15758
15725
|
type: ArgumentType.NO_ARGUMENTS;
|
|
15759
15726
|
noOfBytesToSkip: number;
|
|
@@ -16092,106 +16059,6 @@ declare class ArgsDecoder {
|
|
|
16092
16059
|
}
|
|
16093
16060
|
}
|
|
16094
16061
|
|
|
16095
|
-
declare const createResults = () => {
|
|
16096
|
-
const results = new Array(ARGUMENT_TYPE_LENGTH) as Results;
|
|
16097
|
-
|
|
16098
|
-
results[ArgumentType.NO_ARGUMENTS] = {
|
|
16099
|
-
type: ArgumentType.NO_ARGUMENTS,
|
|
16100
|
-
noOfBytesToSkip: 1,
|
|
16101
|
-
};
|
|
16102
|
-
|
|
16103
|
-
results[ArgumentType.ONE_IMMEDIATE] = {
|
|
16104
|
-
type: ArgumentType.ONE_IMMEDIATE,
|
|
16105
|
-
noOfBytesToSkip: 1,
|
|
16106
|
-
immediateDecoder: new ImmediateDecoder(),
|
|
16107
|
-
};
|
|
16108
|
-
|
|
16109
|
-
results[ArgumentType.TWO_REGISTERS] = {
|
|
16110
|
-
type: ArgumentType.TWO_REGISTERS,
|
|
16111
|
-
noOfBytesToSkip: 1,
|
|
16112
|
-
firstRegisterIndex: 0,
|
|
16113
|
-
secondRegisterIndex: 0,
|
|
16114
|
-
};
|
|
16115
|
-
|
|
16116
|
-
results[ArgumentType.THREE_REGISTERS] = {
|
|
16117
|
-
type: ArgumentType.THREE_REGISTERS,
|
|
16118
|
-
noOfBytesToSkip: 1,
|
|
16119
|
-
firstRegisterIndex: 0,
|
|
16120
|
-
secondRegisterIndex: 0,
|
|
16121
|
-
thirdRegisterIndex: 0,
|
|
16122
|
-
};
|
|
16123
|
-
|
|
16124
|
-
results[ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET] = {
|
|
16125
|
-
type: ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET,
|
|
16126
|
-
noOfBytesToSkip: 1,
|
|
16127
|
-
registerIndex: 0,
|
|
16128
|
-
immediateDecoder: new ImmediateDecoder(),
|
|
16129
|
-
nextPc: 0,
|
|
16130
|
-
};
|
|
16131
|
-
|
|
16132
|
-
results[ArgumentType.TWO_REGISTERS_ONE_OFFSET] = {
|
|
16133
|
-
type: ArgumentType.TWO_REGISTERS_ONE_OFFSET,
|
|
16134
|
-
noOfBytesToSkip: 1,
|
|
16135
|
-
firstRegisterIndex: 0,
|
|
16136
|
-
secondRegisterIndex: 0,
|
|
16137
|
-
nextPc: 0,
|
|
16138
|
-
};
|
|
16139
|
-
|
|
16140
|
-
results[ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE] = {
|
|
16141
|
-
type: ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE,
|
|
16142
|
-
noOfBytesToSkip: 1,
|
|
16143
|
-
firstRegisterIndex: 0,
|
|
16144
|
-
secondRegisterIndex: 0,
|
|
16145
|
-
immediateDecoder: new ImmediateDecoder(),
|
|
16146
|
-
};
|
|
16147
|
-
|
|
16148
|
-
results[ArgumentType.ONE_REGISTER_ONE_IMMEDIATE] = {
|
|
16149
|
-
type: ArgumentType.ONE_REGISTER_ONE_IMMEDIATE,
|
|
16150
|
-
noOfBytesToSkip: 1,
|
|
16151
|
-
registerIndex: 0,
|
|
16152
|
-
immediateDecoder: new ImmediateDecoder(),
|
|
16153
|
-
};
|
|
16154
|
-
|
|
16155
|
-
results[ArgumentType.ONE_REGISTER_TWO_IMMEDIATES] = {
|
|
16156
|
-
type: ArgumentType.ONE_REGISTER_TWO_IMMEDIATES,
|
|
16157
|
-
noOfBytesToSkip: 1,
|
|
16158
|
-
registerIndex: 0,
|
|
16159
|
-
firstImmediateDecoder: new ImmediateDecoder(),
|
|
16160
|
-
secondImmediateDecoder: new ImmediateDecoder(),
|
|
16161
|
-
};
|
|
16162
|
-
|
|
16163
|
-
results[ArgumentType.ONE_OFFSET] = {
|
|
16164
|
-
type: ArgumentType.ONE_OFFSET,
|
|
16165
|
-
noOfBytesToSkip: 1,
|
|
16166
|
-
nextPc: 0,
|
|
16167
|
-
};
|
|
16168
|
-
|
|
16169
|
-
results[ArgumentType.TWO_IMMEDIATES] = {
|
|
16170
|
-
type: ArgumentType.TWO_IMMEDIATES,
|
|
16171
|
-
noOfBytesToSkip: 1,
|
|
16172
|
-
firstImmediateDecoder: new ImmediateDecoder(),
|
|
16173
|
-
secondImmediateDecoder: new ImmediateDecoder(),
|
|
16174
|
-
};
|
|
16175
|
-
|
|
16176
|
-
results[ArgumentType.TWO_REGISTERS_TWO_IMMEDIATES] = {
|
|
16177
|
-
type: ArgumentType.TWO_REGISTERS_TWO_IMMEDIATES,
|
|
16178
|
-
noOfBytesToSkip: 1,
|
|
16179
|
-
firstImmediateDecoder: new ImmediateDecoder(),
|
|
16180
|
-
secondImmediateDecoder: new ImmediateDecoder(),
|
|
16181
|
-
firstRegisterIndex: 0,
|
|
16182
|
-
secondRegisterIndex: 0,
|
|
16183
|
-
};
|
|
16184
|
-
|
|
16185
|
-
results[ArgumentType.ONE_REGISTER_ONE_EXTENDED_WIDTH_IMMEDIATE] = {
|
|
16186
|
-
type: ArgumentType.ONE_REGISTER_ONE_EXTENDED_WIDTH_IMMEDIATE,
|
|
16187
|
-
noOfBytesToSkip: 9,
|
|
16188
|
-
registerIndex: 0,
|
|
16189
|
-
immediateDecoder: new ExtendedWitdthImmediateDecoder(),
|
|
16190
|
-
};
|
|
16191
|
-
|
|
16192
|
-
return results;
|
|
16193
|
-
};
|
|
16194
|
-
|
|
16195
16062
|
declare enum Instruction {
|
|
16196
16063
|
TRAP = 0,
|
|
16197
16064
|
FALLTHROUGH = 1,
|
|
@@ -16334,164 +16201,6 @@ declare enum Instruction {
|
|
|
16334
16201
|
MIN_U = 230,
|
|
16335
16202
|
}
|
|
16336
16203
|
|
|
16337
|
-
declare const instructionArgumentTypeMap = (() => {
|
|
16338
|
-
const instructionArgumentTypeMap = new Array<ArgumentType>(HIGHEST_INSTRUCTION_NUMBER + 1);
|
|
16339
|
-
|
|
16340
|
-
instructionArgumentTypeMap[Instruction.TRAP] = ArgumentType.NO_ARGUMENTS;
|
|
16341
|
-
instructionArgumentTypeMap[Instruction.FALLTHROUGH] = ArgumentType.NO_ARGUMENTS;
|
|
16342
|
-
|
|
16343
|
-
instructionArgumentTypeMap[Instruction.ECALLI] = ArgumentType.ONE_IMMEDIATE;
|
|
16344
|
-
|
|
16345
|
-
instructionArgumentTypeMap[Instruction.LOAD_IMM_64] = ArgumentType.ONE_REGISTER_ONE_EXTENDED_WIDTH_IMMEDIATE;
|
|
16346
|
-
|
|
16347
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_U8] = ArgumentType.TWO_IMMEDIATES;
|
|
16348
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_U16] = ArgumentType.TWO_IMMEDIATES;
|
|
16349
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_U32] = ArgumentType.TWO_IMMEDIATES;
|
|
16350
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_U64] = ArgumentType.TWO_IMMEDIATES;
|
|
16351
|
-
|
|
16352
|
-
instructionArgumentTypeMap[Instruction.JUMP] = ArgumentType.ONE_OFFSET;
|
|
16353
|
-
|
|
16354
|
-
instructionArgumentTypeMap[Instruction.JUMP_IND] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16355
|
-
instructionArgumentTypeMap[Instruction.LOAD_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16356
|
-
instructionArgumentTypeMap[Instruction.LOAD_U8] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16357
|
-
instructionArgumentTypeMap[Instruction.LOAD_I8] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16358
|
-
instructionArgumentTypeMap[Instruction.LOAD_U16] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16359
|
-
instructionArgumentTypeMap[Instruction.LOAD_I16] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16360
|
-
instructionArgumentTypeMap[Instruction.LOAD_U32] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16361
|
-
instructionArgumentTypeMap[Instruction.LOAD_I32] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16362
|
-
instructionArgumentTypeMap[Instruction.LOAD_U64] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16363
|
-
instructionArgumentTypeMap[Instruction.STORE_U8] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16364
|
-
instructionArgumentTypeMap[Instruction.STORE_U16] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16365
|
-
instructionArgumentTypeMap[Instruction.STORE_U32] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16366
|
-
instructionArgumentTypeMap[Instruction.STORE_U64] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE;
|
|
16367
|
-
|
|
16368
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_IND_U8] = ArgumentType.ONE_REGISTER_TWO_IMMEDIATES;
|
|
16369
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_IND_U16] = ArgumentType.ONE_REGISTER_TWO_IMMEDIATES;
|
|
16370
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_IND_U32] = ArgumentType.ONE_REGISTER_TWO_IMMEDIATES;
|
|
16371
|
-
instructionArgumentTypeMap[Instruction.STORE_IMM_IND_U64] = ArgumentType.ONE_REGISTER_TWO_IMMEDIATES;
|
|
16372
|
-
|
|
16373
|
-
instructionArgumentTypeMap[Instruction.LOAD_IMM_JUMP] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16374
|
-
instructionArgumentTypeMap[Instruction.BRANCH_EQ_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16375
|
-
instructionArgumentTypeMap[Instruction.BRANCH_NE_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16376
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LT_U_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16377
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LE_U_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16378
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GE_U_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16379
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GT_U_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16380
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LT_S_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16381
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LE_S_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16382
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GE_S_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16383
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GT_S_IMM] = ArgumentType.ONE_REGISTER_ONE_IMMEDIATE_ONE_OFFSET;
|
|
16384
|
-
|
|
16385
|
-
instructionArgumentTypeMap[Instruction.MOVE_REG] = ArgumentType.TWO_REGISTERS;
|
|
16386
|
-
instructionArgumentTypeMap[Instruction.SBRK] = ArgumentType.TWO_REGISTERS;
|
|
16387
|
-
instructionArgumentTypeMap[Instruction.COUNT_SET_BITS_64] = ArgumentType.TWO_REGISTERS;
|
|
16388
|
-
instructionArgumentTypeMap[Instruction.COUNT_SET_BITS_32] = ArgumentType.TWO_REGISTERS;
|
|
16389
|
-
instructionArgumentTypeMap[Instruction.LEADING_ZERO_BITS_64] = ArgumentType.TWO_REGISTERS;
|
|
16390
|
-
instructionArgumentTypeMap[Instruction.LEADING_ZERO_BITS_32] = ArgumentType.TWO_REGISTERS;
|
|
16391
|
-
instructionArgumentTypeMap[Instruction.TRAILING_ZERO_BITS_64] = ArgumentType.TWO_REGISTERS;
|
|
16392
|
-
instructionArgumentTypeMap[Instruction.TRAILING_ZERO_BITS_32] = ArgumentType.TWO_REGISTERS;
|
|
16393
|
-
instructionArgumentTypeMap[Instruction.SIGN_EXTEND_8] = ArgumentType.TWO_REGISTERS;
|
|
16394
|
-
instructionArgumentTypeMap[Instruction.SIGN_EXTEND_16] = ArgumentType.TWO_REGISTERS;
|
|
16395
|
-
instructionArgumentTypeMap[Instruction.ZERO_EXTEND_16] = ArgumentType.TWO_REGISTERS;
|
|
16396
|
-
instructionArgumentTypeMap[Instruction.REVERSE_BYTES] = ArgumentType.TWO_REGISTERS;
|
|
16397
|
-
|
|
16398
|
-
instructionArgumentTypeMap[Instruction.STORE_IND_U8] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16399
|
-
instructionArgumentTypeMap[Instruction.STORE_IND_U16] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16400
|
-
instructionArgumentTypeMap[Instruction.STORE_IND_U32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16401
|
-
instructionArgumentTypeMap[Instruction.STORE_IND_U64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16402
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_U8] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16403
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_I8] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16404
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_U16] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16405
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_I16] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16406
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_U32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16407
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_I32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16408
|
-
instructionArgumentTypeMap[Instruction.LOAD_IND_U64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16409
|
-
instructionArgumentTypeMap[Instruction.ADD_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16410
|
-
instructionArgumentTypeMap[Instruction.ADD_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16411
|
-
instructionArgumentTypeMap[Instruction.AND_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16412
|
-
instructionArgumentTypeMap[Instruction.XOR_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16413
|
-
instructionArgumentTypeMap[Instruction.OR_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16414
|
-
instructionArgumentTypeMap[Instruction.MUL_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16415
|
-
instructionArgumentTypeMap[Instruction.MUL_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16416
|
-
instructionArgumentTypeMap[Instruction.SET_LT_U_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16417
|
-
instructionArgumentTypeMap[Instruction.SET_LT_S_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16418
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16419
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16420
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16421
|
-
instructionArgumentTypeMap[Instruction.NEG_ADD_IMM_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16422
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16423
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16424
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16425
|
-
instructionArgumentTypeMap[Instruction.NEG_ADD_IMM_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16426
|
-
instructionArgumentTypeMap[Instruction.SET_GT_U_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16427
|
-
instructionArgumentTypeMap[Instruction.SET_GT_S_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16428
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_IMM_ALT_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16429
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_IMM_ALT_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16430
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_IMM_ALT_32] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16431
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_IMM_ALT_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16432
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_IMM_ALT_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16433
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_IMM_ALT_64] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16434
|
-
instructionArgumentTypeMap[Instruction.CMOV_IZ_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16435
|
-
instructionArgumentTypeMap[Instruction.CMOV_NZ_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16436
|
-
instructionArgumentTypeMap[Instruction.ROT_R_64_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16437
|
-
instructionArgumentTypeMap[Instruction.ROT_R_64_IMM_ALT] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16438
|
-
instructionArgumentTypeMap[Instruction.ROT_R_32_IMM] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16439
|
-
instructionArgumentTypeMap[Instruction.ROT_R_32_IMM_ALT] = ArgumentType.TWO_REGISTERS_ONE_IMMEDIATE;
|
|
16440
|
-
|
|
16441
|
-
instructionArgumentTypeMap[Instruction.BRANCH_EQ] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16442
|
-
instructionArgumentTypeMap[Instruction.BRANCH_NE] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16443
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LT_U] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16444
|
-
instructionArgumentTypeMap[Instruction.BRANCH_LT_S] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16445
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GE_U] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16446
|
-
instructionArgumentTypeMap[Instruction.BRANCH_GE_S] = ArgumentType.TWO_REGISTERS_ONE_OFFSET;
|
|
16447
|
-
|
|
16448
|
-
instructionArgumentTypeMap[Instruction.LOAD_IMM_JUMP_IND] = ArgumentType.TWO_REGISTERS_TWO_IMMEDIATES;
|
|
16449
|
-
|
|
16450
|
-
instructionArgumentTypeMap[Instruction.ADD_32] = ArgumentType.THREE_REGISTERS;
|
|
16451
|
-
instructionArgumentTypeMap[Instruction.ADD_64] = ArgumentType.THREE_REGISTERS;
|
|
16452
|
-
instructionArgumentTypeMap[Instruction.SUB_32] = ArgumentType.THREE_REGISTERS;
|
|
16453
|
-
instructionArgumentTypeMap[Instruction.SUB_64] = ArgumentType.THREE_REGISTERS;
|
|
16454
|
-
instructionArgumentTypeMap[Instruction.AND] = ArgumentType.THREE_REGISTERS;
|
|
16455
|
-
instructionArgumentTypeMap[Instruction.XOR] = ArgumentType.THREE_REGISTERS;
|
|
16456
|
-
instructionArgumentTypeMap[Instruction.OR] = ArgumentType.THREE_REGISTERS;
|
|
16457
|
-
instructionArgumentTypeMap[Instruction.MUL_32] = ArgumentType.THREE_REGISTERS;
|
|
16458
|
-
instructionArgumentTypeMap[Instruction.MUL_64] = ArgumentType.THREE_REGISTERS;
|
|
16459
|
-
instructionArgumentTypeMap[Instruction.MUL_UPPER_S_S] = ArgumentType.THREE_REGISTERS;
|
|
16460
|
-
instructionArgumentTypeMap[Instruction.MUL_UPPER_U_U] = ArgumentType.THREE_REGISTERS;
|
|
16461
|
-
instructionArgumentTypeMap[Instruction.MUL_UPPER_S_U] = ArgumentType.THREE_REGISTERS;
|
|
16462
|
-
instructionArgumentTypeMap[Instruction.DIV_U_32] = ArgumentType.THREE_REGISTERS;
|
|
16463
|
-
instructionArgumentTypeMap[Instruction.DIV_S_32] = ArgumentType.THREE_REGISTERS;
|
|
16464
|
-
instructionArgumentTypeMap[Instruction.REM_U_32] = ArgumentType.THREE_REGISTERS;
|
|
16465
|
-
instructionArgumentTypeMap[Instruction.REM_S_32] = ArgumentType.THREE_REGISTERS;
|
|
16466
|
-
instructionArgumentTypeMap[Instruction.DIV_U_64] = ArgumentType.THREE_REGISTERS;
|
|
16467
|
-
instructionArgumentTypeMap[Instruction.DIV_S_64] = ArgumentType.THREE_REGISTERS;
|
|
16468
|
-
instructionArgumentTypeMap[Instruction.REM_U_64] = ArgumentType.THREE_REGISTERS;
|
|
16469
|
-
instructionArgumentTypeMap[Instruction.REM_S_64] = ArgumentType.THREE_REGISTERS;
|
|
16470
|
-
instructionArgumentTypeMap[Instruction.SET_LT_U] = ArgumentType.THREE_REGISTERS;
|
|
16471
|
-
instructionArgumentTypeMap[Instruction.SET_LT_S] = ArgumentType.THREE_REGISTERS;
|
|
16472
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_32] = ArgumentType.THREE_REGISTERS;
|
|
16473
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_32] = ArgumentType.THREE_REGISTERS;
|
|
16474
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_32] = ArgumentType.THREE_REGISTERS;
|
|
16475
|
-
instructionArgumentTypeMap[Instruction.SHLO_L_64] = ArgumentType.THREE_REGISTERS;
|
|
16476
|
-
instructionArgumentTypeMap[Instruction.SHLO_R_64] = ArgumentType.THREE_REGISTERS;
|
|
16477
|
-
instructionArgumentTypeMap[Instruction.SHAR_R_64] = ArgumentType.THREE_REGISTERS;
|
|
16478
|
-
instructionArgumentTypeMap[Instruction.CMOV_IZ] = ArgumentType.THREE_REGISTERS;
|
|
16479
|
-
instructionArgumentTypeMap[Instruction.CMOV_NZ] = ArgumentType.THREE_REGISTERS;
|
|
16480
|
-
instructionArgumentTypeMap[Instruction.ROT_L_64] = ArgumentType.THREE_REGISTERS;
|
|
16481
|
-
instructionArgumentTypeMap[Instruction.ROT_L_32] = ArgumentType.THREE_REGISTERS;
|
|
16482
|
-
instructionArgumentTypeMap[Instruction.ROT_R_64] = ArgumentType.THREE_REGISTERS;
|
|
16483
|
-
instructionArgumentTypeMap[Instruction.ROT_R_32] = ArgumentType.THREE_REGISTERS;
|
|
16484
|
-
instructionArgumentTypeMap[Instruction.AND_INV] = ArgumentType.THREE_REGISTERS;
|
|
16485
|
-
instructionArgumentTypeMap[Instruction.OR_INV] = ArgumentType.THREE_REGISTERS;
|
|
16486
|
-
instructionArgumentTypeMap[Instruction.XNOR] = ArgumentType.THREE_REGISTERS;
|
|
16487
|
-
instructionArgumentTypeMap[Instruction.MAX] = ArgumentType.THREE_REGISTERS;
|
|
16488
|
-
instructionArgumentTypeMap[Instruction.MAX_U] = ArgumentType.THREE_REGISTERS;
|
|
16489
|
-
instructionArgumentTypeMap[Instruction.MIN] = ArgumentType.THREE_REGISTERS;
|
|
16490
|
-
instructionArgumentTypeMap[Instruction.MIN_U] = ArgumentType.THREE_REGISTERS;
|
|
16491
|
-
|
|
16492
|
-
return instructionArgumentTypeMap;
|
|
16493
|
-
})();
|
|
16494
|
-
|
|
16495
16204
|
declare class BasicBlocks {
|
|
16496
16205
|
private basicBlocks: Set<number> = new Set();
|
|
16497
16206
|
|
|
@@ -18267,66 +17976,6 @@ declare enum ProgramDecoderError {
|
|
|
18267
17976
|
InvalidProgramError = 0,
|
|
18268
17977
|
}
|
|
18269
17978
|
|
|
18270
|
-
declare class ProgramDecoder {
|
|
18271
|
-
private code: Uint8Array;
|
|
18272
|
-
private mask: Mask;
|
|
18273
|
-
private jumpTable: JumpTable;
|
|
18274
|
-
|
|
18275
|
-
constructor(rawProgram: Uint8Array) {
|
|
18276
|
-
const { code, mask, jumpTable, jumpTableItemLength } = this.decodeProgram(rawProgram);
|
|
18277
|
-
|
|
18278
|
-
this.code = new Uint8Array(code);
|
|
18279
|
-
this.mask = new Mask(mask);
|
|
18280
|
-
this.jumpTable = new JumpTable(jumpTableItemLength, jumpTable);
|
|
18281
|
-
}
|
|
18282
|
-
|
|
18283
|
-
private decodeProgram(program: Uint8Array) {
|
|
18284
|
-
const decoder = Decoder.fromBlob(program);
|
|
18285
|
-
// number of items in the jump table
|
|
18286
|
-
const jumpTableLength = decoder.varU32();
|
|
18287
|
-
// how many bytes are used to encode a single item of the jump table
|
|
18288
|
-
const jumpTableItemLength = decoder.u8();
|
|
18289
|
-
// the length of the code (in bytes).
|
|
18290
|
-
const codeLength = decoder.varU32();
|
|
18291
|
-
|
|
18292
|
-
const jumpTableLengthInBytes = jumpTableLength * jumpTableItemLength;
|
|
18293
|
-
const jumpTable = decoder.bytes(jumpTableLengthInBytes).raw;
|
|
18294
|
-
|
|
18295
|
-
const code = decoder.bytes(codeLength).raw;
|
|
18296
|
-
const mask = decoder.bitVecFixLen(codeLength);
|
|
18297
|
-
decoder.finish();
|
|
18298
|
-
|
|
18299
|
-
return {
|
|
18300
|
-
mask,
|
|
18301
|
-
code,
|
|
18302
|
-
jumpTableItemLength,
|
|
18303
|
-
jumpTable,
|
|
18304
|
-
};
|
|
18305
|
-
}
|
|
18306
|
-
|
|
18307
|
-
getMask() {
|
|
18308
|
-
return this.mask;
|
|
18309
|
-
}
|
|
18310
|
-
|
|
18311
|
-
getCode() {
|
|
18312
|
-
return this.code;
|
|
18313
|
-
}
|
|
18314
|
-
|
|
18315
|
-
getJumpTable() {
|
|
18316
|
-
return this.jumpTable;
|
|
18317
|
-
}
|
|
18318
|
-
|
|
18319
|
-
/** https://graypaper.fluffylabs.dev/#/68eaa1f/23f400234701?v=0.6.4 */
|
|
18320
|
-
static deblob(program: Uint8Array): Result$2<ProgramDecoder, ProgramDecoderError> {
|
|
18321
|
-
try {
|
|
18322
|
-
return Result.ok(new ProgramDecoder(program));
|
|
18323
|
-
} catch (e) {
|
|
18324
|
-
logger.error`Invalid program: ${e}`;
|
|
18325
|
-
return Result.error(ProgramDecoderError.InvalidProgramError, () => `Program decoder error: ${e}`);
|
|
18326
|
-
}
|
|
18327
|
-
}
|
|
18328
|
-
}
|
|
18329
|
-
|
|
18330
17979
|
type InterpreterOptions = {
|
|
18331
17980
|
useSbrkGas?: boolean;
|
|
18332
17981
|
};
|
|
@@ -19609,133 +19258,10 @@ declare class DebuggerAdapter {
|
|
|
19609
19258
|
}
|
|
19610
19259
|
}
|
|
19611
19260
|
|
|
19612
|
-
type index$4_AccumulationStateUpdate = AccumulationStateUpdate;
|
|
19613
|
-
declare const index$4_AccumulationStateUpdate: typeof AccumulationStateUpdate;
|
|
19614
|
-
type index$4_Args = Args;
|
|
19615
|
-
type index$4_ArgsDecoder = ArgsDecoder;
|
|
19616
|
-
declare const index$4_ArgsDecoder: typeof ArgsDecoder;
|
|
19617
|
-
type index$4_ArgumentType = ArgumentType;
|
|
19618
|
-
declare const index$4_ArgumentType: typeof ArgumentType;
|
|
19619
|
-
type index$4_BasicBlocks = BasicBlocks;
|
|
19620
|
-
declare const index$4_BasicBlocks: typeof BasicBlocks;
|
|
19621
|
-
declare const index$4_CURRENT_SERVICE_ID: typeof CURRENT_SERVICE_ID;
|
|
19622
|
-
type index$4_EjectError = EjectError;
|
|
19623
|
-
declare const index$4_EjectError: typeof EjectError;
|
|
19624
|
-
type index$4_EnumMapping = EnumMapping;
|
|
19625
|
-
type index$4_ErrorResult<Error> = ErrorResult<Error>;
|
|
19626
|
-
type index$4_ExtendedWitdthImmediateDecoder = ExtendedWitdthImmediateDecoder;
|
|
19627
|
-
declare const index$4_ExtendedWitdthImmediateDecoder: typeof ExtendedWitdthImmediateDecoder;
|
|
19628
|
-
type index$4_ForgetPreimageError = ForgetPreimageError;
|
|
19629
|
-
declare const index$4_ForgetPreimageError: typeof ForgetPreimageError;
|
|
19630
|
-
type index$4_HostCallMemory = HostCallMemory;
|
|
19631
|
-
declare const index$4_HostCallMemory: typeof HostCallMemory;
|
|
19632
|
-
type index$4_HostCallRegisters = HostCallRegisters;
|
|
19633
|
-
declare const index$4_HostCallRegisters: typeof HostCallRegisters;
|
|
19634
|
-
declare const index$4_HostCallResult: typeof HostCallResult;
|
|
19635
|
-
type index$4_ImmediateDecoder = ImmediateDecoder;
|
|
19636
|
-
declare const index$4_ImmediateDecoder: typeof ImmediateDecoder;
|
|
19637
|
-
type index$4_InsufficientFundsError = InsufficientFundsError;
|
|
19638
|
-
declare const index$4_MAX_U32: typeof MAX_U32;
|
|
19639
|
-
declare const index$4_MAX_U32_BIG_INT: typeof MAX_U32_BIG_INT;
|
|
19640
|
-
type index$4_MachineId = MachineId;
|
|
19641
|
-
type index$4_MachineInstance = MachineInstance;
|
|
19642
|
-
declare const index$4_MachineInstance: typeof MachineInstance;
|
|
19643
|
-
type index$4_MachineResult = MachineResult;
|
|
19644
|
-
type index$4_MachineStatus = MachineStatus;
|
|
19645
|
-
type index$4_Mask = Mask;
|
|
19646
|
-
declare const index$4_Mask: typeof Mask;
|
|
19647
|
-
type index$4_MemoryOperation = MemoryOperation;
|
|
19648
|
-
declare const index$4_MemoryOperation: typeof MemoryOperation;
|
|
19649
|
-
type index$4_MemorySegment = MemorySegment;
|
|
19650
|
-
declare const index$4_MemorySegment: typeof MemorySegment;
|
|
19651
|
-
type index$4_NewServiceError = NewServiceError;
|
|
19652
|
-
declare const index$4_NewServiceError: typeof NewServiceError;
|
|
19653
|
-
type index$4_NibblesDecoder = NibblesDecoder;
|
|
19654
|
-
declare const index$4_NibblesDecoder: typeof NibblesDecoder;
|
|
19655
|
-
type index$4_NoMachineError = NoMachineError;
|
|
19656
|
-
type index$4_OK = OK;
|
|
19657
|
-
type index$4_OkResult<Ok> = OkResult<Ok>;
|
|
19658
|
-
type index$4_Opaque<Type, Token extends string> = Opaque<Type, Token>;
|
|
19659
|
-
type index$4_PagesError = PagesError;
|
|
19660
|
-
declare const index$4_PagesError: typeof PagesError;
|
|
19661
|
-
type index$4_PartialState = PartialState;
|
|
19662
|
-
type index$4_PartiallyUpdatedState<T extends StateSlice = StateSlice> = PartiallyUpdatedState<T>;
|
|
19663
|
-
declare const index$4_PartiallyUpdatedState: typeof PartiallyUpdatedState;
|
|
19664
|
-
type index$4_PeekPokeError = PeekPokeError;
|
|
19665
|
-
declare const index$4_PeekPokeError: typeof PeekPokeError;
|
|
19666
|
-
type index$4_PendingTransfer = PendingTransfer;
|
|
19667
|
-
declare const index$4_PendingTransfer: typeof PendingTransfer;
|
|
19668
|
-
type index$4_PreimageStatus = PreimageStatus;
|
|
19669
|
-
type index$4_PreimageStatusKind = PreimageStatusKind;
|
|
19670
|
-
declare const index$4_PreimageStatusKind: typeof PreimageStatusKind;
|
|
19671
|
-
type index$4_Program = Program;
|
|
19672
|
-
declare const index$4_Program: typeof Program;
|
|
19673
|
-
type index$4_ProgramCounter = ProgramCounter;
|
|
19674
|
-
type index$4_ProgramDecoder = ProgramDecoder;
|
|
19675
|
-
declare const index$4_ProgramDecoder: typeof ProgramDecoder;
|
|
19676
|
-
type index$4_ProvidePreimageError = ProvidePreimageError;
|
|
19677
|
-
declare const index$4_ProvidePreimageError: typeof ProvidePreimageError;
|
|
19678
|
-
type index$4_RefineExternalities = RefineExternalities;
|
|
19679
|
-
type index$4_Registers = Registers;
|
|
19680
|
-
declare const index$4_Registers: typeof Registers;
|
|
19681
|
-
type index$4_RequestPreimageError = RequestPreimageError;
|
|
19682
|
-
declare const index$4_RequestPreimageError: typeof RequestPreimageError;
|
|
19683
|
-
type index$4_RichTaggedError<Kind extends string | number, Nested> = RichTaggedError<Kind, Nested>;
|
|
19684
|
-
declare const index$4_RichTaggedError: typeof RichTaggedError;
|
|
19685
|
-
declare const index$4_SERVICE_ID_BYTES: typeof SERVICE_ID_BYTES;
|
|
19686
|
-
type index$4_SegmentExportError = SegmentExportError;
|
|
19687
|
-
type index$4_ServiceStateUpdate = ServiceStateUpdate;
|
|
19688
|
-
type index$4_SpiMemory = SpiMemory;
|
|
19689
|
-
declare const index$4_SpiMemory: typeof SpiMemory;
|
|
19690
|
-
type index$4_SpiProgram = SpiProgram;
|
|
19691
|
-
declare const index$4_SpiProgram: typeof SpiProgram;
|
|
19692
|
-
type index$4_StateSlice = StateSlice;
|
|
19693
|
-
type index$4_StringLiteral<Type> = StringLiteral<Type>;
|
|
19694
|
-
type index$4_TRANSFER_MEMO_BYTES = TRANSFER_MEMO_BYTES;
|
|
19695
|
-
type index$4_TaggedError<Kind, Nested> = TaggedError<Kind, Nested>;
|
|
19696
|
-
type index$4_TokenOf<OpaqueType, Type> = TokenOf<OpaqueType, Type>;
|
|
19697
|
-
type index$4_TransferError = TransferError;
|
|
19698
|
-
declare const index$4_TransferError: typeof TransferError;
|
|
19699
|
-
type index$4_Uninstantiable = Uninstantiable;
|
|
19700
|
-
type index$4_UnprivilegedError = UnprivilegedError;
|
|
19701
|
-
type index$4_UpdatePrivilegesError = UpdatePrivilegesError;
|
|
19702
|
-
declare const index$4_UpdatePrivilegesError: typeof UpdatePrivilegesError;
|
|
19703
|
-
type index$4_WithDebug = WithDebug;
|
|
19704
|
-
declare const index$4_WithDebug: typeof WithDebug;
|
|
19705
|
-
type index$4_WithOpaque<Token extends string> = WithOpaque<Token>;
|
|
19706
|
-
type index$4_ZeroVoidError = ZeroVoidError;
|
|
19707
|
-
declare const index$4_ZeroVoidError: typeof ZeroVoidError;
|
|
19708
|
-
declare const index$4___OPAQUE_TYPE__: typeof __OPAQUE_TYPE__;
|
|
19709
|
-
declare const index$4_asOpaqueType: typeof asOpaqueType;
|
|
19710
|
-
declare const index$4_assertEmpty: typeof assertEmpty;
|
|
19711
|
-
declare const index$4_assertNever: typeof assertNever;
|
|
19712
|
-
declare const index$4_check: typeof check;
|
|
19713
|
-
declare const index$4_clampU64ToU32: typeof clampU64ToU32;
|
|
19714
|
-
declare const index$4_createResults: typeof createResults;
|
|
19715
|
-
declare const index$4_decodeStandardProgram: typeof decodeStandardProgram;
|
|
19716
|
-
declare const index$4_deepCloneMapWithArray: typeof deepCloneMapWithArray;
|
|
19717
|
-
declare const index$4_emptyRegistersBuffer: typeof emptyRegistersBuffer;
|
|
19718
|
-
declare const index$4_extractCodeAndMetadata: typeof extractCodeAndMetadata;
|
|
19719
|
-
declare const index$4_getServiceId: typeof getServiceId;
|
|
19720
|
-
declare const index$4_getServiceIdOrCurrent: typeof getServiceIdOrCurrent;
|
|
19721
|
-
declare const index$4_inspect: typeof inspect;
|
|
19722
|
-
declare const index$4_instructionArgumentTypeMap: typeof instructionArgumentTypeMap;
|
|
19723
|
-
declare const index$4_isBrowser: typeof isBrowser;
|
|
19724
|
-
declare const index$4_isTaggedError: typeof isTaggedError;
|
|
19725
|
-
declare const index$4_lazyInspect: typeof lazyInspect;
|
|
19726
|
-
declare const index$4_maybeTaggedErrorToString: typeof maybeTaggedErrorToString;
|
|
19727
|
-
declare const index$4_measure: typeof measure;
|
|
19728
|
-
declare const index$4_preimageLenAsU32: typeof preimageLenAsU32;
|
|
19729
|
-
declare const index$4_resultToString: typeof resultToString;
|
|
19730
|
-
declare const index$4_seeThrough: typeof seeThrough;
|
|
19731
|
-
declare const index$4_slotsToPreimageStatus: typeof slotsToPreimageStatus;
|
|
19732
|
-
declare const index$4_toMemoryOperation: typeof toMemoryOperation;
|
|
19733
|
-
declare const index$4_tryAsMachineId: typeof tryAsMachineId;
|
|
19734
|
-
declare const index$4_tryAsProgramCounter: typeof tryAsProgramCounter;
|
|
19735
|
-
declare const index$4_writeServiceIdAsLeBytes: typeof writeServiceIdAsLeBytes;
|
|
19736
19261
|
declare namespace index$4 {
|
|
19737
|
-
export {
|
|
19738
|
-
|
|
19262
|
+
export {
|
|
19263
|
+
DebuggerAdapter as Pvm,
|
|
19264
|
+
};
|
|
19739
19265
|
}
|
|
19740
19266
|
|
|
19741
19267
|
declare const ENTROPY_BYTES = 32;
|
package/index.js
CHANGED
|
@@ -16,7 +16,11 @@ var TestSuite;
|
|
|
16
16
|
})(TestSuite || (TestSuite = {}));
|
|
17
17
|
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1, GpVersion.V0_7_2];
|
|
18
18
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Current version is set to track the jam-conformance testing.
|
|
21
|
+
* Since we are currently at 0.7.1 not 0.7.2, we set our default version accordingly.
|
|
22
|
+
*/
|
|
23
|
+
const DEFAULT_VERSION = GpVersion.V0_7_1;
|
|
20
24
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
21
25
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
22
26
|
let CURRENT_SUITE = parseCurrentSuite(env$1.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
@@ -75,8 +79,8 @@ class Compatibility {
|
|
|
75
79
|
/**
|
|
76
80
|
* Allows selecting different values for different Gray Paper versions from one record.
|
|
77
81
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
82
|
+
* fallback The default value to return if no value is found for the current.
|
|
83
|
+
* versions A record mapping versions to values, checking if the version is greater or equal to the current version.
|
|
80
84
|
* @returns The value for the current version, or the default value.
|
|
81
85
|
*/
|
|
82
86
|
static selectIfGreaterOrEqual({ fallback, versions, }) {
|
|
@@ -236,7 +240,7 @@ const workspacePathFix = env.NODE_ENV === "development"
|
|
|
236
240
|
: () => (p) => p;
|
|
237
241
|
|
|
238
242
|
/**
|
|
239
|
-
*
|
|
243
|
+
* `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
|
|
240
244
|
* specified unique token Token. It means that base type cannot be assigned to unique type by accident.
|
|
241
245
|
* Good examples of opaque types include:
|
|
242
246
|
* - JWTs or other tokens - these are special kinds of string used for authorization purposes.
|
|
@@ -6709,6 +6713,8 @@ var index$m = /*#__PURE__*/Object.freeze({
|
|
|
6709
6713
|
SEGMENT_BYTES: SEGMENT_BYTES,
|
|
6710
6714
|
TicketsMarker: TicketsMarker,
|
|
6711
6715
|
ValidatorKeys: ValidatorKeys,
|
|
6716
|
+
W_E: W_E,
|
|
6717
|
+
W_S: W_S,
|
|
6712
6718
|
assurances: assurances,
|
|
6713
6719
|
codecPerEpochBlock: codecPerEpochBlock,
|
|
6714
6720
|
codecPerValidator: codecPerValidator,
|
|
@@ -10373,7 +10379,6 @@ class LeafNode {
|
|
|
10373
10379
|
/**
|
|
10374
10380
|
* Get the byte length of embedded value.
|
|
10375
10381
|
*
|
|
10376
|
-
* @remark
|
|
10377
10382
|
* Note in case this node only contains hash this is going to be 0.
|
|
10378
10383
|
*/
|
|
10379
10384
|
getValueLength() {
|
|
@@ -10384,7 +10389,6 @@ class LeafNode {
|
|
|
10384
10389
|
/**
|
|
10385
10390
|
* Returns the embedded value.
|
|
10386
10391
|
*
|
|
10387
|
-
* @remark
|
|
10388
10392
|
* Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
|
|
10389
10393
|
*/
|
|
10390
10394
|
getValue() {
|
|
@@ -10394,7 +10398,6 @@ class LeafNode {
|
|
|
10394
10398
|
/**
|
|
10395
10399
|
* Returns contained value hash.
|
|
10396
10400
|
*
|
|
10397
|
-
* @remark
|
|
10398
10401
|
* Note that for embedded value this is going to be full 0-padded 32 bytes.
|
|
10399
10402
|
*/
|
|
10400
10403
|
getValueHash() {
|
|
@@ -17716,79 +17719,7 @@ class DebuggerAdapter {
|
|
|
17716
17719
|
|
|
17717
17720
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
17718
17721
|
__proto__: null,
|
|
17719
|
-
|
|
17720
|
-
ArgsDecoder: ArgsDecoder,
|
|
17721
|
-
get ArgumentType () { return ArgumentType; },
|
|
17722
|
-
BasicBlocks: BasicBlocks,
|
|
17723
|
-
CURRENT_SERVICE_ID: CURRENT_SERVICE_ID,
|
|
17724
|
-
get EjectError () { return EjectError; },
|
|
17725
|
-
ExtendedWitdthImmediateDecoder: ExtendedWitdthImmediateDecoder,
|
|
17726
|
-
get ForgetPreimageError () { return ForgetPreimageError; },
|
|
17727
|
-
HostCallMemory: HostCallMemory,
|
|
17728
|
-
HostCallRegisters: HostCallRegisters,
|
|
17729
|
-
HostCallResult: HostCallResult,
|
|
17730
|
-
ImmediateDecoder: ImmediateDecoder,
|
|
17731
|
-
InsufficientFundsError: InsufficientFundsError,
|
|
17732
|
-
MachineInstance: MachineInstance,
|
|
17733
|
-
Mask: Mask,
|
|
17734
|
-
get MemoryOperation () { return MemoryOperation; },
|
|
17735
|
-
MemorySegment: MemorySegment,
|
|
17736
|
-
NO_OF_REGISTERS: NO_OF_REGISTERS$1,
|
|
17737
|
-
get NewServiceError () { return NewServiceError; },
|
|
17738
|
-
NibblesDecoder: NibblesDecoder,
|
|
17739
|
-
NoMachineError: NoMachineError,
|
|
17740
|
-
OK: OK,
|
|
17741
|
-
get PagesError () { return PagesError; },
|
|
17742
|
-
PartiallyUpdatedState: PartiallyUpdatedState,
|
|
17743
|
-
get PeekPokeError () { return PeekPokeError; },
|
|
17744
|
-
PendingTransfer: PendingTransfer,
|
|
17745
|
-
get PreimageStatusKind () { return PreimageStatusKind; },
|
|
17746
|
-
Program: Program,
|
|
17747
|
-
ProgramDecoder: ProgramDecoder,
|
|
17748
|
-
get ProvidePreimageError () { return ProvidePreimageError; },
|
|
17749
|
-
Pvm: DebuggerAdapter,
|
|
17750
|
-
Registers: Registers,
|
|
17751
|
-
get RequestPreimageError () { return RequestPreimageError; },
|
|
17752
|
-
Result: Result$1,
|
|
17753
|
-
SERVICE_ID_BYTES: SERVICE_ID_BYTES,
|
|
17754
|
-
SegmentExportError: SegmentExportError,
|
|
17755
|
-
SpiMemory: SpiMemory,
|
|
17756
|
-
SpiProgram: SpiProgram,
|
|
17757
|
-
TRANSFER_MEMO_BYTES: TRANSFER_MEMO_BYTES,
|
|
17758
|
-
get TransferError () { return TransferError; },
|
|
17759
|
-
UnprivilegedError: UnprivilegedError,
|
|
17760
|
-
get UpdatePrivilegesError () { return UpdatePrivilegesError; },
|
|
17761
|
-
WithDebug: WithDebug,
|
|
17762
|
-
get ZeroVoidError () { return ZeroVoidError; },
|
|
17763
|
-
asOpaqueType: asOpaqueType,
|
|
17764
|
-
assertEmpty: assertEmpty,
|
|
17765
|
-
assertNever: assertNever,
|
|
17766
|
-
block: index$m,
|
|
17767
|
-
bytes: index$t,
|
|
17768
|
-
check: check,
|
|
17769
|
-
clampU64ToU32: clampU64ToU32,
|
|
17770
|
-
createResults: createResults,
|
|
17771
|
-
decodeStandardProgram: decodeStandardProgram,
|
|
17772
|
-
emptyRegistersBuffer: emptyRegistersBuffer,
|
|
17773
|
-
extractCodeAndMetadata: extractCodeAndMetadata,
|
|
17774
|
-
getServiceId: getServiceId,
|
|
17775
|
-
getServiceIdOrCurrent: getServiceIdOrCurrent,
|
|
17776
|
-
hash: index$p,
|
|
17777
|
-
hostCallInfoAccount: codecServiceAccountInfoWithThresholdBalance,
|
|
17778
|
-
inspect: inspect,
|
|
17779
|
-
instructionArgumentTypeMap: instructionArgumentTypeMap,
|
|
17780
|
-
interpreter: index$8,
|
|
17781
|
-
isBrowser: isBrowser,
|
|
17782
|
-
lazyInspect: lazyInspect,
|
|
17783
|
-
measure: measure,
|
|
17784
|
-
numbers: index$s,
|
|
17785
|
-
resultToString: resultToString,
|
|
17786
|
-
seeThrough: seeThrough,
|
|
17787
|
-
slotsToPreimageStatus: slotsToPreimageStatus,
|
|
17788
|
-
toMemoryOperation: toMemoryOperation,
|
|
17789
|
-
tryAsMachineId: tryAsMachineId,
|
|
17790
|
-
tryAsProgramCounter: tryAsProgramCounter,
|
|
17791
|
-
writeServiceIdAsLeBytes: writeServiceIdAsLeBytes
|
|
17722
|
+
Pvm: DebuggerAdapter
|
|
17792
17723
|
});
|
|
17793
17724
|
|
|
17794
17725
|
const ENTROPY_BYTES = 32;
|