@pushchain/core 5.1.13 → 5.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushchain/core",
3
- "version": "5.1.13",
3
+ "version": "5.1.15",
4
4
  "homepage": "https://push.org",
5
5
  "keywords": [
6
6
  "pushchain",
@@ -53,6 +53,28 @@ function encodePayloadForOrigin(ctx, payload) {
53
53
  }
54
54
  return (0, signing_1.encodeUniversalPayload)(payload);
55
55
  }
56
+ /**
57
+ * Lazy variant of `encodePayloadForOrigin`. The encoded bytes only ride to
58
+ * the chain on the fee-locking branch (consumed by `lockFee` → origin
59
+ * gateway → relayer → `DecodeUniversalPayloadSolana`). On the non-fee-
60
+ * locking branch the bytes are placed into `req` but `req` is never sent —
61
+ * `sendUniversalTx` ships the proto-struct UniversalPayload via
62
+ * `MsgExecutePayload` instead.
63
+ *
64
+ * Skipping the encode on the non-fee-locking branch sidesteps the SVM
65
+ * encoder's u64 ceiling for the R2 SVM outbound recursive seam (Slack
66
+ * 2026-04-23 regression), which sets `execute.value = multicallNativeValue`
67
+ * — a wei-scale UPC budget that routinely exceeds 2^64 on thin pSOL/WPC
68
+ * pools. The chain decoder is u64-only, so we can't widen the wire format
69
+ * without coordinated chain work; this skip is the SDK-only fix that
70
+ * unblocks Riyanshu's case without changing the wire format.
71
+ */
72
+ function encodePayloadForOriginIfNeeded(ctx, payload, feeLockingRequired) {
73
+ if (!feeLockingRequired) {
74
+ return '0x';
75
+ }
76
+ return encodePayloadForOrigin(ctx, payload);
77
+ }
56
78
  function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks) {
57
79
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
80
  var _a, _b, _c;
@@ -167,7 +189,7 @@ function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks)
167
189
  }, helpers_1.bigintReplacer));
168
190
  req = (0, payload_builder_1.buildUniversalTxRequest)(ctx.universalSigner.account.address, {
169
191
  recipient: viem_1.zeroAddress, token: viem_1.zeroAddress, amount: BigInt(0),
170
- payload: encodePayloadForOrigin(ctx, universalPayloadForReq),
192
+ payload: encodePayloadForOriginIfNeeded(ctx, universalPayloadForReq, feeLockingRequired),
171
193
  });
172
194
  }
173
195
  else {
@@ -196,7 +218,7 @@ function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks)
196
218
  }, helpers_1.bigintReplacer));
197
219
  req = (0, payload_builder_1.buildUniversalTxRequest)(ctx.universalSigner.account.address, {
198
220
  recipient: viem_1.zeroAddress, token: viem_1.zeroAddress, amount: BigInt(0),
199
- payload: encodePayloadForOrigin(ctx, universalPayloadOther),
221
+ payload: encodePayloadForOriginIfNeeded(ctx, universalPayloadOther, feeLockingRequired),
200
222
  });
201
223
  }
202
224
  }
@@ -217,7 +239,7 @@ function executeStandardPayload(ctx, execute, eventBuffer, getResponseCallbacks)
217
239
  }, helpers_1.bigintReplacer));
218
240
  req = (0, payload_builder_1.buildUniversalTxRequest)(ctx.universalSigner.account.address, {
219
241
  recipient: viem_1.zeroAddress, token: viem_1.zeroAddress, amount: BigInt(0),
220
- payload: encodePayloadForOrigin(ctx, universalPayloadSelf),
242
+ payload: encodePayloadForOriginIfNeeded(ctx, universalPayloadSelf, feeLockingRequired),
221
243
  });
222
244
  }
223
245
  }
@@ -15,8 +15,8 @@ export declare const OUTBOUND_POLL_INTERVAL_MS = 3000;
15
15
  export declare const OUTBOUND_MAX_TIMEOUT_MS = 180000;
