@typeberry/lib 0.0.1-099373a → 0.0.1-4a742e9

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.
Files changed (3) hide show
  1. package/index.d.ts +26 -46
  2. package/index.js +26 -45
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -8743,31 +8743,18 @@ declare const ignoreValueWithDefault = <T>(defaultValue: T) =>
8743
8743
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/108301108301?v=0.6.7
8744
8744
  */
8745
8745
  declare class ServiceAccountInfo extends WithDebug {
8746
- static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8747
- ? codec.Class(ServiceAccountInfo, {
8748
- codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8749
- balance: codec.u64,
8750
- accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8751
- onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8752
- storageUtilisationBytes: codec.u64,
8753
- gratisStorage: codec.u64,
8754
- storageUtilisationCount: codec.u32,
8755
- created: codec.u32.convert((x) => x, tryAsTimeSlot),
8756
- lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
8757
- parentService: codec.u32.convert((x) => x, tryAsServiceId),
8758
- })
8759
- : codec.Class(ServiceAccountInfo, {
8760
- codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8761
- balance: codec.u64,
8762
- accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8763
- onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8764
- storageUtilisationBytes: codec.u64,
8765
- storageUtilisationCount: codec.u32,
8766
- gratisStorage: ignoreValueWithDefault(tryAsU64(0)),
8767
- created: ignoreValueWithDefault(tryAsTimeSlot(0)),
8768
- lastAccumulation: ignoreValueWithDefault(tryAsTimeSlot(0)),
8769
- parentService: ignoreValueWithDefault(tryAsServiceId(0)),
8770
- });
8746
+ static Codec = codec.Class(ServiceAccountInfo, {
8747
+ codeHash: codec.bytes(HASH_SIZE).asOpaque<CodeHash>(),
8748
+ balance: codec.u64,
8749
+ accumulateMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8750
+ onTransferMinGas: codec.u64.convert((x) => x, tryAsServiceGas),
8751
+ storageUtilisationBytes: codec.u64,
8752
+ gratisStorage: codec.u64,
8753
+ storageUtilisationCount: codec.u32,
8754
+ created: codec.u32.convert((x) => x, tryAsTimeSlot),
8755
+ lastAccumulation: codec.u32.convert((x) => x, tryAsTimeSlot),
8756
+ parentService: codec.u32.convert((x) => x, tryAsServiceId),
8757
+ });
8771
8758
 
8772
8759
  static create(a: CodecRecord<ServiceAccountInfo>) {
8773
8760
  return new ServiceAccountInfo(
@@ -10361,7 +10348,7 @@ type StateCodec<T> = {
10361
10348
 
10362
10349
  /** Serialization for particular state entries. */
10363
10350
  declare namespace serialize {
10364
- /** C(1): https://graypaper.fluffylabs.dev/#/85129da/38a20138a201?v=0.6.3 */
10351
+ /** C(1): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b15013b1501?v=0.6.7 */
10365
10352
  export const authPools: StateCodec<State["authPools"]> = {
10366
10353
  key: stateKeys.index(StateKeyIdx.Alpha),
10367
10354
  Codec: codecPerCore(
@@ -10374,7 +10361,7 @@ declare namespace serialize {
10374
10361
  extract: (s) => s.authPools,
10375
10362
  };
10376
10363
 
10377
- /** C(2): https://graypaper.fluffylabs.dev/#/85129da/38be0138be01?v=0.6.3 */
10364
+ /** C(2): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b31013b3101?v=0.6.7 */
10378
10365
  export const authQueues: StateCodec<State["authQueues"]> = {
10379
10366
  key: stateKeys.index(StateKeyIdx.Phi),
10380
10367
  Codec: codecPerCore(
@@ -10385,7 +10372,6 @@ declare namespace serialize {
10385
10372
 
10386
10373
  /**
10387
10374
  * C(3): Recent blocks with compatibility
10388
- * https://graypaper.fluffylabs.dev/#/85129da/38cb0138cb01?v=0.6.3
10389
10375
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e013b3e01?v=0.6.7
10390
10376
  */
10391
10377
  export const recentBlocks: StateCodec<State["recentBlocks"]> = {
@@ -10394,7 +10380,7 @@ declare namespace serialize {
10394
10380
  extract: (s) => s.recentBlocks,
10395
10381
  };
10396
10382
 
10397
- /** C(4): https://graypaper.fluffylabs.dev/#/85129da/38e60138e601?v=0.6.3 */
10383
+ /** C(4): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b63013b6301?v=0.6.7 */
10398
10384
  export const safrole: StateCodec<SafroleData> = {
10399
10385
  key: stateKeys.index(StateKeyIdx.Gamma),
10400
10386
  Codec: SafroleData.Codec,
@@ -10407,63 +10393,63 @@ declare namespace serialize {
10407
10393
  }),
10408
10394
  };
10409
10395
 
10410
- /** C(5): https://graypaper.fluffylabs.dev/#/85129da/383d02383d02?v=0.6.3 */
10396
+ /** C(5): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bba013bba01?v=0.6.7 */
10411
10397
  export const disputesRecords: StateCodec<State["disputesRecords"]> = {
10412
10398
  key: stateKeys.index(StateKeyIdx.Psi),
10413
10399
  Codec: DisputesRecords.Codec,
10414
10400
  extract: (s) => s.disputesRecords,
10415
10401
  };
10416
10402
 
10417
- /** C(6): https://graypaper.fluffylabs.dev/#/85129da/387602387602?v=0.6.3 */
10403
+ /** C(6): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bf3013bf301?v=0.6.7 */
10418
10404
  export const entropy: StateCodec<State["entropy"]> = {
10419
10405
  key: stateKeys.index(StateKeyIdx.Eta),
10420
10406
  Codec: codecFixedSizeArray(codec.bytes(HASH_SIZE).asOpaque<EntropyHash>(), ENTROPY_ENTRIES),
10421
10407
  extract: (s) => s.entropy,
10422
10408
  };
10423
10409
 
10424
- /** C(7): https://graypaper.fluffylabs.dev/#/85129da/388302388302?v=0.6.3 */
10410
+ /** C(7): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b00023b0002?v=0.6.7 */
10425
10411
  export const designatedValidators: StateCodec<State["designatedValidatorData"]> = {
10426
10412
  key: stateKeys.index(StateKeyIdx.Iota),
10427
10413
  Codec: codecPerValidator(ValidatorData.Codec),
10428
10414
  extract: (s) => s.designatedValidatorData,
10429
10415
  };
10430
10416
 
10431
- /** C(8): https://graypaper.fluffylabs.dev/#/85129da/389002389002?v=0.6.3 */
10417
+ /** C(8): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b0d023b0d02?v=0.6.7 */
10432
10418
  export const currentValidators: StateCodec<State["currentValidatorData"]> = {
10433
10419
  key: stateKeys.index(StateKeyIdx.Kappa),
10434
10420
  Codec: codecPerValidator(ValidatorData.Codec),
10435
10421
  extract: (s) => s.currentValidatorData,
10436
10422
  };
10437
10423
 
10438
- /** C(9): https://graypaper.fluffylabs.dev/#/85129da/389d02389d02?v=0.6.3 */
10424
+ /** C(9): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b1a023b1a02?v=0.6.7 */
10439
10425
  export const previousValidators: StateCodec<State["previousValidatorData"]> = {
10440
10426
  key: stateKeys.index(StateKeyIdx.Lambda),
10441
10427
  Codec: codecPerValidator(ValidatorData.Codec),
10442
10428
  extract: (s) => s.previousValidatorData,
10443
10429
  };
10444
10430
 
10445
- /** C(10): https://graypaper.fluffylabs.dev/#/85129da/38aa0238aa02?v=0.6.3 */
10431
+ /** C(10): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b27023b2702?v=0.6.7 */
10446
10432
  export const availabilityAssignment: StateCodec<State["availabilityAssignment"]> = {
10447
10433
  key: stateKeys.index(StateKeyIdx.Rho),
10448
10434
  Codec: codecPerCore(codec.optional(AvailabilityAssignment.Codec)),
10449
10435
  extract: (s) => s.availabilityAssignment,
10450
10436
  };
10451
10437
 
10452
- /** C(11): https://graypaper.fluffylabs.dev/#/85129da/38c10238c102?v=0.6.3 */
10438
+ /** C(11): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e023b3e02?v=0.6.7 */
10453
10439
  export const timeslot: StateCodec<State["timeslot"]> = {
10454
10440
  key: stateKeys.index(StateKeyIdx.Tau),
10455
10441
  Codec: codec.u32.asOpaque<TimeSlot>(),
10456
10442
  extract: (s) => s.timeslot,
10457
10443
  };
10458
10444
 
10459
- /** C(12): https://graypaper.fluffylabs.dev/#/85129da/38cf0238cf02?v=0.6.3 */
10445
+ /** C(12): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b4c023b4c02?v=0.6.7 */
10460
10446
  export const privilegedServices: StateCodec<State["privilegedServices"]> = {
10461
10447
  key: stateKeys.index(StateKeyIdx.Chi),
10462
10448
  Codec: PrivilegedServices.Codec,
10463
10449
  extract: (s) => s.privilegedServices,
10464
10450
  };
10465
10451
 
10466
- /** C(13): https://graypaper.fluffylabs.dev/#/85129da/38e10238e102?v=0.6.3 */
10452
+ /** C(13): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b5e023b5e02?v=0.6.7 */
10467
10453
  export const statistics: StateCodec<State["statistics"]> = {
10468
10454
  key: stateKeys.index(StateKeyIdx.Pi),
10469
10455
  Codec: StatisticsData.Codec,
@@ -10477,7 +10463,7 @@ declare namespace serialize {
10477
10463
  extract: (s) => s.accumulationQueue,
10478
10464
  };
10479
10465
 
10480
- /** C(15): https://graypaper.fluffylabs.dev/#/85129da/381903381903?v=0.6.3 */
10466
+ /** C(15): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b96023b9602?v=0.6.7 */
10481
10467
  export const recentlyAccumulated: StateCodec<State["recentlyAccumulated"]> = {
10482
10468
  key: stateKeys.index(StateKeyIdx.Xi),
10483
10469
  Codec: codecPerEpochBlock(
@@ -16320,12 +16306,6 @@ declare class Interpreter {
16320
16306
  }
16321
16307
 
16322
16308
  if (this.instructionResult.status !== null) {
16323
- // All abnormal terminations should be interpreted as TRAP and we should subtract the gas. In case of FAULT we have to do it manually at the very end.
16324
- if (this.instructionResult.status === Result.FAULT || this.instructionResult.status === Result.FAULT_ACCESS) {
16325
- // TODO [ToDr] underflow?
16326
- this.gas.sub(instructionGasMap[Instruction.TRAP]);
16327
- }
16328
-
16329
16309
  switch (this.instructionResult.status) {
16330
16310
  case Result.FAULT:
16331
16311
  this.status = Status.FAULT;
@@ -16684,7 +16664,7 @@ declare class HostCalls {
16684
16664
  this.hostCalls.traceHostCall("Invoking", index, hostCall, regs, gasBefore);
16685
16665
  const result = await hostCall.execute(gas, regs, memory);
16686
16666
  this.hostCalls.traceHostCall(
16687
- result === undefined ? "Result" : `Status(${result})`,
16667
+ result === undefined ? "Result" : `Status(${PvmExecution[result]})`,
16688
16668
  index,
16689
16669
  hostCall,
16690
16670
  regs,
package/index.js CHANGED
@@ -8142,31 +8142,18 @@ class ServiceAccountInfo extends WithDebug {
8142
8142
  created;
8143
8143
  lastAccumulation;
8144
8144
  parentService;
8145
- static Codec = Compatibility.isGreaterOrEqual(GpVersion.V0_6_7)
8146
- ? codec$1.Class(ServiceAccountInfo, {
8147
- codeHash: codec$1.bytes(HASH_SIZE).asOpaque(),
8148
- balance: codec$1.u64,
8149
- accumulateMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8150
- onTransferMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8151
- storageUtilisationBytes: codec$1.u64,
8152
- gratisStorage: codec$1.u64,
8153
- storageUtilisationCount: codec$1.u32,
8154
- created: codec$1.u32.convert((x) => x, tryAsTimeSlot),
8155
- lastAccumulation: codec$1.u32.convert((x) => x, tryAsTimeSlot),
8156
- parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
8157
- })
8158
- : codec$1.Class(ServiceAccountInfo, {
8159
- codeHash: codec$1.bytes(HASH_SIZE).asOpaque(),
8160
- balance: codec$1.u64,
8161
- accumulateMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8162
- onTransferMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8163
- storageUtilisationBytes: codec$1.u64,
8164
- storageUtilisationCount: codec$1.u32,
8165
- gratisStorage: ignoreValueWithDefault(tryAsU64(0)),
8166
- created: ignoreValueWithDefault(tryAsTimeSlot(0)),
8167
- lastAccumulation: ignoreValueWithDefault(tryAsTimeSlot(0)),
8168
- parentService: ignoreValueWithDefault(tryAsServiceId(0)),
8169
- });
8145
+ static Codec = codec$1.Class(ServiceAccountInfo, {
8146
+ codeHash: codec$1.bytes(HASH_SIZE).asOpaque(),
8147
+ balance: codec$1.u64,
8148
+ accumulateMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8149
+ onTransferMinGas: codec$1.u64.convert((x) => x, tryAsServiceGas),
8150
+ storageUtilisationBytes: codec$1.u64,
8151
+ gratisStorage: codec$1.u64,
8152
+ storageUtilisationCount: codec$1.u32,
8153
+ created: codec$1.u32.convert((x) => x, tryAsTimeSlot),
8154
+ lastAccumulation: codec$1.u32.convert((x) => x, tryAsTimeSlot),
8155
+ parentService: codec$1.u32.convert((x) => x, tryAsServiceId),
8156
+ });
8170
8157
  static create(a) {
8171
8158
  return new ServiceAccountInfo(a.codeHash, a.balance, a.accumulateMinGas, a.onTransferMinGas, a.storageUtilisationBytes, a.gratisStorage, a.storageUtilisationCount, a.created, a.lastAccumulation, a.parentService);
8172
8159
  }
@@ -9322,7 +9309,7 @@ function legacyServiceNested(serviceId, hash) {
9322
9309
  /** Serialization for particular state entries. */
9323
9310
  var serialize;
9324
9311
  (function (serialize) {
9325
- /** C(1): https://graypaper.fluffylabs.dev/#/85129da/38a20138a201?v=0.6.3 */
9312
+ /** C(1): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b15013b1501?v=0.6.7 */
9326
9313
  serialize.authPools = {
9327
9314
  key: stateKeys.index(StateKeyIdx.Alpha),
9328
9315
  Codec: codecPerCore(codecKnownSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), {
@@ -9332,7 +9319,7 @@ var serialize;
9332
9319
  })),
9333
9320
  extract: (s) => s.authPools,
9334
9321
  };
9335
- /** C(2): https://graypaper.fluffylabs.dev/#/85129da/38be0138be01?v=0.6.3 */
9322
+ /** C(2): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b31013b3101?v=0.6.7 */
9336
9323
  serialize.authQueues = {
9337
9324
  key: stateKeys.index(StateKeyIdx.Phi),
9338
9325
  Codec: codecPerCore(codecFixedSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), AUTHORIZATION_QUEUE_SIZE)),
@@ -9340,7 +9327,6 @@ var serialize;
9340
9327
  };
9341
9328
  /**
9342
9329
  * C(3): Recent blocks with compatibility
9343
- * https://graypaper.fluffylabs.dev/#/85129da/38cb0138cb01?v=0.6.3
9344
9330
  * https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e013b3e01?v=0.6.7
9345
9331
  */
9346
9332
  serialize.recentBlocks = {
@@ -9348,7 +9334,7 @@ var serialize;
9348
9334
  Codec: RecentBlocksHistory.Codec,
9349
9335
  extract: (s) => s.recentBlocks,
9350
9336
  };
9351
- /** C(4): https://graypaper.fluffylabs.dev/#/85129da/38e60138e601?v=0.6.3 */
9337
+ /** C(4): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b63013b6301?v=0.6.7 */
9352
9338
  serialize.safrole = {
9353
9339
  key: stateKeys.index(StateKeyIdx.Gamma),
9354
9340
  Codec: SafroleData.Codec,
@@ -9359,55 +9345,55 @@ var serialize;
9359
9345
  ticketsAccumulator: s.ticketsAccumulator,
9360
9346
  }),
9361
9347
  };
9362
- /** C(5): https://graypaper.fluffylabs.dev/#/85129da/383d02383d02?v=0.6.3 */
9348
+ /** C(5): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bba013bba01?v=0.6.7 */
9363
9349
  serialize.disputesRecords = {
9364
9350
  key: stateKeys.index(StateKeyIdx.Psi),
9365
9351
  Codec: DisputesRecords.Codec,
9366
9352
  extract: (s) => s.disputesRecords,
9367
9353
  };
9368
- /** C(6): https://graypaper.fluffylabs.dev/#/85129da/387602387602?v=0.6.3 */
9354
+ /** C(6): https://graypaper.fluffylabs.dev/#/7e6ff6a/3bf3013bf301?v=0.6.7 */
9369
9355
  serialize.entropy = {
9370
9356
  key: stateKeys.index(StateKeyIdx.Eta),
9371
9357
  Codec: codecFixedSizeArray(codec$1.bytes(HASH_SIZE).asOpaque(), ENTROPY_ENTRIES),
9372
9358
  extract: (s) => s.entropy,
9373
9359
  };
9374
- /** C(7): https://graypaper.fluffylabs.dev/#/85129da/388302388302?v=0.6.3 */
9360
+ /** C(7): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b00023b0002?v=0.6.7 */
9375
9361
  serialize.designatedValidators = {
9376
9362
  key: stateKeys.index(StateKeyIdx.Iota),
9377
9363
  Codec: codecPerValidator(ValidatorData.Codec),
9378
9364
  extract: (s) => s.designatedValidatorData,
9379
9365
  };
9380
- /** C(8): https://graypaper.fluffylabs.dev/#/85129da/389002389002?v=0.6.3 */
9366
+ /** C(8): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b0d023b0d02?v=0.6.7 */
9381
9367
  serialize.currentValidators = {
9382
9368
  key: stateKeys.index(StateKeyIdx.Kappa),
9383
9369
  Codec: codecPerValidator(ValidatorData.Codec),
9384
9370
  extract: (s) => s.currentValidatorData,
9385
9371
  };
9386
- /** C(9): https://graypaper.fluffylabs.dev/#/85129da/389d02389d02?v=0.6.3 */
9372
+ /** C(9): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b1a023b1a02?v=0.6.7 */
9387
9373
  serialize.previousValidators = {
9388
9374
  key: stateKeys.index(StateKeyIdx.Lambda),
9389
9375
  Codec: codecPerValidator(ValidatorData.Codec),
9390
9376
  extract: (s) => s.previousValidatorData,
9391
9377
  };
9392
- /** C(10): https://graypaper.fluffylabs.dev/#/85129da/38aa0238aa02?v=0.6.3 */
9378
+ /** C(10): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b27023b2702?v=0.6.7 */
9393
9379
  serialize.availabilityAssignment = {
9394
9380
  key: stateKeys.index(StateKeyIdx.Rho),
9395
9381
  Codec: codecPerCore(codec$1.optional(AvailabilityAssignment.Codec)),
9396
9382
  extract: (s) => s.availabilityAssignment,
9397
9383
  };
9398
- /** C(11): https://graypaper.fluffylabs.dev/#/85129da/38c10238c102?v=0.6.3 */
9384
+ /** C(11): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b3e023b3e02?v=0.6.7 */
9399
9385
  serialize.timeslot = {
9400
9386
  key: stateKeys.index(StateKeyIdx.Tau),
9401
9387
  Codec: codec$1.u32.asOpaque(),
9402
9388
  extract: (s) => s.timeslot,
9403
9389
  };
9404
- /** C(12): https://graypaper.fluffylabs.dev/#/85129da/38cf0238cf02?v=0.6.3 */
9390
+ /** C(12): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b4c023b4c02?v=0.6.7 */
9405
9391
  serialize.privilegedServices = {
9406
9392
  key: stateKeys.index(StateKeyIdx.Chi),
9407
9393
  Codec: PrivilegedServices.Codec,
9408
9394
  extract: (s) => s.privilegedServices,
9409
9395
  };
9410
- /** C(13): https://graypaper.fluffylabs.dev/#/85129da/38e10238e102?v=0.6.3 */
9396
+ /** C(13): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b5e023b5e02?v=0.6.7 */
9411
9397
  serialize.statistics = {
9412
9398
  key: stateKeys.index(StateKeyIdx.Pi),
9413
9399
  Codec: StatisticsData.Codec,
@@ -9419,7 +9405,7 @@ var serialize;
9419
9405
  Codec: codecPerEpochBlock(readonlyArray(codec$1.sequenceVarLen(NotYetAccumulatedReport.Codec))),
9420
9406
  extract: (s) => s.accumulationQueue,
9421
9407
  };
9422
- /** C(15): https://graypaper.fluffylabs.dev/#/85129da/381903381903?v=0.6.3 */
9408
+ /** C(15): https://graypaper.fluffylabs.dev/#/7e6ff6a/3b96023b9602?v=0.6.7 */
9423
9409
  serialize.recentlyAccumulated = {
9424
9410
  key: stateKeys.index(StateKeyIdx.Xi),
9425
9411
  Codec: codecPerEpochBlock(codec$1.sequenceVarLen(codec$1.bytes(HASH_SIZE).asOpaque()).convert((x) => Array.from(x), (x) => HashSet.from(x))),
@@ -15987,11 +15973,6 @@ class Interpreter {
15987
15973
  }
15988
15974
  }
15989
15975
  if (this.instructionResult.status !== null) {
15990
- // All abnormal terminations should be interpreted as TRAP and we should subtract the gas. In case of FAULT we have to do it manually at the very end.
15991
- if (this.instructionResult.status === Result.FAULT || this.instructionResult.status === Result.FAULT_ACCESS) {
15992
- // TODO [ToDr] underflow?
15993
- this.gas.sub(instructionGasMap[Instruction.TRAP]);
15994
- }
15995
15976
  switch (this.instructionResult.status) {
15996
15977
  case Result.FAULT:
15997
15978
  this.status = Status.FAULT;
@@ -16435,7 +16416,7 @@ class HostCalls {
16435
16416
  }
16436
16417
  this.hostCalls.traceHostCall("Invoking", index, hostCall, regs, gasBefore);
16437
16418
  const result = await hostCall.execute(gas, regs, memory);
16438
- this.hostCalls.traceHostCall(result === undefined ? "Result" : `Status(${result})`, index, hostCall, regs, gas.get());
16419
+ this.hostCalls.traceHostCall(result === undefined ? "Result" : `Status(${PvmExecution[result]})`, index, hostCall, regs, gas.get());
16439
16420
  if (result === PvmExecution.Halt) {
16440
16421
  status = Status.HALT;
16441
16422
  return this.getReturnValue(status, pvmInstance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/lib",
3
- "version": "0.0.1-099373a",
3
+ "version": "0.0.1-4a742e9",
4
4
  "main": "index.js",
5
5
  "author": "Fluffy Labs",
6
6
  "license": "MPL-2.0"