@hardkas/localnet 0.6.0-alpha → 0.7.0-alpha

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/index.d.ts CHANGED
@@ -372,7 +372,7 @@ declare function moveSink(dag: SimulatedDag, newSinkId: string, txProvider: (txI
372
372
  inputs: string[];
373
373
  } | undefined): SimulatedDag;
374
374
  /**
375
- * Deterministic Conflict Resolution (Approximation for v0.2-alpha)
375
+ * Deterministic Conflict Resolution (Approximation for 0.7.0-alpha)
376
376
  * Priority:
377
377
  * 1. sink ancestry priority (is part of selectedPathToSink?)
378
378
  * 2. deterministic block order (daaScore then block ID)
package/dist/index.js CHANGED
@@ -148,6 +148,7 @@ function createInitialLocalnetState(options = {}) {
148
148
  hardkasVersion: HARDKAS_VERSION,
149
149
  version: "1.0.0-alpha",
150
150
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
151
+ // hardkas-determinism-allow: initial state creation timestamp
151
152
  mode: "simulated",
152
153
  networkId: "simnet",
153
154
  daaScore: "0",
@@ -304,6 +305,7 @@ function createLocalnetSnapshot(state, name) {
304
305
  hardkasVersion: HARDKAS_VERSION2,
305
306
  version: ARTIFACT_VERSION,
306
307
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
308
+ // hardkas-determinism-allow: snapshot creation timestamp
307
309
  name,
308
310
  daaScore: state.daaScore,
309
311
  accountsHash,
@@ -526,6 +528,7 @@ function applySimulatedPayment(state, input, ctx) {
526
528
  const txId = generateDeterministicFailedTxId(preStateHash, errorMessage, daaScore);
527
529
  const receipt = {
528
530
  schema: "hardkas.txReceipt",
531
+ schemaVersion: "hardkas.receipt.v1",
529
532
  hardkasVersion: HARDKAS_VERSION3,
530
533
  version: ARTIFACT_VERSION2,
531
534
  status: "failed",
@@ -609,6 +612,7 @@ function applySimulatedPlan(state, planArtifact, ctx, options) {
609
612
  const txId = generateDeterministicFailedTxId(preStateHash, errorMessage, daaScore);
610
613
  const receipt = {
611
614
  schema: "hardkas.txReceipt",
615
+ schemaVersion: "hardkas.receipt.v1",
612
616
  hardkasVersion: HARDKAS_VERSION3,
613
617
  version: ARTIFACT_VERSION2,
614
618
  status: "failed",
@@ -1066,8 +1070,10 @@ import { ARTIFACT_SCHEMAS as ARTIFACT_SCHEMAS2, HARDKAS_VERSION as HARDKAS_VERSI
1066
1070
  async function forkFromNetwork(rpc, opts) {
1067
1071
  const info = await rpc.getInfo();
1068
1072
  const networkId = info.networkId || opts.network;
1069
- const currentDaaScore = info.virtualDaaScore?.toString() || "0";
1070
- const targetDaaScore = opts.atDaaScore || currentDaaScore;
1073
+ const targetDaaScore = opts.atDaaScore;
1074
+ if (!targetDaaScore) {
1075
+ throw new Error(`[CRITICAL SEMANTIC ERROR] Implicit 'latest' resolution forbidden. You must explicitly provide atDaaScore.`);
1076
+ }
1071
1077
  const utxos = [];
1072
1078
  for (const address of opts.addresses) {
1073
1079
  const rpcUtxos = await rpc.getUtxosByAddress(address);
@@ -1088,6 +1094,7 @@ async function forkFromNetwork(rpc, opts) {
1088
1094
  hashVersion: "sha256-canonical",
1089
1095
  mode: "simulated",
1090
1096
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1097
+ // hardkas-determinism-allow: fork state creation timestamp
1091
1098
  networkId,
1092
1099
  daaScore: targetDaaScore,
1093
1100
  accounts: opts.addresses.map((addr, i) => ({
@@ -1100,6 +1107,7 @@ async function forkFromNetwork(rpc, opts) {
1100
1107
  rpcUrl: opts.rpcUrl,
1101
1108
  daaScore: targetDaaScore,
1102
1109
  forkedAt: (/* @__PURE__ */ new Date()).toISOString(),
1110
+ // hardkas-determinism-allow: fork source timestamp
1103
1111
  addresses: opts.addresses
1104
1112
  }
1105
1113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/localnet",
3
- "version": "0.6.0-alpha",
3
+ "version": "0.7.0-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -8,12 +8,12 @@
8
8
  ".": "./dist/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@hardkas/artifacts": "0.6.0-alpha",
12
- "@hardkas/core": "0.6.0-alpha",
13
- "@hardkas/query": "0.6.0-alpha",
14
- "@hardkas/simulator": "0.6.0-alpha",
15
- "@hardkas/kaspa-rpc": "0.6.0-alpha",
16
- "@hardkas/tx-builder": "0.6.0-alpha"
11
+ "@hardkas/artifacts": "0.7.0-alpha",
12
+ "@hardkas/core": "0.7.0-alpha",
13
+ "@hardkas/kaspa-rpc": "0.7.0-alpha",
14
+ "@hardkas/simulator": "0.7.0-alpha",
15
+ "@hardkas/query": "0.7.0-alpha",
16
+ "@hardkas/tx-builder": "0.7.0-alpha"
17
17
  },
18
18
  "devDependencies": {
19
19
  "fast-check": "^4.8.0",