@gvnrdao/dh-lit-actions 0.0.14 → 0.0.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/out/authorization-dummy-b.hash +1 -0
- package/out/authorization-dummy-b.js +43 -0
- package/out/authorization-dummy.hash +1 -0
- package/out/authorization-dummy.js +63 -0
- package/out/pkp-validator-datil.hash +1 -0
- package/out/pkp-validator-datil.js +231 -0
- package/out/pkp-validator.hash +1 -0
- package/out/pkp-validator.js +386 -0
- package/out/ucd-mint-validator.hash +1 -0
- package/out/ucd-mint-validator.js +2153 -0
- package/package.json +3 -2
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
// src/pkp-validator.ts
|
|
3
|
+
var runPkpValidator = async () => {
|
|
4
|
+
const targetPkpTokenId = globalThis.targetPkpTokenId;
|
|
5
|
+
const expectedCid = globalThis.expectedCid;
|
|
6
|
+
const network = globalThis.network;
|
|
7
|
+
const RPC_ENDPOINTS = {
|
|
8
|
+
"datil-test": "https://datil-test-rpc.litprotocol.com",
|
|
9
|
+
datil: "https://yellowstone-rpc.litprotocol.com"
|
|
10
|
+
};
|
|
11
|
+
const CONTRACT_ADDRESSES = {
|
|
12
|
+
"datil-test": {
|
|
13
|
+
// https://github.com/LIT-Protocol/networks/blob/main/contracts/datil-test.json
|
|
14
|
+
PKPNFT: "0x6a0f439f064B7167A8Ea6B22AcC07ae5360ee0d1",
|
|
15
|
+
PKPPermissions: "0x60C1ddC8b9e38F730F0e7B70A2F84C1A98A69167"
|
|
16
|
+
},
|
|
17
|
+
datil: {
|
|
18
|
+
// Updated contract addresses for datil mainnet - these may need verification
|
|
19
|
+
// Chronicle Yellowstone rollup deployment addresses
|
|
20
|
+
PKPNFT: "0x8F75a53F65e31DD0D2e40d0827becAaE2299D111",
|
|
21
|
+
PKPPermissions: "0x969471556e2B9DC984f4C9c24667B8B0Efb5B7F8"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const withTimeout = async (promise, timeoutMs, operation) => {
|
|
25
|
+
return Promise.race([
|
|
26
|
+
promise,
|
|
27
|
+
new Promise(
|
|
28
|
+
(_, reject) => setTimeout(() => reject(new Error(`Timeout after ${timeoutMs}ms during ${operation}`)), timeoutMs)
|
|
29
|
+
)
|
|
30
|
+
]);
|
|
31
|
+
};
|
|
32
|
+
const makeRpcCall = async (payload, endpoint, operation, maxRetries = 3) => {
|
|
33
|
+
let lastError;
|
|
34
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
35
|
+
try {
|
|
36
|
+
console.log(`\u{1F310} [Attempt ${attempt}/${maxRetries}] Making RPC call for ${operation}`);
|
|
37
|
+
console.log(` Endpoint: ${endpoint}`);
|
|
38
|
+
console.log(` Payload ID: ${payload.id}`);
|
|
39
|
+
console.log(` Method: ${payload.method}`);
|
|
40
|
+
const startTime = Date.now();
|
|
41
|
+
const response = await withTimeout(
|
|
42
|
+
fetch(endpoint, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: { "Content-Type": "application/json" },
|
|
45
|
+
body: JSON.stringify(payload)
|
|
46
|
+
}),
|
|
47
|
+
3e4,
|
|
48
|
+
// 30 second timeout
|
|
49
|
+
operation
|
|
50
|
+
);
|
|
51
|
+
const duration = Date.now() - startTime;
|
|
52
|
+
console.log(`\u23F1\uFE0F RPC call completed in ${duration}ms`);
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
55
|
+
}
|
|
56
|
+
const result = await response.json();
|
|
57
|
+
if (result.error) {
|
|
58
|
+
console.log(`\u274C RPC Error:`, result.error);
|
|
59
|
+
throw new Error(`RPC Error: ${result.error.message} (Code: ${result.error.code})`);
|
|
60
|
+
}
|
|
61
|
+
console.log(`\u2705 RPC call successful for ${operation}`);
|
|
62
|
+
console.log(` Result length: ${JSON.stringify(result).length} bytes`);
|
|
63
|
+
return result;
|
|
64
|
+
} catch (error) {
|
|
65
|
+
lastError = error;
|
|
66
|
+
console.log(`\u274C [Attempt ${attempt}/${maxRetries}] ${operation} failed: ${error.message}`);
|
|
67
|
+
if (attempt < maxRetries) {
|
|
68
|
+
const delay = Math.pow(2, attempt - 1) * 1e3;
|
|
69
|
+
console.log(`\u23F3 Retrying in ${delay}ms...`);
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
throw lastError ?? new Error(`Unknown error during ${operation}`);
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
const targetPkpTokenId2 = globalThis.targetPkpTokenId;
|
|
78
|
+
const expectedCid2 = globalThis.expectedCid;
|
|
79
|
+
const network2 = globalThis.network || "datil";
|
|
80
|
+
if (!Object.prototype.hasOwnProperty.call(RPC_ENDPOINTS, network2)) {
|
|
81
|
+
throw new Error(`Unsupported network: ${network2}`);
|
|
82
|
+
}
|
|
83
|
+
if (!targetPkpTokenId2) {
|
|
84
|
+
throw new Error("targetPkpTokenId is required in parameters");
|
|
85
|
+
}
|
|
86
|
+
if (!expectedCid2) {
|
|
87
|
+
throw new Error("expectedCid is required in parameters");
|
|
88
|
+
}
|
|
89
|
+
console.log("\n\u{1F512} PKP SECURITY VALIDATION - ENHANCED DEBUG MODE");
|
|
90
|
+
console.log("==========================================================");
|
|
91
|
+
console.log(" Using EXACT same logic as validatePKPSecurity test function");
|
|
92
|
+
console.log(" Making direct smart contract calls to verify security");
|
|
93
|
+
console.log(` Target PKP: ${targetPkpTokenId2}`);
|
|
94
|
+
console.log(` Expected CID: ${expectedCid2}`);
|
|
95
|
+
console.log(` Network: ${network2}`);
|
|
96
|
+
console.log(` Execution timestamp: ${Date.now()}`);
|
|
97
|
+
console.log("==========================================================");
|
|
98
|
+
const rpcEndpoint = RPC_ENDPOINTS[network2];
|
|
99
|
+
const LIT_CONTRACTS = CONTRACT_ADDRESSES[network2];
|
|
100
|
+
console.log("\n\u{1F527} CONFIGURATION VERIFICATION:");
|
|
101
|
+
console.log(` RPC Endpoint: ${rpcEndpoint}`);
|
|
102
|
+
console.log(` PKPNFT Contract: ${LIT_CONTRACTS.PKPNFT}`);
|
|
103
|
+
console.log(` PKPPermissions Contract: ${LIT_CONTRACTS.PKPPermissions}`);
|
|
104
|
+
console.log(` Network resolved: ${network2}`);
|
|
105
|
+
console.log("\n\u{1F310} TESTING RPC CONNECTIVITY...");
|
|
106
|
+
try {
|
|
107
|
+
const connectivityTest = {
|
|
108
|
+
method: "eth_chainId",
|
|
109
|
+
params: [],
|
|
110
|
+
id: 0,
|
|
111
|
+
jsonrpc: "2.0"
|
|
112
|
+
};
|
|
113
|
+
const chainIdResult = await makeRpcCall(connectivityTest, rpcEndpoint, "connectivity_test");
|
|
114
|
+
const chainId = parseInt(chainIdResult.result, 16);
|
|
115
|
+
console.log(`\u2705 RPC connectivity confirmed - Chain ID: ${chainId}`);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.log(`\u274C RPC connectivity failed: ${error.message}`);
|
|
118
|
+
throw new Error(`Cannot connect to RPC endpoint ${rpcEndpoint}: ${error.message}`);
|
|
119
|
+
}
|
|
120
|
+
console.log("\n\u{1F50D} STEP 1: PKP EXISTENCE CHECK");
|
|
121
|
+
console.log("====================================");
|
|
122
|
+
console.log(` Checking PKP existence for: ${targetPkpTokenId2}`);
|
|
123
|
+
console.log(` Contract: ${LIT_CONTRACTS.PKPNFT}`);
|
|
124
|
+
const existsCalldata = ethers.utils.concat([
|
|
125
|
+
ethers.utils.id("exists(uint256)").substring(0, 10),
|
|
126
|
+
// function selector
|
|
127
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [targetPkpTokenId2])
|
|
128
|
+
]);
|
|
129
|
+
console.log(` Function selector: ${ethers.utils.id("exists(uint256)").substring(0, 10)}`);
|
|
130
|
+
console.log(` Calldata: ${ethers.utils.hexlify(existsCalldata)}`);
|
|
131
|
+
const existsCall = {
|
|
132
|
+
to: LIT_CONTRACTS.PKPNFT,
|
|
133
|
+
data: ethers.utils.hexlify(existsCalldata)
|
|
134
|
+
};
|
|
135
|
+
const existsRpcPayload = {
|
|
136
|
+
method: "eth_call",
|
|
137
|
+
params: [existsCall, "latest"],
|
|
138
|
+
id: 1,
|
|
139
|
+
jsonrpc: "2.0"
|
|
140
|
+
};
|
|
141
|
+
const existsResult = await makeRpcCall(existsRpcPayload, rpcEndpoint, "PKP_existence_check");
|
|
142
|
+
const exists = ethers.utils.defaultAbiCoder.decode(
|
|
143
|
+
["bool"],
|
|
144
|
+
existsResult.result
|
|
145
|
+
)[0];
|
|
146
|
+
console.log(` Raw result: ${existsResult.result}`);
|
|
147
|
+
console.log(` Decoded result: ${exists}`);
|
|
148
|
+
console.log(`\u2705 PKP EXISTS CHECK RESULT: ${exists}`);
|
|
149
|
+
if (!exists) {
|
|
150
|
+
console.log(`\u274C CRITICAL: PKP ${targetPkpTokenId2} does not exist on-chain!`);
|
|
151
|
+
console.log(` This PKP was never minted or the token ID is incorrect`);
|
|
152
|
+
console.log(` Cannot proceed with security validation`);
|
|
153
|
+
}
|
|
154
|
+
console.log("\n\u{1F50D} STEP 2: PKP IMMUTABILITY CHECK");
|
|
155
|
+
console.log("=====================================");
|
|
156
|
+
console.log(` Checking owner status for PKP: ${targetPkpTokenId2}`);
|
|
157
|
+
const ownerOfCalldata = ethers.utils.concat([
|
|
158
|
+
ethers.utils.id("ownerOf(uint256)").substring(0, 10),
|
|
159
|
+
// function selector
|
|
160
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [targetPkpTokenId2])
|
|
161
|
+
]);
|
|
162
|
+
console.log(` Function selector: ${ethers.utils.id("ownerOf(uint256)").substring(0, 10)}`);
|
|
163
|
+
console.log(` Calldata: ${ethers.utils.hexlify(ownerOfCalldata)}`);
|
|
164
|
+
const ownerOfCall = {
|
|
165
|
+
to: LIT_CONTRACTS.PKPNFT,
|
|
166
|
+
data: ethers.utils.hexlify(ownerOfCalldata)
|
|
167
|
+
};
|
|
168
|
+
const ownerOfRpcPayload = {
|
|
169
|
+
method: "eth_call",
|
|
170
|
+
params: [ownerOfCall, "latest"],
|
|
171
|
+
id: 2,
|
|
172
|
+
jsonrpc: "2.0"
|
|
173
|
+
};
|
|
174
|
+
let owner = "0x0000000000000000000000000000000000000000";
|
|
175
|
+
let isImmutable = false;
|
|
176
|
+
if (exists) {
|
|
177
|
+
const ownerOfResult = await makeRpcCall(ownerOfRpcPayload, rpcEndpoint, "PKP_owner_check");
|
|
178
|
+
owner = ethers.utils.defaultAbiCoder.decode(
|
|
179
|
+
["address"],
|
|
180
|
+
ownerOfResult.result
|
|
181
|
+
)[0];
|
|
182
|
+
const BURN_ADDRESS = "0x000000000000000000000000000000000000dEaD";
|
|
183
|
+
isImmutable = owner.toLowerCase() === BURN_ADDRESS.toLowerCase();
|
|
184
|
+
console.log(` Raw owner result: ${ownerOfResult.result}`);
|
|
185
|
+
console.log(` Decoded owner: ${owner}`);
|
|
186
|
+
console.log(` Expected burn address: ${BURN_ADDRESS}`);
|
|
187
|
+
console.log(` Owner matches burn address: ${isImmutable}`);
|
|
188
|
+
} else {
|
|
189
|
+
console.log(` Skipping owner check - PKP does not exist`);
|
|
190
|
+
}
|
|
191
|
+
console.log(`\u2705 PKP IMMUTABILITY CHECK RESULT: ${isImmutable}`);
|
|
192
|
+
console.log("\n\u{1F510} STEP 3: AUTHORIZATION CHECK");
|
|
193
|
+
console.log("==================================");
|
|
194
|
+
console.log(` Checking permitted actions for PKP: ${targetPkpTokenId2}`);
|
|
195
|
+
console.log(` Contract: ${LIT_CONTRACTS.PKPPermissions}`);
|
|
196
|
+
const getPermittedActionsCalldata = ethers.utils.concat([
|
|
197
|
+
ethers.utils.id("getPermittedActions(uint256)").substring(0, 10),
|
|
198
|
+
// function selector
|
|
199
|
+
ethers.utils.defaultAbiCoder.encode(["uint256"], [targetPkpTokenId2])
|
|
200
|
+
]);
|
|
201
|
+
console.log(` Function selector: ${ethers.utils.id("getPermittedActions(uint256)").substring(0, 10)}`);
|
|
202
|
+
console.log(` Calldata: ${ethers.utils.hexlify(getPermittedActionsCalldata)}`);
|
|
203
|
+
const getPermittedActionsCall = {
|
|
204
|
+
to: LIT_CONTRACTS.PKPPermissions,
|
|
205
|
+
data: ethers.utils.hexlify(getPermittedActionsCalldata)
|
|
206
|
+
};
|
|
207
|
+
const getPermittedActionsRpcPayload = {
|
|
208
|
+
method: "eth_call",
|
|
209
|
+
params: [getPermittedActionsCall, "latest"],
|
|
210
|
+
id: 3,
|
|
211
|
+
jsonrpc: "2.0"
|
|
212
|
+
};
|
|
213
|
+
let actionsBytes = [];
|
|
214
|
+
let hasOnlyOneAction = false;
|
|
215
|
+
let matchesExpectedCID = false;
|
|
216
|
+
let foundCid = null;
|
|
217
|
+
if (exists) {
|
|
218
|
+
const getPermittedActionsResult = await makeRpcCall(
|
|
219
|
+
getPermittedActionsRpcPayload,
|
|
220
|
+
rpcEndpoint,
|
|
221
|
+
"PKP_permitted_actions_check"
|
|
222
|
+
);
|
|
223
|
+
console.log(` Raw permissions result: ${getPermittedActionsResult.result}`);
|
|
224
|
+
actionsBytes = ethers.utils.defaultAbiCoder.decode(
|
|
225
|
+
["bytes[]"],
|
|
226
|
+
getPermittedActionsResult.result
|
|
227
|
+
)[0];
|
|
228
|
+
console.log(` Decoded actions count: ${actionsBytes.length}`);
|
|
229
|
+
console.log(` Actions bytes array:`, actionsBytes);
|
|
230
|
+
hasOnlyOneAction = actionsBytes.length === 1;
|
|
231
|
+
foundCid = actionsBytes[0] || null;
|
|
232
|
+
matchesExpectedCID = foundCid?.toLowerCase() === expectedCid2.toLowerCase();
|
|
233
|
+
console.log(` First action bytes: ${foundCid}`);
|
|
234
|
+
console.log(` Expected CID (input): ${expectedCid2}`);
|
|
235
|
+
console.log(` CID comparison (case-insensitive):`);
|
|
236
|
+
console.log(` Found: ${foundCid?.toLowerCase()}`);
|
|
237
|
+
console.log(` Expected: ${expectedCid2.toLowerCase()}`);
|
|
238
|
+
console.log(` Match: ${matchesExpectedCID}`);
|
|
239
|
+
} else {
|
|
240
|
+
console.log(` Skipping authorization check - PKP does not exist`);
|
|
241
|
+
}
|
|
242
|
+
console.log("\n\u{1F4CA} AUTHORIZATION CHECK SUMMARY:");
|
|
243
|
+
console.log(` Permitted actions count: ${actionsBytes.length}`);
|
|
244
|
+
console.log(` Has exactly one action: ${hasOnlyOneAction}`);
|
|
245
|
+
console.log(` Matches expected CID: ${matchesExpectedCID}`);
|
|
246
|
+
console.log(` Expected CID: ${expectedCid2}`);
|
|
247
|
+
console.log(` Found CID: ${foundCid || "NONE"}`);
|
|
248
|
+
if (actionsBytes.length > 1) {
|
|
249
|
+
console.log(` \u26A0\uFE0F WARNING: PKP has ${actionsBytes.length} authorized actions (expected 1)`);
|
|
250
|
+
console.log(` Additional actions:`);
|
|
251
|
+
actionsBytes.slice(1).forEach((action, index) => {
|
|
252
|
+
console.log(` [${index + 2}]: ${action}`);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (actionsBytes.length === 0) {
|
|
256
|
+
console.log(` \u274C CRITICAL: PKP has no authorized actions!`);
|
|
257
|
+
}
|
|
258
|
+
const allValid = exists && isImmutable && hasOnlyOneAction && matchesExpectedCID;
|
|
259
|
+
const validationSummary = {
|
|
260
|
+
pkpExists: `${exists} ${exists ? "\u2705" : "\u274C"}`,
|
|
261
|
+
pkpImmutable: `${isImmutable} ${isImmutable ? "\u2705" : "\u274C"}`,
|
|
262
|
+
singleAction: `${hasOnlyOneAction} ${hasOnlyOneAction ? "\u2705" : "\u274C"}`,
|
|
263
|
+
correctCID: `${matchesExpectedCID} ${matchesExpectedCID ? "\u2705" : "\u274C"}`,
|
|
264
|
+
overallSecurity: `${allValid} ${allValid ? "\u{1F512} SECURE" : "\u26A0\uFE0F INSECURE"}`
|
|
265
|
+
};
|
|
266
|
+
console.log("\n\u{1F512} COMPLETE SECURITY VALIDATION RESULT:");
|
|
267
|
+
console.log("==========================================");
|
|
268
|
+
console.log(` PKP exists: ${validationSummary.pkpExists}`);
|
|
269
|
+
console.log(` PKP immutable: ${validationSummary.pkpImmutable}`);
|
|
270
|
+
console.log(` Single action: ${validationSummary.singleAction}`);
|
|
271
|
+
console.log(` Correct CID: ${validationSummary.correctCID}`);
|
|
272
|
+
console.log(` OVERALL SECURITY: ${validationSummary.overallSecurity}`);
|
|
273
|
+
console.log("==========================================");
|
|
274
|
+
if (!allValid) {
|
|
275
|
+
const failureReasons = [];
|
|
276
|
+
if (!exists) failureReasons.push("PKP does not exist on-chain");
|
|
277
|
+
if (!isImmutable) failureReasons.push("PKP is not immutable (not burned)");
|
|
278
|
+
if (!hasOnlyOneAction) failureReasons.push(`PKP has ${actionsBytes.length} actions instead of 1`);
|
|
279
|
+
if (!matchesExpectedCID) failureReasons.push("PKP CID does not match expected value");
|
|
280
|
+
const errorMessage = `PKP security validation failed:
|
|
281
|
+
${failureReasons.map((r) => ` - ${r}`).join("\n")}`;
|
|
282
|
+
console.log(`
|
|
283
|
+
\u274C VALIDATION FAILURES:`);
|
|
284
|
+
failureReasons.forEach((reason) => console.log(` - ${reason}`));
|
|
285
|
+
throw new Error(errorMessage);
|
|
286
|
+
}
|
|
287
|
+
console.log("\n\u{1F389} PKP IS FULLY SECURE!");
|
|
288
|
+
console.log(" \u2705 Exists on-chain");
|
|
289
|
+
console.log(" \u2705 Immutable (cannot be modified)");
|
|
290
|
+
console.log(" \u2705 Only authorized for expected LIT Action");
|
|
291
|
+
console.log(" \u{1F512} READY FOR PRODUCTION USE");
|
|
292
|
+
console.log("\n\u{1F50F} STEP 4: GENERATING VALIDATION PROOF");
|
|
293
|
+
console.log("=========================================");
|
|
294
|
+
console.log("All security validations passed - generating verifiable proof...");
|
|
295
|
+
console.log("");
|
|
296
|
+
console.log("ARCHITECTURAL NOTE:");
|
|
297
|
+
console.log("This validator PKP is BURNED (immutable) and cannot sign within");
|
|
298
|
+
console.log("a LIT Action called via session signatures from another wallet.");
|
|
299
|
+
console.log("The validation proof is the on-chain state verification itself.");
|
|
300
|
+
console.log("");
|
|
301
|
+
console.log("The fact that THIS LIT Action (authorized for this PKP) executed");
|
|
302
|
+
console.log("successfully and verified all security conditions IS the certification.");
|
|
303
|
+
console.log("");
|
|
304
|
+
const pkpIdBigInt = BigInt(`0x${targetPkpTokenId2}`);
|
|
305
|
+
const pkpIdDecimal = `0x${pkpIdBigInt.toString(10)}`;
|
|
306
|
+
const cidHex = expectedCid2.toLowerCase();
|
|
307
|
+
const proofMessage = `PKP::${pkpIdDecimal}::CID::${cidHex}::SECURE`;
|
|
308
|
+
const proofHash = ethers.utils.keccak256(ethers.utils.toUtf8Bytes(proofMessage));
|
|
309
|
+
console.log(` Proof message: ${proofMessage}`);
|
|
310
|
+
console.log(` Proof hash: ${proofHash}`);
|
|
311
|
+
console.log(` Validator PKP: ${globalThis.publicKey}`);
|
|
312
|
+
console.log(` Validator LIT Action CID: ${expectedCid2}`);
|
|
313
|
+
console.log("");
|
|
314
|
+
console.log("\u2705 Validation proof generated successfully");
|
|
315
|
+
console.log("");
|
|
316
|
+
console.log("VERIFICATION INSTRUCTIONS:");
|
|
317
|
+
console.log("Anyone can independently verify this validation by:");
|
|
318
|
+
console.log("1. Querying PKP NFT contract for existence and immutability");
|
|
319
|
+
console.log("2. Querying PKP Permissions contract for authorized actions");
|
|
320
|
+
console.log("3. Confirming PKP is only authorized for the expected LIT Action CID");
|
|
321
|
+
console.log("4. This validation result proves the PKP passed all security checks");
|
|
322
|
+
Lit.Actions.setResponse({
|
|
323
|
+
response: JSON.stringify({
|
|
324
|
+
success: true,
|
|
325
|
+
validated: {
|
|
326
|
+
pkpTokenId: targetPkpTokenId2,
|
|
327
|
+
exists,
|
|
328
|
+
immutable: isImmutable,
|
|
329
|
+
singleAction: hasOnlyOneAction,
|
|
330
|
+
correctCid: matchesExpectedCID,
|
|
331
|
+
expectedCid: expectedCid2,
|
|
332
|
+
foundCidHex: actionsBytes[0]
|
|
333
|
+
},
|
|
334
|
+
validatorPkp: globalThis.publicKey,
|
|
335
|
+
validatorActionCid: expectedCid2,
|
|
336
|
+
proofMessage,
|
|
337
|
+
proofHash,
|
|
338
|
+
timestamp: Date.now(),
|
|
339
|
+
network: network2,
|
|
340
|
+
verificationNote: "This validation was performed by the authorized LIT Action for this validator PKP. The validation itself is the proof of security."
|
|
341
|
+
})
|
|
342
|
+
});
|
|
343
|
+
} catch (error) {
|
|
344
|
+
console.error("\n\u{1F4A5} CRITICAL ERROR - PKP VALIDATION FAILED");
|
|
345
|
+
console.error("===========================================");
|
|
346
|
+
console.error(`Error type: ${error.constructor.name}`);
|
|
347
|
+
console.error(`Error message: ${error.message}`);
|
|
348
|
+
console.error(`Error stack: ${error.stack}`);
|
|
349
|
+
console.error(`Network: ${network}`);
|
|
350
|
+
console.error(`Target PKP: ${globalThis.targetPkpTokenId || "unknown"}`);
|
|
351
|
+
console.error(`Expected CID: ${globalThis.expectedCid || "unknown"}`);
|
|
352
|
+
console.error(`Validator PKP: ${globalThis.publicKey || "unknown"}`);
|
|
353
|
+
console.error(`Timestamp: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
354
|
+
console.error("===========================================");
|
|
355
|
+
let errorCategory = "UNKNOWN_ERROR";
|
|
356
|
+
if (error.message.includes("Timeout")) {
|
|
357
|
+
errorCategory = "TIMEOUT_ERROR";
|
|
358
|
+
} else if (error.message.includes("RPC") || error.message.includes("HTTP")) {
|
|
359
|
+
errorCategory = "NETWORK_ERROR";
|
|
360
|
+
} else if (error.message.includes("PKP security validation failed")) {
|
|
361
|
+
errorCategory = "VALIDATION_ERROR";
|
|
362
|
+
} else if (error.message.includes("signEcdsa") || error.message.includes("signature")) {
|
|
363
|
+
errorCategory = "SIGNATURE_ERROR";
|
|
364
|
+
}
|
|
365
|
+
Lit.Actions.setResponse({
|
|
366
|
+
response: JSON.stringify({
|
|
367
|
+
success: false,
|
|
368
|
+
error: error.message || error.toString(),
|
|
369
|
+
errorCategory,
|
|
370
|
+
errorStack: error.stack || "No stack trace available",
|
|
371
|
+
targetPkpTokenId: globalThis.targetPkpTokenId || "unknown",
|
|
372
|
+
expectedCid: globalThis.expectedCid || "unknown",
|
|
373
|
+
validatorPkp: globalThis.publicKey || "unknown",
|
|
374
|
+
network,
|
|
375
|
+
timestamp: Date.now(),
|
|
376
|
+
debug: {
|
|
377
|
+
rpcEndpoint: RPC_ENDPOINTS[network],
|
|
378
|
+
contracts: CONTRACT_ADDRESSES[network] || CONTRACT_ADDRESSES["datil-test"],
|
|
379
|
+
globalThisKeys: Object.keys(globalThis)
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
runPkpValidator();
|
|
386
|
+
})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b23bea3f3679043482afc9f1e58a035d6b1cf5f582100faf1dd80e7114c7bc35
|