solvoid 1.0.0
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/LICENSE +21 -0
- package/README.md +123 -0
- package/SECURITY.md +174 -0
- package/bin/solvoid-scan +2 -0
- package/dist/cli/privacy-scan.d.ts +11 -0
- package/dist/cli/privacy-scan.d.ts.map +1 -0
- package/dist/cli/privacy-scan.js +112 -0
- package/dist/cli/privacy-scan.js.map +1 -0
- package/dist/cli/solvoid-scan.d.ts +13 -0
- package/dist/cli/solvoid-scan.d.ts.map +1 -0
- package/dist/cli/solvoid-scan.js +174 -0
- package/dist/cli/solvoid-scan.js.map +1 -0
- package/dist/cli/test-forensics.d.ts +2 -0
- package/dist/cli/test-forensics.d.ts.map +1 -0
- package/dist/cli/test-forensics.js +90 -0
- package/dist/cli/test-forensics.js.map +1 -0
- package/dist/cli/test-scenarios.d.ts +2 -0
- package/dist/cli/test-scenarios.d.ts.map +1 -0
- package/dist/cli/test-scenarios.js +96 -0
- package/dist/cli/test-scenarios.js.map +1 -0
- package/dist/examples/enterprise-demo.js +65 -0
- package/dist/sdk/client.d.ts +77 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +180 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/sdk/compliance/identity.d.ts +34 -0
- package/dist/sdk/compliance/identity.d.ts.map +1 -0
- package/dist/sdk/compliance/identity.js +55 -0
- package/dist/sdk/compliance/identity.js.map +1 -0
- package/dist/sdk/compliance/threat-model.d.ts +14 -0
- package/dist/sdk/compliance/threat-model.d.ts.map +1 -0
- package/dist/sdk/compliance/threat-model.js +101 -0
- package/dist/sdk/compliance/threat-model.js.map +1 -0
- package/dist/sdk/forensics/mev.js +50 -0
- package/dist/sdk/forensics/order-flow.d.ts +20 -0
- package/dist/sdk/forensics/order-flow.d.ts.map +1 -0
- package/dist/sdk/forensics/order-flow.js +104 -0
- package/dist/sdk/forensics/order-flow.js.map +1 -0
- package/dist/sdk/forensics/simulation.d.ts +14 -0
- package/dist/sdk/forensics/simulation.d.ts.map +1 -0
- package/dist/sdk/forensics/simulation.js +45 -0
- package/dist/sdk/forensics/simulation.js.map +1 -0
- package/dist/sdk/index.d.ts +10 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +43 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/network/shadow-rpc.d.ts +18 -0
- package/dist/sdk/network/shadow-rpc.d.ts.map +1 -0
- package/dist/sdk/network/shadow-rpc.js +32 -0
- package/dist/sdk/network/shadow-rpc.js.map +1 -0
- package/dist/sdk/obfuscator.d.ts +36 -0
- package/dist/sdk/obfuscator.d.ts.map +1 -0
- package/dist/sdk/obfuscator.js +77 -0
- package/dist/sdk/obfuscator.js.map +1 -0
- package/dist/sdk/passport/manager.d.ts +36 -0
- package/dist/sdk/passport/manager.d.ts.map +1 -0
- package/dist/sdk/passport/manager.js +107 -0
- package/dist/sdk/passport/manager.js.map +1 -0
- package/dist/sdk/pipeline.d.ts +34 -0
- package/dist/sdk/pipeline.d.ts.map +1 -0
- package/dist/sdk/pipeline.js +81 -0
- package/dist/sdk/pipeline.js.map +1 -0
- package/dist/sdk/privacy/confidential-transfer.d.ts +81 -0
- package/dist/sdk/privacy/confidential-transfer.d.ts.map +1 -0
- package/dist/sdk/privacy/confidential-transfer.js +158 -0
- package/dist/sdk/privacy/confidential-transfer.js.map +1 -0
- package/dist/sdk/privacy/history.d.ts +11 -0
- package/dist/sdk/privacy/history.d.ts.map +1 -0
- package/dist/sdk/privacy/history.js +110 -0
- package/dist/sdk/privacy/history.js.map +1 -0
- package/dist/sdk/privacy/light-protocol.d.ts +42 -0
- package/dist/sdk/privacy/light-protocol.d.ts.map +1 -0
- package/dist/sdk/privacy/light-protocol.js +83 -0
- package/dist/sdk/privacy/light-protocol.js.map +1 -0
- package/dist/sdk/privacy/relayer.d.ts +12 -0
- package/dist/sdk/privacy/relayer.d.ts.map +1 -0
- package/dist/sdk/privacy/relayer.js +55 -0
- package/dist/sdk/privacy/relayer.js.map +1 -0
- package/dist/sdk/privacy/safe-obfuscator.d.ts +38 -0
- package/dist/sdk/privacy/safe-obfuscator.d.ts.map +1 -0
- package/dist/sdk/privacy/safe-obfuscator.js +101 -0
- package/dist/sdk/privacy/safe-obfuscator.js.map +1 -0
- package/dist/sdk/privacy/shield.d.ts +34 -0
- package/dist/sdk/privacy/shield.d.ts.map +1 -0
- package/dist/sdk/privacy/shield.js +174 -0
- package/dist/sdk/privacy/shield.js.map +1 -0
- package/dist/sdk/privacy/zk.js +43 -0
- package/dist/sdk/privacy-engine.d.ts +11 -0
- package/dist/sdk/privacy-engine.d.ts.map +1 -0
- package/dist/sdk/privacy-engine.js +165 -0
- package/dist/sdk/privacy-engine.js.map +1 -0
- package/dist/sdk/registry/idl-fetcher.d.ts +17 -0
- package/dist/sdk/registry/idl-fetcher.d.ts.map +1 -0
- package/dist/sdk/registry/idl-fetcher.js +98 -0
- package/dist/sdk/registry/idl-fetcher.js.map +1 -0
- package/dist/sdk/registry/programs.d.ts +18 -0
- package/dist/sdk/registry/programs.d.ts.map +1 -0
- package/dist/sdk/registry/programs.js +45 -0
- package/dist/sdk/registry/programs.js.map +1 -0
- package/dist/sdk/rescue/analyzer.d.ts +22 -0
- package/dist/sdk/rescue/analyzer.d.ts.map +1 -0
- package/dist/sdk/rescue/analyzer.js +46 -0
- package/dist/sdk/rescue/analyzer.js.map +1 -0
- package/dist/sdk/rescue/builder.d.ts +16 -0
- package/dist/sdk/rescue/builder.d.ts.map +1 -0
- package/dist/sdk/rescue/builder.js +33 -0
- package/dist/sdk/rescue/builder.js.map +1 -0
- package/dist/sdk/semantics/analyzer.d.ts +1 -0
- package/dist/sdk/semantics/analyzer.d.ts.map +1 -0
- package/dist/sdk/semantics/analyzer.js +2 -0
- package/dist/sdk/semantics/analyzer.js.map +1 -0
- package/dist/sdk/semantics/decoder.d.ts +7 -0
- package/dist/sdk/semantics/decoder.d.ts.map +1 -0
- package/dist/sdk/semantics/decoder.js +30 -0
- package/dist/sdk/semantics/decoder.js.map +1 -0
- package/dist/sdk/semantics/graph.d.ts +1 -0
- package/dist/sdk/semantics/graph.d.ts.map +1 -0
- package/dist/sdk/semantics/graph.js +2 -0
- package/dist/sdk/semantics/graph.js.map +1 -0
- package/dist/sdk/semantics/idl-registry.d.ts +7 -0
- package/dist/sdk/semantics/idl-registry.d.ts.map +1 -0
- package/dist/sdk/semantics/idl-registry.js +95 -0
- package/dist/sdk/semantics/idl-registry.js.map +1 -0
- package/dist/sdk/semantics/types.d.ts +44 -0
- package/dist/sdk/semantics/types.d.ts.map +1 -0
- package/dist/sdk/semantics/types.js +3 -0
- package/dist/sdk/semantics/types.js.map +1 -0
- package/dist/sdk/simulator.d.ts +15 -0
- package/dist/sdk/simulator.d.ts.map +1 -0
- package/dist/sdk/simulator.js +133 -0
- package/dist/sdk/simulator.js.map +1 -0
- package/dist/sdk/types.d.ts +53 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +3 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/sdk/utils/config.d.ts +15 -0
- package/dist/sdk/utils/config.d.ts.map +1 -0
- package/dist/sdk/utils/config.js +40 -0
- package/dist/sdk/utils/config.js.map +1 -0
- package/dist/sdk/utils/logger.d.ts +3 -0
- package/dist/sdk/utils/logger.d.ts.map +1 -0
- package/dist/sdk/utils/logger.js +17 -0
- package/dist/sdk/utils/logger.js.map +1 -0
- package/dist/tests/unit/idl-registry.test.d.ts +2 -0
- package/dist/tests/unit/idl-registry.test.d.ts.map +1 -0
- package/dist/tests/unit/idl-registry.test.js +35 -0
- package/dist/tests/unit/idl-registry.test.js.map +1 -0
- package/dist/tools/exploit_demonstration.js +99 -0
- package/dist/tools/gen-tx.js +29 -0
- package/dist/tools/get-recent-tx.js +18 -0
- package/package.json +95 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdlRegistry = void 0;
|
|
4
|
+
const logger_1 = require("../utils/logger");
|
|
5
|
+
const idl_fetcher_1 = require("../registry/idl-fetcher");
|
|
6
|
+
// Mock IDL suitable for System Program transfers
|
|
7
|
+
const SYSTEM_IDL = {
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
name: "system_program",
|
|
10
|
+
instructions: [
|
|
11
|
+
{
|
|
12
|
+
name: "transfer",
|
|
13
|
+
accounts: [
|
|
14
|
+
{ name: "from", isMut: true, isSigner: true },
|
|
15
|
+
{ name: "to", isMut: true, isSigner: false }
|
|
16
|
+
],
|
|
17
|
+
args: [
|
|
18
|
+
{ name: "lamports", type: "u64" }
|
|
19
|
+
],
|
|
20
|
+
discriminator: [2, 0, 0, 0]
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
// Mock IDL for SPL Token
|
|
25
|
+
const SPL_TOKEN_IDL = {
|
|
26
|
+
version: "0.1.0",
|
|
27
|
+
name: "spl_token",
|
|
28
|
+
instructions: [
|
|
29
|
+
{
|
|
30
|
+
name: "transfer",
|
|
31
|
+
accounts: [
|
|
32
|
+
{ name: "source", isMut: true, isSigner: false },
|
|
33
|
+
{ name: "destination", isMut: true, isSigner: false },
|
|
34
|
+
{ name: "authority", isMut: false, isSigner: true }
|
|
35
|
+
],
|
|
36
|
+
args: [
|
|
37
|
+
{ name: "amount", type: "u64" }
|
|
38
|
+
],
|
|
39
|
+
discriminator: [3]
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
// Mock IDL for a generic DeFi swap
|
|
44
|
+
const DEFI_SWAP_IDL = {
|
|
45
|
+
version: "1.0.0",
|
|
46
|
+
name: "super_swap",
|
|
47
|
+
instructions: [
|
|
48
|
+
{
|
|
49
|
+
name: "swap",
|
|
50
|
+
accounts: [
|
|
51
|
+
{ name: "user_authority", isMut: false, isSigner: true },
|
|
52
|
+
{ name: "user_source", isMut: true, isSigner: false },
|
|
53
|
+
{ name: "pool_source", isMut: true, isSigner: false },
|
|
54
|
+
{ name: "pool_dest", isMut: true, isSigner: false },
|
|
55
|
+
{ name: "user_dest", isMut: true, isSigner: false }
|
|
56
|
+
],
|
|
57
|
+
args: [
|
|
58
|
+
{ name: "amount_in", type: "u64" },
|
|
59
|
+
{ name: "min_out", type: "u64" }
|
|
60
|
+
],
|
|
61
|
+
discriminator: [100, 100, 100, 100, 100, 100, 100, 100]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
class IdlRegistry {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.cache = new Map();
|
|
68
|
+
this.cache.set("11111111111111111111111111111111", SYSTEM_IDL);
|
|
69
|
+
this.cache.set("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", SPL_TOKEN_IDL);
|
|
70
|
+
this.cache.set("DeFi111111111111111111111111111111111111111", DEFI_SWAP_IDL);
|
|
71
|
+
}
|
|
72
|
+
async fetchIdl(programId) {
|
|
73
|
+
if (this.cache.has(programId)) {
|
|
74
|
+
return this.cache.get(programId);
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const fetcher = new idl_fetcher_1.OnChainIdlFetcher("https://api.mainnet-beta.solana.com");
|
|
78
|
+
const idl = await fetcher.fetchIdl(programId);
|
|
79
|
+
if (idl) {
|
|
80
|
+
this.cache.set(programId, idl);
|
|
81
|
+
return idl;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
// Fallback to null
|
|
86
|
+
}
|
|
87
|
+
logger_1.logger.debug(`[IdlRegistry] IDL not found on-chain for ${programId}`);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
registerIdl(programId, idl) {
|
|
91
|
+
this.cache.set(programId, idl);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.IdlRegistry = IdlRegistry;
|
|
95
|
+
//# sourceMappingURL=idl-registry.js.map
|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IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,+BAAiB,CAAC,qCAAqC,CAAC,CAAC;YAC7E,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAC9C,IAAI,GAAG,EAAE,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBAC/B,OAAO,GAAG,CAAC;YACf,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,mBAAmB;QACvB,CAAC;QAED,eAAM,CAAC,KAAK,CAAC,4CAA4C,SAAS,EAAE,CAAC,CAAC;QACtE,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,WAAW,CAAC,SAAiB,EAAE,GAAQ;QAC1C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;CACJ;AAjCD,kCAiCC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface Idl {
|
|
2
|
+
version: string;
|
|
3
|
+
name: string;
|
|
4
|
+
instructions: IdlInstruction[];
|
|
5
|
+
accounts?: IdlAccount[];
|
|
6
|
+
types?: IdlType[];
|
|
7
|
+
events?: IdlEvent[];
|
|
8
|
+
errors?: IdlError[];
|
|
9
|
+
}
|
|
10
|
+
export interface IdlInstruction {
|
|
11
|
+
name: string;
|
|
12
|
+
accounts: IdlAccountItem[];
|
|
13
|
+
args: IdlField[];
|
|
14
|
+
}
|
|
15
|
+
export interface IdlAccountItem {
|
|
16
|
+
name: string;
|
|
17
|
+
isMut: boolean;
|
|
18
|
+
isSigner: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface IdlField {
|
|
21
|
+
name: string;
|
|
22
|
+
type: any;
|
|
23
|
+
}
|
|
24
|
+
export interface IdlAccount {
|
|
25
|
+
name: string;
|
|
26
|
+
type: {
|
|
27
|
+
kind: 'struct';
|
|
28
|
+
fields: IdlField[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface IdlType {
|
|
32
|
+
name: string;
|
|
33
|
+
type: any;
|
|
34
|
+
}
|
|
35
|
+
export interface IdlEvent {
|
|
36
|
+
name: string;
|
|
37
|
+
fields: IdlField[];
|
|
38
|
+
}
|
|
39
|
+
export interface IdlError {
|
|
40
|
+
code: number;
|
|
41
|
+
name: string;
|
|
42
|
+
msg: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../sdk/semantics/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ,CAAC;QACf,MAAM,EAAE,QAAQ,EAAE,CAAC;KACtB,CAAC;CACL;AAED,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../sdk/semantics/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import { GeyserTransactionEvents, TransactionJSON } from './types';
|
|
3
|
+
export declare class ForensicsSimulator {
|
|
4
|
+
private connection;
|
|
5
|
+
constructor(rpcUrl?: string);
|
|
6
|
+
/**
|
|
7
|
+
* Simulates a transaction and converts the result into forensic events.
|
|
8
|
+
*/
|
|
9
|
+
simulate(tx: VersionedTransaction, baseTxJson: TransactionJSON): Promise<GeyserTransactionEvents>;
|
|
10
|
+
/**
|
|
11
|
+
* Reconstructs the full transaction structure by resolving ALTs.
|
|
12
|
+
*/
|
|
13
|
+
expandTransaction(tx: VersionedTransaction): Promise<TransactionJSON>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=simulator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../sdk/simulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,oBAAoB,EAA4D,MAAM,iBAAiB,CAAC;AAC7H,OAAO,EAAE,uBAAuB,EAAiB,eAAe,EAAE,MAAM,SAAS,CAAC;AAIlF,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,UAAU,CAAa;gBAEnB,MAAM,GAAE,MAA8C;IAIlE;;OAEG;IACU,QAAQ,CACjB,EAAE,EAAE,oBAAoB,EACxB,UAAU,EAAE,eAAe,GAC5B,OAAO,CAAC,uBAAuB,CAAC;IAwDnC;;OAEG;IACU,iBAAiB,CAAC,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC;CA2ErF"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ForensicsSimulator = void 0;
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const logger_1 = require("./utils/logger");
|
|
9
|
+
const p_retry_1 = __importDefault(require("p-retry"));
|
|
10
|
+
class ForensicsSimulator {
|
|
11
|
+
constructor(rpcUrl = "https://api.mainnet-beta.solana.com") {
|
|
12
|
+
this.connection = new web3_js_1.Connection(rpcUrl, 'confirmed');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Simulates a transaction and converts the result into forensic events.
|
|
16
|
+
*/
|
|
17
|
+
async simulate(tx, baseTxJson) {
|
|
18
|
+
logger_1.logger.debug("Executing RPC Simulation...");
|
|
19
|
+
const simResult = await (0, p_retry_1.default)(async () => {
|
|
20
|
+
return await this.connection.simulateTransaction(tx, {
|
|
21
|
+
replaceRecentBlockhash: true,
|
|
22
|
+
sigVerify: false,
|
|
23
|
+
commitment: 'confirmed',
|
|
24
|
+
accounts: {
|
|
25
|
+
encoding: "base64",
|
|
26
|
+
addresses: baseTxJson.message.accountKeys
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, {
|
|
30
|
+
retries: 3,
|
|
31
|
+
minTimeout: 1000,
|
|
32
|
+
onFailedAttempt: error => {
|
|
33
|
+
logger_1.logger.warn(`RPC attempt ${error.attemptNumber} failed: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (simResult.value.err) {
|
|
37
|
+
logger_1.logger.error("Simulation Failed:", simResult.value.err);
|
|
38
|
+
throw new Error("Transaction Simulation Failed.");
|
|
39
|
+
}
|
|
40
|
+
const updates = [];
|
|
41
|
+
if (simResult.value.accounts) {
|
|
42
|
+
simResult.value.accounts.forEach((acc, index) => {
|
|
43
|
+
if (!acc)
|
|
44
|
+
return;
|
|
45
|
+
const address = baseTxJson.message.accountKeys[index];
|
|
46
|
+
updates.push({
|
|
47
|
+
pubkey: address,
|
|
48
|
+
owner: acc.owner,
|
|
49
|
+
lamports: acc.lamports,
|
|
50
|
+
data: acc.data[0],
|
|
51
|
+
executable: acc.executable,
|
|
52
|
+
rentEpoch: acc.rentEpoch || 0,
|
|
53
|
+
writeVersion: 0
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
signature: "simulated_state",
|
|
59
|
+
accountUpdates: updates
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Reconstructs the full transaction structure by resolving ALTs.
|
|
64
|
+
*/
|
|
65
|
+
async expandTransaction(tx) {
|
|
66
|
+
const addressLookupTableAccounts = [];
|
|
67
|
+
const message = tx.message;
|
|
68
|
+
if (message.version === 0) {
|
|
69
|
+
const lookups = message.addressTableLookups;
|
|
70
|
+
if (lookups && lookups.length > 0) {
|
|
71
|
+
logger_1.logger.debug(`Resolving ${lookups.length} Address Lookup Tables...`);
|
|
72
|
+
for (const lookup of lookups) {
|
|
73
|
+
const res = await this.connection.getAddressLookupTable(lookup.accountKey);
|
|
74
|
+
if (res.value) {
|
|
75
|
+
addressLookupTableAccounts.push(res.value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const decompiled = web3_js_1.TransactionMessage.decompile(message, { addressLookupTableAccounts });
|
|
81
|
+
const keyMap = new Map();
|
|
82
|
+
const addKey = (pubkey, isSigner, isWritable) => {
|
|
83
|
+
const k = pubkey.toBase58();
|
|
84
|
+
const curr = keyMap.get(k);
|
|
85
|
+
if (curr) {
|
|
86
|
+
curr.isSigner = curr.isSigner || isSigner;
|
|
87
|
+
curr.isWritable = curr.isWritable || isWritable;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
keyMap.set(k, { isSigner, isWritable });
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
addKey(decompiled.payerKey, true, true);
|
|
94
|
+
for (const ix of decompiled.instructions) {
|
|
95
|
+
addKey(ix.programId, false, false);
|
|
96
|
+
for (const meta of ix.keys) {
|
|
97
|
+
addKey(meta.pubkey, meta.isSigner, meta.isWritable);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const entries = Array.from(keyMap.entries());
|
|
101
|
+
const payer = decompiled.payerKey.toBase58();
|
|
102
|
+
const signersWritable = entries.filter(([, v]) => v.isSigner && v.isWritable).map(([k]) => k)
|
|
103
|
+
.sort((a, b) => (a === payer ? -1 : b === payer ? 1 : 0));
|
|
104
|
+
const signersReadonly = entries.filter(([, v]) => v.isSigner && !v.isWritable).map(([k]) => k);
|
|
105
|
+
const nonSignersWritable = entries.filter(([, v]) => !v.isSigner && v.isWritable).map(([k]) => k);
|
|
106
|
+
const nonSignersReadonly = entries.filter(([, v]) => !v.isSigner && !v.isWritable).map(([k]) => k);
|
|
107
|
+
const accountKeys = [
|
|
108
|
+
...signersWritable,
|
|
109
|
+
...signersReadonly,
|
|
110
|
+
...nonSignersWritable,
|
|
111
|
+
...nonSignersReadonly
|
|
112
|
+
];
|
|
113
|
+
const instructions = decompiled.instructions.map(ix => ({
|
|
114
|
+
programIdIndex: accountKeys.indexOf(ix.programId.toBase58()),
|
|
115
|
+
accounts: ix.keys.map(k => accountKeys.indexOf(k.pubkey.toBase58())),
|
|
116
|
+
data: ix.data.toString('base64')
|
|
117
|
+
}));
|
|
118
|
+
return {
|
|
119
|
+
message: {
|
|
120
|
+
accountKeys,
|
|
121
|
+
header: {
|
|
122
|
+
numRequiredSignatures: signersWritable.length + signersReadonly.length,
|
|
123
|
+
numReadonlySignedAccounts: signersReadonly.length,
|
|
124
|
+
numReadonlyUnsignedAccounts: nonSignersReadonly.length
|
|
125
|
+
},
|
|
126
|
+
instructions
|
|
127
|
+
},
|
|
128
|
+
signatures: tx.signatures.map(s => Buffer.from(s).toString('base64'))
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.ForensicsSimulator = ForensicsSimulator;
|
|
133
|
+
//# sourceMappingURL=simulator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulator.js","sourceRoot":"","sources":["../../sdk/simulator.ts"],"names":[],"mappings":";;;;;;AACA,6CAA6H;AAE7H,2CAAwC;AACxC,sDAA6B;AAE7B,MAAa,kBAAkB;IAG3B,YAAY,SAAiB,qCAAqC;QAC9D,IAAI,CAAC,UAAU,GAAG,IAAI,oBAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,QAAQ,CACjB,EAAwB,EACxB,UAA2B;QAG3B,eAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAE5C,MAAM,SAAS,GAAG,MAAM,IAAA,iBAAM,EAC1B,KAAK,IAAI,EAAE;YACP,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,EAAE;gBACjD,sBAAsB,EAAE,IAAI;gBAC5B,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE,WAAW;gBACvB,QAAQ,EAAE;oBACN,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,WAAW;iBAC5C;a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AA2B,EAAE,kBAAkB,CAAC,MAAM;iBACzD;gBACD,YAAY;aACf;YACD,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACxE,CAAC;IACN,CAAC;CACJ;AAnJD,gDAmJC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type LeakType = "identity" | "metadata" | "state-leak" | "cpi-linkage";
|
|
2
|
+
export type VisibilityScope = "PUBLIC" | "PROGRAM" | "LOCAL";
|
|
3
|
+
export interface Leak {
|
|
4
|
+
type: LeakType;
|
|
5
|
+
scope: string;
|
|
6
|
+
visibility: VisibilityScope;
|
|
7
|
+
description: string;
|
|
8
|
+
remediation?: string;
|
|
9
|
+
severity: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
|
|
10
|
+
programName?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GovernanceResult {
|
|
13
|
+
status: "SURFACE_SCAN_PASSED" | "REGRESSION";
|
|
14
|
+
unacceptedLiabilities: {
|
|
15
|
+
leak: Leak;
|
|
16
|
+
reason: string;
|
|
17
|
+
}[];
|
|
18
|
+
remediationHints: string[];
|
|
19
|
+
privacyScore: number;
|
|
20
|
+
}
|
|
21
|
+
export interface TransactionJSON {
|
|
22
|
+
message: {
|
|
23
|
+
accountKeys: string[];
|
|
24
|
+
header: {
|
|
25
|
+
numRequiredSignatures: number;
|
|
26
|
+
};
|
|
27
|
+
instructions: {
|
|
28
|
+
programIdIndex: number;
|
|
29
|
+
accounts: number[];
|
|
30
|
+
data: string;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
meta?: {
|
|
34
|
+
innerInstructions?: {
|
|
35
|
+
index: number;
|
|
36
|
+
instructions: {
|
|
37
|
+
programIdIndex: number;
|
|
38
|
+
accounts: number[];
|
|
39
|
+
data: string;
|
|
40
|
+
}[];
|
|
41
|
+
}[];
|
|
42
|
+
logMessages?: string[];
|
|
43
|
+
};
|
|
44
|
+
signatures: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface GeyserTransactionEvents {
|
|
47
|
+
signature: string;
|
|
48
|
+
accountUpdates: {
|
|
49
|
+
pubkey: string;
|
|
50
|
+
data: string;
|
|
51
|
+
}[];
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../sdk/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GACd,UAAU,GACV,UAAU,GACV,YAAY,GACZ,aAAa,CAAC;AAEpB,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,eAAe,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,qBAAqB,GAAG,YAAY,CAAC;IAC7C,qBAAqB,EAAE;QAAE,IAAI,EAAE,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE;QACL,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,EAAE;YACJ,qBAAqB,EAAE,MAAM,CAAC;SACjC,CAAC;QACF,YAAY,EAAE;YACV,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;YACnB,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,CAAC;IACF,IAAI,CAAC,EAAE;QACH,iBAAiB,CAAC,EAAE;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,YAAY,EAAE;gBACV,cAAc,EAAE,MAAM,CAAC;gBACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACnB,IAAI,EAAE,MAAM,CAAC;aAChB,EAAE,CAAC;SACP,EAAE,CAAC;QACJ,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,UAAU,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../sdk/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Keypair } from '@solana/web3.js';
|
|
2
|
+
export interface EnvConfig {
|
|
3
|
+
rpcUrl: string;
|
|
4
|
+
walletKey?: string;
|
|
5
|
+
historyFile?: string;
|
|
6
|
+
jitoAuthToken?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConfigLoader {
|
|
9
|
+
private config;
|
|
10
|
+
constructor();
|
|
11
|
+
getRpcUrl(): string;
|
|
12
|
+
getSigner(): Keypair | null;
|
|
13
|
+
getJitoAuth(): string | undefined;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../sdk/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAI1C,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAY;;IAWnB,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,OAAO,GAAG,IAAI;IAkB3B,WAAW,IAAI,MAAM,GAAG,SAAS;CAG3C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigLoader = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
class ConfigLoader {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.config = {
|
|
8
|
+
rpcUrl: process.env.RPC_URL || "https://api.mainnet-beta.solana.com",
|
|
9
|
+
walletKey: process.env.WALLET_KEY,
|
|
10
|
+
historyFile: process.env.PRIVACY_HISTORY_FILE,
|
|
11
|
+
jitoAuthToken: process.env.JITO_AUTH_TOKEN
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
getRpcUrl() {
|
|
15
|
+
return this.config.rpcUrl;
|
|
16
|
+
}
|
|
17
|
+
getSigner() {
|
|
18
|
+
if (!this.config.walletKey)
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
// Try different formats
|
|
22
|
+
// 1. JSON Array "[1,2,3...]"
|
|
23
|
+
if (this.config.walletKey.startsWith('[')) {
|
|
24
|
+
return web3_js_1.Keypair.fromSecretKey(Uint8Array.from(JSON.parse(this.config.walletKey)));
|
|
25
|
+
}
|
|
26
|
+
// 2. BS58 String
|
|
27
|
+
const bs58 = require('bs58');
|
|
28
|
+
return web3_js_1.Keypair.fromSecretKey(bs58.decode(this.config.walletKey));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
console.warn("Failed to parse WALLET_KEY from .env");
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
getJitoAuth() {
|
|
36
|
+
return this.config.jitoAuthToken;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ConfigLoader = ConfigLoader;
|
|
40
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../sdk/utils/config.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAW1C,MAAa,YAAY;IAGrB;QACI,IAAI,CAAC,MAAM,GAAG;YACV,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,qCAAqC;YACpE,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;YACjC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;YAC7C,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe;SAC7C,CAAC;IACN,CAAC;IAEM,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAEM,SAAS;QACZ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAExC,IAAI,CAAC;YACD,wBAAwB;YACxB,6BAA6B;YAC7B,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxC,OAAO,iBAAO,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC;YACD,iBAAiB;YACjB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAC7B,OAAO,iBAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACrE,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAEM,WAAW;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IACrC,CAAC;CACJ;AArCD,oCAqCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../sdk/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,eAAO,MAAM,MAAM,gBAcjB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logger = void 0;
|
|
7
|
+
const winston_1 = __importDefault(require("winston"));
|
|
8
|
+
exports.logger = winston_1.default.createLogger({
|
|
9
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
10
|
+
format: winston_1.default.format.combine(winston_1.default.format.timestamp(), winston_1.default.format.json()),
|
|
11
|
+
transports: [
|
|
12
|
+
new winston_1.default.transports.Console({
|
|
13
|
+
format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple()),
|
|
14
|
+
}),
|
|
15
|
+
],
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../sdk/utils/logger.ts"],"names":[],"mappings":";;;;;;AACA,sDAA8B;AAEjB,QAAA,MAAM,GAAG,iBAAO,CAAC,YAAY,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;IACtC,MAAM,EAAE,iBAAO,CAAC,MAAM,CAAC,OAAO,CAC1B,iBAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,iBAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CACxB;IACD,UAAU,EAAE;QACR,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC3B,MAAM,EAAE,iBAAO,CAAC,MAAM,CAAC,OAAO,CAC1B,iBAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,iBAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAC1B;SACJ,CAAC;KACL;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idl-registry.test.d.ts","sourceRoot":"","sources":["../../../tests/unit/idl-registry.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const globals_1 = require("@jest/globals");
|
|
4
|
+
const idl_registry_1 = require("../../sdk/semantics/idl-registry");
|
|
5
|
+
(0, globals_1.describe)('IdlRegistry', () => {
|
|
6
|
+
let registry;
|
|
7
|
+
(0, globals_1.beforeEach)(() => {
|
|
8
|
+
registry = new idl_registry_1.IdlRegistry();
|
|
9
|
+
});
|
|
10
|
+
(0, globals_1.it)('should load pre-seeded system program IDL', async () => {
|
|
11
|
+
const idl = await registry.fetchIdl('11111111111111111111111111111111');
|
|
12
|
+
(0, globals_1.expect)(idl.name).toBe('system_program');
|
|
13
|
+
});
|
|
14
|
+
(0, globals_1.it)('should load pre-seeded SPL token IDL', async () => {
|
|
15
|
+
const idl = await registry.fetchIdl('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');
|
|
16
|
+
(0, globals_1.expect)(idl.name).toBe('spl_token');
|
|
17
|
+
});
|
|
18
|
+
(0, globals_1.it)('should register custom IDLs', () => {
|
|
19
|
+
const mockIdl = { name: 'mock' };
|
|
20
|
+
registry.registerIdl('Mock111111111111111111111111111111111', mockIdl);
|
|
21
|
+
// Using any cast to avoid TS issues in mock test
|
|
22
|
+
const saved = registry.cache.get('Mock111111111111111111111111111111111');
|
|
23
|
+
(0, globals_1.expect)(saved.name).toBe('mock');
|
|
24
|
+
});
|
|
25
|
+
(0, globals_1.it)('should return null for unknown programs', async () => {
|
|
26
|
+
const idl = await registry.fetchIdl('Unknown11111111111111111111111111111111');
|
|
27
|
+
(0, globals_1.expect)(idl).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
(0, globals_1.it)('fix parameter implicit any error', () => {
|
|
30
|
+
// This addresses the "Parameter 'res' implicitly has an 'any' type" error
|
|
31
|
+
const mockFn = (res) => res;
|
|
32
|
+
(0, globals_1.expect)(mockFn('test')).toBe('test');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=idl-registry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idl-registry.test.js","sourceRoot":"","sources":["../../../tests/unit/idl-registry.test.ts"],"names":[],"mappings":";;AAAA,2CAAiE;AACjE,mEAA+D;AAE/D,IAAA,kBAAQ,EAAC,aAAa,EAAE,GAAG,EAAE;IACzB,IAAI,QAAqB,CAAC;IAE1B,IAAA,oBAAU,EAAC,GAAG,EAAE;QACZ,QAAQ,GAAG,IAAI,0BAAW,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACvD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC;QACxE,IAAA,gBAAM,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,6CAA6C,CAAC,CAAC;QACnF,IAAA,gBAAM,EAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,6BAA6B,EAAE,GAAG,EAAE;QACnC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACjC,QAAQ,CAAC,WAAW,CAAC,uCAAuC,EAAE,OAAO,CAAC,CAAC;QACvE,iDAAiD;QACjD,MAAM,KAAK,GAAS,QAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;QACxF,IAAA,gBAAM,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC;QAC/E,IAAA,gBAAM,EAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,0EAA0E;QAC1E,MAAM,MAAM,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC;QACjC,IAAA,gBAAM,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const privacy_engine_1 = require("../sdk/privacy-engine");
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
// Setup
|
|
6
|
+
const engine = new privacy_engine_1.PrivacyEngine();
|
|
7
|
+
const user = web3_js_1.Keypair.generate();
|
|
8
|
+
const attacker = web3_js_1.Keypair.generate();
|
|
9
|
+
const userPubkey = user.publicKey.toBase58();
|
|
10
|
+
console.log("\nš PREDATORY OFFENSIVE SECURITY INTELLECT - SYSTEM ANALYSIS š\n");
|
|
11
|
+
console.log(`Target Identity: ${userPubkey.slice(0, 8)}...`);
|
|
12
|
+
// --- EXPLOIT 1: THE KING'S ROBES (System Program Blindness) ---
|
|
13
|
+
console.log("\n[1] Executing Exploit: 'The King's Robes' (System Program Blindness)...");
|
|
14
|
+
// Construct a raw JSON reflecting a SystemProgram.transfer(User, Attacker)
|
|
15
|
+
// In a real tx, AccountKeys = [User (Payer, Signer), Attacker, SystemProgram]
|
|
16
|
+
// Instruction: ProgramIdIndex = 2 (System), Accounts = [0, 1]
|
|
17
|
+
// We expect the engine to SKIP this because ProgramId is SystemProgram (111...)
|
|
18
|
+
const systemProgramId = web3_js_1.SystemProgram.programId.toBase58();
|
|
19
|
+
const txTransfer = {
|
|
20
|
+
message: {
|
|
21
|
+
accountKeys: [userPubkey, attacker.publicKey.toBase58(), systemProgramId],
|
|
22
|
+
header: {
|
|
23
|
+
numRequiredSignatures: 1,
|
|
24
|
+
numReadonlySignedAccounts: 0,
|
|
25
|
+
numReadonlyUnsignedAccounts: 0
|
|
26
|
+
},
|
|
27
|
+
instructions: [{
|
|
28
|
+
programIdIndex: 2, // System Program
|
|
29
|
+
accounts: [0, 1], // User -> Attacker
|
|
30
|
+
data: "AgAAAAAAAAA=" // Dummy transfer instruction data
|
|
31
|
+
}]
|
|
32
|
+
},
|
|
33
|
+
signatures: ["dummy_signature"]
|
|
34
|
+
};
|
|
35
|
+
const leaks1 = engine.analyzeTransaction(txTransfer);
|
|
36
|
+
if (leaks1.length === 0) {
|
|
37
|
+
console.log("ā RESULT: ZERO LEAKS DETECTED.");
|
|
38
|
+
console.log(" The engine explicitly ignores 'SystemProgram'.");
|
|
39
|
+
console.log(" A direct transfer of funds (The ultimate graph link) is INVISIBLE.");
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.log("ā
RESULT: LEAKS DETECTED.", leaks1);
|
|
43
|
+
}
|
|
44
|
+
// --- EXPLOIT 2: THE BROKEN LENS (ALT Blindness) ---
|
|
45
|
+
console.log("\n[2] Executing Exploit: 'The Broken Lens' (Address Lookup Table Blindness)...");
|
|
46
|
+
// Scenario: A V0 transaction using ALTs.
|
|
47
|
+
// The 'accountKeys' array in message ONLY has static keys.
|
|
48
|
+
// The 'loadedAddresses' in meta has the dynamic keys.
|
|
49
|
+
// The user is HIDDEN in the ALT (loadedAddresses).
|
|
50
|
+
const dexProgramId = "Dex1111111111111111111111111111111111111"; // Hypothetical DEX
|
|
51
|
+
const txAlt = {
|
|
52
|
+
message: {
|
|
53
|
+
accountKeys: [
|
|
54
|
+
attacker.publicKey.toBase58(), // Payer (Attacker pays!)
|
|
55
|
+
dexProgramId // Static Program
|
|
56
|
+
],
|
|
57
|
+
header: {
|
|
58
|
+
numRequiredSignatures: 1,
|
|
59
|
+
numReadonlySignedAccounts: 0,
|
|
60
|
+
numReadonlyUnsignedAccounts: 0
|
|
61
|
+
},
|
|
62
|
+
instructions: [{
|
|
63
|
+
programIdIndex: 1, // Dex Program
|
|
64
|
+
accounts: [0, 2], // 0=Attacker, 2=User (from ALT!)
|
|
65
|
+
// Note: In V0, index 2 points to loadedAddresses[0] if static length is 2.
|
|
66
|
+
data: "dummydata"
|
|
67
|
+
}]
|
|
68
|
+
},
|
|
69
|
+
meta: {
|
|
70
|
+
loadedAddresses: {
|
|
71
|
+
writable: [userPubkey], // User is here!
|
|
72
|
+
readonly: []
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
signatures: ["dummy_signature"]
|
|
76
|
+
};
|
|
77
|
+
try {
|
|
78
|
+
const leaks2 = engine.analyzeTransaction(txAlt);
|
|
79
|
+
// Check if the user was found
|
|
80
|
+
const userFound = leaks2.some(l => l.description.includes(userPubkey.slice(0, 8)));
|
|
81
|
+
if (!userFound) {
|
|
82
|
+
console.log("ā RESULT: USER NOT DETECTED.");
|
|
83
|
+
console.log(` Internal Engine State Check:`);
|
|
84
|
+
// The engine logic: ix.accounts.map(idx => accountKeys[idx])
|
|
85
|
+
// accountKeys has length 2. Index is 2.
|
|
86
|
+
// accountKeys[2] is UNDEFINED.
|
|
87
|
+
// [undefined].includes(user) is FALSE.
|
|
88
|
+
console.log(" The engine fails to look in 'loadedAddresses'.");
|
|
89
|
+
console.log(" The User is invisible by simply moving them to a Lookup Table.");
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
console.log("ā
RESULT: USER DETECTED.", leaks2);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
console.log("š„ CRASH: The engine choked on the ALT structure.");
|
|
97
|
+
console.log(" Error:", e.message);
|
|
98
|
+
}
|
|
99
|
+
console.log("\nš DEMONSTRATION COMPLETE š");
|