@ocap/tx-protocols 1.32.1 → 1.32.3
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/esm/protocols/rollup/bridge-create.mjs +9 -1
- package/esm/protocols/rollup/bridge-governance-tx-binding.mjs +4 -1
- package/esm/protocols/rollup/bridge-governance-vote.mjs +78 -8
- package/esm/protocols/rollup/bridge-membership.mjs +12 -1
- package/esm/protocols/rollup/bridge-v2.mjs +3 -2
- package/esm/protocols/rollup/token-authority.d.mts +4 -1
- package/esm/protocols/rollup/token-authority.mjs +27 -12
- package/esm/protocols/rollup/update.mjs +6 -1
- package/lib/protocols/rollup/bridge-create.cjs +9 -1
- package/lib/protocols/rollup/bridge-governance-tx-binding.cjs +4 -1
- package/lib/protocols/rollup/bridge-governance-vote.cjs +78 -8
- package/lib/protocols/rollup/bridge-membership.cjs +12 -1
- package/lib/protocols/rollup/bridge-v2.cjs +3 -2
- package/lib/protocols/rollup/token-authority.cjs +27 -12
- package/lib/protocols/rollup/token-authority.d.cts +4 -1
- package/lib/protocols/rollup/update.cjs +6 -1
- package/package.json +16 -16
|
@@ -63,13 +63,21 @@ async function verifyBridgeCreate(context, next) {
|
|
|
63
63
|
statedb.evidence.get(tokenKey, context),
|
|
64
64
|
statedb.evidence.get(reserveKey, context),
|
|
65
65
|
statedb.account.get(reserve, context),
|
|
66
|
-
Promise.all(epoch1.validators.map((a) => statedb.account.get(account.ensureChecksumAddress(a),
|
|
66
|
+
Promise.all(epoch1.validators.map((a) => statedb.account.get(account.ensureChecksumAddress(a), {
|
|
67
|
+
...context,
|
|
68
|
+
traceMigration: false
|
|
69
|
+
})))
|
|
67
70
|
]);
|
|
68
71
|
if (indexBlocks(gatewayEntry, txSec, "bridge-gateway")) return next(new CustomError("DUPLICATE_ROLLUP", "A bridge that is not final already uses this ethereum gateway"));
|
|
69
72
|
if (indexBlocks(tokenEntry, txSec, "bridge-token")) return next(new CustomError("DUPLICATE_ROLLUP", "Only 1 bridge that is not final can exist for the token"));
|
|
70
73
|
if (reserveEntry && !isV1EvidenceRow(reserveEntry) || reserveAccount) return next(new CustomError("DUPLICATE_ROLLUP", "The reserve of this bridge already exists"));
|
|
71
74
|
const missing = epoch1.validators.find((_, i) => !validatorAccounts[i]);
|
|
72
75
|
if (missing) return next(new CustomError("INVALID_TX", `Initial validator ${missing} has no account on this chain`));
|
|
76
|
+
const migratedVal = epoch1.validators.find((addr, i) => {
|
|
77
|
+
const acct = validatorAccounts[i];
|
|
78
|
+
return Boolean(acct && (account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !rollup.sameAddress(acct.address, addr)));
|
|
79
|
+
});
|
|
80
|
+
if (migratedVal) return next(new CustomError("INVALID_TX", `Initial validator ${migratedVal} account has been migrated`));
|
|
73
81
|
let attestationSigner;
|
|
74
82
|
try {
|
|
75
83
|
attestationSigner = recoverBridgeSigner(computeBridgeOwnerAttestationDigest({
|
|
@@ -202,7 +202,10 @@ async function verifyOcapProposalTxBinding(context, proposal) {
|
|
|
202
202
|
if (Object.keys(d).some((k) => k !== "action") || d.action !== action.step) invalidTx("unsignedTxBytesHex migrate_rollup(reserve) step does not match proposal");
|
|
203
203
|
}
|
|
204
204
|
} else if (action.kind === "update_rollup") assertUpdatePatchMatches(readItxData(itx), action.patch);
|
|
205
|
-
const fromAcct = await context.statedb.account.get(action.txFrom,
|
|
205
|
+
const fromAcct = await context.statedb.account.get(action.txFrom, {
|
|
206
|
+
...context,
|
|
207
|
+
traceMigration: false
|
|
208
|
+
});
|
|
206
209
|
if (!fromAcct) invalidTx(`Proposal txFrom account ${action.txFrom} does not exist on-chain`);
|
|
207
210
|
const currentAcctNonce = BigInt(String(fromAcct.nonce ?? 0));
|
|
208
211
|
if (currentAcctNonce >= action.frozenNonce) invalidTx(`Proposal frozenNonce (${action.frozenNonce.toString(10)}) is already spent on ${action.txFrom} (account.nonce=${currentAcctNonce.toString(10)})`);
|
|
@@ -115,9 +115,18 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
115
115
|
const isVal = activeValidators.has(signer);
|
|
116
116
|
if (!isJoiner && !isOwner && !isVal) invalidSig(`Signer ${signer} is not an authorized membership co-signer on this bridge`);
|
|
117
117
|
if (isNewDoc && isJoiner && !isOwner && !isVal) invalidSig("Only the bridge owner or an active validator may open a join_rollup proposal; the candidate validator may only co-sign an existing proposal");
|
|
118
|
+
const isAcctMigratedFor = (acct, expectedAddr) => Boolean(acct && (account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !rollup.sameAddress(acct.address, expectedAddr)));
|
|
119
|
+
if (!isOwner) {
|
|
120
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
121
|
+
...context,
|
|
122
|
+
traceMigration: false
|
|
123
|
+
});
|
|
124
|
+
if (isVal && (!signerAcct || isAcctMigratedFor(signerAcct, signer))) invalidSig(`Validator signer ${signer} account is missing or has been migrated`);
|
|
125
|
+
if (isJoiner && isAcctMigratedFor(signerAcct, signer)) invalidSig(`Candidate validator ${signer} account has been migrated`);
|
|
126
|
+
}
|
|
118
127
|
role = isJoiner ? "joiner" : isOwner ? "owner" : "validator";
|
|
119
128
|
} else {
|
|
120
|
-
|
|
129
|
+
const isAcctMigratedFor = (acct, expectedAddr) => Boolean(acct && (account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !rollup.sameAddress(acct.address, expectedAddr)));
|
|
121
130
|
signedDigest = action.challenge;
|
|
122
131
|
const rawExpectedSigner = voteRec.signer !== void 0 ? voteRec.signer : !("signerRoster" in action) && action.txFrom?.startsWith("0x") ? action.txFrom : void 0;
|
|
123
132
|
if (rawExpectedSigner === void 0) invalidTx("govProposalVote.vote.signer is required for ArcBlockTransaction vote");
|
|
@@ -142,6 +151,13 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
142
151
|
if (action.kind === "pause_rollup" && action.mode === "lone") {
|
|
143
152
|
if (!bridgeBody.pausers.some((p) => rollup.sameAddress(p, signer))) invalidSig(`Signer ${signer} is not an authorized bridge pauser`);
|
|
144
153
|
if (signer !== owner && !activeValidators.has(signer)) invalidSig("Pauser-only key cannot submit govProposalVote; submit PauseRollupTx directly");
|
|
154
|
+
if (signer !== owner) {
|
|
155
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
156
|
+
...context,
|
|
157
|
+
traceMigration: false
|
|
158
|
+
});
|
|
159
|
+
if (!signerAcct || isAcctMigratedFor(signerAcct, signer)) invalidSig(`Pauser signer ${signer} account is missing or has been migrated`);
|
|
160
|
+
}
|
|
145
161
|
role = "pauser";
|
|
146
162
|
} else if (action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") {
|
|
147
163
|
const tokenState = isOfficialToken(context.config, rollupState.tokenAddress) ? null : await context.statedb.token.get(rollupState.tokenAddress, context);
|
|
@@ -150,11 +166,50 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
150
166
|
role = "authority";
|
|
151
167
|
} else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) {
|
|
152
168
|
if (signer !== owner) invalidSig("Only the current bridge owner may co-sign cancelOwnerProposal");
|
|
169
|
+
if ("signerRoster" in action && (action.signerRoster.length !== 1 || action.signerRoster[0]?.signer !== owner)) invalidTx("cancelOwnerProposal signerRoster must contain only the current bridge owner");
|
|
153
170
|
role = "owner";
|
|
154
171
|
} else {
|
|
155
172
|
if (signer !== owner && !activeValidators.has(signer)) invalidSig(`Signer ${signer} is neither the bridge owner nor an active validator`);
|
|
173
|
+
if (signer !== owner) {
|
|
174
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
175
|
+
...context,
|
|
176
|
+
traceMigration: false
|
|
177
|
+
});
|
|
178
|
+
if (!signerAcct || isAcctMigratedFor(signerAcct, signer)) invalidSig(`Validator signer ${signer} account is missing or has been migrated`);
|
|
179
|
+
}
|
|
180
|
+
if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) {
|
|
181
|
+
const candAddr = action.patch.proposeOwner.newOwner;
|
|
182
|
+
const candAcct = await context.statedb.account.get(candAddr, {
|
|
183
|
+
...context,
|
|
184
|
+
traceMigration: false
|
|
185
|
+
});
|
|
186
|
+
if (!candAcct) invalidTx("The proposed owner has no account on this chain");
|
|
187
|
+
if (isAcctMigratedFor(candAcct, candAddr)) invalidTx("The proposed owner account has been migrated");
|
|
188
|
+
}
|
|
189
|
+
if ("signerRoster" in action) {
|
|
190
|
+
const rosterAddrs = new Set(action.signerRoster.map((e) => e.signer));
|
|
191
|
+
for (const rAddr of rosterAddrs) {
|
|
192
|
+
if (rAddr !== owner && !activeValidators.has(rAddr)) invalidTx(`Proposal signerRoster entry ${rAddr} is neither the bridge owner nor an active validator`);
|
|
193
|
+
if (rAddr !== owner) {
|
|
194
|
+
const rAcct = await context.statedb.account.get(rAddr, {
|
|
195
|
+
...context,
|
|
196
|
+
traceMigration: false
|
|
197
|
+
});
|
|
198
|
+
if (!rAcct || isAcctMigratedFor(rAcct, rAddr)) invalidTx(`Proposal signerRoster validator ${rAddr} account is missing or has been migrated`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const rosterValCount = [...rosterAddrs].filter((a) => activeValidators.has(a)).length;
|
|
202
|
+
if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) {
|
|
203
|
+
const need = Math.ceil(2 * activeEpoch.validators.length / 3);
|
|
204
|
+
if (rosterValCount < need) invalidTx(`Proposal signerRoster has ${rosterValCount} active validators; proposeOwner requires ${need}`);
|
|
205
|
+
} else {
|
|
206
|
+
if (!rosterAddrs.has(owner)) invalidTx("Proposal signerRoster must include the bridge owner");
|
|
207
|
+
if (rosterValCount < activeEpoch.threshold) invalidTx(`Proposal signerRoster has ${rosterValCount} active validators; threshold is ${activeEpoch.threshold}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
156
210
|
role = signer === owner ? "owner" : "validator";
|
|
157
211
|
}
|
|
212
|
+
await verifyOcapProposalTxBinding(context, proposal);
|
|
158
213
|
}
|
|
159
214
|
if (voteRec.signer !== void 0 && checkedNonZeroAddress(voteRec.signer, "vote.signer") !== signer) invalidSig("vote.signer does not match recovered signature signer");
|
|
160
215
|
if (voteRec.role !== void 0 && voteRec.role !== role) invalidTx(`vote.role must be "${role}" for signer ${signer}`);
|
|
@@ -170,14 +225,29 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
170
225
|
...publicKeyHex ? { publicKeyHex } : {}
|
|
171
226
|
};
|
|
172
227
|
const nextVotes = sortVotes([...existingVotes.filter((v) => v.signer.toLowerCase() !== signerLc), entry]);
|
|
173
|
-
const
|
|
174
|
-
const
|
|
228
|
+
const liveVotedAddrs = /* @__PURE__ */ new Set();
|
|
229
|
+
for (const v of nextVotes) {
|
|
230
|
+
if (v.signer === owner) {
|
|
231
|
+
liveVotedAddrs.add(v.signer);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const vAcct = await context.statedb.account.get(v.signer, {
|
|
235
|
+
...context,
|
|
236
|
+
traceMigration: false
|
|
237
|
+
});
|
|
238
|
+
const vMigrated = Boolean(vAcct && (account.isMigrated(vAcct) || typeof vAcct.address === "string" && vAcct.address && !rollup.sameAddress(vAcct.address, v.signer)));
|
|
239
|
+
if (action.kind === "join_rollup" && v.signer === action.validator) {
|
|
240
|
+
if (!vMigrated) liveVotedAddrs.add(v.signer);
|
|
241
|
+
} else if (vAcct && !vMigrated) liveVotedAddrs.add(v.signer);
|
|
242
|
+
}
|
|
243
|
+
const valCount = [...liveVotedAddrs].filter((a) => activeValidators.has(a)).length;
|
|
244
|
+
const allRosterCoSignersVoted = !("signerRoster" in action) || action.signerRoster.every((e) => e.signer === action.txFrom || liveVotedAddrs.has(e.signer));
|
|
175
245
|
let quorumReached = false;
|
|
176
|
-
if (action.kind === "pause_rollup" && action.mode === "lone" || action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") quorumReached = nextVotes.length >= 1;
|
|
177
|
-
else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) quorumReached =
|
|
178
|
-
else if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) quorumReached = valCount >= Math.ceil(2 * activeEpoch.validators.length / 3);
|
|
179
|
-
else if (action.kind === "join_rollup") quorumReached =
|
|
180
|
-
else quorumReached =
|
|
246
|
+
if (action.kind === "pause_rollup" && action.mode === "lone" || action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") quorumReached = nextVotes.length >= 1 && allRosterCoSignersVoted;
|
|
247
|
+
else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) quorumReached = liveVotedAddrs.has(owner) && allRosterCoSignersVoted;
|
|
248
|
+
else if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) quorumReached = valCount >= Math.ceil(2 * activeEpoch.validators.length / 3) && allRosterCoSignersVoted;
|
|
249
|
+
else if (action.kind === "join_rollup") quorumReached = liveVotedAddrs.has(owner) && liveVotedAddrs.has(action.validator) && valCount >= activeEpoch.threshold;
|
|
250
|
+
else quorumReached = liveVotedAddrs.has(owner) && valCount >= activeEpoch.threshold && allRosterCoSignersVoted;
|
|
181
251
|
return {
|
|
182
252
|
signer,
|
|
183
253
|
role,
|
|
@@ -93,7 +93,18 @@ const membershipChecks = (action) => async function MembershipChecks(context, ne
|
|
|
93
93
|
const owner = rollup.lc(body.owner);
|
|
94
94
|
const quorum = new Set(plan.signingEpoch.validators);
|
|
95
95
|
const joiner = rollup.lc(data.validator);
|
|
96
|
-
for (const address of signers.keys())
|
|
96
|
+
for (const address of signers.keys()) {
|
|
97
|
+
if (!(address === owner || quorum.has(address) || action === "join" && address === joiner)) throw new CustomError("INVALID_SIGNATURE", `Signer ${address} is not the owner, a validator or the joiner`);
|
|
98
|
+
if (address !== owner) {
|
|
99
|
+
const signerAcct = await statedb.account.get(account.ensureChecksumAddress(address), {
|
|
100
|
+
...context,
|
|
101
|
+
traceMigration: false
|
|
102
|
+
});
|
|
103
|
+
const isSignerMigrated = Boolean(signerAcct && (account.isMigrated(signerAcct) || typeof signerAcct.address === "string" && signerAcct.address && !rollup.sameAddress(signerAcct.address, address)));
|
|
104
|
+
if (quorum.has(address) && (!signerAcct || isSignerMigrated)) throw new CustomError("INVALID_SIGNATURE", `Validator signer ${address} account is missing or has been migrated`);
|
|
105
|
+
if (action === "join" && address === joiner && isSignerMigrated) throw new CustomError("INVALID_SIGNATURE", `Joining validator ${address} account has been migrated`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
97
108
|
if (!signers.has(owner)) throw new CustomError("INVALID_SIGNATURE", "The bridge owner must sign the membership change");
|
|
98
109
|
const have = [...signers.keys()].filter((a) => quorum.has(a)).length;
|
|
99
110
|
if (have < plan.signingEpoch.threshold) throw new CustomError("INVALID_SIGNATURE", `Expect at least ${plan.signingEpoch.threshold} validator signatures of epoch ${plan.signingEpoch.epoch}, got ${have}`);
|
|
@@ -204,8 +204,9 @@ const upsertIndexEvidence = async (statedb, key, data, context) => {
|
|
|
204
204
|
};
|
|
205
205
|
/** Decoded `itx.data.value` as a plain object (v2 governance payloads are JSON objects). */
|
|
206
206
|
function readItxData(itx) {
|
|
207
|
-
const
|
|
208
|
-
|
|
207
|
+
const decoded = decodeAnySafe(itx?.data ?? null);
|
|
208
|
+
const value = decoded?.value;
|
|
209
|
+
if (!decoded || decoded.type !== "json" || !value || typeof value !== "object" || Array.isArray(value)) throw new CustomError("INVALID_TX", "Invalid itx: data must be a JSON object for a v2 bridge");
|
|
209
210
|
return value;
|
|
210
211
|
}
|
|
211
212
|
/** Digest of the membership struct for `epoch` (validators already sorted ascending by the epoch rules). */
|
|
@@ -10,7 +10,10 @@ declare const isOfficialToken: (config: Ctx, tokenAddress: string) => boolean;
|
|
|
10
10
|
*
|
|
11
11
|
* - not migrated: the configured address, unchanged;
|
|
12
12
|
* - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
|
|
13
|
-
* - the chain is broken (cycle or a missing target): no authority, fail closed.
|
|
13
|
+
* - the chain is broken (cycle, hop cap, or a missing target): no authority, fail closed.
|
|
14
|
+
*
|
|
15
|
+
* Walks `migratedTo[0]` explicitly with `{ traceMigration: false }` so `OverlayStateDB` (`TransactionBlock`) never
|
|
16
|
+
* caches `null` across differing `traceMigration` flags or misses intra-block `account_migrate` writes.
|
|
14
17
|
*/
|
|
15
18
|
declare function resolveTokenAuthority(context: Ctx, tokenAddress: string, tokenState?: Ctx): Promise<string | undefined>;
|
|
16
19
|
//#endregion
|
|
@@ -8,6 +8,7 @@ import { isSameDid } from "@ocap/util";
|
|
|
8
8
|
*/
|
|
9
9
|
/** Whether `tokenAddress` is the chain's official token. */
|
|
10
10
|
const isOfficialToken = (config, tokenAddress) => !!config?.token?.address && isSameDid(tokenAddress, config.token.address);
|
|
11
|
+
const MAX_MIGRATION_HOPS = 64;
|
|
11
12
|
/**
|
|
12
13
|
* The configured authority (`config.moderator.address` or `tokenState.issuer`) resolved along the account migration
|
|
13
14
|
* chain to its TERMINAL account (#1795). The configured address stays the old one after `account_migrate`, so only the
|
|
@@ -16,24 +17,38 @@ const isOfficialToken = (config, tokenAddress) => !!config?.token?.address && is
|
|
|
16
17
|
*
|
|
17
18
|
* - not migrated: the configured address, unchanged;
|
|
18
19
|
* - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
|
|
19
|
-
* - the chain is broken (cycle or a missing target): no authority, fail closed.
|
|
20
|
+
* - the chain is broken (cycle, hop cap, or a missing target): no authority, fail closed.
|
|
21
|
+
*
|
|
22
|
+
* Walks `migratedTo[0]` explicitly with `{ traceMigration: false }` so `OverlayStateDB` (`TransactionBlock`) never
|
|
23
|
+
* caches `null` across differing `traceMigration` flags or misses intra-block `account_migrate` writes.
|
|
20
24
|
*/
|
|
21
25
|
async function resolveTokenAuthority(context, tokenAddress, tokenState) {
|
|
22
26
|
const { config, statedb } = context;
|
|
23
27
|
const configured = isOfficialToken(config, tokenAddress) ? config?.moderator?.address : tokenState?.issuer;
|
|
24
28
|
if (!configured) return void 0;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!
|
|
31
|
-
|
|
29
|
+
const normKey = (addr) => String(addr || "").trim().replace(/^did:abt:/i, "").toLowerCase();
|
|
30
|
+
const visited = /* @__PURE__ */ new Set();
|
|
31
|
+
let current = configured;
|
|
32
|
+
for (let hop = 0; hop <= MAX_MIGRATION_HOPS; hop++) {
|
|
33
|
+
const key = normKey(current);
|
|
34
|
+
if (!key || visited.has(key)) return void 0;
|
|
35
|
+
visited.add(key);
|
|
36
|
+
const acct = await statedb.account.get(current, {
|
|
37
|
+
...context,
|
|
38
|
+
traceMigration: false
|
|
39
|
+
});
|
|
40
|
+
if (!acct) return hop === 0 ? configured : void 0;
|
|
41
|
+
if (typeof acct.address === "string" && acct.address && !isSameDid(acct.address, current)) return;
|
|
42
|
+
const migratedTo = Array.isArray(acct.migratedTo) ? acct.migratedTo : [];
|
|
43
|
+
if (migratedTo.length === 0) {
|
|
44
|
+
if (hop === 0) return configured;
|
|
45
|
+
return typeof acct.address === "string" && acct.address ? acct.address : current;
|
|
46
|
+
}
|
|
47
|
+
if (hop === MAX_MIGRATION_HOPS) return void 0;
|
|
48
|
+
const next = typeof migratedTo[0] === "string" ? migratedTo[0].trim() : "";
|
|
49
|
+
if (!next) return void 0;
|
|
50
|
+
current = next;
|
|
32
51
|
}
|
|
33
|
-
return await statedb.account.get(configured, {
|
|
34
|
-
...context,
|
|
35
|
-
traceMigration: false
|
|
36
|
-
}) ? void 0 : configured;
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
//#endregion
|
|
@@ -90,7 +90,12 @@ runner.use(async (context, next) => {
|
|
|
90
90
|
const plan = context.bridgePlan;
|
|
91
91
|
if (!context.isBridgeV2 || plan?.kind !== "propose-owner") return next();
|
|
92
92
|
const candidate = plan.body.pendingOwner?.address;
|
|
93
|
-
|
|
93
|
+
const candidateAcct = await context.statedb.account.get(candidate, {
|
|
94
|
+
...context,
|
|
95
|
+
traceMigration: false
|
|
96
|
+
});
|
|
97
|
+
if (!candidateAcct) return next(new CustomError("INVALID_TX", "The proposed owner has no account on this chain"));
|
|
98
|
+
if (account.isMigrated(candidateAcct) || typeof candidateAcct.address === "string" && candidateAcct.address && !rollup.sameAddress(candidateAcct.address, candidate)) return next(new CustomError("INVALID_TX", "The proposed owner account has been migrated"));
|
|
94
99
|
return next();
|
|
95
100
|
});
|
|
96
101
|
runner.use(ifV1(verify_signers_default({
|
|
@@ -65,13 +65,21 @@ async function verifyBridgeCreate(context, next) {
|
|
|
65
65
|
statedb.evidence.get(tokenKey, context),
|
|
66
66
|
statedb.evidence.get(reserveKey, context),
|
|
67
67
|
statedb.account.get(reserve, context),
|
|
68
|
-
Promise.all(epoch1.validators.map((a) => statedb.account.get(_ocap_state.account.ensureChecksumAddress(a),
|
|
68
|
+
Promise.all(epoch1.validators.map((a) => statedb.account.get(_ocap_state.account.ensureChecksumAddress(a), {
|
|
69
|
+
...context,
|
|
70
|
+
traceMigration: false
|
|
71
|
+
})))
|
|
69
72
|
]);
|
|
70
73
|
if (require_protocols_rollup_bridge_v2.indexBlocks(gatewayEntry, txSec, "bridge-gateway")) return next(new _ocap_util_lib_error.CustomError("DUPLICATE_ROLLUP", "A bridge that is not final already uses this ethereum gateway"));
|
|
71
74
|
if (require_protocols_rollup_bridge_v2.indexBlocks(tokenEntry, txSec, "bridge-token")) return next(new _ocap_util_lib_error.CustomError("DUPLICATE_ROLLUP", "Only 1 bridge that is not final can exist for the token"));
|
|
72
75
|
if (reserveEntry && !(0, _ocap_tx_pipeline.isV1EvidenceRow)(reserveEntry) || reserveAccount) return next(new _ocap_util_lib_error.CustomError("DUPLICATE_ROLLUP", "The reserve of this bridge already exists"));
|
|
73
76
|
const missing = epoch1.validators.find((_, i) => !validatorAccounts[i]);
|
|
74
77
|
if (missing) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Initial validator ${missing} has no account on this chain`));
|
|
78
|
+
const migratedVal = epoch1.validators.find((addr, i) => {
|
|
79
|
+
const acct = validatorAccounts[i];
|
|
80
|
+
return Boolean(acct && (_ocap_state.account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !_ocap_state.rollup.sameAddress(acct.address, addr)));
|
|
81
|
+
});
|
|
82
|
+
if (migratedVal) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", `Initial validator ${migratedVal} account has been migrated`));
|
|
75
83
|
let attestationSigner;
|
|
76
84
|
try {
|
|
77
85
|
attestationSigner = (0, _ocap_mcrypto.recoverBridgeSigner)((0, _ocap_mcrypto.computeBridgeOwnerAttestationDigest)({
|
|
@@ -203,7 +203,10 @@ async function verifyOcapProposalTxBinding(context, proposal) {
|
|
|
203
203
|
if (Object.keys(d).some((k) => k !== "action") || d.action !== action.step) invalidTx("unsignedTxBytesHex migrate_rollup(reserve) step does not match proposal");
|
|
204
204
|
}
|
|
205
205
|
} else if (action.kind === "update_rollup") assertUpdatePatchMatches(require_protocols_rollup_bridge_v2.readItxData(itx), action.patch);
|
|
206
|
-
const fromAcct = await context.statedb.account.get(action.txFrom,
|
|
206
|
+
const fromAcct = await context.statedb.account.get(action.txFrom, {
|
|
207
|
+
...context,
|
|
208
|
+
traceMigration: false
|
|
209
|
+
});
|
|
207
210
|
if (!fromAcct) invalidTx(`Proposal txFrom account ${action.txFrom} does not exist on-chain`);
|
|
208
211
|
const currentAcctNonce = BigInt(String(fromAcct.nonce ?? 0));
|
|
209
212
|
if (currentAcctNonce >= action.frozenNonce) invalidTx(`Proposal frozenNonce (${action.frozenNonce.toString(10)}) is already spent on ${action.txFrom} (account.nonce=${currentAcctNonce.toString(10)})`);
|
|
@@ -117,9 +117,18 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
117
117
|
const isVal = activeValidators.has(signer);
|
|
118
118
|
if (!isJoiner && !isOwner && !isVal) invalidSig(`Signer ${signer} is not an authorized membership co-signer on this bridge`);
|
|
119
119
|
if (isNewDoc && isJoiner && !isOwner && !isVal) invalidSig("Only the bridge owner or an active validator may open a join_rollup proposal; the candidate validator may only co-sign an existing proposal");
|
|
120
|
+
const isAcctMigratedFor = (acct, expectedAddr) => Boolean(acct && (_ocap_state.account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !_ocap_state.rollup.sameAddress(acct.address, expectedAddr)));
|
|
121
|
+
if (!isOwner) {
|
|
122
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
123
|
+
...context,
|
|
124
|
+
traceMigration: false
|
|
125
|
+
});
|
|
126
|
+
if (isVal && (!signerAcct || isAcctMigratedFor(signerAcct, signer))) invalidSig(`Validator signer ${signer} account is missing or has been migrated`);
|
|
127
|
+
if (isJoiner && isAcctMigratedFor(signerAcct, signer)) invalidSig(`Candidate validator ${signer} account has been migrated`);
|
|
128
|
+
}
|
|
120
129
|
role = isJoiner ? "joiner" : isOwner ? "owner" : "validator";
|
|
121
130
|
} else {
|
|
122
|
-
|
|
131
|
+
const isAcctMigratedFor = (acct, expectedAddr) => Boolean(acct && (_ocap_state.account.isMigrated(acct) || typeof acct.address === "string" && acct.address && !_ocap_state.rollup.sameAddress(acct.address, expectedAddr)));
|
|
123
132
|
signedDigest = action.challenge;
|
|
124
133
|
const rawExpectedSigner = voteRec.signer !== void 0 ? voteRec.signer : !("signerRoster" in action) && action.txFrom?.startsWith("0x") ? action.txFrom : void 0;
|
|
125
134
|
if (rawExpectedSigner === void 0) invalidTx("govProposalVote.vote.signer is required for ArcBlockTransaction vote");
|
|
@@ -144,6 +153,13 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
144
153
|
if (action.kind === "pause_rollup" && action.mode === "lone") {
|
|
145
154
|
if (!bridgeBody.pausers.some((p) => _ocap_state.rollup.sameAddress(p, signer))) invalidSig(`Signer ${signer} is not an authorized bridge pauser`);
|
|
146
155
|
if (signer !== owner && !activeValidators.has(signer)) invalidSig("Pauser-only key cannot submit govProposalVote; submit PauseRollupTx directly");
|
|
156
|
+
if (signer !== owner) {
|
|
157
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
158
|
+
...context,
|
|
159
|
+
traceMigration: false
|
|
160
|
+
});
|
|
161
|
+
if (!signerAcct || isAcctMigratedFor(signerAcct, signer)) invalidSig(`Pauser signer ${signer} account is missing or has been migrated`);
|
|
162
|
+
}
|
|
147
163
|
role = "pauser";
|
|
148
164
|
} else if (action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") {
|
|
149
165
|
const tokenState = require_protocols_rollup_token_authority.isOfficialToken(context.config, rollupState.tokenAddress) ? null : await context.statedb.token.get(rollupState.tokenAddress, context);
|
|
@@ -152,11 +168,50 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
152
168
|
role = "authority";
|
|
153
169
|
} else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) {
|
|
154
170
|
if (signer !== owner) invalidSig("Only the current bridge owner may co-sign cancelOwnerProposal");
|
|
171
|
+
if ("signerRoster" in action && (action.signerRoster.length !== 1 || action.signerRoster[0]?.signer !== owner)) invalidTx("cancelOwnerProposal signerRoster must contain only the current bridge owner");
|
|
155
172
|
role = "owner";
|
|
156
173
|
} else {
|
|
157
174
|
if (signer !== owner && !activeValidators.has(signer)) invalidSig(`Signer ${signer} is neither the bridge owner nor an active validator`);
|
|
175
|
+
if (signer !== owner) {
|
|
176
|
+
const signerAcct = await context.statedb.account.get(signer, {
|
|
177
|
+
...context,
|
|
178
|
+
traceMigration: false
|
|
179
|
+
});
|
|
180
|
+
if (!signerAcct || isAcctMigratedFor(signerAcct, signer)) invalidSig(`Validator signer ${signer} account is missing or has been migrated`);
|
|
181
|
+
}
|
|
182
|
+
if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) {
|
|
183
|
+
const candAddr = action.patch.proposeOwner.newOwner;
|
|
184
|
+
const candAcct = await context.statedb.account.get(candAddr, {
|
|
185
|
+
...context,
|
|
186
|
+
traceMigration: false
|
|
187
|
+
});
|
|
188
|
+
if (!candAcct) invalidTx("The proposed owner has no account on this chain");
|
|
189
|
+
if (isAcctMigratedFor(candAcct, candAddr)) invalidTx("The proposed owner account has been migrated");
|
|
190
|
+
}
|
|
191
|
+
if ("signerRoster" in action) {
|
|
192
|
+
const rosterAddrs = new Set(action.signerRoster.map((e) => e.signer));
|
|
193
|
+
for (const rAddr of rosterAddrs) {
|
|
194
|
+
if (rAddr !== owner && !activeValidators.has(rAddr)) invalidTx(`Proposal signerRoster entry ${rAddr} is neither the bridge owner nor an active validator`);
|
|
195
|
+
if (rAddr !== owner) {
|
|
196
|
+
const rAcct = await context.statedb.account.get(rAddr, {
|
|
197
|
+
...context,
|
|
198
|
+
traceMigration: false
|
|
199
|
+
});
|
|
200
|
+
if (!rAcct || isAcctMigratedFor(rAcct, rAddr)) invalidTx(`Proposal signerRoster validator ${rAddr} account is missing or has been migrated`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const rosterValCount = [...rosterAddrs].filter((a) => activeValidators.has(a)).length;
|
|
204
|
+
if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) {
|
|
205
|
+
const need = Math.ceil(2 * activeEpoch.validators.length / 3);
|
|
206
|
+
if (rosterValCount < need) invalidTx(`Proposal signerRoster has ${rosterValCount} active validators; proposeOwner requires ${need}`);
|
|
207
|
+
} else {
|
|
208
|
+
if (!rosterAddrs.has(owner)) invalidTx("Proposal signerRoster must include the bridge owner");
|
|
209
|
+
if (rosterValCount < activeEpoch.threshold) invalidTx(`Proposal signerRoster has ${rosterValCount} active validators; threshold is ${activeEpoch.threshold}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
158
212
|
role = signer === owner ? "owner" : "validator";
|
|
159
213
|
}
|
|
214
|
+
await require_protocols_rollup_bridge_governance_tx_binding.verifyOcapProposalTxBinding(context, proposal);
|
|
160
215
|
}
|
|
161
216
|
if (voteRec.signer !== void 0 && (0, _ocap_mcrypto.checkedNonZeroAddress)(voteRec.signer, "vote.signer") !== signer) invalidSig("vote.signer does not match recovered signature signer");
|
|
162
217
|
if (voteRec.role !== void 0 && voteRec.role !== role) invalidTx(`vote.role must be "${role}" for signer ${signer}`);
|
|
@@ -172,14 +227,29 @@ async function verifyAndScoreOcapVote(context, proposal, voteRec, envelope, exis
|
|
|
172
227
|
...publicKeyHex ? { publicKeyHex } : {}
|
|
173
228
|
};
|
|
174
229
|
const nextVotes = sortVotes([...existingVotes.filter((v) => v.signer.toLowerCase() !== signerLc), entry]);
|
|
175
|
-
const
|
|
176
|
-
const
|
|
230
|
+
const liveVotedAddrs = /* @__PURE__ */ new Set();
|
|
231
|
+
for (const v of nextVotes) {
|
|
232
|
+
if (v.signer === owner) {
|
|
233
|
+
liveVotedAddrs.add(v.signer);
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
const vAcct = await context.statedb.account.get(v.signer, {
|
|
237
|
+
...context,
|
|
238
|
+
traceMigration: false
|
|
239
|
+
});
|
|
240
|
+
const vMigrated = Boolean(vAcct && (_ocap_state.account.isMigrated(vAcct) || typeof vAcct.address === "string" && vAcct.address && !_ocap_state.rollup.sameAddress(vAcct.address, v.signer)));
|
|
241
|
+
if (action.kind === "join_rollup" && v.signer === action.validator) {
|
|
242
|
+
if (!vMigrated) liveVotedAddrs.add(v.signer);
|
|
243
|
+
} else if (vAcct && !vMigrated) liveVotedAddrs.add(v.signer);
|
|
244
|
+
}
|
|
245
|
+
const valCount = [...liveVotedAddrs].filter((a) => activeValidators.has(a)).length;
|
|
246
|
+
const allRosterCoSignersVoted = !("signerRoster" in action) || action.signerRoster.every((e) => e.signer === action.txFrom || liveVotedAddrs.has(e.signer));
|
|
177
247
|
let quorumReached = false;
|
|
178
|
-
if (action.kind === "pause_rollup" && action.mode === "lone" || action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") quorumReached = nextVotes.length >= 1;
|
|
179
|
-
else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) quorumReached =
|
|
180
|
-
else if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) quorumReached = valCount >= Math.ceil(2 * activeEpoch.validators.length / 3);
|
|
181
|
-
else if (action.kind === "join_rollup") quorumReached =
|
|
182
|
-
else quorumReached =
|
|
248
|
+
if (action.kind === "pause_rollup" && action.mode === "lone" || action.kind === "migrate_rollup" && action.migrateKind === "reserve" && action.step === "cancel") quorumReached = nextVotes.length >= 1 && allRosterCoSignersVoted;
|
|
249
|
+
else if (action.kind === "update_rollup" && action.patch.cancelOwnerProposal === true) quorumReached = liveVotedAddrs.has(owner) && allRosterCoSignersVoted;
|
|
250
|
+
else if (action.kind === "update_rollup" && action.patch.proposeOwner !== void 0) quorumReached = valCount >= Math.ceil(2 * activeEpoch.validators.length / 3) && allRosterCoSignersVoted;
|
|
251
|
+
else if (action.kind === "join_rollup") quorumReached = liveVotedAddrs.has(owner) && liveVotedAddrs.has(action.validator) && valCount >= activeEpoch.threshold;
|
|
252
|
+
else quorumReached = liveVotedAddrs.has(owner) && valCount >= activeEpoch.threshold && allRosterCoSignersVoted;
|
|
183
253
|
return {
|
|
184
254
|
signer,
|
|
185
255
|
role,
|
|
@@ -95,7 +95,18 @@ const membershipChecks = (action) => async function MembershipChecks(context, ne
|
|
|
95
95
|
const owner = _ocap_state.rollup.lc(body.owner);
|
|
96
96
|
const quorum = new Set(plan.signingEpoch.validators);
|
|
97
97
|
const joiner = _ocap_state.rollup.lc(data.validator);
|
|
98
|
-
for (const address of signers.keys())
|
|
98
|
+
for (const address of signers.keys()) {
|
|
99
|
+
if (!(address === owner || quorum.has(address) || action === "join" && address === joiner)) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNATURE", `Signer ${address} is not the owner, a validator or the joiner`);
|
|
100
|
+
if (address !== owner) {
|
|
101
|
+
const signerAcct = await statedb.account.get(_ocap_state.account.ensureChecksumAddress(address), {
|
|
102
|
+
...context,
|
|
103
|
+
traceMigration: false
|
|
104
|
+
});
|
|
105
|
+
const isSignerMigrated = Boolean(signerAcct && (_ocap_state.account.isMigrated(signerAcct) || typeof signerAcct.address === "string" && signerAcct.address && !_ocap_state.rollup.sameAddress(signerAcct.address, address)));
|
|
106
|
+
if (quorum.has(address) && (!signerAcct || isSignerMigrated)) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNATURE", `Validator signer ${address} account is missing or has been migrated`);
|
|
107
|
+
if (action === "join" && address === joiner && isSignerMigrated) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNATURE", `Joining validator ${address} account has been migrated`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
99
110
|
if (!signers.has(owner)) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNATURE", "The bridge owner must sign the membership change");
|
|
100
111
|
const have = [...signers.keys()].filter((a) => quorum.has(a)).length;
|
|
101
112
|
if (have < plan.signingEpoch.threshold) throw new _ocap_util_lib_error.CustomError("INVALID_SIGNATURE", `Expect at least ${plan.signingEpoch.threshold} validator signatures of epoch ${plan.signingEpoch.epoch}, got ${have}`);
|
|
@@ -205,8 +205,9 @@ const upsertIndexEvidence = async (statedb, key, data, context) => {
|
|
|
205
205
|
};
|
|
206
206
|
/** Decoded `itx.data.value` as a plain object (v2 governance payloads are JSON objects). */
|
|
207
207
|
function readItxData(itx) {
|
|
208
|
-
const
|
|
209
|
-
|
|
208
|
+
const decoded = require_util.decodeAnySafe(itx?.data ?? null);
|
|
209
|
+
const value = decoded?.value;
|
|
210
|
+
if (!decoded || decoded.type !== "json" || !value || typeof value !== "object" || Array.isArray(value)) throw new _ocap_util_lib_error.CustomError("INVALID_TX", "Invalid itx: data must be a JSON object for a v2 bridge");
|
|
210
211
|
return value;
|
|
211
212
|
}
|
|
212
213
|
/** Digest of the membership struct for `epoch` (validators already sorted ascending by the epoch rules). */
|
|
@@ -9,6 +9,7 @@ let _ocap_util = require("@ocap/util");
|
|
|
9
9
|
*/
|
|
10
10
|
/** Whether `tokenAddress` is the chain's official token. */
|
|
11
11
|
const isOfficialToken = (config, tokenAddress) => !!config?.token?.address && (0, _ocap_util.isSameDid)(tokenAddress, config.token.address);
|
|
12
|
+
const MAX_MIGRATION_HOPS = 64;
|
|
12
13
|
/**
|
|
13
14
|
* The configured authority (`config.moderator.address` or `tokenState.issuer`) resolved along the account migration
|
|
14
15
|
* chain to its TERMINAL account (#1795). The configured address stays the old one after `account_migrate`, so only the
|
|
@@ -17,24 +18,38 @@ const isOfficialToken = (config, tokenAddress) => !!config?.token?.address && (0
|
|
|
17
18
|
*
|
|
18
19
|
* - not migrated: the configured address, unchanged;
|
|
19
20
|
* - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
|
|
20
|
-
* - the chain is broken (cycle or a missing target): no authority, fail closed.
|
|
21
|
+
* - the chain is broken (cycle, hop cap, or a missing target): no authority, fail closed.
|
|
22
|
+
*
|
|
23
|
+
* Walks `migratedTo[0]` explicitly with `{ traceMigration: false }` so `OverlayStateDB` (`TransactionBlock`) never
|
|
24
|
+
* caches `null` across differing `traceMigration` flags or misses intra-block `account_migrate` writes.
|
|
21
25
|
*/
|
|
22
26
|
async function resolveTokenAuthority(context, tokenAddress, tokenState) {
|
|
23
27
|
const { config, statedb } = context;
|
|
24
28
|
const configured = isOfficialToken(config, tokenAddress) ? config?.moderator?.address : tokenState?.issuer;
|
|
25
29
|
if (!configured) return void 0;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!
|
|
32
|
-
|
|
30
|
+
const normKey = (addr) => String(addr || "").trim().replace(/^did:abt:/i, "").toLowerCase();
|
|
31
|
+
const visited = /* @__PURE__ */ new Set();
|
|
32
|
+
let current = configured;
|
|
33
|
+
for (let hop = 0; hop <= MAX_MIGRATION_HOPS; hop++) {
|
|
34
|
+
const key = normKey(current);
|
|
35
|
+
if (!key || visited.has(key)) return void 0;
|
|
36
|
+
visited.add(key);
|
|
37
|
+
const acct = await statedb.account.get(current, {
|
|
38
|
+
...context,
|
|
39
|
+
traceMigration: false
|
|
40
|
+
});
|
|
41
|
+
if (!acct) return hop === 0 ? configured : void 0;
|
|
42
|
+
if (typeof acct.address === "string" && acct.address && !(0, _ocap_util.isSameDid)(acct.address, current)) return;
|
|
43
|
+
const migratedTo = Array.isArray(acct.migratedTo) ? acct.migratedTo : [];
|
|
44
|
+
if (migratedTo.length === 0) {
|
|
45
|
+
if (hop === 0) return configured;
|
|
46
|
+
return typeof acct.address === "string" && acct.address ? acct.address : current;
|
|
47
|
+
}
|
|
48
|
+
if (hop === MAX_MIGRATION_HOPS) return void 0;
|
|
49
|
+
const next = typeof migratedTo[0] === "string" ? migratedTo[0].trim() : "";
|
|
50
|
+
if (!next) return void 0;
|
|
51
|
+
current = next;
|
|
33
52
|
}
|
|
34
|
-
return await statedb.account.get(configured, {
|
|
35
|
-
...context,
|
|
36
|
-
traceMigration: false
|
|
37
|
-
}) ? void 0 : configured;
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
//#endregion
|
|
@@ -10,7 +10,10 @@ declare const isOfficialToken: (config: Ctx, tokenAddress: string) => boolean;
|
|
|
10
10
|
*
|
|
11
11
|
* - not migrated: the configured address, unchanged;
|
|
12
12
|
* - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
|
|
13
|
-
* - the chain is broken (cycle or a missing target): no authority, fail closed.
|
|
13
|
+
* - the chain is broken (cycle, hop cap, or a missing target): no authority, fail closed.
|
|
14
|
+
*
|
|
15
|
+
* Walks `migratedTo[0]` explicitly with `{ traceMigration: false }` so `OverlayStateDB` (`TransactionBlock`) never
|
|
16
|
+
* caches `null` across differing `traceMigration` flags or misses intra-block `account_migrate` writes.
|
|
14
17
|
*/
|
|
15
18
|
declare function resolveTokenAuthority(context: Ctx, tokenAddress: string, tokenState?: Ctx): Promise<string | undefined>;
|
|
16
19
|
//#endregion
|
|
@@ -93,7 +93,12 @@ runner.use(async (context, next) => {
|
|
|
93
93
|
const plan = context.bridgePlan;
|
|
94
94
|
if (!context.isBridgeV2 || plan?.kind !== "propose-owner") return next();
|
|
95
95
|
const candidate = plan.body.pendingOwner?.address;
|
|
96
|
-
|
|
96
|
+
const candidateAcct = await context.statedb.account.get(candidate, {
|
|
97
|
+
...context,
|
|
98
|
+
traceMigration: false
|
|
99
|
+
});
|
|
100
|
+
if (!candidateAcct) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "The proposed owner has no account on this chain"));
|
|
101
|
+
if (_ocap_state.account.isMigrated(candidateAcct) || typeof candidateAcct.address === "string" && candidateAcct.address && !_ocap_state.rollup.sameAddress(candidateAcct.address, candidate)) return next(new _ocap_util_lib_error.CustomError("INVALID_TX", "The proposed owner account has been migrated"));
|
|
97
102
|
return next();
|
|
98
103
|
});
|
|
99
104
|
runner.use(require_protocols_rollup_bridge_v2.ifV1(require_protocols_rollup_pipes_verify_signers.default({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.32.
|
|
6
|
+
"version": "1.32.3",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -46,22 +46,22 @@
|
|
|
46
46
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@arcblock/did": "1.32.
|
|
50
|
-
"@arcblock/did-util": "1.32.
|
|
51
|
-
"@arcblock/jwt": "1.32.
|
|
52
|
-
"@arcblock/validator": "1.32.
|
|
53
|
-
"@arcblock/vc": "1.32.
|
|
49
|
+
"@arcblock/did": "1.32.3",
|
|
50
|
+
"@arcblock/did-util": "1.32.3",
|
|
51
|
+
"@arcblock/jwt": "1.32.3",
|
|
52
|
+
"@arcblock/validator": "1.32.3",
|
|
53
|
+
"@arcblock/vc": "1.32.3",
|
|
54
54
|
"@blocklet/xss": "^0.3.7",
|
|
55
|
-
"@ocap/asset": "1.32.
|
|
56
|
-
"@ocap/client": "1.32.
|
|
57
|
-
"@ocap/mcrypto": "1.32.
|
|
58
|
-
"@ocap/merkle-tree": "1.32.
|
|
59
|
-
"@ocap/message": "1.32.
|
|
60
|
-
"@ocap/state": "1.32.
|
|
61
|
-
"@ocap/tx-pipeline": "1.32.
|
|
62
|
-
"@ocap/types": "1.32.
|
|
63
|
-
"@ocap/util": "1.32.
|
|
64
|
-
"@ocap/wallet": "1.32.
|
|
55
|
+
"@ocap/asset": "1.32.3",
|
|
56
|
+
"@ocap/client": "1.32.3",
|
|
57
|
+
"@ocap/mcrypto": "1.32.3",
|
|
58
|
+
"@ocap/merkle-tree": "1.32.3",
|
|
59
|
+
"@ocap/message": "1.32.3",
|
|
60
|
+
"@ocap/state": "1.32.3",
|
|
61
|
+
"@ocap/tx-pipeline": "1.32.3",
|
|
62
|
+
"@ocap/types": "1.32.3",
|
|
63
|
+
"@ocap/util": "1.32.3",
|
|
64
|
+
"@ocap/wallet": "1.32.3",
|
|
65
65
|
"debug": "^4.4.3",
|
|
66
66
|
"deep-diff": "^1.0.2",
|
|
67
67
|
"lodash": "^4.17.23",
|