Testnet Mode — switch back to Production in the menuheader when you're done.
VarnirKeyHealthCheck extends Event
/**
* Voting round: after the social-recovery guard, reads this node's
* volatile for `$o.key` (an unreadable volatile counts as empty) and
* shares `{hashtable, hash, inTable}` with the other nodes. Always votes
* yes: the comparison happens in commit().
*
* @returns {Promise<boolean>}
* @memberof VarnirKeyHealthCheck
*/ public vote(): Promise<boolean> {
return new Promise<boolean>(async (resolve, reject) => {
// Social recovery (spec §4.5): a recovered identity is dead, a frozen one cannot move money.
const recoveryRefusal = this.refuseRecoveredStreams([]);
if (recoveryRefusal) return reject(recoveryRefusal);
// The mpc2 entries (class comment); each decides its own vote.
const entry = this.transactions.$entry;
if (entry === "mpcfreeze" || entry === "mpccanary" || entry === "mpcstatus") {
try {
this.setTimeout(MPC2_VOTE_TIMEOUT_MS);
// Gateway only (PR #358 review M1). A freeze still rests on the
// CVMs' own reports, never on the gateway's word.
await this.assertMinigateSigner();
if (entry === "mpcfreeze") {
await this.voteMpcFreeze();
} else if (entry === "mpccanary") {
await this.voteMpcCanary();
} else {
await this.voteMpcStatus();
}
return resolve(true);
} catch (e) {
return reject(typeof e === "string" ? e : "Runtime Vote Revert");
}
}
// Get the Key & Volatile data
const key: Activity = this.getActivityStreams(this.transactions.$o.key);
let keyData;
try {
// Can't always fetch volatile
keyData = await key.getVolatile();
} catch {
// Could be a temporary database issue however not a problem as "restore" keeps history
keyData = {};
}
const compareData = {
hashtable: [],
hash: "000000",
inTable: false,
};
// Only add it if we have it!
if (keyData?.public?.hashes && keyData?.private?.part) {
compareData.hashtable = keyData.public.hashes.sort();
compareData.hash = this.ActiveCrypto.Hash.getHash(
keyData.private.part,
"sha256"
);
}
// Make sure our part is still in the hashtable so that neither have been tampered with
if (compareData.hashtable.indexOf(compareData.hash) !== -1) {
compareData.inTable = true;
}
// Our compare data is sent with the transaction
// No private data is leaked here
this.setThisInterNodeComms(compareData);
// Part of the "vote" round is now managed in the commit phase so we can compare all datasets
return resolve(true);
});
}/**
* Commit round: compares every node's shared data (see the class comment),
* lists the nodes whose data was consistent as `territoriality`, writes a
* repair token when the key is not healthy, and returns the result.
*
* @returns {Promise<any>}
* @memberof VarnirKeyHealthCheck
*/ public commit(): Promise<any> {
return new Promise<any>(async (resolve, reject) => {
const entry = this.transactions.$entry;
if (entry === "mpcfreeze") {
this.commitMpcFreeze();
return resolve(true);
}
if (entry === "mpccanary") {
this.commitMpcCanary();
return resolve(true);
}
if (entry === "mpcstatus") {
// Read only: this node's two verified reports go back to the caller.
this.returnToRemote({reports: this.mpc2Reports});
return resolve(true);
}
// Owner doesn't mean the owner of the key just the transaction
//const owner: Activity = this.getActivityStreams(this.transactions.$i.owner);
const ownerGetId = this.ActiveCrypto.Hash.getHash(
this.transactions.$i.admin.publicKey
);
// We should now have all of the nodes (with $unanimous)
const comms = this.getInterNodeComms() || {};
const commsKeys = Object.keys(comms);
// Not needed now with $unanimous but still good to know the node reference which is safe to use
const safeNode: string[] = [];
// Assume the key is healthy
let keyHealthy = true;
// Array to provide reasons for what could be wrong with the key from this node
const keyHealthReason: string[] = [];
// Make sure the hashes are unique in the network
const keyHashUnique = {};
// The hash table for the parts to be compared to. There is a chance the first hash table is wrong
let sampleHashTable;
let sampleHashTableString;
// The token is used for creating the tunnel
let token: string;
// Loop the nodes that provided keys
for (let i = commsKeys.length; i--;) {
const node = commsKeys[i];
const key = comms[node];
let safe = true;
// Make sure the hash was found at the node level
if (key.inTable) {
// Have we got a sample of the table to compare
if (sampleHashTableString) {
// String compare will work as we have already ordered it
if (key.hashtable.toString() !== sampleHashTableString) {
safe = keyHealthy = false;
keyHealthReason.push(`${node} hashtable not matching`);
}
} else {
// Create Sample
sampleHashTable = key.hashtable;
sampleHashTableString = key.hashtable.toString();
}
// Duplicate Parts?
if (!keyHashUnique[key.hash]) {
keyHashUnique[key.hash] = true;
} else {
safe = keyHealthy = false;
keyHealthReason.push(`Duplicate key hash in network`);
}
} else {
safe = keyHealthy = false;
keyHealthReason.push(`${node} key hash not in its own hash table`);
}
// Can be used for $terri
if (safe) {
safeNode.push(node);
}
// If the key isn't healthy setup this node to prepare a history write
if (!keyHealthy) {
token = await this.prepareForWrites(ownerGetId, safeNode);
}
}
// Now lets make sure we got the same node count as the sample
// Chances of this one being false is low however it is still needed just in case a single node is down
if (commsKeys.length !== sampleHashTable.length) {
keyHealthy = false;
keyHealthReason.push(
`key maybe healthy, Only ${commsKeys.length} responded and needed ${sampleHashTable.length}`
);
token = await this.prepareForWrites(ownerGetId, safeNode);
}
this.returnToRemote({
healthy: keyHealthy,
reasons: keyHealthReason,
response: {
got: commsKeys.length,
need: sampleHashTable.length,
},
territoriality: safeNode,
token,
});
resolve(true);
});
} private refuseRecoveredIdentity(state: any, outgoing: boolean): string | null {
if (state && state.recoveredTo) {
// A dead identity may still RECEIVE: the credit lands and is swept to recoveredTo.
return outgoing
? `Identity recovered - new identity is ${state.recoveredTo}; your keys are still valid`
: null;
}
if (outgoing && state && state.recovery && state.recovery.frozen) {
return "Identity frozen - a social recovery is in its 48h waiting period";
}
return null;
} private refuseRecoveredStreams(incomingOnly: string[] | "all-outputs"): string | null {
// Never getActivityStreams(ref): an unloaded ref CREATES a stream. The
// no-argument form returns only the streams this transaction loaded.
const ctx: any = this as any;
const loaded: any = ctx.getActivityStreams() || {};
const outputs: any = (ctx.transactions && ctx.transactions.$o) || {};
const toId = (label: string, ref: any): string | null => {
const raw = ref && typeof ref === "object" ? ref.$stream : typeof ref === "string" ? ref : /^[0-9a-f]{64}$/i.test(label) ? label : null;
return typeof raw === "string" ? raw.split(":")[0].slice(-64) : null;
};
const outputIds: string[] = [];
const incomingIds: string[] = [];
for (const label of Object.keys(outputs)) {
const id = toId(label, outputs[label]);
if (!id) continue;
outputIds.push(id);
if (incomingOnly === "all-outputs" || incomingOnly.indexOf(label) !== -1) incomingIds.push(id);
}
for (const id of Object.keys(loaded)) {
const activity = loaded[id];
if (!activity || typeof activity.getState !== "function") continue;
const signed = typeof activity.hasSignature === "function" && activity.hasSignature();
const incoming = !signed && outputIds.indexOf(id) !== -1 && incomingIds.indexOf(id) !== -1;
const refusal = this.refuseRecoveredIdentity(activity.getState(), !incoming);
if (refusal) return refusal;
}
return null;
}/** * The key on `$o.key` and its state, refused unless it is an mpc2 key (the * only keys whose CVMs answer `mpc2/*`). Old mpc-tss keys (no * `mpcProtocol`) have no freeze or canary on these CVMs. */
private mpc2KeyOnOutput(): {key: Activity; state: any; keyId: string}/**
* One `mpc2/status` through this node's egress agent; returns `{a, b}`, the
* two reports, after the checks the contract can make itself (the agent
* has already checked each `reportSig` against the CVM's pinned evidence).
* Throws on anything else: a node that cannot read its CVMs votes no.
*/ private async mpc2Status(keyId: string, network: string, payload: any): Promise<{a: any; b: any}/** * Throws unless the `$selfsign` signer is a gateway (PR #358 review M1): * `$r.minigate` is a provisioned minigate (its `:volatile` carries the * `minigate` flag only an operator writes) and `$i.admin.publicKey` is one of * its authorities. The same proof as Varnir.CryptoTransfer's * assertMinigateSigner. Why: each of these rounds makes all four agents * call both CVMs, spending the nodes' status and signing budgets and (for * `$o` streams) holding locks; anyone able to submit them could blind the * watch and block freeze records. */
private async assertMinigateSigner(): Promise<void> {
const minigateRef = this.transactions.$r ? this.transactions.$r.minigate : undefined;
if (!minigateRef) {
throw "mpc2: not authorised - missing minigate reference";
}
const minigateVolatile: any = await this.getAnyStreamReadOnly(`${minigateRef}:volatile`);
if (!minigateVolatile || !minigateVolatile.minigate) {
throw "mpc2: not authorised - reference is not a minigate";
}
const signingKey = this.transactions.$i.admin ? this.transactions.$i.admin.publicKey : undefined;
const minigateMeta: any = await this.getAnyStreamReadOnly(`${minigateRef}:stream`);
if (!signingKey || !minigateMeta || !Array.isArray(minigateMeta.authorities) ||
!minigateMeta.authorities.some((a: any) => a.public === signingKey)) {
throw "mpc2: not authorised - signing key is not a minigate authority";
}
}/** The per-tree constant, read in one place (tests pin another value here). */
private mpc2HaltContract(): string {
return MPC2_HALT_CONTRACT;
}/** * Throws while Varnir.CryptoTransfer's ledger halt (`mpchalt`, a CVM's * peer lockout kept on the ledger) stands (PR #358 review M2). A canary is * a full signing session with the peer, which is what the lockout stops. * Read from that contract's data (MPC2_HALT_CONTRACT, per tree); blank or * unreadable refuses: without it no node can say the peer is trusted. */
private async assertNoMpcHalt(): Promise<void> {
const haltContract = this.mpc2HaltContract();
if (!/^[0-9a-f]{64}$/.test(haltContract)) {
throw "mpc2: the halt record's contract is not configured on this network";
}
let doc: any;
try {
doc = await this.getAnyStreamReadOnly(`${haltContract}:data`);
} catch (e) {
// Not found and a failed read look the same here, so both refuse.
// CryptoTransfer's data exists wherever mpc2 runs (its `mod` writes
// `mpc2Enabled`).
throw "mpc2: cannot read the ledger halt record";
}
const data = doc && typeof doc === "object" && doc.data && typeof doc.data === "object" ? doc.data : {};
// Any stored value counts, as in CryptoTransfer's signingRoute.
if (data.mpc2Halt !== undefined && data.mpc2Halt !== null) {
throw "mpc2: MPC signing is halted on the ledger (peer lockout)";
}
}/** * Throws unless the ledger freeze is switched on: Varnir.CryptoTransfer's * contract data `mpc2FreezeEnabled: true` (Adam 2026-10-09, * docs/decisions/2026-10-09-mpc-freeze-behind-flag.md). Missing, false, * malformed or unreadable is OFF. Why a flag, default off: recording a * freeze starts the frozen-key machinery (a new deposit address, held * Bitcoin deposits, the owner's sweep), which needs much more testing * first. While it is off, a key the CVMs refuse in memory simply stays * unsigned, and minigate pages "[MPC-FREEZE] ... should be frozen" for a * person to act on; nothing is written to the ledger. */
private async assertFreezeEnabled(what: string): Promise<void> {
const flagContract = this.mpc2HaltContract();
let data: any = {};
try {
const doc: any = /^[0-9a-f]{64}$/.test(flagContract) ? await this.getAnyStreamReadOnly(`${flagContract}:data`) : null;
data = doc && typeof doc === "object" && doc.data && typeof doc.data === "object" ? doc.data : {};
} catch (e) {
data = {};
}
if (data.mpc2FreezeEnabled !== true) {
throw `${what}: the ledger freeze is off (mpc2FreezeEnabled); a person reviews the key by hand`;
}
}/** `mpcfreeze` vote: see the class comment. */
private async voteMpcFreeze(): Promise<void> {
// Behind the freeze flag, before any CVM call (Adam 2026-10-09).
await this.assertFreezeEnabled("mpc2 freeze");
const {state, keyId} = this.mpc2KeyOnOutput();
const admin = this.transactions.$i.admin || {};
// Never cleared or unfrozen (spec §4.5, a frozen key is never unfrozen).
// A second submission is a duplicate, with one exception (PR #416
// re-review N2): a `stall` record may ESCALATE to `strike` once a CVM
// shows a strike freeze of this key. A strike only ever stays or
// escalates, never downgrades: a stall is what lets a frozen-key sweep
// run, so a stall recorded first (a malicious peer's own freeze, say)
// must not outlive the honest CVM's strike, which is held in memory only.
// A record from before kinds were kept counts as a strike.
const existing = state.mpcFrozen;
const escalate = existing !== undefined && existing !== null && existing.kind === "stall" && admin.kind === "strike";
if (existing !== undefined && !escalate) {
throw "mpc2: the key is already recorded frozen";
}
// The claim is copied into the record only after the CVMs confirm it, so
// it must be the CVM's own sid (a SHA-256) and a short reason code.
if (typeof admin.sid !== "string" || !/^[0-9a-f]{64}$/.test(admin.sid)) {
throw "mpc2 freeze: sid must be 64 lowercase hex";
}
if (typeof admin.reason !== "string" || !/^[A-Za-z0-9 _:.\/-]{1,128}$/.test(admin.reason)) {
throw "mpc2 freeze: reason must be a short code";
}
// Why it froze, as the CVM recorded it (PR #416 review M3): `stall` (a
// timeout, a dropped link) or `strike` (a bad message from the peer). A
// frozen-key sweep runs only after a stall, so the kind is recorded with
// the freeze and must be the confirming CVM's own.
if (admin.kind !== "stall" && admin.kind !== "strike") {
throw "mpc2 freeze: kind must be stall or strike";
}
const reports = await this.mpc2Status(keyId, state.network, {});
// A CVM image from before kinds were kept reports none: that counts as a
// strike (PR #416 re-review N3), so an old image fails closed, to the kind
// that never opens a sweep, rather than refusing every freeze. Deploy the
// CVM image before these contracts all the same (the runbook says so).
const kindOf = (r: any): string => (r.key.kind === undefined || r.key.kind === null ? "strike" : r.key.kind);
// Either CVM's freeze is enough, on its own verified report (H1): a key
// frozen on one CVM can no longer sign (both must take part), so the
// ledger must say so whatever the other CVM answers. The Q check ties the
// freeze to this key's share, not to another key stream reusing the id.
const confirms = (r: any) => !!r && r.key.frozen === true && r.key.sid === admin.sid && r.key.reason === admin.reason && r.key.publicKey === state.publicKey && kindOf(r) === admin.kind;
if (!confirms(reports.a) && !confirms(reports.b)) {
throw "mpc2 freeze: not confirmed by this node's CVMs";
}
// The worst kind wins (N2): "either CVM is enough" is right for recording
// THAT a key froze, but not for calling it a stall. A peer that means
// harm can freeze the key itself as a stall first; if the honest CVM
// shows this key frozen for a strike, a stall is refused here, and that
// CVM's own strike record (the watch submits each CVM's freeze) stands.
if (admin.kind === "stall" && [reports.a, reports.b].some((r: any) => !!r && r.key.frozen === true && kindOf(r) !== "stall")) {
throw "mpc2 freeze: a CVM reports this key frozen for a strike, so it cannot be recorded as a stall";
}
this.mpc2Freeze = {sid: admin.sid, reason: admin.reason};
}/** * `mpcfreeze` commit: writes `mpcFrozen` from the claim every yes-voting * node confirmed. The transaction's own values, not this node's report, * so every node writes the same record. */
private commitMpcFreeze(): void {
const key: Activity = this.getActivityStreams(this.transactions.$o.key);
const state = key.getState() as any;
const admin = this.transactions.$i.admin;
// A record committed meanwhile stands; this is the only writer. The one
// change it allows is the escalation (N2): a stall becomes a strike,
// keeping its first time, with the strike that escalated it beside it.
const prev = state.mpcFrozen;
const next = prev === undefined
? {at: this.cDate, sid: admin.sid, reason: admin.reason, kind: admin.kind}
: prev.kind === "stall" && admin.kind === "strike"
? {...prev, kind: "strike", escalated: {at: this.cDate, sid: admin.sid, reason: admin.reason}}
: prev;
if (next !== prev) {
state.mpcFrozen = next;
key.setState(state);
// Every gateway learns it at once (plan Task 4.3 review M1 (b)): the
// wallet's owner gets a new deposit address (AssignOwner
// `replacefrozen`) and the scanner marks it "Frozen: do not send".
this.event.emit("mpc-frozen", {
stream: key.getId(),
network: state.network,
symbol: state.symbol,
address: state.address,
owner: typeof state.owner === "string" ? state.owner : null,
at: this.cDate,
});
}
}/** `mpccanary` vote: see the class comment. */
private async voteMpcCanary(): Promise<void> {
const {key, state, keyId} = this.mpc2KeyOnOutput();
if (state.mpcCanary !== undefined) {
throw "mpc2 canary: already recorded";
}
// A frozen key's CVMs refuse to sign, and a frozen or retired key is
// never offered again, so a canary would prove nothing anyone uses.
if (state.mpcFrozen !== undefined) {
throw "mpc2 canary: the key is frozen";
}
if (state.retired !== undefined) {
throw "mpc2 canary: the key is retired";
}
const q = state.publicKey;
if (typeof q !== "string" || !/^0[23][0-9a-f]{64}$/.test(q) || (state.pubkey !== undefined && state.pubkey !== q)) {
throw "mpc2 canary: the key has no compressed publicKey";
}
// Not with a peer a CVM held suspect (M2): the halt outlives the CVM's
// memory only on the ledger.
await this.assertNoMpcHalt();
const tables = this.mpc2Tables(state.partHashes);
let volatile: any = null;
try {
volatile = await key.getVolatile();
} catch (e) {
volatile = null;
}
const part = volatile && volatile.private ? volatile.private.part : undefined;
const part2 = volatile && volatile.private ? volatile.private.part2 : undefined;
// Each CVM rebuilds its own share from three nodes' parts; a node without
// both cannot take part, and says no rather than sending half a request.
if (typeof part !== "string" || part.length === 0 || typeof part2 !== "string" || part2.length === 0) {
throw "mpc2 canary: this node's parts are missing";
}
// Table A for part, table B for part2, as at signing: a swapped record
// would send a CVM the other party's part.
if (tables[0].indexOf(this.ActiveCrypto.Hash.getHash(part, "sha256")) === -1 ||
tables[1].indexOf(this.ActiveCrypto.Hash.getHash(part2, "sha256")) === -1) {
throw "mpc2 canary: this node's part hash is not in the key's tables";
}
let response: any;
try {
response = await HTTP.send(
`${MPC2_EGRESS_URL}/mpc2/sign`,
"POST",
[],
{
umid: this.umid,
network: state.network,
keyId,
keyMethod: "mpc-tss",
mpcProtocol: MPC2_PROTOCOL,
part,
part2,
// Exactly {canary: true}: the CVMs build the canary digest
// themselves and refuse anything else in a canary payload.
payload: {publicKey: q, partHashes: tables, tx: {canary: true}},
},
false,
MPC2_SIGN_HTTP_TIMEOUT_S
);
} catch (e) {
throw "mpc2 canary: the egress agent did not answer";
}
this.mpc2AssertCanary(response ? response.data : null, keyId, state.network, q);
}/**
* Throws unless `both` (`{a, b}`, the agent's verified sign answers) is a
* signature by Q over this key's canary digest that both CVMs acknowledged.
*/ private mpc2AssertCanary(both: any, keyId: string, network: string, q: string): void {
const isObject = (x: any) => !!x && typeof x === "object" && !Array.isArray(x);
if (!isObject(both)) {
throw "mpc2 canary: no answer from the egress agent";
}
for (const [answer, party, who] of [[both.a, 0, "CVM-A"], [both.b, 1, "CVM-B"]] as [any, number, string][]) {
if (!isObject(answer) || answer.status !== "ok") {
throw `mpc2 canary: ${who} refused`;
}
const ack = answer.ack;
// Each acknowledgement must be this request's, under its own party.
if (answer.umid !== this.umid || !isObject(ack) || ack.party !== party || ack.umid !== this.umid || ack.keyId !== keyId ||
ack.network !== network || ack.publicKey !== q || !Array.isArray(ack.signatures) || ack.signatures.length !== 1) {
throw `mpc2 canary: ${who}'s acknowledgement is not for this request`;
}
}
// Both CVMs took part in one signing: one (sid, digest, r, s, v).
if (JSON.stringify(both.a.ack.signatures) !== JSON.stringify(both.b.ack.signatures)) {
throw "mpc2 canary: CVM-A and CVM-B acknowledged different signatures";
}
// The digest is computed here, not taken from the answer: a signature
// over anything else (a chain transaction, say) is not the canary.
const digest = utils.sha256(utils.concat([utils.toUtf8Bytes(MPC2_CANARY_DOMAIN), "0x" + keyId])).slice(2);
const sig = both.a.signature;
if (!isObject(sig) || sig.canary !== digest) {
throw "mpc2 canary: the signature is not over this key's canary digest";
}
const entry = both.a.ack.signatures[0];
if (!isObject(entry) || entry.inputIndex !== 0 || entry.digest !== digest || entry.r !== sig.r || entry.s !== sig.s || entry.v !== sig.v) {
throw "mpc2 canary: the signature is not the acknowledged one";
}
if (typeof sig.r !== "string" || !/^[0-9a-f]{64}$/.test(sig.r) || typeof sig.s !== "string" || !/^[0-9a-f]{64}$/.test(sig.s) ||
(sig.v !== 0 && sig.v !== 1)) {
throw "mpc2 canary: the signature is malformed";
}
// The whole point (review M2): the shares the parts rebuild really sign
// for Q. Recovered here, against the stored Q's address.
let recovered = "";
try {
recovered = utils.recoverAddress("0x" + digest, "0x" + sig.r + sig.s + (27 + sig.v).toString(16));
} catch (e) {
recovered = "";
}
if (recovered !== utils.computeAddress("0x" + q)) {
throw "mpc2 canary: the signature is not Q's";
}
}/** `mpccanary` commit: records the canary and tells every gateway's pool (minigate learns the key on `mpc-canary`). */
private commitMpcCanary(): void {
const key: Activity = this.getActivityStreams(this.transactions.$o.key);
const state = key.getState() as any;
state.mpcCanary = {at: this.cDate};
key.setState(state);
this.event.emit("mpc-canary", {stream: key.getId(), network: state.network, symbol: state.symbol, address: state.address});
}/** `mpcstatus` vote: this node's two reports, for commit to return. */
private async voteMpcStatus(): Promise<void> {
// Read only, so the key is a `$r` reference (PR #358 review M1): a status
// round never locks the stream a payout may be signing with.
const keyId = this.transactions.$r ? this.transactions.$r.key : undefined;
const state = this.getReadOnlyStream("key");
if (typeof keyId !== "string" || !/^[0-9a-f]{64}$/.test(keyId)) {
throw "mpc2: the key id must be 64 lowercase hex";
}
if (!state || state.keyMethod !== "mpc-tss" || state.mpcProtocol !== MPC2_PROTOCOL ||
typeof state.network !== "string" || !/^[A-Za-z0-9-]{1,32}$/.test(state.network)) {
throw "mpc2: not an mpc2 key";
}
const since = this.transactions.$i.admin ? this.transactions.$i.admin.since : undefined;
// The CVM's cursor is a non-negative integer of ms; anything else would
// be refused by the CVM as a malformed payload.
if (since !== undefined && (!Number.isSafeInteger(since) || since < 0)) {
throw "mpc2 status: since must be a non-negative integer";
}
this.mpc2Reports = await this.mpc2Status(keyId, state.network, since === undefined ? {} : {since});
}/** The key's part-hash tables as `[A, B]`: two disjoint tables of TOTAL distinct SHA-256 hex hashes. Throws otherwise. */
private mpc2Tables(t: any): string[][] {
const table = (x: any) =>
Array.isArray(x) && x.length === TOTAL &&
x.every((h: any, i: number) => typeof h === "string" && /^[0-9a-f]{64}$/.test(h) && x.indexOf(h) === i);
if (!Array.isArray(t) || t.length !== 2 || !table(t[0]) || !table(t[1]) || t[0].some((h: string) => t[1].indexOf(h) !== -1)) {
throw "mpc2: the key's partHashes must be two disjoint tables of four distinct hashes";
}
return [t[0].slice(), t[1].slice()];
}