@nihilium/recovery-watchtower-solana 0.0.0-stage → 0.9.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/README.md +78 -2
- package/dist/index.d.ts +136 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +407 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +64 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +140 -0
- package/dist/layout.js.map +1 -0
- package/package.json +26 -4
package/README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nihilium/recovery-watchtower-solana
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Watch probe for the Solana recovery vault (spec §6, §15). Answers targets of kind
|
|
4
|
+
`solana-recovery-vault`.
|
|
5
|
+
|
|
6
|
+
A recovery this SDK protects against is vetoable, but only by someone who **notices in time**. The
|
|
7
|
+
Nihilium reveal-value probe fires earlier; this one is what tells the user how long they have.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SolanaRecoveryProbe, solanaRecoveryTarget } from "@nihilium/recovery-watchtower-solana";
|
|
11
|
+
import { SOLANA_NAMESPACE } from "@nihilium/recovery-key-solana";
|
|
12
|
+
|
|
13
|
+
const target = solanaRecoveryTarget({
|
|
14
|
+
namespace: SOLANA_NAMESPACE.devnet,
|
|
15
|
+
vault: vaultPda,
|
|
16
|
+
programId: "DaLebS3k5gD1k42uGU6LPnSP9qTNwYxaKqLQBb7BqgkG",
|
|
17
|
+
expectedRecoveryOwner, // what `register` bound
|
|
18
|
+
expectedEpoch: 0,
|
|
19
|
+
expectedConfigNonce: 1,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const probe = new SolanaRecoveryProbe({
|
|
23
|
+
rpcUrls: { [SOLANA_NAMESPACE.devnet]: "https://api.devnet.solana.com" },
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## The clock is projected here, and that is the difference from EVM
|
|
28
|
+
|
|
29
|
+
`RecoveryModule.attemptOf` returns an attempt the **contract** has already advanced, because a
|
|
30
|
+
Solidity `view` can run `GradualVeto.project()` for free. Reading a Solana account returns exactly
|
|
31
|
+
what was last written — so a paused attempt that passed its ceiling a week ago still *says* `PAUSED`
|
|
32
|
+
until someone sends a transaction. Reporting that verbatim would tell a user their recovery is
|
|
33
|
+
frozen when it has in fact been counting down.
|
|
34
|
+
|
|
35
|
+
So the clock is replayed client-side, using `@nihilium/recovery-veto` — the same machine the Rust
|
|
36
|
+
crate and the Solidity library are both pinned to by the shared trace fixture. This is the third
|
|
37
|
+
consumer of one state machine rather than a fourth implementation of it, which matters because the
|
|
38
|
+
arithmetic is exactly where independent implementations drift.
|
|
39
|
+
|
|
40
|
+
## "unknown" is never "clear"
|
|
41
|
+
|
|
42
|
+
The rule the whole package is built around, and the reason most of the test file is refusals. A
|
|
43
|
+
watchtower that reports `clear` because it could not read anything is worse than no watchtower: the
|
|
44
|
+
user believes they are covered.
|
|
45
|
+
|
|
46
|
+
Solana is **better placed than EVM** here and the probe spends that advantage. An `eth_call` to an
|
|
47
|
+
address with no code returns zero words, which decode as `NONE`, which reads as "nothing has
|
|
48
|
+
happened" — so a wrong module address produces a permanently, silently reassuring watch. A Solana
|
|
49
|
+
read of a nonexistent account returns `null`, which is distinguishable, so a wrong vault address,
|
|
50
|
+
a vault that was never created and one that has been closed all report `unknown` with a reason.
|
|
51
|
+
|
|
52
|
+
Also `unknown`: the RPC being unreachable, a cluster with no configured endpoint, an account owned
|
|
53
|
+
by another program, an account whose Anchor discriminator is not a vault's, and a vault with no
|
|
54
|
+
recovery key bound to it.
|
|
55
|
+
|
|
56
|
+
## Integrity is orthogonal to the verdict
|
|
57
|
+
|
|
58
|
+
A rotated recovery key is not a recovery attempt and must not render as one — but it means the
|
|
59
|
+
user's recovery has been replaced, which is every bit as urgent. Overloading one field would force a
|
|
60
|
+
wallet to cry wolf, so `integrity: "changed"` is reported separately from `verdict`.
|
|
61
|
+
|
|
62
|
+
`config_nonce` is what makes a rotation visible even when the replacement key is the *same* key.
|
|
63
|
+
Comparing keys alone would miss that someone holding the owner key has been rewriting the vault's
|
|
64
|
+
protection.
|
|
65
|
+
|
|
66
|
+
One signal is permanent: `epoch` is monotone and only `execute_recovery` bumps it, so a completed
|
|
67
|
+
recovery is detectable retroactively even if nothing was watching at the time. It is checked first
|
|
68
|
+
for that reason.
|
|
69
|
+
|
|
70
|
+
## No Anchor client, no `@solana/web3.js`
|
|
71
|
+
|
|
72
|
+
The decode surface is one account layout, read sequentially in `layout.ts`. Pulling in an Anchor
|
|
73
|
+
client to do it would put a large, fast-moving dependency in the one component that has to keep
|
|
74
|
+
working while nobody is looking at it — the same reasoning `watchtower-evm` applies to viem.
|
|
75
|
+
|
|
76
|
+
The cost of decoding by hand is drift, and `test/layout-pin.test.ts` pays it: the field order and
|
|
77
|
+
the account discriminator are pinned against the program's generated IDL through a test-only alias.
|
|
78
|
+
Borsh is positional, so order *is* the format — a field inserted anywhere but the end shifts every
|
|
79
|
+
field after it, and a hand decoder would keep returning plausible values.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { VetoState, WatchObservation, WatchProbe, WatchTarget } from "@nihilium/recovery-core";
|
|
2
|
+
import { type VetoMachineState } from "@nihilium/recovery-veto";
|
|
3
|
+
import { type DecodedVault } from "./layout.js";
|
|
4
|
+
export { decodeVault, VAULT_DISCRIMINATOR, VAULT_FIELD_ORDER } from "./layout.js";
|
|
5
|
+
export type { DecodedVault } from "./layout.js";
|
|
6
|
+
/**
|
|
7
|
+
* `@nihilium/recovery-watchtower-solana` — the authoritative half of the signal on Solana
|
|
8
|
+
* (spec §6, §15).
|
|
9
|
+
*
|
|
10
|
+
* The reveal-value probe fires earlier; this one is what tells the user how long they have.
|
|
11
|
+
*
|
|
12
|
+
* **One account read per vault, batched.** `getMultipleAccounts` answers up to a hundred vaults in
|
|
13
|
+
* a single request, where the EVM probe needs three `eth_call`s per account. That is not a
|
|
14
|
+
* micro-optimisation: the whole vault — config, attempt and integrity fields — lives in one
|
|
15
|
+
* account, so there is nothing to stitch together and no window in which two reads disagree.
|
|
16
|
+
*
|
|
17
|
+
* **The clock is projected here, not on-chain, and that is the one real difference from EVM.**
|
|
18
|
+
* `attemptOf` on the EVM module returns an attempt the contract has already projected forward,
|
|
19
|
+
* because a Solidity `view` can run `GradualVeto.project()` for free. Reading a Solana account
|
|
20
|
+
* returns exactly what was last written, so a paused attempt that passed its ceiling still *says*
|
|
21
|
+
* `PAUSED` until someone sends a transaction. Reporting that verbatim would mean telling a user
|
|
22
|
+
* their recovery is frozen when it has in fact been counting down for a week.
|
|
23
|
+
*
|
|
24
|
+
* So this projects the clock client-side — using `@nihilium/recovery-veto`, the same machine the
|
|
25
|
+
* Rust and Solidity implementations are both pinned to by the shared trace fixture. That makes this
|
|
26
|
+
* the third consumer of one state machine rather than a fourth implementation of it, which matters
|
|
27
|
+
* because the arithmetic is where independent implementations drift.
|
|
28
|
+
*
|
|
29
|
+
* No `@solana/web3.js` and no Anchor client. The decode surface is one account layout (see
|
|
30
|
+
* `layout.ts`), and this repo's precedent is to declare the small transport a package needs rather
|
|
31
|
+
* than pull in a large one that has to keep working while nobody is looking.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SOLANA_WATCH_KIND: "solana-recovery-vault";
|
|
34
|
+
/** `gradual_veto::State` ordinals, as stored in the vault account. */
|
|
35
|
+
export declare const VETO_STATE: {
|
|
36
|
+
readonly NONE: 0;
|
|
37
|
+
readonly INITIATED: 1;
|
|
38
|
+
readonly PAUSED: 2;
|
|
39
|
+
readonly EXECUTABLE: 3;
|
|
40
|
+
readonly EXECUTED: 4;
|
|
41
|
+
readonly ABORTED: 5;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Ordinal → `VetoState`, refusing to invent one for `NONE`.
|
|
45
|
+
*
|
|
46
|
+
* An attempt that does not exist is represented in the TypeScript union by the *absence* of a
|
|
47
|
+
* record, not by a state, so `NONE` maps to `undefined` and the caller decides what that means.
|
|
48
|
+
* Returning a plausible string here is how "no attempt" quietly becomes "some attempt".
|
|
49
|
+
*/
|
|
50
|
+
export declare function toVetoState(ordinal: number): VetoState | undefined;
|
|
51
|
+
/** The minimal `fetch`, declared locally so this package needs no DOM types. */
|
|
52
|
+
export type FetchLike = (url: string, init?: {
|
|
53
|
+
method?: string;
|
|
54
|
+
headers?: Record<string, string>;
|
|
55
|
+
body?: string;
|
|
56
|
+
}) => Promise<{
|
|
57
|
+
ok: boolean;
|
|
58
|
+
status: number;
|
|
59
|
+
json: () => Promise<unknown>;
|
|
60
|
+
}>;
|
|
61
|
+
export interface SolanaTargetSpec {
|
|
62
|
+
/** CAIP-2, e.g. `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`. Selects which RPC answers. */
|
|
63
|
+
namespace: string;
|
|
64
|
+
/**
|
|
65
|
+
* The vault PDA, base58. **Required, never defaulted.**
|
|
66
|
+
*
|
|
67
|
+
* Unlike EVM — where a call to an address with no code returns zero words that decode as
|
|
68
|
+
* `NONE`, i.e. as "nothing has happened" — a Solana read of a nonexistent account returns
|
|
69
|
+
* `null`, which this probe reports as `unknown`. A wrong address is therefore *detectable*
|
|
70
|
+
* here rather than permanently reassuring, which is a real advantage and the reason the
|
|
71
|
+
* unknown-vs-clear distinction is enforced so hard below.
|
|
72
|
+
*/
|
|
73
|
+
vault: string;
|
|
74
|
+
/** The program that owns the vault, base58. A mismatch means the account is not ours. */
|
|
75
|
+
programId: string;
|
|
76
|
+
/** The key registered at install. A change means the protection was replaced. */
|
|
77
|
+
expectedRecoveryOwner: string;
|
|
78
|
+
/** The epoch at registration. Any advance means a recovery completed. */
|
|
79
|
+
expectedEpoch: number;
|
|
80
|
+
/**
|
|
81
|
+
* The registration nonce at registration time.
|
|
82
|
+
*
|
|
83
|
+
* Bumped by every `register`, so an advance means the recovery key was **rotated** — which is a
|
|
84
|
+
* legitimate operation the owner may have performed deliberately, and is also exactly what an
|
|
85
|
+
* attacker who obtained the owner key would do. Reported as an integrity change either way; it
|
|
86
|
+
* is not this probe's place to guess which.
|
|
87
|
+
*/
|
|
88
|
+
expectedConfigNonce: number;
|
|
89
|
+
}
|
|
90
|
+
export type SolanaTargetParams = SolanaTargetSpec;
|
|
91
|
+
export interface SolanaProbeOptions {
|
|
92
|
+
/** CAIP-2 namespace → RPC endpoint. */
|
|
93
|
+
rpcUrls: Readonly<Record<string, string>>;
|
|
94
|
+
fetchFn?: FetchLike;
|
|
95
|
+
/** Unix seconds. Injectable so the clock projection is testable without waiting. */
|
|
96
|
+
now?: () => number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Build the on-chain half of a watch registration.
|
|
100
|
+
*
|
|
101
|
+
* Exported from here rather than built in core because the `params` shape belongs to the probe that
|
|
102
|
+
* reads it — the same arrangement that keeps `SealBlob.payload` adapter-owned.
|
|
103
|
+
*
|
|
104
|
+
* **Carries no record id**, at any depth. A watch target that named one would let a party running
|
|
105
|
+
* both the record host and the watchtower join their two stores, which is the whole reason they are
|
|
106
|
+
* kept apart.
|
|
107
|
+
*/
|
|
108
|
+
export declare function solanaRecoveryTarget(spec: SolanaTargetSpec): WatchTarget;
|
|
109
|
+
export declare class SolanaRecoveryProbe implements WatchProbe {
|
|
110
|
+
readonly kind: "solana-recovery-vault";
|
|
111
|
+
private readonly rpcUrls;
|
|
112
|
+
private readonly fetchFn;
|
|
113
|
+
private readonly now;
|
|
114
|
+
private readonly unhealthy;
|
|
115
|
+
constructor(options: SolanaProbeOptions);
|
|
116
|
+
probe(targets: readonly WatchTarget[]): Promise<WatchObservation[]>;
|
|
117
|
+
checkHealth(): Promise<{
|
|
118
|
+
ok: boolean;
|
|
119
|
+
detail: string;
|
|
120
|
+
}>;
|
|
121
|
+
private probeCluster;
|
|
122
|
+
private observe;
|
|
123
|
+
private getMultipleAccounts;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* When the attempt becomes executable.
|
|
127
|
+
*
|
|
128
|
+
* Computed from the **projected** attempt with `now` as its checkpoint, which is what makes this
|
|
129
|
+
* match the EVM probe: there, `attemptOf` hands back an attempt the contract already projected, so
|
|
130
|
+
* its `checkpointTime` is the block timestamp. Using the raw account's stale checkpoint here would
|
|
131
|
+
* report a deadline that had already passed.
|
|
132
|
+
*/
|
|
133
|
+
export declare function deadlineFor(projected: {
|
|
134
|
+
state: number;
|
|
135
|
+
} & VetoMachineState, vault: DecodedVault, now: number): number | undefined;
|
|
136
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACe,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAC9E,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClF,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,eAAO,MAAM,iBAAiB,EAAG,uBAAgC,CAAC;AAElE,sEAAsE;AACtE,eAAO,MAAM,UAAU;;;;;;;CAEb,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CASlE;AAED,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,CACpB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAA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nE,WAAW,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;YAQ/C,YAAY;IA2C1B,OAAO,CAAC,OAAO;YA8ED,mBAAmB;CAwCpC;AAmED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACvB,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,gBAAgB,EAC/C,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAUpB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { deriveTargetId } from "@nihilium/recovery-core";
|
|
2
|
+
import { applyEvent } from "@nihilium/recovery-veto";
|
|
3
|
+
import { decodeVault } from "./layout.js";
|
|
4
|
+
export { decodeVault, VAULT_DISCRIMINATOR, VAULT_FIELD_ORDER } from "./layout.js";
|
|
5
|
+
/**
|
|
6
|
+
* `@nihilium/recovery-watchtower-solana` — the authoritative half of the signal on Solana
|
|
7
|
+
* (spec §6, §15).
|
|
8
|
+
*
|
|
9
|
+
* The reveal-value probe fires earlier; this one is what tells the user how long they have.
|
|
10
|
+
*
|
|
11
|
+
* **One account read per vault, batched.** `getMultipleAccounts` answers up to a hundred vaults in
|
|
12
|
+
* a single request, where the EVM probe needs three `eth_call`s per account. That is not a
|
|
13
|
+
* micro-optimisation: the whole vault — config, attempt and integrity fields — lives in one
|
|
14
|
+
* account, so there is nothing to stitch together and no window in which two reads disagree.
|
|
15
|
+
*
|
|
16
|
+
* **The clock is projected here, not on-chain, and that is the one real difference from EVM.**
|
|
17
|
+
* `attemptOf` on the EVM module returns an attempt the contract has already projected forward,
|
|
18
|
+
* because a Solidity `view` can run `GradualVeto.project()` for free. Reading a Solana account
|
|
19
|
+
* returns exactly what was last written, so a paused attempt that passed its ceiling still *says*
|
|
20
|
+
* `PAUSED` until someone sends a transaction. Reporting that verbatim would mean telling a user
|
|
21
|
+
* their recovery is frozen when it has in fact been counting down for a week.
|
|
22
|
+
*
|
|
23
|
+
* So this projects the clock client-side — using `@nihilium/recovery-veto`, the same machine the
|
|
24
|
+
* Rust and Solidity implementations are both pinned to by the shared trace fixture. That makes this
|
|
25
|
+
* the third consumer of one state machine rather than a fourth implementation of it, which matters
|
|
26
|
+
* because the arithmetic is where independent implementations drift.
|
|
27
|
+
*
|
|
28
|
+
* No `@solana/web3.js` and no Anchor client. The decode surface is one account layout (see
|
|
29
|
+
* `layout.ts`), and this repo's precedent is to declare the small transport a package needs rather
|
|
30
|
+
* than pull in a large one that has to keep working while nobody is looking.
|
|
31
|
+
*/
|
|
32
|
+
export const SOLANA_WATCH_KIND = "solana-recovery-vault";
|
|
33
|
+
/** `gradual_veto::State` ordinals, as stored in the vault account. */
|
|
34
|
+
export const VETO_STATE = {
|
|
35
|
+
NONE: 0, INITIATED: 1, PAUSED: 2, EXECUTABLE: 3, EXECUTED: 4, ABORTED: 5,
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Ordinal → `VetoState`, refusing to invent one for `NONE`.
|
|
39
|
+
*
|
|
40
|
+
* An attempt that does not exist is represented in the TypeScript union by the *absence* of a
|
|
41
|
+
* record, not by a state, so `NONE` maps to `undefined` and the caller decides what that means.
|
|
42
|
+
* Returning a plausible string here is how "no attempt" quietly becomes "some attempt".
|
|
43
|
+
*/
|
|
44
|
+
export function toVetoState(ordinal) {
|
|
45
|
+
switch (ordinal) {
|
|
46
|
+
case VETO_STATE.INITIATED: return "INITIATED";
|
|
47
|
+
case VETO_STATE.PAUSED: return "PAUSED";
|
|
48
|
+
case VETO_STATE.EXECUTABLE: return "EXECUTABLE";
|
|
49
|
+
case VETO_STATE.EXECUTED: return "EXECUTED";
|
|
50
|
+
case VETO_STATE.ABORTED: return "ABORTED";
|
|
51
|
+
default: return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the on-chain half of a watch registration.
|
|
56
|
+
*
|
|
57
|
+
* Exported from here rather than built in core because the `params` shape belongs to the probe that
|
|
58
|
+
* reads it — the same arrangement that keeps `SealBlob.payload` adapter-owned.
|
|
59
|
+
*
|
|
60
|
+
* **Carries no record id**, at any depth. A watch target that named one would let a party running
|
|
61
|
+
* both the record host and the watchtower join their two stores, which is the whole reason they are
|
|
62
|
+
* kept apart.
|
|
63
|
+
*/
|
|
64
|
+
export function solanaRecoveryTarget(spec) {
|
|
65
|
+
const params = {
|
|
66
|
+
namespace: spec.namespace,
|
|
67
|
+
vault: spec.vault,
|
|
68
|
+
programId: spec.programId,
|
|
69
|
+
expectedRecoveryOwner: spec.expectedRecoveryOwner,
|
|
70
|
+
expectedEpoch: spec.expectedEpoch,
|
|
71
|
+
expectedConfigNonce: spec.expectedConfigNonce,
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
kind: SOLANA_WATCH_KIND,
|
|
75
|
+
targetId: deriveTargetId(SOLANA_WATCH_KIND, params),
|
|
76
|
+
params,
|
|
77
|
+
// Truncated: a full base58 PDA is 44 characters and this is shown to a human.
|
|
78
|
+
label: `Solana vault ${spec.vault.slice(0, 8)}…`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export class SolanaRecoveryProbe {
|
|
82
|
+
kind = SOLANA_WATCH_KIND;
|
|
83
|
+
rpcUrls;
|
|
84
|
+
fetchFn;
|
|
85
|
+
now;
|
|
86
|
+
unhealthy = new Map();
|
|
87
|
+
constructor(options) {
|
|
88
|
+
this.rpcUrls = options.rpcUrls;
|
|
89
|
+
this.fetchFn = options.fetchFn
|
|
90
|
+
?? ((url, init) => globalThis.fetch(url, init));
|
|
91
|
+
this.now = options.now ?? (() => Math.floor(Date.now() / 1000));
|
|
92
|
+
}
|
|
93
|
+
async probe(targets) {
|
|
94
|
+
const byNamespace = new Map();
|
|
95
|
+
const results = new Map();
|
|
96
|
+
for (const target of targets) {
|
|
97
|
+
if (target.kind !== this.kind) {
|
|
98
|
+
results.set(target.targetId, unknownFor(target, `This probe answers "${this.kind}" targets, not "${target.kind}".`, `wrong probe kind: ${target.kind}`));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const params = target.params;
|
|
102
|
+
if (!params?.namespace || !params.vault || !params.programId) {
|
|
103
|
+
results.set(target.targetId, unknownFor(target, "This target names no cluster, vault or program, so nothing can be asked.", "malformed solana-recovery-vault target"));
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
byNamespace.set(params.namespace, [...(byNamespace.get(params.namespace) ?? []), target]);
|
|
107
|
+
}
|
|
108
|
+
for (const [namespace, group] of byNamespace) {
|
|
109
|
+
const url = this.rpcUrls[namespace];
|
|
110
|
+
if (!url) {
|
|
111
|
+
for (const target of group) {
|
|
112
|
+
results.set(target.targetId, unknownFor(target, `No RPC endpoint is configured for ${namespace}, so this is unwatched.`, `no rpc url for ${namespace}`));
|
|
113
|
+
}
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
for (const [targetId, observation] of await this.probeCluster(url, namespace, group)) {
|
|
117
|
+
results.set(targetId, observation);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// One observation per input target, in input order — a dropped one is an unwatched one.
|
|
121
|
+
return targets.map((t) => results.get(t.targetId) ?? unknownFor(t, "This target was not answered.", "no observation produced"));
|
|
122
|
+
}
|
|
123
|
+
async checkHealth() {
|
|
124
|
+
if (this.unhealthy.size === 0) {
|
|
125
|
+
return { ok: true, detail: `${Object.keys(this.rpcUrls).length} rpc endpoint(s)` };
|
|
126
|
+
}
|
|
127
|
+
const named = [...this.unhealthy.entries()].map(([ns, why]) => `${ns} (${why})`);
|
|
128
|
+
return { ok: false, detail: `unreachable: ${named.join("; ")}` };
|
|
129
|
+
}
|
|
130
|
+
async probeCluster(url, namespace, targets) {
|
|
131
|
+
const results = new Map();
|
|
132
|
+
// getMultipleAccounts caps at 100 addresses per request.
|
|
133
|
+
for (let offset = 0; offset < targets.length; offset += 100) {
|
|
134
|
+
const chunk = targets.slice(offset, offset + 100);
|
|
135
|
+
const addresses = chunk.map((t) => t.params.vault);
|
|
136
|
+
let accounts;
|
|
137
|
+
try {
|
|
138
|
+
accounts = await this.getMultipleAccounts(url, addresses);
|
|
139
|
+
this.unhealthy.delete(namespace);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
this.unhealthy.set(namespace, errorMessage(error));
|
|
143
|
+
for (const target of chunk) {
|
|
144
|
+
results.set(target.targetId, unknownFor(target, `The ${namespace} RPC endpoint could not be reached, so nothing has been ` +
|
|
145
|
+
`established. This is not the same as "nothing has happened".`, errorMessage(error)));
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
for (const [index, target] of chunk.entries()) {
|
|
150
|
+
try {
|
|
151
|
+
results.set(target.targetId, this.observe(target, accounts[index] ?? null));
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
results.set(target.targetId, unknownFor(target, "This vault account could not be read, so nothing has been established.", errorMessage(error)));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return results;
|
|
159
|
+
}
|
|
160
|
+
observe(target, account) {
|
|
161
|
+
const params = target.params;
|
|
162
|
+
// An account that is not there is **not** an absence of recovery activity. It may be the
|
|
163
|
+
// wrong address, a vault that was never created, or one that has been closed — none of
|
|
164
|
+
// which establishes that nothing happened, and the last of which is alarming. EVM cannot
|
|
165
|
+
// tell these apart from "no attempt"; here it would be a choice to throw that away.
|
|
166
|
+
if (account === null) {
|
|
167
|
+
return unknownFor(target, `No account exists at ${params.vault}. This is not "no recovery in progress": ` +
|
|
168
|
+
`the vault may never have been created, may have been closed, or this watch may ` +
|
|
169
|
+
`name the wrong address.`, "vault account not found");
|
|
170
|
+
}
|
|
171
|
+
if (account.owner !== params.programId) {
|
|
172
|
+
return unknownFor(target, `The account at ${params.vault} belongs to program ${account.owner}, not to ` +
|
|
173
|
+
`${params.programId}. Nothing about this watch's vault has been established.`, `wrong program owner: ${account.owner}`);
|
|
174
|
+
}
|
|
175
|
+
const vault = decodeVault(account.data);
|
|
176
|
+
const integrity = integrityOf(params, vault);
|
|
177
|
+
const now = this.now();
|
|
178
|
+
// Checked first, and permanently, because it is the only signal that survives the
|
|
179
|
+
// watchtower having been down. `epoch` is monotone and only `execute_recovery` bumps it, so
|
|
180
|
+
// a completed recovery is detectable retroactively even if nothing was watching at the time.
|
|
181
|
+
if (vault.epoch > params.expectedEpoch) {
|
|
182
|
+
return {
|
|
183
|
+
targetId: target.targetId,
|
|
184
|
+
verdict: "tripped",
|
|
185
|
+
signal: "onchain:epoch-advanced",
|
|
186
|
+
...integrity,
|
|
187
|
+
detail: `This vault's recovery epoch has advanced from ${params.expectedEpoch} to ` +
|
|
188
|
+
`${vault.epoch}, which happens only when a recovery is executed. One has ` +
|
|
189
|
+
`already completed against this vault.`,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (!vault.registered) {
|
|
193
|
+
return {
|
|
194
|
+
targetId: target.targetId,
|
|
195
|
+
verdict: "unknown",
|
|
196
|
+
...integrity,
|
|
197
|
+
detail: "This vault has no recovery key bound to it, so there is no protection here " +
|
|
198
|
+
"to watch. It was never registered, and nothing can recover it.",
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
const projected = project(vault, now);
|
|
202
|
+
const state = toVetoState(projected.state);
|
|
203
|
+
if (state === undefined) {
|
|
204
|
+
return {
|
|
205
|
+
targetId: target.targetId,
|
|
206
|
+
verdict: "clear",
|
|
207
|
+
...integrity,
|
|
208
|
+
detail: "No recovery attempt is open against this vault.",
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const deadlineAt = deadlineFor(projected, vault, now);
|
|
212
|
+
return {
|
|
213
|
+
targetId: target.targetId,
|
|
214
|
+
verdict: "tripped",
|
|
215
|
+
signal: `onchain:${state}`,
|
|
216
|
+
...(deadlineAt !== undefined ? { deadlineAt } : {}),
|
|
217
|
+
...integrity,
|
|
218
|
+
detail: detailFor(state, deadlineAt, now),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async getMultipleAccounts(url, addresses) {
|
|
222
|
+
const response = await this.fetchFn(url, {
|
|
223
|
+
method: "POST",
|
|
224
|
+
headers: { "content-type": "application/json" },
|
|
225
|
+
body: JSON.stringify({
|
|
226
|
+
jsonrpc: "2.0",
|
|
227
|
+
id: 1,
|
|
228
|
+
method: "getMultipleAccounts",
|
|
229
|
+
params: [addresses, { encoding: "base64", commitment: "confirmed" }],
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
if (!response.ok)
|
|
233
|
+
throw new Error(`rpc returned HTTP ${response.status}`);
|
|
234
|
+
const body = await response.json();
|
|
235
|
+
if (body.error)
|
|
236
|
+
throw new Error(body.error.message ?? "rpc returned an error");
|
|
237
|
+
const value = body.result?.value;
|
|
238
|
+
if (!Array.isArray(value))
|
|
239
|
+
throw new Error("rpc did not return an account list");
|
|
240
|
+
if (value.length !== addresses.length) {
|
|
241
|
+
// Positional, so a short list would silently shift every account onto the wrong watch.
|
|
242
|
+
throw new Error(`rpc returned ${value.length} accounts for ${addresses.length} addresses`);
|
|
243
|
+
}
|
|
244
|
+
return value.map((entry) => {
|
|
245
|
+
if (entry === null || entry === undefined)
|
|
246
|
+
return null;
|
|
247
|
+
const encoded = entry.data?.[0];
|
|
248
|
+
if (typeof encoded !== "string" || typeof entry.owner !== "string") {
|
|
249
|
+
throw new Error("rpc returned an account in an unexpected shape");
|
|
250
|
+
}
|
|
251
|
+
return { data: fromBase64(encoded), owner: entry.owner };
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Replay the veto clock forward to `now`.
|
|
257
|
+
*
|
|
258
|
+
* Delegates to `@nihilium/recovery-veto`, which is the oracle the Rust crate and the Solidity
|
|
259
|
+
* library are both checked against by the shared trace fixture. Re-deriving the arithmetic here
|
|
260
|
+
* would make this a fourth implementation to keep in step, and the clock is precisely where
|
|
261
|
+
* independent implementations drift.
|
|
262
|
+
*/
|
|
263
|
+
function project(vault, now) {
|
|
264
|
+
const status = toVetoState(vault.attempt.state);
|
|
265
|
+
if (status === undefined) {
|
|
266
|
+
return { state: VETO_STATE.NONE, status: "ABORTED", accruedSeconds: 0, pausedSeconds: 0 };
|
|
267
|
+
}
|
|
268
|
+
const config = vetoConfigOf(vault);
|
|
269
|
+
const before = {
|
|
270
|
+
status,
|
|
271
|
+
accruedSeconds: vault.attempt.accruedSeconds,
|
|
272
|
+
pausedSeconds: vault.attempt.pausedSeconds,
|
|
273
|
+
};
|
|
274
|
+
// A clock reading behind the checkpoint means no time has passed, not negative time. The
|
|
275
|
+
// machine refuses a negative advance outright, and freezing would be worse than ignoring it.
|
|
276
|
+
const elapsed = Math.max(0, now - vault.attempt.checkpointTime);
|
|
277
|
+
const transition = applyEvent(config, before, { type: "advance", seconds: elapsed });
|
|
278
|
+
const after = transition.ok ? transition.state : before;
|
|
279
|
+
return { state: ordinalOf(after.status), ...after };
|
|
280
|
+
}
|
|
281
|
+
function ordinalOf(status) {
|
|
282
|
+
switch (status) {
|
|
283
|
+
case "INITIATED": return VETO_STATE.INITIATED;
|
|
284
|
+
case "PAUSED": return VETO_STATE.PAUSED;
|
|
285
|
+
case "EXECUTABLE": return VETO_STATE.EXECUTABLE;
|
|
286
|
+
case "EXECUTED": return VETO_STATE.EXECUTED;
|
|
287
|
+
default: return VETO_STATE.ABORTED;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The vault's veto configuration, as the chain-agnostic type.
|
|
292
|
+
*
|
|
293
|
+
* Only `timelockSeconds` and `pauseCeilingSeconds` steer a projection, but the authorities are
|
|
294
|
+
* filled in properly rather than stubbed: a half-built config passed to a shared machine is a trap
|
|
295
|
+
* for whoever next uses it for something that does read them.
|
|
296
|
+
*/
|
|
297
|
+
function vetoConfigOf(vault) {
|
|
298
|
+
const authority = (id) => ({ namespace: "solana", id });
|
|
299
|
+
return {
|
|
300
|
+
pauseAuthority: authority(vault.veto.pauseAuthority),
|
|
301
|
+
abortAuthority: authority(vault.veto.abortAuthority),
|
|
302
|
+
resumeQuorum: {
|
|
303
|
+
members: vault.veto.resumeMembers.map(authority),
|
|
304
|
+
threshold: vault.veto.resumeThreshold,
|
|
305
|
+
},
|
|
306
|
+
timelockSeconds: vault.veto.timelockSeconds,
|
|
307
|
+
pauseCeilingSeconds: vault.veto.pauseCeilingSeconds,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* When the attempt becomes executable.
|
|
312
|
+
*
|
|
313
|
+
* Computed from the **projected** attempt with `now` as its checkpoint, which is what makes this
|
|
314
|
+
* match the EVM probe: there, `attemptOf` hands back an attempt the contract already projected, so
|
|
315
|
+
* its `checkpointTime` is the block timestamp. Using the raw account's stale checkpoint here would
|
|
316
|
+
* report a deadline that had already passed.
|
|
317
|
+
*/
|
|
318
|
+
export function deadlineFor(projected, vault, now) {
|
|
319
|
+
if (projected.state === VETO_STATE.INITIATED) {
|
|
320
|
+
return now + (vault.veto.timelockSeconds - projected.accruedSeconds);
|
|
321
|
+
}
|
|
322
|
+
if (projected.state === VETO_STATE.PAUSED) {
|
|
323
|
+
return now
|
|
324
|
+
+ (vault.veto.pauseCeilingSeconds - projected.pausedSeconds)
|
|
325
|
+
+ (vault.veto.timelockSeconds - projected.accruedSeconds);
|
|
326
|
+
}
|
|
327
|
+
return undefined;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Whether the protection the user registered is still the one in force.
|
|
331
|
+
*
|
|
332
|
+
* Orthogonal to `verdict` on purpose. A rotated recovery key is not a recovery attempt and must not
|
|
333
|
+
* render as one — but it means the user's recovery has been replaced, which is every bit as urgent.
|
|
334
|
+
* `config_nonce` makes a rotation detectable even when the replacement key happens to be the same
|
|
335
|
+
* one, which a comparison of keys alone would miss.
|
|
336
|
+
*/
|
|
337
|
+
function integrityOf(params, vault) {
|
|
338
|
+
if (!vault.registered)
|
|
339
|
+
return { integrity: "changed" };
|
|
340
|
+
if (vault.recoveryOwner !== params.expectedRecoveryOwner)
|
|
341
|
+
return { integrity: "changed" };
|
|
342
|
+
if (vault.configNonce !== params.expectedConfigNonce)
|
|
343
|
+
return { integrity: "changed" };
|
|
344
|
+
return { integrity: "ok" };
|
|
345
|
+
}
|
|
346
|
+
function detailFor(state, deadlineAt, now) {
|
|
347
|
+
switch (state) {
|
|
348
|
+
case "INITIATED":
|
|
349
|
+
return deadlineAt !== undefined
|
|
350
|
+
? `A recovery is in progress against this vault and becomes executable in ` +
|
|
351
|
+
`${describe(deadlineAt - now)}. Pause it if you did not start it.`
|
|
352
|
+
: "A recovery is in progress against this vault.";
|
|
353
|
+
case "PAUSED":
|
|
354
|
+
return deadlineAt !== undefined
|
|
355
|
+
? `A recovery against this vault is paused, but the pause expires automatically. ` +
|
|
356
|
+
`It becomes executable in ${describe(deadlineAt - now)} unless aborted.`
|
|
357
|
+
: "A recovery against this vault is paused.";
|
|
358
|
+
case "EXECUTABLE":
|
|
359
|
+
return "A recovery against this vault can be executed right now. The timelock is over.";
|
|
360
|
+
case "EXECUTED":
|
|
361
|
+
return "A recovery against this vault has already been executed.";
|
|
362
|
+
default:
|
|
363
|
+
return "A recovery against this vault was aborted.";
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function describe(seconds) {
|
|
367
|
+
if (seconds <= 0)
|
|
368
|
+
return "moments";
|
|
369
|
+
const days = Math.floor(seconds / 86_400);
|
|
370
|
+
if (days >= 1)
|
|
371
|
+
return `${days} day${days === 1 ? "" : "s"}`;
|
|
372
|
+
const hours = Math.floor(seconds / 3_600);
|
|
373
|
+
if (hours >= 1)
|
|
374
|
+
return `${hours} hour${hours === 1 ? "" : "s"}`;
|
|
375
|
+
const minutes = Math.floor(seconds / 60);
|
|
376
|
+
if (minutes >= 1)
|
|
377
|
+
return `${minutes} minute${minutes === 1 ? "" : "s"}`;
|
|
378
|
+
return `${seconds} second${seconds === 1 ? "" : "s"}`;
|
|
379
|
+
}
|
|
380
|
+
function unknownFor(target, detail, signal) {
|
|
381
|
+
return { targetId: target.targetId, verdict: "unknown", signal, detail };
|
|
382
|
+
}
|
|
383
|
+
function errorMessage(error) {
|
|
384
|
+
return error instanceof Error ? error.message : String(error);
|
|
385
|
+
}
|
|
386
|
+
/** Base64 → bytes, without assuming `Buffer` or `atob`. */
|
|
387
|
+
function fromBase64(encoded) {
|
|
388
|
+
const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
389
|
+
const clean = encoded.replace(/=+$/, "");
|
|
390
|
+
const out = new Uint8Array((clean.length * 3) >> 2);
|
|
391
|
+
let bits = 0;
|
|
392
|
+
let accumulator = 0;
|
|
393
|
+
let at = 0;
|
|
394
|
+
for (const character of clean) {
|
|
395
|
+
const value = ALPHABET.indexOf(character);
|
|
396
|
+
if (value < 0)
|
|
397
|
+
throw new Error("account data is not valid base64");
|
|
398
|
+
accumulator = (accumulator << 6) | value;
|
|
399
|
+
bits += 6;
|
|
400
|
+
if (bits >= 8) {
|
|
401
|
+
bits -= 8;
|
|
402
|
+
out[at++] = (accumulator >> bits) & 0xff;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return out.subarray(0, at);
|
|
406
|
+
}
|
|
407
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,OAAO,EAAE,UAAU,EAAyB,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGlF;;;;;;;;;;;;;;;;;;;;;;;;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C;QACV,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,CAAC;YACV,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC;QAC7C,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Vault` account layout, decoded by hand.
|
|
3
|
+
*
|
|
4
|
+
* **Inlined rather than imported from the program's IDL**, for the reason `watchtower-evm/abi.ts`
|
|
5
|
+
* inlines its three signatures: the generated bindings live in a git submodule and are not
|
|
6
|
+
* published, so depending on them would be unresolvable from npm and would break `tsc -b` for
|
|
7
|
+
* anyone without an initialized submodule. The cost of inlining is drift, and
|
|
8
|
+
* `test/layout-pin.test.ts` is what pays it — it checks this decoder against the generated IDL
|
|
9
|
+
* through a test-only alias.
|
|
10
|
+
*
|
|
11
|
+
* No `@coral-xyz/anchor` and no `@solana/web3.js`. This is one sequential Borsh read; pulling in an
|
|
12
|
+
* Anchor client to do it would put a large, fast-moving dependency in the one component that has to
|
|
13
|
+
* keep working while nobody is looking at it.
|
|
14
|
+
*
|
|
15
|
+
* **Borsh writes the `Vec` at its real length, not its reserved one.** Anchor's `InitSpace` sizes
|
|
16
|
+
* the *account* for `MAX_RESUME_MEMBERS`, but the serialized bytes carry `u32` length + that many
|
|
17
|
+
* members, and every field after it shifts accordingly. So this reads sequentially and never
|
|
18
|
+
* computes a fixed offset — a decoder built from constants would misread every vault whose quorum
|
|
19
|
+
* is not exactly the maximum size.
|
|
20
|
+
*/
|
|
21
|
+
/** Anchor's account discriminator: `sha256("account:Vault")[0..8]`. */
|
|
22
|
+
export declare const VAULT_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
23
|
+
export interface DecodedVault {
|
|
24
|
+
creator: string;
|
|
25
|
+
vaultId: Uint8Array;
|
|
26
|
+
owner: string;
|
|
27
|
+
recoveryOwner: string;
|
|
28
|
+
epoch: number;
|
|
29
|
+
nonce: number;
|
|
30
|
+
attemptSeq: number;
|
|
31
|
+
configNonce: number;
|
|
32
|
+
veto: {
|
|
33
|
+
pauseAuthority: string;
|
|
34
|
+
abortAuthority: string;
|
|
35
|
+
resumeMembers: string[];
|
|
36
|
+
resumeThreshold: number;
|
|
37
|
+
timelockSeconds: number;
|
|
38
|
+
pauseCeilingSeconds: number;
|
|
39
|
+
};
|
|
40
|
+
attempt: {
|
|
41
|
+
/** `gradual_veto::State` ordinal. 0 = NONE, which has no `VetoState` counterpart. */
|
|
42
|
+
state: number;
|
|
43
|
+
accruedSeconds: number;
|
|
44
|
+
pausedSeconds: number;
|
|
45
|
+
checkpointTime: number;
|
|
46
|
+
};
|
|
47
|
+
intentDigest: string;
|
|
48
|
+
registered: bool;
|
|
49
|
+
bump: number;
|
|
50
|
+
solBump: number;
|
|
51
|
+
}
|
|
52
|
+
type bool = boolean;
|
|
53
|
+
/** Field order, pinned against the IDL by `layout-pin.test.ts`. Changing one changes the other. */
|
|
54
|
+
export declare const VAULT_FIELD_ORDER: readonly ["creator", "vault_id", "owner", "recovery_owner", "epoch", "nonce", "attempt_seq", "config_nonce", "veto", "attempt", "intent_digest", "registered", "bump", "sol_bump"];
|
|
55
|
+
/**
|
|
56
|
+
* Decode a `Vault` account's data.
|
|
57
|
+
*
|
|
58
|
+
* Throws rather than returning a partial value. A probe that half-read an account and reported
|
|
59
|
+
* `clear` for the half it understood would be the exact failure this component exists to prevent,
|
|
60
|
+
* so every failure here surfaces as `unknown`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function decodeVault(data: Uint8Array): DecodedVault;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,yBAAsD,CAAC;AAEvF,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE;QACF,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,mBAAmB,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACL,qFAAqF;QACrF,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,IAAI,GAAG,OAAO,CAAC;AAEpB,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,oLAGpB,CAAC;AA+DX;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAoD1D"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { toSolanaAddress } from "@nihilium/recovery-key-solana";
|
|
2
|
+
/**
|
|
3
|
+
* The `Vault` account layout, decoded by hand.
|
|
4
|
+
*
|
|
5
|
+
* **Inlined rather than imported from the program's IDL**, for the reason `watchtower-evm/abi.ts`
|
|
6
|
+
* inlines its three signatures: the generated bindings live in a git submodule and are not
|
|
7
|
+
* published, so depending on them would be unresolvable from npm and would break `tsc -b` for
|
|
8
|
+
* anyone without an initialized submodule. The cost of inlining is drift, and
|
|
9
|
+
* `test/layout-pin.test.ts` is what pays it — it checks this decoder against the generated IDL
|
|
10
|
+
* through a test-only alias.
|
|
11
|
+
*
|
|
12
|
+
* No `@coral-xyz/anchor` and no `@solana/web3.js`. This is one sequential Borsh read; pulling in an
|
|
13
|
+
* Anchor client to do it would put a large, fast-moving dependency in the one component that has to
|
|
14
|
+
* keep working while nobody is looking at it.
|
|
15
|
+
*
|
|
16
|
+
* **Borsh writes the `Vec` at its real length, not its reserved one.** Anchor's `InitSpace` sizes
|
|
17
|
+
* the *account* for `MAX_RESUME_MEMBERS`, but the serialized bytes carry `u32` length + that many
|
|
18
|
+
* members, and every field after it shifts accordingly. So this reads sequentially and never
|
|
19
|
+
* computes a fixed offset — a decoder built from constants would misread every vault whose quorum
|
|
20
|
+
* is not exactly the maximum size.
|
|
21
|
+
*/
|
|
22
|
+
/** Anchor's account discriminator: `sha256("account:Vault")[0..8]`. */
|
|
23
|
+
export const VAULT_DISCRIMINATOR = new Uint8Array([211, 8, 232, 43, 2, 152, 117, 119]);
|
|
24
|
+
/** Field order, pinned against the IDL by `layout-pin.test.ts`. Changing one changes the other. */
|
|
25
|
+
export const VAULT_FIELD_ORDER = [
|
|
26
|
+
"creator", "vault_id", "owner", "recovery_owner", "epoch", "nonce", "attempt_seq",
|
|
27
|
+
"config_nonce", "veto", "attempt", "intent_digest", "registered", "bump", "sol_bump",
|
|
28
|
+
];
|
|
29
|
+
class Reader {
|
|
30
|
+
data;
|
|
31
|
+
at = 0;
|
|
32
|
+
constructor(data) {
|
|
33
|
+
this.data = data;
|
|
34
|
+
}
|
|
35
|
+
bytes(length) {
|
|
36
|
+
const end = this.at + length;
|
|
37
|
+
if (end > this.data.length) {
|
|
38
|
+
throw new Error(`vault account is truncated: wanted ${length} bytes at offset ${this.at}, ` +
|
|
39
|
+
`only ${this.data.length - this.at} remain`);
|
|
40
|
+
}
|
|
41
|
+
const slice = this.data.subarray(this.at, end);
|
|
42
|
+
this.at = end;
|
|
43
|
+
return slice;
|
|
44
|
+
}
|
|
45
|
+
pubkey() {
|
|
46
|
+
return toSolanaAddress({ algorithm: "ed25519", bytes: this.bytes(32) });
|
|
47
|
+
}
|
|
48
|
+
u8() {
|
|
49
|
+
return this.bytes(1)[0];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Read a 64-bit integer as a JS number.
|
|
53
|
+
*
|
|
54
|
+
* Safe for every field this reads: epochs, nonces and second-counters are far below 2^53, and a
|
|
55
|
+
* `checkpointTime` that overflowed would mean a clock past the year 285 million. Returning
|
|
56
|
+
* bigints would push that arithmetic into every caller for no gain.
|
|
57
|
+
*/
|
|
58
|
+
u64() {
|
|
59
|
+
const raw = this.bytes(8);
|
|
60
|
+
let value = 0n;
|
|
61
|
+
for (let i = 7; i >= 0; i--)
|
|
62
|
+
value = (value << 8n) | BigInt(raw[i]);
|
|
63
|
+
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
64
|
+
throw new Error(`vault field exceeds a safe integer: ${value}`);
|
|
65
|
+
}
|
|
66
|
+
return Number(value);
|
|
67
|
+
}
|
|
68
|
+
i64() {
|
|
69
|
+
const raw = this.bytes(8);
|
|
70
|
+
let value = 0n;
|
|
71
|
+
for (let i = 7; i >= 0; i--)
|
|
72
|
+
value = (value << 8n) | BigInt(raw[i]);
|
|
73
|
+
// Two's complement.
|
|
74
|
+
if (value >= 1n << 63n)
|
|
75
|
+
value -= 1n << 64n;
|
|
76
|
+
return Number(value);
|
|
77
|
+
}
|
|
78
|
+
u32() {
|
|
79
|
+
const raw = this.bytes(4);
|
|
80
|
+
return raw[0] | (raw[1] << 8) | (raw[2] << 16) | (raw[3] << 24);
|
|
81
|
+
}
|
|
82
|
+
hex(length) {
|
|
83
|
+
return [...this.bytes(length)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Decode a `Vault` account's data.
|
|
88
|
+
*
|
|
89
|
+
* Throws rather than returning a partial value. A probe that half-read an account and reported
|
|
90
|
+
* `clear` for the half it understood would be the exact failure this component exists to prevent,
|
|
91
|
+
* so every failure here surfaces as `unknown`.
|
|
92
|
+
*/
|
|
93
|
+
export function decodeVault(data) {
|
|
94
|
+
if (data.length < 8)
|
|
95
|
+
throw new Error("vault account holds no discriminator");
|
|
96
|
+
for (let i = 0; i < 8; i++) {
|
|
97
|
+
if (data[i] !== VAULT_DISCRIMINATOR[i]) {
|
|
98
|
+
throw new Error("this account is not a recovery vault: its Anchor discriminator does not match. " +
|
|
99
|
+
"The address may belong to a different program or a different account type.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const r = new Reader(data.subarray(8));
|
|
103
|
+
const creator = r.pubkey();
|
|
104
|
+
const vaultId = r.bytes(16).slice();
|
|
105
|
+
const owner = r.pubkey();
|
|
106
|
+
const recoveryOwner = r.pubkey();
|
|
107
|
+
const epoch = r.u64();
|
|
108
|
+
const nonce = r.u64();
|
|
109
|
+
const attemptSeq = r.u64();
|
|
110
|
+
const configNonce = r.u64();
|
|
111
|
+
const pauseAuthority = r.pubkey();
|
|
112
|
+
const abortAuthority = r.pubkey();
|
|
113
|
+
const memberCount = r.u32();
|
|
114
|
+
if (memberCount > 255) {
|
|
115
|
+
throw new Error(`vault declares ${memberCount} resume members, which cannot be genuine`);
|
|
116
|
+
}
|
|
117
|
+
const resumeMembers = Array.from({ length: memberCount }, () => r.pubkey());
|
|
118
|
+
const resumeThreshold = r.u8();
|
|
119
|
+
const timelockSeconds = r.u64();
|
|
120
|
+
const pauseCeilingSeconds = r.u64();
|
|
121
|
+
const attempt = {
|
|
122
|
+
state: r.u8(),
|
|
123
|
+
accruedSeconds: r.u64(),
|
|
124
|
+
pausedSeconds: r.u64(),
|
|
125
|
+
checkpointTime: r.i64(),
|
|
126
|
+
};
|
|
127
|
+
const intentDigest = r.hex(32);
|
|
128
|
+
const registered = r.u8() !== 0;
|
|
129
|
+
const bump = r.u8();
|
|
130
|
+
const solBump = r.u8();
|
|
131
|
+
return {
|
|
132
|
+
creator, vaultId, owner, recoveryOwner, epoch, nonce, attemptSeq, configNonce,
|
|
133
|
+
veto: {
|
|
134
|
+
pauseAuthority, abortAuthority, resumeMembers, resumeThreshold,
|
|
135
|
+
timelockSeconds, pauseCeilingSeconds,
|
|
136
|
+
},
|
|
137
|
+
attempt, intentDigest, registered, bump, solBump,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAkCvF,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa;IACjF,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU;CAC9E,CAAC;AAEX,MAAM,MAAM;IAEqB;IADrB,EAAE,GAAG,CAAC,CAAC;IACf,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,KAAK,CAA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C;IAC/B,MAAM,eAAe,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAChC,MAAM,mBAAmB,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAEpC,MAAM,OAAO,GAAG;QACZ,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;QACb,cAAc,EAAE,CAAC,CAAC,GAAG,EAAE;QACvB,aAAa,EAAE,CAAC,CAAC,GAAG,EAAE;QACtB,cAAc,EAAE,CAAC,CAAC,GAAG,EAAE;KAC1B,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IAEvB,OAAO;QACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW;QAC7E,IAAI,EAAE;YACF,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe;YAC9D,eAAe,EAAE,mBAAmB;SACvC;QACD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO;KACnD,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nihilium/recovery-watchtower-solana",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Watch probe for the Solana recovery vault — reads the vault account and projects the veto clock (spec §6, §15).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": ["dist", "README.md"],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -b",
|
|
18
|
+
"clean": "tsc -b --clean"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@nihilium/recovery-core": "^0.9.0",
|
|
22
|
+
"@nihilium/recovery-key-solana": "^0.9.0",
|
|
23
|
+
"@nihilium/recovery-veto": "^0.9.0"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
}
|
|
28
|
+
}
|