16
16
  /** Maximum total timeout for the R3 inbound round-trip polling loop (ms). */
17
17
  export declare const INBOUND_MAX_TIMEOUT_MS = 300000;
18
- /** Initial wait before the first inbound poll (ms). Set to 0 — the outbound just completed, so the indexer may already have the child UTX. */
19
- export declare const INBOUND_INITIAL_WAIT_MS = 0;
18
+ /** Initial wait before the first inbound poll (ms). Validator observation + Push commit + indexer ingestion realistically take 15-25 s on testnet (esp. SVM source), so polling immediately just burns RPC on guaranteed-empty results. */
19
+ export declare const INBOUND_INITIAL_WAIT_MS = 15000;
20
20
  /**
21
21
  * Thrown by `waitForOutboundTx` when the polling loop exceeds the configured
22
22
  * timeout without observing an external tx hash. Callers can `instanceof`
@@ -30,8 +30,8 @@ exports.OUTBOUND_POLL_INTERVAL_MS = 3000; // 3s
30
30
  exports.OUTBOUND_MAX_TIMEOUT_MS = 180000; // 180s (3 min)
31
31
  /** Maximum total timeout for the R3 inbound round-trip polling loop (ms). */
32
32
  exports.INBOUND_MAX_TIMEOUT_MS = 300000; // 300s (5 min) — covers R3 inbound latency on testnet
33
- /** Initial wait before the first inbound poll (ms). Set to 0 — the outbound just completed, so the indexer may already have the child UTX. */
34
- exports.INBOUND_INITIAL_WAIT_MS = 0;
33
+ /** Initial wait before the first inbound poll (ms). Validator observation + Push commit + indexer ingestion realistically take 15-25 s on testnet (esp. SVM source), so polling immediately just burns RPC on guaranteed-empty results. */
34
+ exports.INBOUND_INITIAL_WAIT_MS = 15000;
35
35
  // ============================================================================
36
36
  // Typed errors
37
37
  // ============================================================================
@@ -1235,13 +1235,17 @@ function executeCeaToPushSvm(ctx, params, sourceChain, executeFn) {
1235
1235
  response.chain = sourceChain;
1236
1236
  const chainInfo = chain_1.CHAIN_INFO[sourceChain];
1237
1237
  response.chainNamespace = `${chain_1.VM_NAMESPACE[chainInfo.vm]}:${chainInfo.chainId}`;
1238
- // R3 SVM inbound round-trip tracking: enable only when funds flow back
1239
- // (drainAmount > 0). See the EVM executeCeaToPush note — child-utxId
1240
- // correlation uses the universal-tx-detector's deterministic derivation.
1241
- // NOTE: the detector is EVM-only today; SVM source-chain logs can't be
1242
- // decoded yet, so this branch will fall back to the (broken) cosmos
1243
- // search. Disable if SVM R3 tests start timing out in CI.
1244
- response._expectsInboundRoundTrip = drainAmount > BigInt(0);
1238
+ // R3 SVM inbound round-trip tracking is disabled.
1239
+ //
1240
+ // For Route 3 SVM drains (rescue_funds-style flow, txType=RESCUE_FUNDS),
1241
+ // empirical check on donut showed the keeper does NOT create a child
1242
+ // universalTxId on Push for the Solana-side `UniversalTx(fromCEA=true)`
1243
+ // log — the parent utxId's `outboundStatus=OBSERVED` is the terminal state.
1244
+ // Polling for a deterministically-derived child id therefore never
1245
+ // resolves, and the cosmos `inbound_tx_hash` text-search fallback also
1246
+ // returns 0 hits. Receipts now resolve as soon as the Solana outbound is
1247
+ // observed instead of timing out at 300s.
1248
+ response._expectsInboundRoundTrip = false;
1245
1249
  return response;
1246
1250
  });
1247
1251
  }
@@ -54,11 +54,29 @@ class PriceFetch {
54
54
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
55
  }, { commitment: 'confirmed' });
