shinjuku-shielded 0.3.38 → 0.3.39
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/manifest.json +3 -3
- package/package.json +3 -3
- package/shinjuku-wallet.mjs +185 -101
package/manifest.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "carbon-shielded-wallet/bundle-manifest/v1",
|
|
3
3
|
"file": "shinjuku-wallet.mjs",
|
|
4
|
-
"sha256": "
|
|
5
|
-
"bytes":
|
|
6
|
-
"sourceCommit": "
|
|
4
|
+
"sha256": "5f5ca189829786779ba9e05c237bb6edf057a06d4745f0a601212136aa0bf68f",
|
|
5
|
+
"bytes": 11216201,
|
|
6
|
+
"sourceCommit": "c72d3c75917cf35191aa263f3e30878779ed814b",
|
|
7
7
|
"sourceDirty": false,
|
|
8
8
|
"installRecordMatchesLockfile": true,
|
|
9
9
|
"releaseRule": "valid only when two fresh npm ci --ignore-scripts builds on different OSes give the same sha256; installRecordMatchesLockfile true means every entry npm installed equals its package-lock.json entry and every entry not marked optional, devOptional included, is installed: an optional entry (a package for another platform) may be absent",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinjuku-shielded",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.39",
|
|
4
4
|
"mcpName": "io.github.ShinjukuStaition/shinjuku-mcp",
|
|
5
5
|
"description": "Shinjuku Shielded, the private x402 facilitator on Solana: the self-custody wallet CLI and its MCP server. Shield, pay, and unshield USDC from any MCP agent, under caps you set.",
|
|
6
|
-
"shinjukuRelease": "
|
|
7
|
-
"shinjukuSha256": "
|
|
6
|
+
"shinjukuRelease": "5f5ca189",
|
|
7
|
+
"shinjukuSha256": "5f5ca189829786779ba9e05c237bb6edf057a06d4745f0a601212136aa0bf68f",
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
9
9
|
"author": "Shinjuku Shielded",
|
|
10
10
|
"homepage": "https://github.com/ShinjukuStaition/shinjuku-mcp#readme",
|
package/shinjuku-wallet.mjs
CHANGED
|
@@ -6359,13 +6359,13 @@ var require_src = __commonJS({
|
|
|
6359
6359
|
zeroes++;
|
|
6360
6360
|
}
|
|
6361
6361
|
var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
6362
|
-
var
|
|
6362
|
+
var b583 = new Uint8Array(size);
|
|
6363
6363
|
while (pbegin !== pend) {
|
|
6364
6364
|
var carry = source[pbegin];
|
|
6365
6365
|
var i2 = 0;
|
|
6366
6366
|
for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
|
|
6367
|
-
carry += 256 *
|
|
6368
|
-
|
|
6367
|
+
carry += 256 * b583[it1] >>> 0;
|
|
6368
|
+
b583[it1] = carry % BASE2 >>> 0;
|
|
6369
6369
|
carry = carry / BASE2 >>> 0;
|
|
6370
6370
|
}
|
|
6371
6371
|
if (carry !== 0) {
|
|
@@ -6375,12 +6375,12 @@ var require_src = __commonJS({
|
|
|
6375
6375
|
pbegin++;
|
|
6376
6376
|
}
|
|
6377
6377
|
var it2 = size - length;
|
|
6378
|
-
while (it2 !== size &&
|
|
6378
|
+
while (it2 !== size && b583[it2] === 0) {
|
|
6379
6379
|
it2++;
|
|
6380
6380
|
}
|
|
6381
6381
|
var str = LEADER.repeat(zeroes);
|
|
6382
6382
|
for (; it2 < size; ++it2) {
|
|
6383
|
-
str += ALPHABET.charAt(
|
|
6383
|
+
str += ALPHABET.charAt(b583[it2]);
|
|
6384
6384
|
}
|
|
6385
6385
|
return str;
|
|
6386
6386
|
}
|
|
@@ -50068,11 +50068,11 @@ function connectSplit(own, historyUrl, commitment = "finalized", { pause: pause3
|
|
|
50068
50068
|
integrity: { signaturesVerified: 0, crossChecked: 0 }
|
|
50069
50069
|
});
|
|
50070
50070
|
const served = /* @__PURE__ */ new Map();
|
|
50071
|
-
let
|
|
50072
|
-
if (
|
|
50071
|
+
let memo2 = runTransactions.get(historyUrl);
|
|
50072
|
+
if (memo2 === void 0) runTransactions.set(historyUrl, memo2 = /* @__PURE__ */ new Map());
|
|
50073
50073
|
const memoKey3 = (signature, config) => `${signature}|${config?.commitment ?? commitment}|${config?.maxSupportedTransactionVersion ?? 1}`;
|
|
50074
50074
|
const remembered = (signature, config) => {
|
|
50075
|
-
const hit =
|
|
50075
|
+
const hit = memo2.get(memoKey3(signature, config));
|
|
50076
50076
|
if (hit === void 0) return void 0;
|
|
50077
50077
|
counts.integrity.signaturesVerified += 1;
|
|
50078
50078
|
served.set(signature, hit.fingerprint);
|
|
@@ -50136,7 +50136,7 @@ function connectSplit(own, historyUrl, commitment = "finalized", { pause: pause3
|
|
|
50136
50136
|
const { response, fingerprint } = verifiedTransaction(result, call3[0]);
|
|
50137
50137
|
counts.integrity.signaturesVerified += 1;
|
|
50138
50138
|
served.set(call3[0], fingerprint);
|
|
50139
|
-
|
|
50139
|
+
memo2.set(memoKey3(call3[0], call3[1]), { response, fingerprint });
|
|
50140
50140
|
return response;
|
|
50141
50141
|
} catch (error) {
|
|
50142
50142
|
if (error?.code === HISTORY_RPC_BEHIND_CODE && !strict) {
|
|
@@ -50184,7 +50184,7 @@ function connectSplit(own, historyUrl, commitment = "finalized", { pause: pause3
|
|
|
50184
50184
|
const { response: verified, fingerprint } = verifiedTransaction(result, signatures[index]);
|
|
50185
50185
|
counts.integrity.signaturesVerified += 1;
|
|
50186
50186
|
served.set(signatures[index], fingerprint);
|
|
50187
|
-
|
|
50187
|
+
memo2.set(memoKey3(signatures[index], config), { response: verified, fingerprint });
|
|
50188
50188
|
return verified;
|
|
50189
50189
|
});
|
|
50190
50190
|
let next = 0;
|
|
@@ -52548,6 +52548,15 @@ var init_genericHistory = __esm({
|
|
|
52548
52548
|
|
|
52549
52549
|
// wallet/src/history/walk.mjs
|
|
52550
52550
|
import { createHash as createHash10 } from "node:crypto";
|
|
52551
|
+
function e1TreeAddress2(poolBase58, programBase58) {
|
|
52552
|
+
return memo(`e1|${poolBase58}|${programBase58}`, () => e1TreeAddress(poolBase58, programBase58));
|
|
52553
|
+
}
|
|
52554
|
+
function vaultAuthorityAddress3(program, pool2) {
|
|
52555
|
+
return memo(`va|${b58(program)}|${b58(pool2)}`, () => vaultAuthorityAddress2(program, pool2));
|
|
52556
|
+
}
|
|
52557
|
+
function depositAuthorityAddress3(program, pool2, outHex) {
|
|
52558
|
+
return memo(`da|${b58(program)}|${b58(pool2)}|${outHex}`, () => depositAuthorityAddress2(program, pool2, outHex));
|
|
52559
|
+
}
|
|
52551
52560
|
function p03SettlementConsumesBuffer(tag2) {
|
|
52552
52561
|
return P03_SETTLEMENT_TAGS.includes(tag2) && !P03_INLINE_SETTLEMENT_TAGS.includes(tag2);
|
|
52553
52562
|
}
|
|
@@ -52673,7 +52682,7 @@ function buildFinalizedP03HistoryReport({
|
|
|
52673
52682
|
sourceModel: P03_FINALIZED_HISTORY_SOURCE_MODEL,
|
|
52674
52683
|
complete: true,
|
|
52675
52684
|
commitment: "finalized",
|
|
52676
|
-
programId: program
|
|
52685
|
+
programId: b58(program),
|
|
52677
52686
|
pool: poolKey.toBase58(),
|
|
52678
52687
|
initialization: Object.freeze({
|
|
52679
52688
|
signature: initialization.signature,
|
|
@@ -52731,14 +52740,14 @@ async function refreshFinalizedP03HistorySnapshot({
|
|
|
52731
52740
|
const authenticated = assertAuthenticatedFinalizedP03History(history);
|
|
52732
52741
|
const program = canonicalKey(programId, "program_id");
|
|
52733
52742
|
const poolKey = canonicalKey(pool2, "pool");
|
|
52734
|
-
if (authenticated.programId !== program
|
|
52743
|
+
if (authenticated.programId !== b58(program) || authenticated.pool !== poolKey.toBase58()) {
|
|
52735
52744
|
throw new Error("p03_history_refresh_binding_invalid");
|
|
52736
52745
|
}
|
|
52737
52746
|
const snapshot = await readFinalizedPoolForRefresh(connection, program, poolKey);
|
|
52738
52747
|
if (snapshot.terminal !== authenticated.finalizedPoolSnapshot.terminal || snapshot.currentIndex !== authenticated.finalizedPoolSnapshot.currentIndex || snapshot.currentRoot !== authenticated.finalizedPoolSnapshot.currentRoot || !sameP03PoolPolicy(snapshot, authenticated.finalizedPoolSnapshot.policy) || !sameE1TreeHeader(snapshot, authenticated.finalizedPoolSnapshot.e1Tree, program, poolKey) || paymentSettler !== void 0 && snapshot.paymentSettler?.toBase58() !== paymentSettler) {
|
|
52739
52748
|
throw Object.assign(
|
|
52740
52749
|
new Error("p03_history_refresh_transition_detected"),
|
|
52741
|
-
{ currentIndex: snapshot.currentIndex, snapshotBinding: { programId: program
|
|
52750
|
+
{ currentIndex: snapshot.currentIndex, snapshotBinding: { programId: b58(program), pool: poolKey.toBase58() } }
|
|
52742
52751
|
);
|
|
52743
52752
|
}
|
|
52744
52753
|
const priorCoverage = authenticated.deploymentCoverage;
|
|
@@ -52805,7 +52814,7 @@ async function readFinalizedPool(connection, program, pool2) {
|
|
|
52805
52814
|
if (only.replayStore === REPLAY_STORE_INDEXED) throw new Error("p03_history_e1_tree_read_unavailable");
|
|
52806
52815
|
return only;
|
|
52807
52816
|
}
|
|
52808
|
-
const tree = new import_web396.PublicKey(
|
|
52817
|
+
const tree = new import_web396.PublicKey(e1TreeAddress2(b58(pool2), b58(program)));
|
|
52809
52818
|
const both = await retryTransientRpc(() => connection.getMultipleAccountsInfoAndContext(
|
|
52810
52819
|
[pool2, tree],
|
|
52811
52820
|
{ commitment: "finalized" }
|
|
@@ -52826,7 +52835,7 @@ async function readFinalizedPool(connection, program, pool2) {
|
|
|
52826
52835
|
}
|
|
52827
52836
|
async function readFinalizedPoolForRefresh(connection, program, pool2) {
|
|
52828
52837
|
if (typeof connection.getMultipleAccountsInfoAndContext !== "function") return readFinalizedPool(connection, program, pool2);
|
|
52829
|
-
const tree = new import_web396.PublicKey(
|
|
52838
|
+
const tree = new import_web396.PublicKey(e1TreeAddress2(b58(pool2), b58(program)));
|
|
52830
52839
|
const both = await retryTransientRpc(() => connection.getMultipleAccountsInfoAndContext(
|
|
52831
52840
|
[pool2, tree],
|
|
52832
52841
|
{ commitment: "finalized", dataSlice: { offset: 0, length: REFRESH_READ_BYTES } }
|
|
@@ -52850,7 +52859,7 @@ function parseFinalizedPool(response, program) {
|
|
|
52850
52859
|
const slot3 = response?.context?.slot;
|
|
52851
52860
|
safeSlot(slot3, "snapshot_slot");
|
|
52852
52861
|
if (!value) throw new Error("p03_history_pool_missing");
|
|
52853
|
-
if (canonicalKey(value.owner, "pool_owner").toBase58() !== program
|
|
52862
|
+
if (canonicalKey(value.owner, "pool_owner").toBase58() !== b58(program)) {
|
|
52854
52863
|
throw new Error("p03_history_pool_owner_mismatch");
|
|
52855
52864
|
}
|
|
52856
52865
|
const data = Buffer.from(value.data);
|
|
@@ -52937,7 +52946,7 @@ function coverageKey({ program, initialization, deploymentIdentity }) {
|
|
|
52937
52946
|
return createHash10("sha256").update(JSON.stringify({
|
|
52938
52947
|
// v2: coverage carries the executable timeline; older caches re-attest.
|
|
52939
52948
|
coverageModel: 2,
|
|
52940
|
-
program: program
|
|
52949
|
+
program: b58(program),
|
|
52941
52950
|
initializationSignature: initialization.signature,
|
|
52942
52951
|
programDataAddress: canonicalKey(deploymentIdentity.programDataAddress, "programdata_address").toBase58(),
|
|
52943
52952
|
deployedAtSlot: (typeof slot3 === "bigint" ? slot3 : BigInt(safeSlot(slot3, "deployed_at_slot"))).toString(),
|
|
@@ -53072,7 +53081,7 @@ async function attestProgramDataCoverage({
|
|
|
53072
53081
|
if (programHistory) {
|
|
53073
53082
|
const coverage = await attestP03ProgramHistory({
|
|
53074
53083
|
history: programHistory,
|
|
53075
|
-
programId: program
|
|
53084
|
+
programId: b58(program),
|
|
53076
53085
|
programDataAddress: address5.toBase58(),
|
|
53077
53086
|
currentProgramData: data,
|
|
53078
53087
|
initializationSlot: BigInt(initialization.slot),
|
|
@@ -53104,7 +53113,7 @@ async function attestProgramDataCoverage({
|
|
|
53104
53113
|
sourceModel: P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL,
|
|
53105
53114
|
complete: true,
|
|
53106
53115
|
commitment: "finalized",
|
|
53107
|
-
programId: program
|
|
53116
|
+
programId: b58(program),
|
|
53108
53117
|
programDataAddress: address5.toBase58(),
|
|
53109
53118
|
deployedAtSlot,
|
|
53110
53119
|
programDataSha256: expectedHash,
|
|
@@ -53134,7 +53143,7 @@ async function attestProgramDataCoverage({
|
|
|
53134
53143
|
sourceModel: P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL,
|
|
53135
53144
|
complete: true,
|
|
53136
53145
|
commitment: "finalized",
|
|
53137
|
-
programId: program
|
|
53146
|
+
programId: b58(program),
|
|
53138
53147
|
programDataAddress: address5.toBase58(),
|
|
53139
53148
|
deployedAtSlot,
|
|
53140
53149
|
programDataSha256: expectedHash,
|
|
@@ -53362,7 +53371,7 @@ function blockIndex(blockCache, slot3, signature) {
|
|
|
53362
53371
|
return transactionIndex;
|
|
53363
53372
|
}
|
|
53364
53373
|
function positionsEvidence(program) {
|
|
53365
|
-
const target = program
|
|
53374
|
+
const target = b58(program);
|
|
53366
53375
|
return (transaction) => !transaction.failed && transaction.instructions.some((instruction) => instruction.programId === target && (instruction.data[0] === 0 || instruction.data[0] === 8 || P03_SETTLEMENT_TAGS.includes(instruction.data[0])));
|
|
53367
53376
|
}
|
|
53368
53377
|
function historyCommitmentLevels(commitment) {
|
|
@@ -53516,14 +53525,14 @@ function exactInstructionData(data) {
|
|
|
53516
53525
|
throw new Error("p03_history_instruction_data_invalid");
|
|
53517
53526
|
}
|
|
53518
53527
|
function targetInstructions(transactions, program) {
|
|
53519
|
-
const target = program
|
|
53528
|
+
const target = b58(program);
|
|
53520
53529
|
if (transactions.some((transaction) => transaction.innerInstructions.some((instruction) => instruction.programId === target))) {
|
|
53521
53530
|
throw new Error("p03_history_inner_program_instruction_unsupported");
|
|
53522
53531
|
}
|
|
53523
53532
|
return transactions.flatMap((transaction) => transaction.instructions.filter((instruction) => instruction.programId === target)).sort(compareInstruction);
|
|
53524
53533
|
}
|
|
53525
53534
|
function validateAndFindInitialization(instructions2, pool2, program) {
|
|
53526
|
-
const poolString = pool2
|
|
53535
|
+
const poolString = b58(pool2);
|
|
53527
53536
|
const candidates = instructions2.filter((instruction) => instruction.accounts.includes(poolString) && (instruction.data[0] === 0 || instruction.data[0] === 8));
|
|
53528
53537
|
if (candidates.length !== 1) throw new Error("p03_history_initialization_count_invalid");
|
|
53529
53538
|
const initialization = candidates[0];
|
|
@@ -53533,8 +53542,8 @@ function validateAndFindInitialization(instructions2, pool2, program) {
|
|
|
53533
53542
|
)[0].toBase58();
|
|
53534
53543
|
const store = initializationReplayStore(initialization);
|
|
53535
53544
|
const gated = initialization.accounts.length === 6 && initialization.accounts[4] === programData;
|
|
53536
|
-
const gatedIndexed = initialization.accounts.length === 7 && initialization.accounts[4] === programData && initialization.accounts[6] ===
|
|
53537
|
-
if (store === void 0 || (store === REPLAY_STORE_INDEXED ? !gatedIndexed : initialization.accounts.length !== 4 && !gated) || initialization.accounts[0] !== poolString || initialization.accounts[3] !== import_web396.SYSVAR_CLOCK_PUBKEY
|
|
53545
|
+
const gatedIndexed = initialization.accounts.length === 7 && initialization.accounts[4] === programData && initialization.accounts[6] === e1TreeAddress2(poolString, b58(program));
|
|
53546
|
+
if (store === void 0 || (store === REPLAY_STORE_INDEXED ? !gatedIndexed : initialization.accounts.length !== 4 && !gated) || initialization.accounts[0] !== poolString || initialization.accounts[3] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY)) {
|
|
53538
53547
|
throw new Error("p03_history_initialization_invalid");
|
|
53539
53548
|
}
|
|
53540
53549
|
if (instructions2.some((instruction) => compareInstruction(instruction, initialization) < 0)) {
|
|
@@ -53555,21 +53564,21 @@ function assertP03E1TreeComplete({ program, pool: pool2, poolSnapshot, settles,
|
|
|
53555
53564
|
};
|
|
53556
53565
|
const tree = poolSnapshot.e1TreeAccount;
|
|
53557
53566
|
if (!tree || tree.slot !== poolSnapshot.slot) mismatch("tree_snapshot_missing");
|
|
53558
|
-
if (tree.address !==
|
|
53567
|
+
if (tree.address !== e1TreeAddress2(b58(pool2), b58(program))) mismatch("tree_address");
|
|
53559
53568
|
const empty = tree.data === null || tree.ownerProgramId === null || tree.ownerProgramId === SYSTEM_PROGRAM && tree.data.every((byte) => byte === 0);
|
|
53560
53569
|
if (closed) {
|
|
53561
53570
|
if (!empty) mismatch("closed_pool_has_tree");
|
|
53562
53571
|
return Object.freeze({ state: "closed", address: tree.address, slot: BigInt(poolSnapshot.slot) });
|
|
53563
53572
|
}
|
|
53564
53573
|
if (empty) mismatch("tree_empty_without_close");
|
|
53565
|
-
if (tree.ownerProgramId !== program
|
|
53574
|
+
if (tree.ownerProgramId !== b58(program) || tree.data.length !== E1.treeBytes) mismatch("tree_owner_or_length");
|
|
53566
53575
|
let header;
|
|
53567
53576
|
try {
|
|
53568
53577
|
header = readE1TreeAccount(tree.data);
|
|
53569
53578
|
} catch (error) {
|
|
53570
53579
|
mismatch(`tree_header:${error?.message ?? "invalid"}`);
|
|
53571
53580
|
}
|
|
53572
|
-
if (header.pool !== pool2
|
|
53581
|
+
if (header.pool !== b58(pool2)) mismatch("tree_pool");
|
|
53573
53582
|
const mirror = E1TreeMirror.fromOrderedValues(settles.flatMap((values) => e1SortValues(values)));
|
|
53574
53583
|
const leaves = mirror.leaves();
|
|
53575
53584
|
if (header.leaves !== leaves) mismatch(`leaves:${header.leaves}/${leaves}`);
|
|
@@ -53584,19 +53593,19 @@ function sameE1TreeHeader(snapshot, verified, program, pool2) {
|
|
|
53584
53593
|
if (!tree || tree.address !== verified.address) return false;
|
|
53585
53594
|
const empty = tree.data === null || tree.ownerProgramId === null || tree.ownerProgramId === SYSTEM_PROGRAM && tree.data.every((byte) => byte === 0);
|
|
53586
53595
|
if (verified.state === "closed") return empty;
|
|
53587
|
-
if (empty || tree.ownerProgramId !== program
|
|
53596
|
+
if (empty || tree.ownerProgramId !== b58(program) || tree.data.length < E1_TREE_HEADER_BYTES || !Number.isSafeInteger(verified.leaves) || verified.leaves < 1) return false;
|
|
53588
53597
|
const data = tree.data;
|
|
53589
53598
|
if (data.subarray(0, 8).toString("latin1") !== "SX402T01" || !data.subarray(8, 40).equals(pool2.toBuffer()) || data[40] !== 1 || data[41] !== E1.depth || data.readUInt16LE(42) !== E1.bufferSize || data[44] !== E1.canopyDepth || data[45] !== 0 || data[46] !== 0 || data[47] !== 0) return false;
|
|
53590
53599
|
return data.readBigUInt64LE(56) === BigInt(2 * verified.leaves - 1);
|
|
53591
53600
|
}
|
|
53592
53601
|
function assertIndexedSettlementCpis(cpis, kind) {
|
|
53593
53602
|
const exit = kind === "withdraw" || kind === "note-exit";
|
|
53594
|
-
if (cpis.length !== (exit ? 1 : 0) || exit && (cpis[0].programId !== TOKEN_PROGRAM_ID
|
|
53603
|
+
if (cpis.length !== (exit ? 1 : 0) || exit && (cpis[0].programId !== b58(TOKEN_PROGRAM_ID) || cpis[0].data.length !== 10 || cpis[0].data[0] !== 12)) {
|
|
53595
53604
|
throw new Error("p03_history_indexed_settlement_cpis_invalid");
|
|
53596
53605
|
}
|
|
53597
53606
|
}
|
|
53598
53607
|
function validateBufferInit(instruction, pool2) {
|
|
53599
|
-
if (instruction.data.length !== 10 || instruction.accounts.length !== 4 || instruction.accounts[2] !== pool2
|
|
53608
|
+
if (instruction.data.length !== 10 || instruction.accounts.length !== 4 || instruction.accounts[2] !== b58(pool2) || instruction.accounts[3] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY) || ![1, 2, 3, 4].includes(instruction.data[1])) {
|
|
53600
53609
|
throw new Error("p03_history_buffer_init_invalid");
|
|
53601
53610
|
}
|
|
53602
53611
|
}
|
|
@@ -53617,8 +53626,8 @@ function rebuildContexts({
|
|
|
53617
53626
|
if (!(transactions instanceof Map)) throw new Error("p03_history_transactions_required");
|
|
53618
53627
|
const snapshotSlot = BigInt(poolSnapshot.slot);
|
|
53619
53628
|
instructions2 = instructions2.filter((instruction) => BigInt(instruction.slot) <= snapshotSlot);
|
|
53620
|
-
const poolString = pool2
|
|
53621
|
-
const programString = program
|
|
53629
|
+
const poolString = b58(pool2);
|
|
53630
|
+
const programString = b58(program);
|
|
53622
53631
|
const executableAt = (slot3, subject) => {
|
|
53623
53632
|
if (!deploymentCoverage) {
|
|
53624
53633
|
if (assumeOriginalExecutable === true) return ASSUMED_ORIGINAL_EXECUTABLE;
|
|
@@ -53699,7 +53708,7 @@ function rebuildContexts({
|
|
|
53699
53708
|
}
|
|
53700
53709
|
if (tag2 === CLOSE_REPLAY_TREE_TAG) {
|
|
53701
53710
|
const withRecord = instruction.accounts.length === 5;
|
|
53702
|
-
if (!indexedPool || !retired || instruction.data.length !== 1 || instruction.accounts.length !== 4 && !withRecord || instruction.accounts[0] !== poolString || instruction.accounts[1] !==
|
|
53711
|
+
if (!indexedPool || !retired || instruction.data.length !== 1 || instruction.accounts.length !== 4 && !withRecord || instruction.accounts[0] !== poolString || instruction.accounts[1] !== e1TreeAddress2(poolString, programString) || instruction.accounts[2] !== settler || instruction.accounts[3] !== P03_E1_TREE_RENT_DESTINATION || withRecord && instruction.accounts[4] !== successionRecordAddress(program, poolString)) {
|
|
53703
53712
|
throw new Error("p03_history_tree_close_invalid");
|
|
53704
53713
|
}
|
|
53705
53714
|
const atClose = executableAt(instruction.slot, "tree_close");
|
|
@@ -53711,7 +53720,7 @@ function rebuildContexts({
|
|
|
53711
53720
|
}
|
|
53712
53721
|
if (tag2 === 12) {
|
|
53713
53722
|
const withTree = instruction.accounts.length === 5;
|
|
53714
|
-
if (!deploymentCoverage || retired || instruction.data.length !== 25 || instruction.accounts.length !== 3 && !withTree || instruction.accounts[0] !== poolString || instruction.accounts[1] !== deploymentCoverage.programDataAddress || withTree && (!indexedPool || instruction.accounts[3] !==
|
|
53723
|
+
if (!deploymentCoverage || retired || instruction.data.length !== 25 || instruction.accounts.length !== 3 && !withTree || instruction.accounts[0] !== poolString || instruction.accounts[1] !== deploymentCoverage.programDataAddress || withTree && (!indexedPool || instruction.accounts[3] !== e1TreeAddress2(poolString, programString) || instruction.accounts[4] !== successionInboundAddress(program, poolString))) {
|
|
53715
53724
|
throw new Error("p03_history_policy_update_invalid");
|
|
53716
53725
|
}
|
|
53717
53726
|
if (withTree) successionAt(instruction, "policy_update");
|
|
@@ -53755,7 +53764,7 @@ function rebuildContexts({
|
|
|
53755
53764
|
continue;
|
|
53756
53765
|
}
|
|
53757
53766
|
if (tag2 === 6) {
|
|
53758
|
-
if (instruction.data.length !== 1 || instruction.accounts.length !== 3 || instruction.accounts[2] !== import_web396.SYSVAR_CLOCK_PUBKEY
|
|
53767
|
+
if (instruction.data.length !== 1 || instruction.accounts.length !== 3 || instruction.accounts[2] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY)) {
|
|
53759
53768
|
throw new Error("p03_history_buffer_close_invalid");
|
|
53760
53769
|
}
|
|
53761
53770
|
const state2 = active.get(instruction.accounts[0]);
|
|
@@ -53764,27 +53773,27 @@ function rebuildContexts({
|
|
|
53764
53773
|
continue;
|
|
53765
53774
|
}
|
|
53766
53775
|
if (tag2 === 7) {
|
|
53767
|
-
if (instruction.data.length !== 1 || instruction.accounts.length !== 2 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== import_web396.SYSVAR_CLOCK_PUBKEY
|
|
53776
|
+
if (instruction.data.length !== 1 || instruction.accounts.length !== 2 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY)) {
|
|
53768
53777
|
throw new Error("p03_history_checkpoint_invalid");
|
|
53769
53778
|
}
|
|
53770
53779
|
continue;
|
|
53771
53780
|
}
|
|
53772
53781
|
if (tag2 === 10) {
|
|
53773
|
-
if (instruction.data.length !== 1 || instruction.accounts.length !== 3 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== settler || instruction.accounts[2] !== poolSnapshot.vault
|
|
53782
|
+
if (instruction.data.length !== 1 || instruction.accounts.length !== 3 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== settler || instruction.accounts[2] !== b58(poolSnapshot.vault)) {
|
|
53774
53783
|
throw new Error("p03_history_retire_instruction_invalid");
|
|
53775
53784
|
}
|
|
53776
53785
|
retired = true;
|
|
53777
53786
|
continue;
|
|
53778
53787
|
}
|
|
53779
53788
|
if (tag2 === 23) {
|
|
53780
|
-
if (instruction.data.length !== 1 || instruction.accounts.length !== 7 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== settler || instruction.accounts[2] !== poolSnapshot.vault
|
|
53789
|
+
if (instruction.data.length !== 1 || instruction.accounts.length !== 7 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== settler || instruction.accounts[2] !== b58(poolSnapshot.vault)) {
|
|
53781
53790
|
throw new Error("p03_history_test_pool_retire_invalid");
|
|
53782
53791
|
}
|
|
53783
53792
|
retired = true;
|
|
53784
53793
|
continue;
|
|
53785
53794
|
}
|
|
53786
53795
|
if (tag2 === 28) {
|
|
53787
|
-
if (retired || poolString !== P03_LOCKED_RETIRE_POOL || instruction.data.length !== 1 || instruction.accounts.length !== 7 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== P03_LOCKED_RETIRE_AUTHORITY || instruction.accounts[2] !== poolSnapshot.vault
|
|
53796
|
+
if (retired || poolString !== P03_LOCKED_RETIRE_POOL || instruction.data.length !== 1 || instruction.accounts.length !== 7 || instruction.accounts[0] !== poolString || instruction.accounts[1] !== P03_LOCKED_RETIRE_AUTHORITY || instruction.accounts[2] !== b58(poolSnapshot.vault) || instruction.accounts[4] !== P03_LOCKED_RETIRE_DESTINATION) {
|
|
53788
53797
|
throw new Error("p03_history_locked_retire_invalid");
|
|
53789
53798
|
}
|
|
53790
53799
|
if (executableAt(instruction.slot, "locked_retire").lockedPoolRetire !== true) {
|
|
@@ -53830,18 +53839,18 @@ function rebuildContexts({
|
|
|
53830
53839
|
}
|
|
53831
53840
|
if (tag2 === LINK_SUCCESSOR_TAG) {
|
|
53832
53841
|
const accounts = instruction.accounts;
|
|
53833
|
-
if (!deploymentCoverage || !indexedPool || instruction.data.length !== 1 || accounts.length !== 15 || accounts[0] === accounts[1] || accounts[2] !== successionRecordAddress(program, accounts[0]) || accounts[5] !== poolSnapshot.mint
|
|
53842
|
+
if (!deploymentCoverage || !indexedPool || instruction.data.length !== 1 || accounts.length !== 15 || accounts[0] === accounts[1] || accounts[2] !== successionRecordAddress(program, accounts[0]) || accounts[5] !== b58(poolSnapshot.mint) || accounts[7] !== b58(TOKEN_PROGRAM_ID) || accounts[8] !== e1TreeAddress2(accounts[0], programString) || accounts[9] !== e1TreeAddress2(accounts[1], programString) || accounts[10] !== deploymentCoverage.programDataAddress || accounts[12] !== SYSTEM_PROGRAM || accounts[13] !== successionInboundAddress(program, accounts[0]) || accounts[14] !== successionInboundAddress(program, accounts[1])) {
|
|
53834
53843
|
throw new Error("p03_history_link_successor_invalid");
|
|
53835
53844
|
}
|
|
53836
53845
|
successionAt(instruction, "link_successor");
|
|
53837
53846
|
if (accounts[0] === poolString) {
|
|
53838
|
-
if (retired || linkedTo !== void 0 || accounts[3] !== poolSnapshot.vault
|
|
53847
|
+
if (retired || linkedTo !== void 0 || accounts[3] !== b58(poolSnapshot.vault) || accounts[6] !== vaultAuthorityAddress3(program, pool2).toBase58()) {
|
|
53839
53848
|
throw new Error("p03_history_link_successor_invalid");
|
|
53840
53849
|
}
|
|
53841
53850
|
retired = true;
|
|
53842
53851
|
linkedTo = Object.freeze({ successor: accounts[1], record: accounts[2], ...positionOf(instruction) });
|
|
53843
53852
|
} else if (accounts[1] === poolString) {
|
|
53844
|
-
if (retired || accounts[4] !== poolSnapshot.vault
|
|
53853
|
+
if (retired || accounts[4] !== b58(poolSnapshot.vault)) throw new Error("p03_history_link_successor_invalid");
|
|
53845
53854
|
predecessors.push(Object.freeze({ predecessor: accounts[0], record: accounts[2], ...positionOf(instruction) }));
|
|
53846
53855
|
} else {
|
|
53847
53856
|
throw new Error("p03_history_link_successor_invalid");
|
|
@@ -53850,7 +53859,7 @@ function rebuildContexts({
|
|
|
53850
53859
|
}
|
|
53851
53860
|
if (tag2 === IMPORT_REPLAY_LEAVES_TAG) {
|
|
53852
53861
|
const accounts = instruction.accounts;
|
|
53853
|
-
if (!indexedPool || retired || accounts.length !== 5 || accounts[1] !== poolString || accounts[2] !==
|
|
53862
|
+
if (!indexedPool || retired || accounts.length !== 5 || accounts[1] !== poolString || accounts[2] !== e1TreeAddress2(poolString, programString) || accounts[4] !== successionInboundAddress(program, poolString)) {
|
|
53854
53863
|
throw new Error("p03_history_import_replay_invalid");
|
|
53855
53864
|
}
|
|
53856
53865
|
canonicalKey(accounts[0], "import_record");
|
|
@@ -53867,15 +53876,15 @@ function rebuildContexts({
|
|
|
53867
53876
|
}
|
|
53868
53877
|
if (tag2 === SWEEP_PREDECESSOR_VAULT_TAG) {
|
|
53869
53878
|
const accounts = instruction.accounts;
|
|
53870
|
-
if (!indexedPool || instruction.data.length !== 1 || accounts.length !== 8 || accounts[1] === accounts[2] || accounts[0] !== successionRecordAddress(program, accounts[1]) || accounts[5] !== poolSnapshot.mint
|
|
53879
|
+
if (!indexedPool || instruction.data.length !== 1 || accounts.length !== 8 || accounts[1] === accounts[2] || accounts[0] !== successionRecordAddress(program, accounts[1]) || accounts[5] !== b58(poolSnapshot.mint) || accounts[7] !== b58(TOKEN_PROGRAM_ID)) {
|
|
53871
53880
|
throw new Error("p03_history_sweep_invalid");
|
|
53872
53881
|
}
|
|
53873
53882
|
if (accounts[1] === poolString) {
|
|
53874
|
-
if (!retired || accounts[3] !== poolSnapshot.vault
|
|
53883
|
+
if (!retired || accounts[3] !== b58(poolSnapshot.vault) || accounts[6] !== vaultAuthorityAddress3(program, pool2).toBase58()) {
|
|
53875
53884
|
throw new Error("p03_history_sweep_invalid");
|
|
53876
53885
|
}
|
|
53877
53886
|
} else if (accounts[2] === poolString) {
|
|
53878
|
-
if (retired || accounts[4] !== poolSnapshot.vault
|
|
53887
|
+
if (retired || accounts[4] !== b58(poolSnapshot.vault)) throw new Error("p03_history_sweep_invalid");
|
|
53879
53888
|
} else {
|
|
53880
53889
|
throw new Error("p03_history_sweep_invalid");
|
|
53881
53890
|
}
|
|
@@ -53988,7 +53997,7 @@ function rebuildContexts({
|
|
|
53988
53997
|
broadcaster: instruction.accounts[2],
|
|
53989
53998
|
settleData: instruction.data,
|
|
53990
53999
|
replayValues: transitionReplayValues.map(fieldHex),
|
|
53991
|
-
tokenProgram: TOKEN_PROGRAM_ID
|
|
54000
|
+
tokenProgram: b58(TOKEN_PROGRAM_ID)
|
|
53992
54001
|
});
|
|
53993
54002
|
}
|
|
53994
54003
|
if (profile.indexed === true) {
|
|
@@ -54103,16 +54112,16 @@ function p03SuccessorMovedReplayValues(successorReport, sourceDomain) {
|
|
|
54103
54112
|
return Object.freeze([...new Set(report.contexts.filter((context) => context.kind === "move" && context.sourceDomain === domain3).flatMap((context) => context.replayValues.map(String)))].sort());
|
|
54104
54113
|
}
|
|
54105
54114
|
function successionRecordAddress(program, poolBase58) {
|
|
54106
|
-
return import_web396.PublicKey.findProgramAddressSync(
|
|
54115
|
+
return memo(`sr|${b58(program)}|${poolBase58}`, () => import_web396.PublicKey.findProgramAddressSync(
|
|
54107
54116
|
[Buffer.from("sx402-succ"), canonicalKey(poolBase58, "succession_pool").toBuffer()],
|
|
54108
54117
|
program
|
|
54109
|
-
)[0].toBase58();
|
|
54118
|
+
)[0].toBase58());
|
|
54110
54119
|
}
|
|
54111
54120
|
function successionInboundAddress(program, poolBase58) {
|
|
54112
|
-
return import_web396.PublicKey.findProgramAddressSync(
|
|
54121
|
+
return memo(`si|${b58(program)}|${poolBase58}`, () => import_web396.PublicKey.findProgramAddressSync(
|
|
54113
54122
|
[Buffer.from("sx402-succ-in"), canonicalKey(poolBase58, "succession_pool").toBuffer()],
|
|
54114
54123
|
program
|
|
54115
|
-
)[0].toBase58();
|
|
54124
|
+
)[0].toBase58());
|
|
54116
54125
|
}
|
|
54117
54126
|
function decodeImportValues(data) {
|
|
54118
54127
|
const invalid4 = () => {
|
|
@@ -54191,7 +54200,7 @@ function validateInitializationBinding(instruction, snapshot, { settlerRotated =
|
|
|
54191
54200
|
const data = instruction.data;
|
|
54192
54201
|
const expectedAnchorMode = data[0] === 0 ? 0 : 1;
|
|
54193
54202
|
const anchorModeMatches = snapshot.anchorMode === expectedAnchorMode || expectedAnchorMode === 0 && snapshot.anchorMode === 2;
|
|
54194
|
-
if (!anchorModeMatches || instruction.accounts[1] !== snapshot.mint
|
|
54203
|
+
if (!anchorModeMatches || instruction.accounts[1] !== b58(snapshot.mint) || instruction.accounts[2] !== b58(snapshot.vault) || data[65] !== snapshot.decimals || !settlerRotated && !data.subarray(66, 98).equals(snapshot.paymentSettler.toBuffer())) {
|
|
54195
54204
|
throw new Error("p03_history_initialization_snapshot_binding_invalid");
|
|
54196
54205
|
}
|
|
54197
54206
|
}
|
|
@@ -54210,14 +54219,14 @@ function sameP03PoolPolicy(left, right) {
|
|
|
54210
54219
|
function validateSettlementAccounts(instruction, profile, program, pool2) {
|
|
54211
54220
|
if (profile.move === true) {
|
|
54212
54221
|
const accounts2 = instruction.accounts;
|
|
54213
|
-
if (accounts2.length !== profile.accountCount || accounts2[0] !== pool2
|
|
54222
|
+
if (accounts2.length !== profile.accountCount || accounts2[0] !== b58(pool2) || accounts2[3] !== b58(import_web396.SystemProgram.programId) || accounts2[4] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY) || accounts2[5] !== e1TreeAddress2(b58(pool2), b58(program)) || accounts2[6] !== successionInboundAddress(program, b58(pool2))) {
|
|
54214
54223
|
throw new Error("p03_history_move_accounts_invalid");
|
|
54215
54224
|
}
|
|
54216
54225
|
canonicalKey(accounts2[2], "move_record");
|
|
54217
54226
|
return;
|
|
54218
54227
|
}
|
|
54219
54228
|
const accounts = settlementAccountsByLegacyIndex(instruction, profile);
|
|
54220
|
-
if (instruction.accounts.length !== profile.accountCount || accounts[0] !== pool2
|
|
54229
|
+
if (instruction.accounts.length !== profile.accountCount || accounts[0] !== b58(pool2)) {
|
|
54221
54230
|
throw new Error("p03_history_settlement_accounts_invalid");
|
|
54222
54231
|
}
|
|
54223
54232
|
if (profile.compressed === true) {
|
|
@@ -54225,19 +54234,19 @@ function validateSettlementAccounts(instruction, profile, program, pool2) {
|
|
|
54225
54234
|
const start = accounts.length - light.length;
|
|
54226
54235
|
if (light.some((key, index) => accounts[start + index] !== key)) throw new Error("p03_history_light_section_invalid");
|
|
54227
54236
|
}
|
|
54228
|
-
if (profile.indexed === true && instruction.accounts[instruction.accounts.length - 1] !==
|
|
54237
|
+
if (profile.indexed === true && instruction.accounts[instruction.accounts.length - 1] !== e1TreeAddress2(b58(pool2), b58(program))) {
|
|
54229
54238
|
throw new Error("p03_history_e1_tree_account_invalid");
|
|
54230
54239
|
}
|
|
54231
54240
|
if (profile.kind === "deposit") {
|
|
54232
|
-
if (accounts[7] !== TOKEN_PROGRAM_ID
|
|
54241
|
+
if (accounts[7] !== b58(TOKEN_PROGRAM_ID) || accounts[8] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY) || accounts[10] !== b58(import_web396.SystemProgram.programId)) {
|
|
54233
54242
|
throw new Error("p03_history_deposit_accounts_invalid");
|
|
54234
54243
|
}
|
|
54235
54244
|
} else if (profile.kind === "payment") {
|
|
54236
|
-
if (accounts[3] !== import_web396.SystemProgram.programId
|
|
54245
|
+
if (accounts[3] !== b58(import_web396.SystemProgram.programId) || accounts[4] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY)) {
|
|
54237
54246
|
throw new Error("p03_history_payment_accounts_invalid");
|
|
54238
54247
|
}
|
|
54239
54248
|
} else {
|
|
54240
|
-
if (accounts[7] !== TOKEN_PROGRAM_ID
|
|
54249
|
+
if (accounts[7] !== b58(TOKEN_PROGRAM_ID) || accounts[8] !== b58(import_web396.SystemProgram.programId) || accounts[9] !== b58(import_web396.SYSVAR_CLOCK_PUBKEY) || accounts[6] !== vaultAuthorityAddress3(program, pool2).toBase58()) {
|
|
54241
54250
|
throw new Error("p03_history_exit_accounts_invalid");
|
|
54242
54251
|
}
|
|
54243
54252
|
}
|
|
@@ -54250,13 +54259,13 @@ function settlementAccountsByLegacyIndex(instruction, profile) {
|
|
|
54250
54259
|
function validateCircuitBoundAccounts(instruction, profile, publicInputs, program, pool2, snapshot, settler) {
|
|
54251
54260
|
const accounts = settlementAccountsByLegacyIndex(instruction, profile);
|
|
54252
54261
|
if (profile.kind === "deposit") {
|
|
54253
|
-
if (accounts[4] !== snapshot.mint
|
|
54262
|
+
if (accounts[4] !== b58(snapshot.mint) || accounts[5] !== b58(snapshot.vault) || accounts[6] !== depositAuthorityAddress3(program, pool2, fieldHex(publicInputs[3])).toBase58()) {
|
|
54254
54263
|
throw new Error("p03_history_deposit_binding_invalid");
|
|
54255
54264
|
}
|
|
54256
|
-
const intent = import_web396.PublicKey.findProgramAddressSync(
|
|
54265
|
+
const intent = memo(`di|${b58(program)}|${b58(pool2)}|${fieldHex(publicInputs[3])}`, () => import_web396.PublicKey.findProgramAddressSync(
|
|
54257
54266
|
[Buffer.from("deposit-intent"), pool2.toBuffer(), Buffer.from(fieldHex(publicInputs[3]), "hex")],
|
|
54258
54267
|
program
|
|
54259
|
-
)[0].toBase58();
|
|
54268
|
+
)[0].toBase58());
|
|
54260
54269
|
if (accounts[9] !== intent) throw new Error("p03_history_deposit_intent_invalid");
|
|
54261
54270
|
return;
|
|
54262
54271
|
}
|
|
@@ -54264,7 +54273,7 @@ function validateCircuitBoundAccounts(instruction, profile, publicInputs, progra
|
|
|
54264
54273
|
throw new Error("p03_history_payment_settler_invalid");
|
|
54265
54274
|
}
|
|
54266
54275
|
if (profile.kind === "withdraw" || profile.kind === "note-exit") {
|
|
54267
|
-
if (accounts[4] !== snapshot.mint
|
|
54276
|
+
if (accounts[4] !== b58(snapshot.mint) || accounts[5] !== b58(snapshot.vault)) {
|
|
54268
54277
|
throw new Error("p03_history_exit_binding_invalid");
|
|
54269
54278
|
}
|
|
54270
54279
|
if (u160Commitment2(new import_web396.PublicKey(accounts[3]).toBytes()) !== publicInputs[4]) {
|
|
@@ -54375,7 +54384,7 @@ function base58Decode(value) {
|
|
|
54375
54384
|
while (zeros < value.length && value[zeros] === "1") zeros += 1;
|
|
54376
54385
|
return Uint8Array.from(Buffer.concat([Buffer.alloc(zeros), body]));
|
|
54377
54386
|
}
|
|
54378
|
-
var import_web396, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, WIDEN_ANCHOR_RING_TAG, WIDE_ANCHOR_RING_POOL_BYTES, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_STEP_OF_BASE, LAGGING_NODE_MAX_RETRIES, LAGGING_NODE_FAST_RETRIES, LAGGING_NODE_SLOW_STEP_OF_BASE, LAGGING_NODE_RPC_CODES;
|
|
54387
|
+
var import_web396, b58Cache, b58, REPLAY_STORE_INDEXED, CLOSE_REPLAY_TREE_TAG, EXTEND_ANCHOR_RING_TAG, WIDEN_ANCHOR_RING_TAG, WIDE_ANCHOR_RING_POOL_BYTES, LINK_SUCCESSOR_TAG, IMPORT_REPLAY_LEAVES_TAG, SETTLE_MOVE_TAG, SWEEP_PREDECESSOR_VAULT_TAG, RELINK_SUCCESSOR_TAG, ROTATE_PAYMENT_SETTLER_TAG, IMPORT_A_LEAF_BYTES, IMPORT_MEMBERSHIP_BYTES, IMPORT_PRESENT_SHIFT, IMPORT_MAX_ENTRIES, MOVE_HEAD_BYTES, MOVE_INSERTED_VALUES, DEFAULT_KEY, FIELD_BYTES2, PRIMARY_PROOF_BYTES, SUBTREE_LEAVES, PAGE_SIZE, FIELD_MODULUS3, BPF_LOADER_UPGRADEABLE_PROGRAM_ID, SYSTEM_PROGRAM, TEST_EXECUTABLES, derivationMemo, memo, reviewedExecutables, isProgramDataIdentityError, ASSUMED_ORIGINAL_EXECUTABLE, AUTHENTICATED_HISTORY_REPORTS, HISTORY_ATTESTATIONS, hasExecutableEvidence, P03_FINALIZED_HISTORY_SOURCE_MODEL, P03_PROGRAMDATA_COVERAGE_SOURCE_MODEL, P03_RUN_RECOVER_UNAVAILABLE_FROM_CHAIN, PROFILES, P03_SETTLEMENT_TAGS, P03_INLINE_SETTLEMENT_TAGS, P03_PAYMENT_REPLAY_INDICES, NO_CONTEXTS, REFRESH_READ_BYTES, E1_TREE_HEADER_BYTES, HISTORY_FETCH_CONCURRENCY, HISTORY_BULK_TRANSACTIONS, HISTORY_BULK_ADDRESSES, TRANSIENT_RPC_ATTEMPTS, TRANSIENT_RPC_BASE_DELAY_MS, LAGGING_NODE_STEP_OF_BASE, LAGGING_NODE_MAX_RETRIES, LAGGING_NODE_FAST_RETRIES, LAGGING_NODE_SLOW_STEP_OF_BASE, LAGGING_NODE_RPC_CODES;
|
|
54379
54388
|
var init_walk = __esm({
|
|
54380
54389
|
"wallet/src/history/walk.mjs"() {
|
|
54381
54390
|
"use strict";
|
|
@@ -54389,6 +54398,15 @@ var init_walk = __esm({
|
|
|
54389
54398
|
init_compressedReplay();
|
|
54390
54399
|
init_p03E1Tree();
|
|
54391
54400
|
init_genericHistory();
|
|
54401
|
+
b58Cache = /* @__PURE__ */ new WeakMap();
|
|
54402
|
+
b58 = (key) => {
|
|
54403
|
+
let text3 = b58Cache.get(key);
|
|
54404
|
+
if (text3 === void 0) {
|
|
54405
|
+
text3 = key.toBase58();
|
|
54406
|
+
b58Cache.set(key, text3);
|
|
54407
|
+
}
|
|
54408
|
+
return text3;
|
|
54409
|
+
};
|
|
54392
54410
|
REPLAY_STORE_INDEXED = 2;
|
|
54393
54411
|
CLOSE_REPLAY_TREE_TAG = 27;
|
|
54394
54412
|
EXTEND_ANCHOR_RING_TAG = 29;
|
|
@@ -54415,8 +54433,17 @@ var init_walk = __esm({
|
|
|
54415
54433
|
BPF_LOADER_UPGRADEABLE_PROGRAM_ID = new import_web396.PublicKey(
|
|
54416
54434
|
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
54417
54435
|
);
|
|
54418
|
-
SYSTEM_PROGRAM = import_web396.SystemProgram.programId
|
|
54436
|
+
SYSTEM_PROGRAM = b58(import_web396.SystemProgram.programId);
|
|
54419
54437
|
TEST_EXECUTABLES = [];
|
|
54438
|
+
derivationMemo = /* @__PURE__ */ new Map();
|
|
54439
|
+
memo = (key, make) => {
|
|
54440
|
+
let value = derivationMemo.get(key);
|
|
54441
|
+
if (value === void 0) {
|
|
54442
|
+
value = make();
|
|
54443
|
+
derivationMemo.set(key, value);
|
|
54444
|
+
}
|
|
54445
|
+
return value;
|
|
54446
|
+
};
|
|
54420
54447
|
reviewedExecutables = () => [...p03ReviewedExecutables(), ...TEST_EXECUTABLES];
|
|
54421
54448
|
isProgramDataIdentityError = (error) => /\bp03_history_programdata_(identity|deployment_slot)_invalid\b/.test(String(error?.message ?? ""));
|
|
54422
54449
|
ASSUMED_ORIGINAL_EXECUTABLE = p03ReviewedExecutable(P03_COMPATIBLE_CODE.previous);
|
|
@@ -60082,11 +60109,11 @@ function openRecoveryCache(store, { programId, pool: pool2 }) {
|
|
|
60082
60109
|
if (read.value.programId !== programId || read.value.pool !== pool2 || !Array.isArray(read.value.memos)) {
|
|
60083
60110
|
throw new Error("recovery_cache_identity_mismatch");
|
|
60084
60111
|
}
|
|
60085
|
-
for (const
|
|
60086
|
-
if (typeof
|
|
60112
|
+
for (const memo2 of read.value.memos) {
|
|
60113
|
+
if (typeof memo2?.digest !== "string" || !/^[0-9a-f]{64}$/.test(memo2.digest) || typeof memo2.binding !== "string" || !Array.isArray(memo2.outputs)) throw new Error("recovery_cache_value_invalid");
|
|
60087
60114
|
entries.set(
|
|
60088
|
-
entryKey(
|
|
60089
|
-
{ digest:
|
|
60115
|
+
entryKey(memo2.digest, memo2.binding),
|
|
60116
|
+
{ digest: memo2.digest, binding: memo2.binding, outputs: memo2.outputs.map(decodeOutput) }
|
|
60090
60117
|
);
|
|
60091
60118
|
}
|
|
60092
60119
|
} catch {
|
|
@@ -60672,8 +60699,7 @@ function prefetchRecoveryMemos({ store, finalizedHistory: finalizedHistory2, ser
|
|
|
60672
60699
|
const cache = openRecoveryCache(store, { programId: new import_web3102.PublicKey(programId).toBase58(), pool: new import_web3102.PublicKey(store.state.pool).toBase58() });
|
|
60673
60700
|
const pending = finalizedHistory2.contexts.filter((context) => !cache?.lookup(hexOf2(context.memoDigest), context)).map((context) => hexOf2(context.memoDigest));
|
|
60674
60701
|
if (pending.length === 0) return;
|
|
60675
|
-
createMemoReader(serviceUrl2, { fetchImpl: deps.fetchImpl ?? fetch, notice:
|
|
60676
|
-
} }).prefetch(pending);
|
|
60702
|
+
createMemoReader(serviceUrl2, { fetchImpl: deps.fetchImpl ?? fetch, ...deps.notice ? { notice: deps.notice } : {} }).prefetch(pending);
|
|
60677
60703
|
warmMemoDecryptPool();
|
|
60678
60704
|
} catch {
|
|
60679
60705
|
}
|
|
@@ -72252,18 +72278,39 @@ function preflightSpend({ account: account2, notes, accountPath, notePaths, amou
|
|
|
72252
72278
|
changeAtomic: (inputTotal - amount).toString()
|
|
72253
72279
|
});
|
|
72254
72280
|
}
|
|
72255
|
-
function respendNoteSubset({ accounts, notes, outputIndex, amountAtomic }) {
|
|
72281
|
+
function respendNoteSubset({ accounts, notes, outputIndex, amountAtomic, refusedInput }) {
|
|
72256
72282
|
const out = BigInt(outputIndex);
|
|
72257
72283
|
const want = BigInt(amountAtomic);
|
|
72258
72284
|
const value = (taken) => taken.reduce((sum2, note) => sum2 + BigInt(note.note.b), 0n);
|
|
72285
|
+
const sets = (fits) => {
|
|
72286
|
+
const byLeaf = (left, right) => {
|
|
72287
|
+
const a = BigInt(left.leafIndex);
|
|
72288
|
+
const b = BigInt(right.leafIndex);
|
|
72289
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
72290
|
+
};
|
|
72291
|
+
const byValue = (left, right) => {
|
|
72292
|
+
const a = BigInt(left.note.b);
|
|
72293
|
+
const b = BigInt(right.note.b);
|
|
72294
|
+
return a > b ? -1 : a < b ? 1 : byLeaf(left, right);
|
|
72295
|
+
};
|
|
72296
|
+
const plain = [[...fits].sort(byLeaf).slice(0, MAX_RESPEND_NOTES), [...fits].sort(byValue).slice(0, MAX_RESPEND_NOTES)];
|
|
72297
|
+
const refused = refusedInput === void 0 ? [] : fits.filter(refusedInput).sort(byLeaf).slice(0, MAX_RESPEND_NOTES);
|
|
72298
|
+
if (refused.length === 0) return { refused: [], plain };
|
|
72299
|
+
const rest = fits.filter((note) => !refused.includes(note));
|
|
72300
|
+
const fill = (order) => [...refused, ...[...rest].sort(order).slice(0, MAX_RESPEND_NOTES - refused.length)];
|
|
72301
|
+
return { refused: [fill(byLeaf), fill(byValue)], plain };
|
|
72302
|
+
};
|
|
72303
|
+
const candidates = [];
|
|
72259
72304
|
for (const account2 of accounts) {
|
|
72260
72305
|
const accountI = BigInt(account2.account.i);
|
|
72261
72306
|
if (out <= accountI || account2.leafIndex !== void 0 && account2.leafIndex !== null && BigInt(account2.leafIndex) >= out) continue;
|
|
72262
|
-
|
|
72263
|
-
|
|
72264
|
-
|
|
72265
|
-
for (const
|
|
72266
|
-
|
|
72307
|
+
candidates.push({ account: account2, ...sets(notes.filter((note) => BigInt(note.leafIndex) >= accountI && BigInt(note.leafIndex) < out)) });
|
|
72308
|
+
}
|
|
72309
|
+
for (const pass of ["refused", "plain"]) {
|
|
72310
|
+
for (const candidate of candidates) {
|
|
72311
|
+
for (const taken of candidate[pass]) {
|
|
72312
|
+
if (BigInt(candidate.account.account.b) + value(taken) >= want) return Object.freeze(taken);
|
|
72313
|
+
}
|
|
72267
72314
|
}
|
|
72268
72315
|
}
|
|
72269
72316
|
return void 0;
|
|
@@ -72470,6 +72517,15 @@ async function prepareRecoveredPayment({
|
|
|
72470
72517
|
const exitReserved = exitReservedNoteCommitments(store);
|
|
72471
72518
|
const notes = unspentNotes.filter((entry) => !heldByPending(entry) && !exitReserved.has(BigInt(entry.commitment).toString()));
|
|
72472
72519
|
const held = accounts.length !== unspentAccounts.length || unspentNotes.filter((entry) => !exitReserved.has(BigInt(entry.commitment).toString())).length !== notes.length;
|
|
72520
|
+
let refusedValues;
|
|
72521
|
+
const refusedInput = typeof deps.refusedReplayValues !== "function" ? void 0 : (entry) => {
|
|
72522
|
+
try {
|
|
72523
|
+
refusedValues ??= deps.refusedReplayValues();
|
|
72524
|
+
return refusedValues instanceof Set && refusedValues.size > 0 && entry.leafIndex !== void 0 && entry.leafIndex !== null && refusedValues.has(noteNullifier2(poolDomain, entry.commitment, viewing.eta, entry.leafIndex).toString());
|
|
72525
|
+
} catch {
|
|
72526
|
+
return false;
|
|
72527
|
+
}
|
|
72528
|
+
};
|
|
72473
72529
|
const wantedNotes = selection?.noteCommitments !== void 0 ? selection.noteCommitments.map((commitment) => {
|
|
72474
72530
|
const wanted = BigInt(commitment);
|
|
72475
72531
|
const found = notes.find((entry) => BigInt(entry.commitment) === wanted);
|
|
@@ -72481,7 +72537,8 @@ async function prepareRecoveredPayment({
|
|
|
72481
72537
|
accounts: selection?.accountCommitment === void 0 ? accounts : accounts.filter((entry) => BigInt(entry.commitment) === BigInt(selection.accountCommitment)),
|
|
72482
72538
|
notes,
|
|
72483
72539
|
outputIndex: anchor.index,
|
|
72484
|
-
amountAtomic: witnessQuote.amountAtomic
|
|
72540
|
+
amountAtomic: witnessQuote.amountAtomic,
|
|
72541
|
+
refusedInput
|
|
72485
72542
|
}) ?? notes : notes;
|
|
72486
72543
|
const accountFile = selection?.accountFile;
|
|
72487
72544
|
let account2;
|
|
@@ -72539,11 +72596,12 @@ async function prepareRecoveredPayment({
|
|
|
72539
72596
|
const notesValue = wantedNotes.reduce((sum2, note) => sum2 + BigInt(note.note.b), 0n);
|
|
72540
72597
|
const pays = (candidate) => candidate !== void 0 && BigInt(candidate.account.b) + notesValue >= BigInt(witnessQuote.amountAtomic);
|
|
72541
72598
|
if (held && !pays(underAnchor)) heldInputsWait();
|
|
72542
|
-
|
|
72599
|
+
const laterNotes = wantedNotes.length > MAX_RESPEND_NOTES && selection?.noteCommitments === void 0 ? respendNoteSubset({ accounts, notes, outputIndex: history.finalizedPoolSnapshot.currentIndex, amountAtomic: witnessQuote.amountAtomic }) : void 0;
|
|
72600
|
+
if (!pays(underAnchor) && (laterNotes !== void 0 || pays(selectSpendAccount({
|
|
72543
72601
|
accounts,
|
|
72544
72602
|
notes: wantedNotes,
|
|
72545
72603
|
outputIndex: history.finalizedPoolSnapshot.currentIndex
|
|
72546
|
-
}).account)) {
|
|
72604
|
+
}).account))) {
|
|
72547
72605
|
throw new Error("p03_quote_anchor_older_than_note_wait_next_epoch");
|
|
72548
72606
|
}
|
|
72549
72607
|
account2 = underAnchor ?? accounts[0];
|
|
@@ -91094,6 +91152,9 @@ async function finalizedPocketBalance({ connection, entry, state }) {
|
|
|
91094
91152
|
} catch (error) {
|
|
91095
91153
|
fail17("pocket_balance_unreadable", { cause: error });
|
|
91096
91154
|
}
|
|
91155
|
+
return pocketBalanceOf(info, entry, state);
|
|
91156
|
+
}
|
|
91157
|
+
function pocketBalanceOf(info, entry, state) {
|
|
91097
91158
|
if (info === null) return 0n;
|
|
91098
91159
|
let account2;
|
|
91099
91160
|
try {
|
|
@@ -91699,14 +91760,20 @@ function floatOffer({ paymentRequired, store, config }) {
|
|
|
91699
91760
|
return { requirement, priceAtomic, feeAtomic, paidAtomic: (BigInt(priceAtomic) + BigInt(feeAtomic)).toString(), config };
|
|
91700
91761
|
}
|
|
91701
91762
|
async function ownRefundAddress(store, connection) {
|
|
91702
|
-
const
|
|
91703
|
-
|
|
91704
|
-
|
|
91763
|
+
const poolKey = `${store.state.network}:${store.state.pool}`;
|
|
91764
|
+
let poolDomain = poolDomains.get(poolKey);
|
|
91765
|
+
if (poolDomain === void 0) {
|
|
91766
|
+
const pool2 = await readPoolState2(connection, new import_web3109.PublicKey(store.state.pool));
|
|
91767
|
+
if (!pool2?.poolDomain) fail18("p03_float_pool_unreadable_retry_same_request");
|
|
91768
|
+
poolDomain = BigInt(pool2.poolDomain);
|
|
91769
|
+
poolDomains.set(poolKey, poolDomain);
|
|
91770
|
+
}
|
|
91771
|
+
payerGenerator ??= JSON.parse(readFileSync(fileURLToPath9(new URL(
|
|
91705
91772
|
"../../vendor/shielded-x402-model/vectors/rust-vectors.json",
|
|
91706
91773
|
new URL("__bundled_source__/wallet/src/pay/floatPay.mjs", import.meta.url).href
|
|
91707
91774
|
)), "utf8")).payerKeys.generator;
|
|
91708
|
-
const { eta } = deriveWalletViewingAuthority2({ seedBytes: Uint8Array.from(Buffer.from(store.state.seedHex, "hex")), generator:
|
|
91709
|
-
return deriveShieldedSolanaP03Recipient({ eta, poolDomain
|
|
91775
|
+
const { eta } = deriveWalletViewingAuthority2({ seedBytes: Uint8Array.from(Buffer.from(store.state.seedHex, "hex")), generator: payerGenerator });
|
|
91776
|
+
return deriveShieldedSolanaP03Recipient({ eta, poolDomain, resourceNonce: randomBytes11(32) }).payTo;
|
|
91710
91777
|
}
|
|
91711
91778
|
function canonicalBody({ requestId, resourceUrl, requirement, refundTo }) {
|
|
91712
91779
|
const opaque = `w-${hash8(`carbon-road/float-request/v1|${requestId}`).slice(0, 40)}`;
|
|
@@ -92035,7 +92102,7 @@ function paidResult(record, replayed) {
|
|
|
92035
92102
|
float: { floatId: record.floatId }
|
|
92036
92103
|
};
|
|
92037
92104
|
}
|
|
92038
|
-
var import_web3109, FLOAT_PAYMENT_SCHEMA, REGENERATE_CODES, FLOAT_PAYMENT_WAL_PREFIX, FLOAT_CONFIG_SCHEMA, FLOAT_PAY_PATH, MAX_BODY_BYTES, FLOAT_REFUND_ETA_SECONDS, REFUND_SETTLED_AFTER_MS, FINISHING_POLL_MS, FINISHING_LIMIT_MS, SELLER_TIMEOUT_MS, CONFIG_TIMEOUT_MS, CONFIG_CACHE_MS, DECIMAL3, POSITIVE, PENDING_CODES, hash8, fail18, floatPaymentWalName, configCache, plainText;
|
|
92105
|
+
var import_web3109, FLOAT_PAYMENT_SCHEMA, REGENERATE_CODES, FLOAT_PAYMENT_WAL_PREFIX, FLOAT_CONFIG_SCHEMA, FLOAT_PAY_PATH, MAX_BODY_BYTES, FLOAT_REFUND_ETA_SECONDS, REFUND_SETTLED_AFTER_MS, FINISHING_POLL_MS, FINISHING_LIMIT_MS, SELLER_TIMEOUT_MS, CONFIG_TIMEOUT_MS, CONFIG_CACHE_MS, DECIMAL3, POSITIVE, PENDING_CODES, hash8, fail18, floatPaymentWalName, configCache, poolDomains, payerGenerator, plainText;
|
|
92039
92106
|
var init_floatPay = __esm({
|
|
92040
92107
|
"wallet/src/pay/floatPay.mjs"() {
|
|
92041
92108
|
"use strict";
|
|
@@ -92074,6 +92141,7 @@ var init_floatPay = __esm({
|
|
|
92074
92141
|
};
|
|
92075
92142
|
floatPaymentWalName = (requestKey) => `${FLOAT_PAYMENT_WAL_PREFIX}${requestKey}`;
|
|
92076
92143
|
configCache = /* @__PURE__ */ new Map();
|
|
92144
|
+
poolDomains = /* @__PURE__ */ new Map();
|
|
92077
92145
|
plainText = (value) => value.replace(/[^ -~]+/g, " ").trim().slice(0, 300);
|
|
92078
92146
|
}
|
|
92079
92147
|
});
|
|
@@ -93029,7 +93097,23 @@ async function payResourceOnce({
|
|
|
93029
93097
|
deps: {
|
|
93030
93098
|
...deps,
|
|
93031
93099
|
quoteMarginSeconds: QUOTE_MARGIN_SECONDS,
|
|
93032
|
-
...held.size > 0 ? { reservedReplayValues: new Set(held) } : {}
|
|
93100
|
+
...held.size > 0 ? { reservedReplayValues: new Set(held) } : {},
|
|
93101
|
+
// The inputs of this wallet's open refused payments (the records
|
|
93102
|
+
// assertRefusedPaymentsCannotLand reads), asked only by a default spend
|
|
93103
|
+
// of more than 3 notes: its 3-note set then spends one (steps, 2026-10-15).
|
|
93104
|
+
refusedReplayValues: () => {
|
|
93105
|
+
const values = /* @__PURE__ */ new Set();
|
|
93106
|
+
for (const name of store.listWal()) {
|
|
93107
|
+
if (!name.startsWith("resource-payment-") || name === walName2) continue;
|
|
93108
|
+
const refused = readPriorPayment(store, name);
|
|
93109
|
+
if (refused === FINAL_UNCHANGED || refused?.state !== "cancelled" || !refused.refused || refused.refused.resolved || refused.paymentHeader === void 0) continue;
|
|
93110
|
+
try {
|
|
93111
|
+
for (const value of replayValuesOf(refused.paymentHeader)) values.add(value);
|
|
93112
|
+
} catch {
|
|
93113
|
+
}
|
|
93114
|
+
}
|
|
93115
|
+
return values;
|
|
93116
|
+
}
|
|
93033
93117
|
},
|
|
93034
93118
|
walName: `resource-proof-${requestKey}`,
|
|
93035
93119
|
quote: {
|
|
@@ -95823,8 +95907,8 @@ var init_ShieldedSolanaP03MemoScanner = __esm({
|
|
|
95823
95907
|
const record = parsed.memoBundle.subarray(offset, offset + MEMO_RECORD_BYTES);
|
|
95824
95908
|
const candidate = this.#candidateRecord(record, slot3, context);
|
|
95825
95909
|
if (candidate === void 0) continue;
|
|
95826
|
-
const
|
|
95827
|
-
if (
|
|
95910
|
+
const memo2 = this.#recoverRecord(record, slot3, context, quoteFields, candidate);
|
|
95911
|
+
if (memo2 !== void 0) recovered.push(memo2);
|
|
95828
95912
|
}
|
|
95829
95913
|
if (!quoteBindingValid || recovered.length !== 1) throw new Error("invalid");
|
|
95830
95914
|
const merchant = recovered[0];
|
|
@@ -113239,8 +113323,8 @@ function poolDomainOf(programId, pool2) {
|
|
|
113239
113323
|
if (d === 0n) throw new Error("zero pool domain");
|
|
113240
113324
|
return d;
|
|
113241
113325
|
}
|
|
113242
|
-
function memoDigest(
|
|
113243
|
-
const d = sha25611(new TextEncoder().encode(
|
|
113326
|
+
function memoDigest(memo2) {
|
|
113327
|
+
const d = sha25611(new TextEncoder().encode(memo2));
|
|
113244
113328
|
return { memoHi: beInt(d.slice(0, 16)), memoLo: beInt(d.slice(16, 32)) };
|
|
113245
113329
|
}
|
|
113246
113330
|
var FR, DEPOSIT_CT_DOMAIN, EXIT_CT_DOMAIN, EXIT_CT_AUTH_DOMAIN, BIND_DOMAIN, BIND_TAG, POOL_DOMAIN_TAG, RELATION, beInt, DEPOSIT_CT_PUBLIC, EXIT_CT_PUBLIC, TREE_APPEND_PUBLIC, depositContext, exitContext, exitAuthorizationFields, TAG, POOL_MAGIC, POOL_LEN, RING_LEN, MAX_PENDING_CREDITS, DEPOSIT_DATA_LEN, EXIT_DATA_LEN, ESCAPE_MAGIC, FXREQ_MAGIC, ESCAPE_LEN, FXREQ_LEN, FORCED_DATA_LEN, COMPLETE_DATA_LEN, ESCAPE_N_MAX, ESCAPE_MODE, ESCAPE_MAX_TIMER_S, ESCAPE_MAX_SLACK_S, ESCAPE_TRIGGER, ERR;
|
|
@@ -114111,7 +114195,7 @@ var init_witness2 = __esm({
|
|
|
114111
114195
|
WITNESS_SCHEMA = "carbon-shielded-x402/ctvault-v0b-witness/v1";
|
|
114112
114196
|
dec = (x) => x.toString();
|
|
114113
114197
|
acct = (a) => ({ d: dec(a.d), pDX: dec(a.pDX), i: dec(a.i), b: dec(a.b) });
|
|
114114
|
-
memoDigestHex2 = (
|
|
114198
|
+
memoDigestHex2 = (memo2) => `0x${createHash33("sha256").update(memo2, "utf8").digest("hex")}`;
|
|
114115
114199
|
bindFields = (b) => ({
|
|
114116
114200
|
value: dec(b.v),
|
|
114117
114201
|
blinding: dec(b.k),
|
|
@@ -117511,14 +117595,14 @@ function proveConfidentialAmount({ transactions, sourceSecretKey, amount, nonce
|
|
|
117511
117595
|
const A2b = A2.toBytes();
|
|
117512
117596
|
const c = challenge2({ nonce: nonce32, half: name, sourcePubkey: context.sourcePubkey, sourceHandle: part.sourceHandle, R: Rb, A1: A1b, A2: A2b, commitment: part.commitment });
|
|
117513
117597
|
const z = modL2(k + c * s4);
|
|
117514
|
-
out[name] = { R:
|
|
117598
|
+
out[name] = { R: b582(Rb), A1: b582(A1b), A2: b582(A2b), z: b582(bigTo32LE2(z)) };
|
|
117515
117599
|
}
|
|
117516
117600
|
for (const name of ["lo", "hi"]) {
|
|
117517
117601
|
if (!verifyHalf(name, nonce32, context.sourcePubkey, context[name], out[name], halves[name])) refuse13(`the ${name} amount proof does not verify`);
|
|
117518
117602
|
}
|
|
117519
117603
|
return out;
|
|
117520
117604
|
}
|
|
117521
|
-
var Point4, L3, G2, H2, AMOUNT_PROOF_DOMAIN, AMOUNT_PROOF_VERSION, AMOUNT_PROOF_LAYOUT_CODE, ZK_PROOF_PROGRAM2, TOKEN_2022_PROGRAM, VALIDITY_TAG, VALIDITY_DATA_BYTES, MAX_AMOUNT_EXCLUSIVE, refuse13, modL2, leToBig2, bigTo32LE2, mulPublic, mulSecret, pointOf,
|
|
117605
|
+
var Point4, L3, G2, H2, AMOUNT_PROOF_DOMAIN, AMOUNT_PROOF_VERSION, AMOUNT_PROOF_LAYOUT_CODE, ZK_PROOF_PROGRAM2, TOKEN_2022_PROGRAM, VALIDITY_TAG, VALIDITY_DATA_BYTES, MAX_AMOUNT_EXCLUSIVE, refuse13, modL2, leToBig2, bigTo32LE2, mulPublic, mulSecret, pointOf, b582, unb58;
|
|
117522
117606
|
var init_amountProof = __esm({
|
|
117523
117607
|
"wallet/src/laneb/amountProof.mjs"() {
|
|
117524
117608
|
"use strict";
|
|
@@ -117571,7 +117655,7 @@ var init_amountProof = __esm({
|
|
|
117571
117655
|
return refuse13(`the plan's ${what} is not a valid ristretto255 point`);
|
|
117572
117656
|
}
|
|
117573
117657
|
};
|
|
117574
|
-
|
|
117658
|
+
b582 = (bytes2) => kit.getBase58Decoder().decode(bytes2);
|
|
117575
117659
|
unb58 = (text3) => Uint8Array.from(kit.getAddressEncoder().encode(text3));
|
|
117576
117660
|
}
|
|
117577
117661
|
});
|
|
@@ -118918,13 +119002,13 @@ function checkConfig(value) {
|
|
|
118918
119002
|
if (value.schema !== CONFIG_SCHEMA) throw invalid3(`has no schema ${CONFIG_SCHEMA}`);
|
|
118919
119003
|
for (const name of ["pool", "program", "asset"]) if (!isPubkey(value[name])) throw invalid3(`${name} is not a base58 Solana address`);
|
|
118920
119004
|
if (typeof value.network !== "string" || !/^solana:[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(value.network)) throw invalid3("network is not a solana: CAIP-2 id");
|
|
118921
|
-
let
|
|
119005
|
+
let memo2;
|
|
118922
119006
|
try {
|
|
118923
|
-
|
|
119007
|
+
memo2 = new URL(value.memoService);
|
|
118924
119008
|
} catch {
|
|
118925
|
-
|
|
119009
|
+
memo2 = void 0;
|
|
118926
119010
|
}
|
|
118927
|
-
if (!
|
|
119011
|
+
if (!memo2 || memo2.protocol !== "https:") throw invalid3("memoService is not an https origin");
|
|
118928
119012
|
for (const name of ["proofTools", "exitProofTools", "profile", "passphraseFile", "recoveryFile"]) {
|
|
118929
119013
|
if (value[name] !== void 0 && (typeof value[name] !== "string" || !isAbsolute6(value[name]))) throw invalid3(`${name} is not an absolute path`);
|
|
118930
119014
|
}
|
|
@@ -119350,8 +119434,8 @@ function channelListsSet(body, { facilitator, pool: pool2, dir, sumsSha256 }) {
|
|
|
119350
119434
|
// wallet/src/setup/proofTools.mjs
|
|
119351
119435
|
var PINNED_PROOF_TOOLS = Object.freeze({
|
|
119352
119436
|
[DEFAULT_FACILITATOR_ORIGIN]: Object.freeze({
|
|
119353
|
-
dir: "
|
|
119354
|
-
sumsSha256: "
|
|
119437
|
+
dir: "8d8db6a0",
|
|
119438
|
+
sumsSha256: "8d8db6a0ef847031d01a2b65608e4b456c231c0d348f893e01eba4ad908907f3"
|
|
119355
119439
|
})
|
|
119356
119440
|
});
|
|
119357
119441
|
var UPDATE_NEXT = "update the wallet: npx -y shinjuku-shielded@latest setup";
|