@ocap/tx-protocols 1.31.9 → 1.32.1
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/execute.d.mts +6 -1
- package/esm/execute.mjs +151 -9
- package/esm/gas-security-guard.d.mts +19 -1
- package/esm/gas-security-guard.mjs +44 -1
- package/esm/index.d.mts +8 -2
- package/esm/index.mjs +2 -2
- package/esm/pipes/ensure-cost.mjs +39 -2
- package/esm/pipes/write-ledger.mjs +18 -3
- package/esm/protocols/rollup/bridge-create.mjs +10 -4
- package/esm/protocols/rollup/bridge-governance-tx-binding.d.mts +7 -0
- package/esm/protocols/rollup/bridge-governance-tx-binding.mjs +212 -0
- package/esm/protocols/rollup/bridge-governance-vote.d.mts +49 -0
- package/esm/protocols/rollup/bridge-governance-vote.mjs +563 -0
- package/esm/protocols/rollup/bridge-migrate.mjs +9 -9
- package/esm/protocols/rollup/bridge-v2.d.mts +6 -0
- package/esm/protocols/rollup/bridge-v2.mjs +5 -0
- package/esm/protocols/rollup/create.mjs +5 -4
- package/esm/protocols/rollup/token-authority.d.mts +17 -0
- package/esm/protocols/rollup/token-authority.mjs +40 -0
- package/esm/protocols/rollup/update.d.mts +2 -0
- package/esm/protocols/rollup/update.mjs +28 -6
- package/lib/execute.cjs +151 -9
- package/lib/execute.d.cts +6 -1
- package/lib/gas-security-guard.cjs +44 -0
- package/lib/gas-security-guard.d.cts +19 -1
- package/lib/index.cjs +1 -0
- package/lib/index.d.cts +8 -2
- package/lib/pipes/ensure-cost.cjs +39 -2
- package/lib/pipes/write-ledger.cjs +18 -3
- package/lib/protocols/rollup/bridge-create.cjs +10 -4
- package/lib/protocols/rollup/bridge-governance-tx-binding.cjs +213 -0
- package/lib/protocols/rollup/bridge-governance-tx-binding.d.cts +7 -0
- package/lib/protocols/rollup/bridge-governance-vote.cjs +572 -0
- package/lib/protocols/rollup/bridge-governance-vote.d.cts +49 -0
- package/lib/protocols/rollup/bridge-migrate.cjs +9 -9
- package/lib/protocols/rollup/bridge-v2.cjs +5 -0
- package/lib/protocols/rollup/bridge-v2.d.cts +6 -0
- package/lib/protocols/rollup/create.cjs +5 -4
- package/lib/protocols/rollup/token-authority.cjs +42 -0
- package/lib/protocols/rollup/token-authority.d.cts +17 -0
- package/lib/protocols/rollup/update.cjs +28 -6
- package/lib/protocols/rollup/update.d.cts +2 -0
- package/package.json +16 -16
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OcapGovernanceProposal } from "@ocap/mcrypto";
|
|
2
|
+
|
|
3
|
+
//#region src/protocols/rollup/bridge-governance-tx-binding.d.ts
|
|
4
|
+
type Ctx = any;
|
|
5
|
+
declare function verifyOcapProposalTxBinding(context: Ctx, proposal: OcapGovernanceProposal): Promise<void>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { verifyOcapProposalTxBinding };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { readItxData } from "./bridge-v2.mjs";
|
|
2
|
+
import { Hasher, canonicalJson, checkedNonZeroAddress, ethAddressFromUncompressedPk, normalizeUncompressedSecp256k1Pk, toHexDigest } from "@ocap/mcrypto";
|
|
3
|
+
import { CustomError } from "@ocap/util/lib/error";
|
|
4
|
+
import { getListField } from "@ocap/util/lib/get-list-field";
|
|
5
|
+
import { normalizePublicKeyHex } from "@arcblock/did";
|
|
6
|
+
import { rollup } from "@ocap/state";
|
|
7
|
+
import { hexToBytes } from "@ocap/util";
|
|
8
|
+
import { createMessage, decodeAny, findFormatProblem, fromTypeUrl, toTypeUrl } from "@ocap/message";
|
|
9
|
+
import { CANONICAL_SELF_DESCRIBE_PREFIX, decodeTx, encodeTx } from "@ocap/message/cbor";
|
|
10
|
+
import { decodeTx as decodeTx$1, encodeTx as encodeTx$1 } from "@ocap/message/protobuf";
|
|
11
|
+
|
|
12
|
+
//#region src/protocols/rollup/bridge-governance-tx-binding.ts
|
|
13
|
+
/**
|
|
14
|
+
* On-chain `unsignedTxBytesHex` + `frozenNonce` binding for OCAP `ArcBlockTransaction` governance proposals (#1880).
|
|
15
|
+
*
|
|
16
|
+
* Ensures every `ArcBlockTransaction` co-signed on-chain via `govProposalVote` commits to a canonical unsigned OCAP
|
|
17
|
+
* `Transaction` whose `chainId`, `typeUrl`, `from`, `pk`, `nonce`, `signatures` roster, and decoded `itx` fields
|
|
18
|
+
* match `proposal.action`, and whose `frozenNonce` has not yet been spent on `txFrom`'s on-chain account.
|
|
19
|
+
*/
|
|
20
|
+
function invalidTx(msg) {
|
|
21
|
+
throw new CustomError("INVALID_TX", msg);
|
|
22
|
+
}
|
|
23
|
+
function hasCborSelfDescribeTag(buf) {
|
|
24
|
+
return buf.length >= CANONICAL_SELF_DESCRIBE_PREFIX.length && buf[0] === CANONICAL_SELF_DESCRIBE_PREFIX[0] && buf[1] === CANONICAL_SELF_DESCRIBE_PREFIX[1] && buf[2] === CANONICAL_SELF_DESCRIBE_PREFIX[2];
|
|
25
|
+
}
|
|
26
|
+
function normalizeDecodedItx(raw) {
|
|
27
|
+
if (!raw || typeof raw !== "object") invalidTx("unsignedTxBytesHex contains no decodable itx");
|
|
28
|
+
if (typeof raw.typeUrl === "string" && raw.typeUrl) {
|
|
29
|
+
if (typeof raw.value === "string") {
|
|
30
|
+
const decoded = decodeAny(raw);
|
|
31
|
+
return {
|
|
32
|
+
typeUrl: raw.typeUrl,
|
|
33
|
+
value: decoded?.value ?? {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const inner = {};
|
|
37
|
+
for (const [key, val] of Object.entries(raw)) {
|
|
38
|
+
if (key === "typeUrl" || key === "type_url") continue;
|
|
39
|
+
inner[key] = val;
|
|
40
|
+
}
|
|
41
|
+
const msg = createMessage(fromTypeUrl(raw.typeUrl), inner);
|
|
42
|
+
return {
|
|
43
|
+
typeUrl: raw.typeUrl,
|
|
44
|
+
value: msg?.toObject ? msg.toObject() : inner
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof raw.type === "string" && raw.type) {
|
|
48
|
+
const typeUrl = toTypeUrl(raw.type);
|
|
49
|
+
const typeName = fromTypeUrl(typeUrl);
|
|
50
|
+
const inner = raw.value || {};
|
|
51
|
+
const msg = createMessage(typeName, inner);
|
|
52
|
+
return {
|
|
53
|
+
typeUrl,
|
|
54
|
+
value: msg?.toObject ? msg.toObject() : inner
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
invalidTx("unsignedTxBytesHex itx is missing typeUrl");
|
|
58
|
+
}
|
|
59
|
+
function isEmptyBytesOrStr(v) {
|
|
60
|
+
if (v === void 0 || v === null || v === "") return true;
|
|
61
|
+
if (v instanceof Uint8Array) return v.length === 0;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
function assertUpdatePatchMatches(decodedPatch, expected) {
|
|
65
|
+
const expectedKeys = [];
|
|
66
|
+
for (const k of [
|
|
67
|
+
"minDeposit",
|
|
68
|
+
"minWithdraw",
|
|
69
|
+
"maxWithdraw",
|
|
70
|
+
"releaseDailyCap",
|
|
71
|
+
"refundDailyCap"
|
|
72
|
+
]) if (expected[k] !== void 0) {
|
|
73
|
+
expectedKeys.push(k);
|
|
74
|
+
if (decodedPatch[k] !== expected[k].toString(10)) invalidTx(`unsignedTxBytesHex update_rollup patch.${k} does not match proposal`);
|
|
75
|
+
}
|
|
76
|
+
for (const k of ["releaseGrace", "refundDelay"]) if (expected[k] !== void 0) {
|
|
77
|
+
expectedKeys.push(k);
|
|
78
|
+
if (decodedPatch[k] !== expected[k]) invalidTx(`unsignedTxBytesHex update_rollup patch.${k} does not match proposal`);
|
|
79
|
+
}
|
|
80
|
+
if (expected.pausers !== void 0) {
|
|
81
|
+
expectedKeys.push("pausers");
|
|
82
|
+
if (!Array.isArray(decodedPatch.pausers) || decodedPatch.pausers.length !== expected.pausers.length || decodedPatch.pausers.some((p, i) => {
|
|
83
|
+
try {
|
|
84
|
+
return checkedNonZeroAddress(p, `patch.pausers[${i}]`) !== expected.pausers[i];
|
|
85
|
+
} catch {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
})) invalidTx("unsignedTxBytesHex update_rollup patch.pausers does not match proposal");
|
|
89
|
+
}
|
|
90
|
+
if (expected.cancelPendingEpoch === true) {
|
|
91
|
+
expectedKeys.push("cancelPendingEpoch");
|
|
92
|
+
if (decodedPatch.cancelPendingEpoch !== true) invalidTx("unsignedTxBytesHex update_rollup patch.cancelPendingEpoch does not match proposal");
|
|
93
|
+
}
|
|
94
|
+
if (expected.cancelOwnerProposal === true) {
|
|
95
|
+
expectedKeys.push("cancelOwnerProposal");
|
|
96
|
+
if (decodedPatch.cancelOwnerProposal !== true) invalidTx("unsignedTxBytesHex update_rollup patch.cancelOwnerProposal does not match proposal");
|
|
97
|
+
}
|
|
98
|
+
if (expected.proposeOwner !== void 0) {
|
|
99
|
+
expectedKeys.push("proposeOwner");
|
|
100
|
+
const po = decodedPatch.proposeOwner;
|
|
101
|
+
if (!po || typeof po !== "object" || Array.isArray(po)) invalidTx("unsignedTxBytesHex update_rollup patch.proposeOwner must be an object");
|
|
102
|
+
const poKeys = Object.keys(po);
|
|
103
|
+
if (poKeys.length !== 3 || !poKeys.every((k) => k === "address" || k === "pk" || k === "endpoint")) invalidTx("unsignedTxBytesHex update_rollup patch.proposeOwner has unexpected keys");
|
|
104
|
+
let normAddr = "";
|
|
105
|
+
let normPk = "";
|
|
106
|
+
try {
|
|
107
|
+
normAddr = checkedNonZeroAddress(po.address, "proposeOwner.address");
|
|
108
|
+
normPk = normalizeUncompressedSecp256k1Pk(normalizePublicKeyHex(po.pk) || String(po.pk ?? ""));
|
|
109
|
+
} catch (err) {
|
|
110
|
+
invalidTx(err.message);
|
|
111
|
+
}
|
|
112
|
+
if (normAddr !== expected.proposeOwner.newOwner || normPk !== expected.proposeOwner.newOwnerPk || po.endpoint !== expected.proposeOwner.endpoint) invalidTx("unsignedTxBytesHex update_rollup patch.proposeOwner does not match proposal");
|
|
113
|
+
}
|
|
114
|
+
if (expected.evmGovernance !== void 0) {
|
|
115
|
+
expectedKeys.push("evmGovernance");
|
|
116
|
+
if (canonicalJson(rollup.validateStrictEvmGovernance(decodedPatch.evmGovernance, "INVALID_ROLLUP_UPDATE")) !== canonicalJson(expected.evmGovernance)) invalidTx("unsignedTxBytesHex update_rollup patch.evmGovernance does not match proposal");
|
|
117
|
+
}
|
|
118
|
+
const actualKeys = Object.keys(decodedPatch).filter((k) => decodedPatch[k] !== void 0);
|
|
119
|
+
if (actualKeys.length !== expectedKeys.length || !actualKeys.every((k) => expectedKeys.includes(k))) invalidTx("unsignedTxBytesHex update_rollup patch keys do not match proposal.action.patch");
|
|
120
|
+
}
|
|
121
|
+
async function verifyOcapProposalTxBinding(context, proposal) {
|
|
122
|
+
const { action } = proposal;
|
|
123
|
+
if (action.kind === "join_rollup" || action.kind === "leave_rollup") return;
|
|
124
|
+
if (!action.txFrom || action.frozenNonce === void 0 || !action.unsignedTxBytesHex || !action.challenge) invalidTx(`${action.kind} proposal requires txFrom, frozenNonce, unsignedTxBytesHex, and challenge on-chain`);
|
|
125
|
+
if (action.frozenNonce < 1n) invalidTx(`${action.kind}.frozenNonce must be a positive integer`);
|
|
126
|
+
const originBytes = new Uint8Array(hexToBytes(action.unsignedTxBytesHex.slice(2)));
|
|
127
|
+
if (toHexDigest(Hasher.Keccak.hash256(originBytes, 1, "Uint8Array")) !== action.challenge) invalidTx("action.challenge does not match keccak256(action.unsignedTxBytesHex)");
|
|
128
|
+
const isCbor = hasCborSelfDescribeTag(originBytes);
|
|
129
|
+
let decodedTx;
|
|
130
|
+
try {
|
|
131
|
+
decodedTx = isCbor ? decodeTx(originBytes) : decodeTx$1(originBytes);
|
|
132
|
+
const reencoded = isCbor ? encodeTx(decodedTx) : encodeTx$1(decodedTx);
|
|
133
|
+
if (reencoded.length !== originBytes.length || !reencoded.every((b, i) => b === originBytes[i])) invalidTx("unsignedTxBytesHex is not canonically encoded");
|
|
134
|
+
const problem = findFormatProblem("Transaction", decodedTx);
|
|
135
|
+
if (problem && (!isCbor || problem.kind === "invalid-timestamp")) invalidTx("unsignedTxBytesHex failed Transaction format check");
|
|
136
|
+
} catch (err) {
|
|
137
|
+
const e = err;
|
|
138
|
+
if (e?.code === "INVALID_TX") throw err;
|
|
139
|
+
invalidTx(`Failed to decode unsignedTxBytesHex: ${e?.message || String(err)}`);
|
|
140
|
+
}
|
|
141
|
+
if (!isEmptyBytesOrStr(decodedTx.signature)) invalidTx("unsignedTxBytesHex must be an unsigned Transaction (tx.signature must be empty)");
|
|
142
|
+
if (decodedTx.delegator) invalidTx("unsignedTxBytesHex must not set tx.delegator");
|
|
143
|
+
if (decodedTx.serviceFee && decodedTx.serviceFee !== "0") invalidTx("unsignedTxBytesHex must not set non-zero tx.serviceFee");
|
|
144
|
+
if (decodedTx.chainId !== proposal.ocapChainId) invalidTx("unsignedTxBytesHex tx.chainId does not match proposal.ocapChainId");
|
|
145
|
+
if (decodedTx.from !== action.txFrom) invalidTx("unsignedTxBytesHex tx.from does not match proposal.action.txFrom");
|
|
146
|
+
let txNonce = -1n;
|
|
147
|
+
try {
|
|
148
|
+
txNonce = BigInt(String(decodedTx.nonce ?? ""));
|
|
149
|
+
} catch {
|
|
150
|
+
invalidTx("unsignedTxBytesHex tx.nonce is not a valid integer");
|
|
151
|
+
}
|
|
152
|
+
if (txNonce !== action.frozenNonce) invalidTx("unsignedTxBytesHex tx.nonce does not match proposal.action.frozenNonce");
|
|
153
|
+
const sigList = getListField(decodedTx, "signatures");
|
|
154
|
+
for (const s of sigList) if (!isEmptyBytesOrStr(s.signature) || !isEmptyBytesOrStr(s.extra) || !isEmptyBytesOrStr(s.data) || s.delegator) invalidTx("unsignedTxBytesHex tx.signatures entries must omit signature, extra, data, and delegator");
|
|
155
|
+
let fromPk = "";
|
|
156
|
+
try {
|
|
157
|
+
fromPk = normalizeUncompressedSecp256k1Pk(normalizePublicKeyHex(decodedTx.pk) || String(decodedTx.pk ?? ""));
|
|
158
|
+
} catch {
|
|
159
|
+
invalidTx("unsignedTxBytesHex tx.pk is not a valid uncompressed secp256k1 public key");
|
|
160
|
+
}
|
|
161
|
+
if (!rollup.sameAddress(ethAddressFromUncompressedPk(fromPk), action.txFrom)) invalidTx("unsignedTxBytesHex tx.pk does not derive to proposal.action.txFrom");
|
|
162
|
+
if ("signerRoster" in action) {
|
|
163
|
+
if (sigList.length !== action.signerRoster.length - 1) invalidTx("unsignedTxBytesHex tx.signatures length does not match proposal signerRoster");
|
|
164
|
+
const rosterByAddr = new Map(action.signerRoster.map((e) => [e.signer, e.pk]));
|
|
165
|
+
if (rosterByAddr.get(action.txFrom) !== fromPk) invalidTx("unsignedTxBytesHex tx.pk does not match txFrom entry in signerRoster");
|
|
166
|
+
const seenSigs = new Set([action.txFrom]);
|
|
167
|
+
for (const s of sigList) {
|
|
168
|
+
let sAddr = "";
|
|
169
|
+
let sPk = "";
|
|
170
|
+
try {
|
|
171
|
+
sAddr = checkedNonZeroAddress(s.signer, "tx.signatures.signer");
|
|
172
|
+
sPk = normalizeUncompressedSecp256k1Pk(normalizePublicKeyHex(s.pk) || String(s.pk ?? ""));
|
|
173
|
+
} catch (err) {
|
|
174
|
+
invalidTx(err.message);
|
|
175
|
+
}
|
|
176
|
+
if (s.signer !== sAddr) invalidTx("unsignedTxBytesHex tx.signatures.signer must be EIP-55 checksummed");
|
|
177
|
+
if (seenSigs.has(sAddr) || rosterByAddr.get(sAddr) !== sPk) invalidTx(`unsignedTxBytesHex tx.signatures entry ${sAddr} does not match signerRoster`);
|
|
178
|
+
seenSigs.add(sAddr);
|
|
179
|
+
}
|
|
180
|
+
} else if (sigList.length !== 0) invalidTx("Single-signer OCAP proposal unsignedTxBytesHex must have empty tx.signatures");
|
|
181
|
+
const normItx = normalizeDecodedItx(decodedTx.itx);
|
|
182
|
+
if (normItx.typeUrl !== `fg:t:${action.kind}`) invalidTx(`unsignedTxBytesHex itx.typeUrl (${normItx.typeUrl}) does not match fg:t:${action.kind}`);
|
|
183
|
+
const itx = normItx.value;
|
|
184
|
+
if (itx.rollup !== proposal.ocapBridge) invalidTx("unsignedTxBytesHex itx.rollup does not match proposal.ocapBridge");
|
|
185
|
+
rollup.assertV1FieldsUnused(itx, "INVALID_ROLLUP_UPDATE");
|
|
186
|
+
if (action.kind === "pause_rollup" || action.kind === "resume_rollup") {
|
|
187
|
+
if (itx.data !== void 0 && itx.data !== null) {
|
|
188
|
+
const d = readItxData(itx);
|
|
189
|
+
if (Object.keys(d).some((k) => k !== "reason") || d.reason !== void 0 && d.reason !== action.reason) invalidTx(`unsignedTxBytesHex ${action.kind} itx.data does not match proposal`);
|
|
190
|
+
}
|
|
191
|
+
} else if (action.kind === "close_rollup") {
|
|
192
|
+
if (typeof itx.message !== "string" || itx.message.trim() !== action.reason || itx.token) invalidTx("unsignedTxBytesHex close_rollup message/token does not match proposal");
|
|
193
|
+
const d = readItxData(itx);
|
|
194
|
+
if (!Object.keys(d).every((k) => k === "depositCutoffEthBlock" || k === "reason") || String(d.depositCutoffEthBlock ?? "") !== action.depositCutoffEthBlock.toString(10) || d.reason !== void 0 && d.reason !== action.reason) invalidTx("unsignedTxBytesHex close_rollup depositCutoffEthBlock does not match proposal");
|
|
195
|
+
} else if (action.kind === "migrate_rollup") {
|
|
196
|
+
if (itx.type !== action.migrateKind || typeof itx.message !== "string" || itx.message.trim() !== action.reason) invalidTx("unsignedTxBytesHex migrate_rollup type/message does not match proposal");
|
|
197
|
+
if (action.migrateKind === "vault") {
|
|
198
|
+
if (!rollup.sameAddress(itx.to, action.nextVault) || itx.data !== void 0 && itx.data !== null) invalidTx("unsignedTxBytesHex migrate_rollup(vault) target/data does not match proposal");
|
|
199
|
+
} else {
|
|
200
|
+
if (itx.to !== action.targetBridge) invalidTx("unsignedTxBytesHex migrate_rollup(reserve) to does not match proposal.action.targetBridge");
|
|
201
|
+
const d = readItxData(itx);
|
|
202
|
+
if (Object.keys(d).some((k) => k !== "action") || d.action !== action.step) invalidTx("unsignedTxBytesHex migrate_rollup(reserve) step does not match proposal");
|
|
203
|
+
}
|
|
204
|
+
} else if (action.kind === "update_rollup") assertUpdatePatchMatches(readItxData(itx), action.patch);
|
|
205
|
+
const fromAcct = await context.statedb.account.get(action.txFrom, context);
|
|
206
|
+
if (!fromAcct) invalidTx(`Proposal txFrom account ${action.txFrom} does not exist on-chain`);
|
|
207
|
+
const currentAcctNonce = BigInt(String(fromAcct.nonce ?? 0));
|
|
208
|
+
if (currentAcctNonce >= action.frozenNonce) invalidTx(`Proposal frozenNonce (${action.frozenNonce.toString(10)}) is already spent on ${action.txFrom} (account.nonce=${currentAcctNonce.toString(10)})`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//#endregion
|
|
212
|
+
export { verifyOcapProposalTxBinding };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region src/protocols/rollup/bridge-governance-vote.d.ts
|
|
2
|
+
declare const MAX_ACTIVE_DRAFTS_PER_PROPOSER = 2;
|
|
3
|
+
declare const MAX_SINGLE_SIG_PROPOSALS_PER_PROPOSER = 2;
|
|
4
|
+
declare const MAX_GOV_INDEX_RING_CAP = 100;
|
|
5
|
+
declare const MAX_GOV_PROPOSAL_TTL_SEC: number;
|
|
6
|
+
declare const MAX_GOV_CREATED_AT_SKEW_SEC = 300;
|
|
7
|
+
interface BridgeGovVoteEntry {
|
|
8
|
+
signer: string;
|
|
9
|
+
role: string;
|
|
10
|
+
signature: string;
|
|
11
|
+
envelope: 'eip712' | 'eip191';
|
|
12
|
+
isSeed: boolean;
|
|
13
|
+
votedAt: number;
|
|
14
|
+
publicKeyHex?: string;
|
|
15
|
+
}
|
|
16
|
+
interface BridgeGovIndexItem {
|
|
17
|
+
proposalId: string;
|
|
18
|
+
signedDigest: string;
|
|
19
|
+
plane: 'ethereum' | 'ocap';
|
|
20
|
+
actionKind: string;
|
|
21
|
+
proposer: string;
|
|
22
|
+
summary: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
createdAt: number;
|
|
25
|
+
updatedAt: number;
|
|
26
|
+
expiresAt: string;
|
|
27
|
+
voteCount: number;
|
|
28
|
+
quorumReached: boolean;
|
|
29
|
+
singleSig?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface BridgeGovVotePlan {
|
|
32
|
+
indexKey: string;
|
|
33
|
+
docKey: string;
|
|
34
|
+
createDoc: boolean;
|
|
35
|
+
createIndex: boolean;
|
|
36
|
+
gasEstimate: {
|
|
37
|
+
create: number;
|
|
38
|
+
update: number;
|
|
39
|
+
payment: 0;
|
|
40
|
+
};
|
|
41
|
+
docData: string;
|
|
42
|
+
indexData: string;
|
|
43
|
+
}
|
|
44
|
+
type Ctx = any;
|
|
45
|
+
declare function isGovProposalVotePayload(rawData: Record<string, unknown>): boolean;
|
|
46
|
+
declare function planBridgeGovProposalVote(context: Ctx, rawData: Record<string, unknown>): Promise<BridgeGovVotePlan>;
|
|
47
|
+
declare function commitBridgeGovProposalVote(context: Ctx, plan: BridgeGovVotePlan): Promise<void>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { BridgeGovIndexItem, BridgeGovVoteEntry, BridgeGovVotePlan, MAX_ACTIVE_DRAFTS_PER_PROPOSER, MAX_GOV_CREATED_AT_SKEW_SEC, MAX_GOV_INDEX_RING_CAP, MAX_GOV_PROPOSAL_TTL_SEC, MAX_SINGLE_SIG_PROPOSALS_PER_PROPOSER, commitBridgeGovProposalVote, isGovProposalVotePayload, planBridgeGovProposalVote };
|