56
56
  const program = new anchor_1.Program(feeLocker_json_1.default, provider);
57
- const result = yield program.methods['getSolPrice']()
58
- .accounts({
59
- priceUpdate: PRICE_ACCOUNT,
60
- })
61
- .view();
57
+ let result;
58
+ try {
59
+ result = yield program.methods['getSolPrice']()
60
+ .accounts({
61
+ priceUpdate: PRICE_ACCOUNT,
62
+ })
63
+ .view();
64
+ }
65
+ catch (err) {
66
+ const e = err;
67
+ console.error('[price-fetch][SVM getSolPrice] FAILED');
68
+ console.error(' rpc:', rpcUrls[0]);
69
+ console.error(' locker:', lockerContract);
70
+ console.error(' priceAccount:', PRICE_ACCOUNT.toBase58());
71
+ console.error(' message:', e === null || e === void 0 ? void 0 : e.message);
72
+ if (e === null || e === void 0 ? void 0 : e.logs)
73
+ console.error(' logs:', e.logs);
74
+ if (e === null || e === void 0 ? void 0 : e.simulationResponse)
75
+ console.error(' simulationResponse:', JSON.stringify(e.simulationResponse, null, 2));
76
+ if (e === null || e === void 0 ? void 0 : e.programErrorStack)
77
+ console.error(' programErrorStack:', e.programErrorStack);
78
+ throw err;
79
+ }
62
80
  if (!result || !result.price) {
63
81
  throw new Error('Invalid price data returned');
64
82
  }
@@ -94,7 +94,7 @@ export declare function deriveSvmCeaPda(ueaAddress: `0x${string}`, targetChain:
94
94
  *
95
95
  * @param account - UniversalAccount with chain and address.
96
96
  * @param options.chain - Target external chain for CEA derivation. If omitted, returns UEA.
97
- * @param options.skipNetworkCheck - If true, skip deployment check and return deployed: false.
97
+ * @param options.skipNetworkCheck - If true, skip deployment check and return deployed: null.
98
98
  * @returns The derived executor account address and deployment status.
99
99
  */
100
100
  export declare function deriveExecutorAccount(account: UniversalAccount, options?: {
@@ -471,7 +471,7 @@ function deriveSvmCeaPda(ueaAddress, targetChain, skipNetworkCheck) {
471
471
  *
472
472
  * @param account - UniversalAccount with chain and address.
473
473
  * @param options.chain - Target external chain for CEA derivation. If omitted, returns UEA.
474
- * @param options.skipNetworkCheck - If true, skip deployment check and return deployed: false.
474
+ * @param options.skipNetworkCheck - If true, skip deployment check and return deployed: null.
475
475
  * @returns The derived executor account address and deployment status.
476
476
  */
477
477
  function deriveExecutorAccount(account, options) {
@@ -135,6 +135,21 @@ function resolveChildInboundsFromLogs(pushClient, sourceChainCaip, externalTxHas
135
135
  }
136
136
  catch (err) {
137
137
  diagnostics === null || diagnostics === void 0 ? void 0 : diagnostics.push(`getUniversalTxByIdV2(${utxIdHex}) failed: ${err instanceof Error ? err.message : String(err)}`);
138
+ // Cosmos lookup failed (commonly NotFound while the indexer is still
139
+ // catching up). The utxId is deterministically derived from the source
140
+ // log, so surface it as notFound rather than dropping the entry —
141
+ // otherwise callers like inbound-tracker repeatedly re-run the full
142
+ // detector pass instead of advancing to lightweight status polling.
143
+ out.push({
144
+ universalTxId: utxIdHex,
145
+ sourceLogIndex: log.logIndex,
146
+ sourceEventName: log.eventName,
147
+ status: 0,
148
+ statusName: STATUS_NAMES[0],
149
+ pcTxHashes: [],
150
+ outboundHashes: [],
151
+ notFound: true,
152
+ });
138
153
  }
139
154
  }
140
155
  return out;