@vocdoni/skills 0.6.0 → 0.7.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/.claude-plugin/marketplace.json +27 -15
- package/CHANGELOG.md +22 -0
- package/README.md +38 -24
- package/bin/install.js +13 -2
- package/package.json +1 -1
- package/plugins/agentic-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/agentic-dev/skills/subagent-driven-development/SKILL.md +6 -4
- package/plugins/agentic-dev/skills/subagent-driven-development/references/dispatch.md +6 -1
- package/plugins/agentic-dev/skills/subagent-driven-development/references/ledger.md +8 -5
- package/plugins/agentic-dev/skills/subagent-driven-development/references/models.md +38 -6
- package/plugins/agentic-dev/skills/subagent-driven-development/scripts/init-workspace.sh +1 -0
- package/plugins/agentic-dev/skills/subagent-driven-development/scripts/model-inventory.sh +6 -4
- package/plugins/claude-pi-subagent/plugins/pi-subagent/package-lock.json +4 -3
- package/plugins/vocdoni-contributing/.claude-plugin/plugin.json +2 -2
- package/plugins/vocdoni-contributing/hooks/session-start.sh +1 -1
- package/plugins/vocdoni-contributing/skills/contributing/SKILL.md +33 -6
- package/plugins/vocdoni-go/.claude-plugin/plugin.json +2 -2
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/SKILL.md +522 -0
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/references/prompts.md +260 -0
- package/plugins/vocdoni-go/skills/vocdoni-backend-review/scripts/untracked-list.sh +35 -0
- package/plugins/vocdoni-sdk/.claude-plugin/plugin.json +4 -5
- package/plugins/vocdoni-sdk/skills/vocdoni-ballot-protocol/SKILL.md +61 -38
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/SKILL.md +35 -21
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/approval-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/basic-poll.ts +6 -6
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/csp-vote.ts +12 -7
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/multichoice-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/quadratic-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/ranked-vote.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/weighted-census.ts +3 -3
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/accounts.md +26 -15
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/census.md +9 -10
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/client.md +15 -13
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/csp.md +43 -18
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/elections.md +4 -4
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/errors.md +24 -21
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/removed-features.md +98 -0
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/results.md +0 -1
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/voting.md +30 -34
- package/plugins/vocdoni-sequencer/.claude-plugin/plugin.json +21 -0
- package/plugins/vocdoni-sequencer/skills/vocdoni-sequencer/SKILL.md +169 -0
- package/plugins/vocdoni-sequencer/skills/vocdoni-sequencer/references/removed-routes.md +60 -0
- package/plugins/davinci-sdk/.claude-plugin/plugin.json +0 -13
- package/plugins/davinci-sdk/skills/davinci-sdk/SKILL.md +0 -120
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/bootstrap.ts +0 -61
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/cast-vote.ts +0 -78
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/create-process.ts +0 -102
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/full-election.ts +0 -128
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/read-results.ts +0 -73
- package/plugins/davinci-sdk/skills/davinci-sdk/recipes/token-census.ts +0 -111
- package/plugins/davinci-sdk/skills/davinci-sdk/references/ballot-modes.md +0 -125
- package/plugins/davinci-sdk/skills/davinci-sdk/references/census.md +0 -168
- package/plugins/davinci-sdk/skills/davinci-sdk/references/contracts.md +0 -133
- package/plugins/davinci-sdk/skills/davinci-sdk/references/errors.md +0 -83
- package/plugins/davinci-sdk/skills/davinci-sdk/references/process.md +0 -225
- package/plugins/davinci-sdk/skills/davinci-sdk/references/protocol.md +0 -65
- package/plugins/davinci-sdk/skills/davinci-sdk/references/sequencer.md +0 -135
- package/plugins/davinci-sdk/skills/davinci-sdk/references/setup.md +0 -123
- package/plugins/davinci-sdk/skills/davinci-sdk/references/voting.md +0 -128
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/anonymous-vote.ts +0 -108
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/recipes/token-census.ts +0 -121
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/anonymous.md +0 -183
- package/plugins/vocdoni-sdk/skills/vocdoni-sdk/references/census3.md +0 -308
|
@@ -15,6 +15,8 @@ Use cases: KYC-gated elections, allowlist memberships managed in a CRM, anti-Syb
|
|
|
15
15
|
|
|
16
16
|
The SDK ships against [`vocdoni/blind-csp`](https://github.com/vocdoni/blind-csp); the wire shape is theirs.
|
|
17
17
|
|
|
18
|
+
> **SDK 0.10.0 needs a CSP that uses the V2 salt.** Since 0.10.0, CSP elections are published as census origin `OFF_CHAIN_CA_V2`. The sequencer derives the salt as `keccak256(processID || weight as 32-byte big-endian)[:20]` and requires weight < 2^160. `vocdoni/blind-csp` v0.2.0 and later derive that salt for these elections; older releases use the legacy salt (`processID[:20]`), so their signatures fail. Upgrade `blind-csp` to v0.2.0 or later. v0.2.0 signs weight 1 for every voter, so it cannot serve weighted votes (see below).
|
|
19
|
+
|
|
18
20
|
## Creating a CSP-gated election
|
|
19
21
|
|
|
20
22
|
```ts
|
|
@@ -44,10 +46,10 @@ There's no `.add()` on a `CspCensus` — the participant set is the CSP's busine
|
|
|
44
46
|
## The voting flow
|
|
45
47
|
|
|
46
48
|
```ts
|
|
47
|
-
import {
|
|
49
|
+
import { EnvOptions, VocdoniSDKClient, Vote } from '@vocdoni/sdk';
|
|
48
50
|
|
|
49
51
|
const client = new VocdoniSDKClient({
|
|
50
|
-
env: EnvOptions.
|
|
52
|
+
env: EnvOptions.DEV,
|
|
51
53
|
wallet: voterWallet,
|
|
52
54
|
electionId,
|
|
53
55
|
});
|
|
@@ -60,11 +62,11 @@ const step1 = (await client.cspStep(
|
|
|
60
62
|
step0.authToken,
|
|
61
63
|
)) as ICspFinalStepResponse;
|
|
62
64
|
|
|
63
|
-
// 2. Obtain a blind signature for this voter's address.
|
|
64
|
-
const
|
|
65
|
+
// 2. Obtain a blind signature for this voter's address: { signature, weight }.
|
|
66
|
+
const sig = await client.cspSign(voterWallet.address, step1.token);
|
|
65
67
|
|
|
66
|
-
// 3. Build a CspVote
|
|
67
|
-
const vote = client.cspVote(new Vote([0]),
|
|
68
|
+
// 3. Build a CspVote from the signature object.
|
|
69
|
+
const vote = client.cspVote(new Vote([0]), sig);
|
|
68
70
|
|
|
69
71
|
// 4. Submit it.
|
|
70
72
|
const voteId = await client.submitVote(vote);
|
|
@@ -89,24 +91,35 @@ type ICspFinalStepResponse = {
|
|
|
89
91
|
|
|
90
92
|
If the CSP only needs one round, you may have a single `cspStep(0, …)` returning a final response directly. Refer to the CSP's docs.
|
|
91
93
|
|
|
92
|
-
### `cspSign(address, token)`
|
|
94
|
+
### `cspSign(address, token, weight?)`
|
|
93
95
|
|
|
94
96
|
```ts
|
|
95
|
-
client.cspSign(address: string, token: string): Promise<
|
|
97
|
+
client.cspSign(address: string, token: string, weight?: bigint): Promise<CspSignature>
|
|
98
|
+
|
|
99
|
+
type CspSignature = { signature: string; weight?: bigint };
|
|
96
100
|
```
|
|
97
101
|
|
|
98
|
-
Returns
|
|
102
|
+
Returns the unblinded signature and the weight you passed (as a bigint; `undefined` when omitted). That weight must be the one the CSP authorised for this voter. Before 0.10.0 it returned the bare string; code that used the result as a string must read `.signature` now. Internally this is `getBlindedPayload(electionId, hexTokenR, address)` → CSP signs the blinded blob → `CensusBlind.unblind(...)` to recover the usable signature.
|
|
103
|
+
|
|
104
|
+
### `cspVote(vote, signature, proof_type?, weight?)`
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
```ts
|
|
107
|
+
client.cspVote(vote: Vote, signature: string | CspSignatureInput, proof_type?: CspProofType, weight?: bigint): CspVote
|
|
108
|
+
|
|
109
|
+
type CspSignatureInput = { signature: string; weight?: bigint | number | string };
|
|
110
|
+
```
|
|
101
111
|
|
|
102
|
-
Convenience constructor for `CspVote
|
|
112
|
+
Convenience constructor for `CspVote`. Pass the `cspSign` result directly:
|
|
103
113
|
|
|
104
114
|
```ts
|
|
105
|
-
const
|
|
106
|
-
|
|
115
|
+
const sig = await client.cspSign(voterWallet.address, step1.token); // { signature, weight }
|
|
116
|
+
const cspVote = client.cspVote(new Vote([0]), sig);
|
|
117
|
+
// equivalent to: new CspVote([0], sig.signature, CspProofType.ECDSA_BLIND_PIDSALTED, sig.weight);
|
|
107
118
|
```
|
|
108
119
|
|
|
109
|
-
`
|
|
120
|
+
`cspVote` copies `vote.memo`. `CspSignatureInput.weight` also accepts `number` and `string`, so an object rebuilt from JSON works.
|
|
121
|
+
|
|
122
|
+
`proof_type` defaults to `ECDSA_BLIND_PIDSALTED`; override only if your CSP requires a non-default type:
|
|
110
123
|
|
|
111
124
|
```ts
|
|
112
125
|
import { CspProofType } from '@vocdoni/sdk';
|
|
@@ -114,10 +127,22 @@ import { CspProofType } from '@vocdoni/sdk';
|
|
|
114
127
|
// Available types
|
|
115
128
|
CspProofType.ECDSA
|
|
116
129
|
CspProofType.ECDSA_PIDSALTED
|
|
117
|
-
CspProofType.ECDSA_BLIND
|
|
118
|
-
CspProofType.ECDSA_BLIND_PIDSALTED
|
|
130
|
+
CspProofType.ECDSA_BLIND
|
|
131
|
+
CspProofType.ECDSA_BLIND_PIDSALTED // default
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Weighted CSP votes (0.10.0)
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const sig = await client.cspSign(voterWallet.address, step1.token, 5n); // the CSP authorised weight 5
|
|
138
|
+
const vote = client.cspVote(new Vote([0]), sig); // weight reused from sig
|
|
119
139
|
```
|
|
120
140
|
|
|
141
|
+
- `weight` is a bigint in [1, 2^160). An explicit `0n` throws. Use the weight the CSP authorised for this voter.
|
|
142
|
+
- Omit `weight` from `cspVote` to reuse the one `cspSign` signed. Passing a different one throws `Vote weight (X) does not match the weight signed by the CSP (Y)`.
|
|
143
|
+
- A wrong weight fails signature verification on the chain, because the V2 salt includes the weight.
|
|
144
|
+
- **A weighted CSP vote needs a CSP that signs per-voter weights.** `vocdoni/blind-csp` v0.2.0 signs every vote with weight 1, so it cannot authorise a weight. The Vocdoni SaaS CSP signs per-voter weights with the V2 salt, but it is reached through [[vocdoni-integrator-sdk]], not through `@vocdoni/sdk`: `CspCensus` calls the blind-csp routes (`/auth/elections/...`), and a `CspCensus` pointed at saas-backend gets 404, because saas-backend exposes a different API (routes under `/processes/{processId}/`: `auth/{step}`, `sign`, `blind-point`, `blind-sign`). With `@vocdoni/sdk`, weighted CSP votes need a CSP you run that implements the blind-csp API and signs weights with the V2 salt.
|
|
145
|
+
|
|
121
146
|
### `cspUrl()` and `cspInfo()`
|
|
122
147
|
|
|
123
148
|
If you need to inspect the configured CSP from the election:
|
|
@@ -135,7 +160,7 @@ class CspVote extends Vote {
|
|
|
135
160
|
votes: Array<number | bigint>,
|
|
136
161
|
signature: string, // required
|
|
137
162
|
proof_type?: CspProofType,
|
|
138
|
-
weight?: bigint, // optional;
|
|
163
|
+
weight?: bigint, // optional; must match the weight the CSP signed
|
|
139
164
|
);
|
|
140
165
|
signature: string;
|
|
141
166
|
proof_type?: CspProofType;
|
|
@@ -165,4 +190,4 @@ class CspVote extends Vote {
|
|
|
165
190
|
- `census.md` — `CspCensus` construction.
|
|
166
191
|
- `voting.md` — `submitVote` accepts `CspVote` transparently.
|
|
167
192
|
- `recipes/csp-vote.ts` — runnable example.
|
|
168
|
-
- [`vocdoni/blind-csp`](https://github.com/vocdoni/blind-csp) — the reference CSP implementation.
|
|
193
|
+
- [`vocdoni/blind-csp`](https://github.com/vocdoni/blind-csp) — the reference CSP implementation. Releases before v0.2.0 sign with the legacy salt, so their signatures fail on 0.10.0 elections (see the note at the top).
|
|
@@ -50,7 +50,7 @@ type IElectionParameters = {
|
|
|
50
50
|
voteType?: IVoteType;
|
|
51
51
|
questions?: IQuestion[]; // can also be added via .addQuestion()
|
|
52
52
|
maxCensusSize?: number; // cap on eligible voters; must be > 0
|
|
53
|
-
temporarySecretIdentity?: boolean; //
|
|
53
|
+
temporarySecretIdentity?: boolean; // sets tempSIKs, which the chain ignores
|
|
54
54
|
addSDKVersion?: boolean; // embed SDK version in meta; default true
|
|
55
55
|
};
|
|
56
56
|
```
|
|
@@ -64,7 +64,7 @@ type IElectionType = {
|
|
|
64
64
|
interruptible?: boolean; // default true — election can be paused/ended manually
|
|
65
65
|
dynamicCensus?: boolean; // default false — true allows changeElectionCensus() after creation
|
|
66
66
|
secretUntilTheEnd?: boolean; // default false — true encrypts individual votes until the end block; live results hidden
|
|
67
|
-
anonymous?: boolean; //
|
|
67
|
+
anonymous?: boolean; // do not set: the chain rejects anonymous elections (removed-features.md)
|
|
68
68
|
metadata?: {
|
|
69
69
|
encrypted?: boolean; // default false — encrypts questions/descriptions
|
|
70
70
|
password?: string | null; // required if encrypted = true
|
|
@@ -217,7 +217,7 @@ Voting is only possible while `ONGOING`. Reading results works on `ONGOING`, `EN
|
|
|
217
217
|
- **The `meta.sdk` key is reserved.** Setting it throws. The SDK auto-embeds its own version under that key unless `addSDKVersion: false`.
|
|
218
218
|
- **Multi-question elections use `Vote([…])`** with one entry per question. The order is the order in which you called `addQuestion`.
|
|
219
219
|
- **Variant elections (approval/multichoice/budget/quadratic) only support one question.** Calling `addQuestion` a second time throws. See `election-types.md`.
|
|
220
|
-
- **Election creation costs tokens.** Use `estimateElectionCost` to see roughly how many; the price depends on `maxCensusSize`, duration, `secretUntilTheEnd`,
|
|
220
|
+
- **Election creation costs tokens.** Use `estimateElectionCost` to see roughly how many; the price depends on `maxCensusSize`, duration, `secretUntilTheEnd`, and `maxVoteOverwrites`.
|
|
221
221
|
- **Setting `maxCensusSize` is strongly recommended** even for small censuses — it makes cost calculation deterministic and unblocks `changeElectionMaxCensusSize` later.
|
|
222
222
|
|
|
223
223
|
## Cross-references
|
|
@@ -228,4 +228,4 @@ Voting is only possible while `ONGOING`. Reading results works on `ONGOING`, `EN
|
|
|
228
228
|
- `election-types.md` — approval, multichoice, budget, quadratic, ranked.
|
|
229
229
|
- `voting.md` — how voters submit, with the `Vote` class.
|
|
230
230
|
- `results.md` — how `fetchElection(id)` returns results and metadata.
|
|
231
|
-
- `
|
|
231
|
+
- `csp.md` — the CSP election type. `removed-features.md` — the dropped anonymous election type.
|
|
@@ -8,17 +8,17 @@ Companion to the [[vocdoni-sdk]] skill. Use this when debugging a thrown error o
|
|
|
8
8
|
| ------------------------------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
9
9
|
| `No wallet set` | You called a method that signs, but `client.wallet` is null. | Set `client.wallet = …` or pass `{ wallet }` in the options object. |
|
|
10
10
|
| `No election set` | Voting/inspection method without `electionId`. | Call `client.setElectionId(id)` or pass `{ electionId }`. |
|
|
11
|
-
| `No URL set` | API base URL is missing — `env` and `api_url` both unset (rare). | Pass `env: EnvOptions.
|
|
11
|
+
| `No URL set` | API base URL is missing — `env` and `api_url` both unset (rare). | Pass `env: EnvOptions.DEV` (or whichever) to the constructor. |
|
|
12
12
|
| `Account is archived` | `fetchAccount(address)` on an archived account. | Use `fetchAccountInfo` instead (returns archived accounts too). |
|
|
13
|
-
| `Invalid faucet package` | Passed a malformed string to `createAccount({ faucetPackage })`. | Re-fetch the base64; verify with `parseFaucetPackage`. |
|
|
14
13
|
|
|
15
14
|
## Account errors
|
|
16
15
|
|
|
17
16
|
| Symptom | Likely cause | Fix |
|
|
18
17
|
| --------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
19
|
-
| `
|
|
20
|
-
|
|
|
21
|
-
| `
|
|
18
|
+
| `Invalid faucet package` | `faucetPackage` is not base64 of the JSON `{ "faucetPayload", "signature" }`, e.g. the base64 of the raw protobuf. | Re-fetch the package, or wrap it as `accounts.md` shows; verify with `parseFaucetPackage`. |
|
|
19
|
+
| balance too low to create elections on PROD | On PROD the faucet hands out only a small package. | Pass a `faucetPackage` signed by a funded account. |
|
|
20
|
+
| `collectFaucetTokens` rejects | Already funded. | Skip if `balance > 0`. |
|
|
21
|
+
| `Time out waiting for transaction: …` during `createAccount` | Wallet not funded, or chain congested. | Retry; bump `tx_wait.attempts`. |
|
|
22
22
|
|
|
23
23
|
## Election creation errors
|
|
24
24
|
|
|
@@ -30,19 +30,18 @@ Companion to the [[vocdoni-sdk]] skill. Use this when debugging a thrown error o
|
|
|
30
30
|
| `maxCensusSize must be greater than 0` | `maxCensusSize: 0` literally. | Set to `census.size`, omit, or ≥ 1. |
|
|
31
31
|
| `This type of election can only have one question` | Called `addQuestion` more than once on an Approval/MultiChoice/Budget/Quadratic election. | Add a single question; use base `Election` for multi-question polls. |
|
|
32
32
|
| `meta key "sdk" is reserved` | You tried to put `meta: { sdk: … }`. | Use a different key; `sdk` is auto-populated unless `addSDKVersion: false`. |
|
|
33
|
-
| Insufficient balance for election | `client.estimateElectionCost(election) > account.balance`. | Top up via faucet or
|
|
33
|
+
| Insufficient balance for election | `client.estimateElectionCost(election) > account.balance`. | Top up via the DEV faucet or a `faucetPackage` from a funded account; reduce `maxCensusSize`/duration. |
|
|
34
34
|
| `Time out waiting for transaction: …` during create | Chain accepting the tx slow; or wallet not funded; or someone else won the nonce race. | Retry; bump `tx_wait.attempts`; for many-elections-in-a-row, serialise. |
|
|
35
35
|
|
|
36
36
|
## Voting errors
|
|
37
37
|
|
|
38
38
|
| Symptom | Likely cause | Fix |
|
|
39
39
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
40
|
-
| Vote rejected with "not in census" | `client.wallet.address` is not in the census
|
|
40
|
+
| Vote rejected with "not in census" | `client.wallet.address` is not in the census. | `await client.isInCensus()` first. |
|
|
41
41
|
| Vote rejected with "election not ready" | Election is not yet `ONGOING`; you submitted too fast after `createElection`. | Poll `fetchElection(id).status` until `ONGOING` (block time ~10–13 s; budget ~30 s after create). |
|
|
42
42
|
| `Invalid vote` from `checkVote` | Vote shape doesn't match election type (length, value range, uniqueness, cost cap). | Read `election-types.md` for the variant's shape; call `publishedElection.checkVote(vote)` first. |
|
|
43
|
+
| `Memo cannot be longer than 256 bytes` | Vote memo is over 256 UTF-8 bytes. | Shorten it. Memos are public, even on `secretUntilTheEnd` elections. |
|
|
43
44
|
| `Vote already submitted` | `maxVoteOverwrites` exhausted. | Check `votesLeftCount` first; raise `maxVoteOverwrites` if you want changeable votes. |
|
|
44
|
-
| `hasAlreadyVoted` always returns `null` on anonymous | Anonymous vote IDs are not deterministic — SDK can't recompute without the signature. | Save `voteId` returned by `submitVote`; pass it as `{ voteId }`. |
|
|
45
|
-
| Anonymous vote fails with no SIK | Voter never registered a SIK on this chain, or used a different password. | `createAccount({ sik: true, password })` once per voter; use the same password at vote time. |
|
|
46
45
|
|
|
47
46
|
## Census creation / publishing errors
|
|
48
47
|
|
|
@@ -53,16 +52,6 @@ Companion to the [[vocdoni-sdk]] skill. Use this when debugging a thrown error o
|
|
|
53
52
|
| `weight` validation fails | Passed a `number` instead of `bigint`. | Use `BigInt(123)` or `123n`. |
|
|
54
53
|
| `fetchProof` throws "not found" | Address not in census; or census not yet published. | Add address before publishing; await publish completion. |
|
|
55
54
|
|
|
56
|
-
## Census3 errors
|
|
57
|
-
|
|
58
|
-
| Symptom | Likely cause | Fix |
|
|
59
|
-
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
60
|
-
| `Token is not yet synced` | `createTokenCensus` before `getToken(...).status.synced` is true. | Poll `getToken` and wait. |
|
|
61
|
-
| `ErrInvalidStrategyPredicate` | Predicate string doesn't parse. | Use `validatePredicate(p)` to debug; check operator spelling (`AND`, not `&&`). |
|
|
62
|
-
| `ErrNoStrategyHolders` | The predicate matches zero addresses. | Relax `minBalance`, broaden tokens. |
|
|
63
|
-
| `Time out waiting for queue with id: …` | Large census creation exceeded `tx_wait.attempts`. | Bump `tx_wait.attempts` to 20+ in client constructor. |
|
|
64
|
-
| `ErrChainIDNotSupported` | Used a chain not in `getSupportedChains()`. | Check support; some chains exist on PROD but not DEV/STG and vice versa. |
|
|
65
|
-
|
|
66
55
|
## Status / fetching errors
|
|
67
56
|
|
|
68
57
|
| Symptom | Likely cause | Fix |
|
|
@@ -77,7 +66,22 @@ Companion to the [[vocdoni-sdk]] skill. Use this when debugging a thrown error o
|
|
|
77
66
|
| ---------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
|
|
78
67
|
| `cspStep` 4xx / 5xx | CSP refuses; the auth payload was wrong. | Read the CSP's docs; check `cspInfo()` for required schema. |
|
|
79
68
|
| Vote rejected with "invalid signature" | `CspCensus.publicKey` doesn't match what the CSP signed with. | Re-confirm the public key; rebuild the election. |
|
|
69
|
+
| Votes fail signature verification on an election built with SDK 0.10.0 | The CSP signs with the legacy salt (a `vocdoni/blind-csp` release older than v0.2.0, or a custom CSP), or signed a different weight than the vote carries (blind-csp always signs weight 1). | Upgrade the CSP to derive the V2 salt (`blind-csp` v0.2.0 or later), and pass a weight only if the CSP authorised it. Pinning `@vocdoni/sdk` 0.9.x does not repair an existing election and affects only elections created afterwards, and only for non-sensitive, unweighted elections; it has a security caveat (`removed-features.md#csp-salt-blind-csp`). |
|
|
80
70
|
| `cspSign` throws on later election | Token expired or already used. | Re-run the full auth flow. |
|
|
71
|
+
| `Invalid CSP signature: expected a hex string; pass the object returned by cspSign to cspVote instead` | `cspSign` result passed to `new CspVote`. | Pass the object to `client.cspVote`, or pass `.signature` to `new CspVote`. |
|
|
72
|
+
| `Invalid CSP signature: expected a hex string or the object returned by cspSign` | `client.cspVote` got an object without a string `signature`. | Pass the `cspSign` result unchanged, or a `{ signature, weight }` with a hex string. |
|
|
73
|
+
| `Vote weight (X) does not match the weight signed by the CSP (Y)` | `cspVote` got a weight other than the one `cspSign` signed. | Pass the same weight to both, or omit it from `cspVote` to reuse the signed weight. |
|
|
74
|
+
| `Vote weight must be an integer in the range [1, 2^160)` | Weight is 0, negative, fractional or too large. | Use a bigint in [1, 2^160). An explicit `0n` throws too. |
|
|
75
|
+
|
|
76
|
+
## Removed by the chain or the SaaS
|
|
77
|
+
|
|
78
|
+
| Symptom | Likely cause | Fix |
|
|
79
|
+
| ----------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
|
80
|
+
| `endpoint removed: <METHOD> <path>: <reason>` (code 4067) | Old SDK calling a route the chain dropped. | Upgrade to `@vocdoni/sdk` 0.10.0; `removed-features.md` names the replacement. |
|
|
81
|
+
| `anonymous process not supported`; HTTP 410 on `POST /censuses/zkweighted` | `electionType.anonymous = true`. | Drop the flag. See `removed-features.md`. |
|
|
82
|
+
| `VocdoniCensus3Client` call fails with HTTP 404 (PROD) or a DNS `ENOTFOUND` error (DEV/STG) | Census3 is shut down. | Build a `WeightedCensus` from a snapshot of the holders, with bigint weights (`removed-features.md`). |
|
|
83
|
+
| Signing calls fail against the Vocdoni SaaS (`RemoteSigner`) | The SaaS removed `/transactions*` in October 2026. | Sign with a local `Wallet`, or run your own signer service. |
|
|
84
|
+
| TLS handshake error from `api-stg.faucet.vocdoni.net` | The STG faucet fails its TLS handshake. | Use `EnvOptions.DEV` or a `faucetPackage`; see `removed-features.md`. |
|
|
81
85
|
|
|
82
86
|
## General debugging checklist
|
|
83
87
|
|
|
@@ -95,6 +99,5 @@ Companion to the [[vocdoni-sdk]] skill. Use this when debugging a thrown error o
|
|
|
95
99
|
- `accounts.md` — faucet, balance.
|
|
96
100
|
- `elections.md`, `election-types.md` — election shape.
|
|
97
101
|
- `voting.md` — the check methods listed above.
|
|
98
|
-
- `anonymous.md` — SIK and password specifics.
|
|
99
102
|
- `csp.md` — CSP-specific failure modes.
|
|
100
|
-
- `
|
|
103
|
+
- `removed-features.md` — dropped features (anonymous voting, Census3, SIKs, `RemoteSigner` against the SaaS).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# `references/removed-features.md` — SDK features the chain or the SaaS dropped
|
|
2
|
+
|
|
3
|
+
Companion to the [[vocdoni-sdk]] skill. Use this when old `@vocdoni/sdk` code calls something the chain or the SaaS dropped.
|
|
4
|
+
|
|
5
|
+
The chain is now [[vocdoni-sequencer]]. A removed route answers HTTP 410 with API code 4067 and the message `endpoint removed: <METHOD> <path>: <reason>`. The full route list lives in [[vocdoni-sequencer]]'s `references/removed-routes.md`; do not copy it here.
|
|
6
|
+
|
|
7
|
+
| SDK API | Symptom | Section |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `electionType: { anonymous: true }` | census publish returns 410 | [Anonymous election flag](#anonymous-election-flag) |
|
|
10
|
+
| `AnonymousVote`, circuits, SIK and ZK services | `/siks/*` or `/chain/info/circuit` return 410 | [Anonymous voting classes](#anonymous-voting-classes) |
|
|
11
|
+
| `sik`, `password`, `temporarySecretIdentity` | silently ignored | [SIK options](#sik-options) |
|
|
12
|
+
| `VocdoniCensus3Client`, `TokenCensus`, `StrategyCensus` | every Census3 call fails (HTTP 404 on PROD, DNS error on DEV/STG) | [Census3](#census3) |
|
|
13
|
+
| `RemoteSigner` against the SaaS | signing fails | [RemoteSigner](#remotesigner) |
|
|
14
|
+
| `@vocdoni/sdk` 0.8.3 and older | paginated or count calls return 410 | [Old SDK and upgrading to 0.10.0](#old-sdk-and-upgrading-to-0100) |
|
|
15
|
+
| `EnvOptions.STG` faucet | Can fail its TLS handshake | [STG faucet](#stg-faucet) |
|
|
16
|
+
| CSP elections on 0.10.0 with `blind-csp` older than v0.2.0 | votes fail signature verification | [CSP salt (blind-csp)](#csp-salt-blind-csp) |
|
|
17
|
+
|
|
18
|
+
## Anonymous election flag
|
|
19
|
+
|
|
20
|
+
**`electionType: { anonymous: true }`** with `createElection`
|
|
21
|
+
|
|
22
|
+
**What happens now:** the census publish to `POST /censuses/zkweighted` returns 410. A pre-published anonymous census is rejected with `anonymous process not supported`.
|
|
23
|
+
|
|
24
|
+
**Do instead:**
|
|
25
|
+
|
|
26
|
+
- Drop the flag.
|
|
27
|
+
- For voter privacy, use a `CspCensus` with blind signatures (`csp.md`). This is what the Vocdoni SaaS calls anonymous voting.
|
|
28
|
+
- To hide ballots until the end, add `secretUntilTheEnd`.
|
|
29
|
+
- For ZK voting, use [[davinci-sdk]].
|
|
30
|
+
|
|
31
|
+
## Anonymous voting classes
|
|
32
|
+
|
|
33
|
+
**`AnonymousVote`, `client.fetchCircuits()` / `setCircuits()`, `anonymousService.fetchAccountSIK()` / `hasRegisteredSIK()` / `fetchZKProof()`, `CensusType.ANONYMOUS`**
|
|
34
|
+
|
|
35
|
+
**What happens now:** these call `/chain/info/circuit` or `/siks/*`, which answer 410. `submitVote` on an anonymous election fails the same way.
|
|
36
|
+
|
|
37
|
+
**Do instead:** delete the code paths. Use the CSP flow in `csp.md`.
|
|
38
|
+
|
|
39
|
+
## SIK options
|
|
40
|
+
|
|
41
|
+
**`createAccount({ sik, password })`, `AccountData.sik`, `Election.from({ temporarySecretIdentity })`**
|
|
42
|
+
|
|
43
|
+
**What happens now:** no-ops. The chain ignores `tx.SIK`, the account JSON has no `sik` field, and `tempSIKs` is never read. `createAccount()` still spends one extra wallet signature and a Poseidon hash on the SIK.
|
|
44
|
+
|
|
45
|
+
**Do instead:** pass `createAccount({ sik: false })` to skip the signature, and remove the other options. The next `@vocdoni/sdk` release drops the `sik` option; remove the argument when you upgrade past 0.10.0.
|
|
46
|
+
|
|
47
|
+
## Census3
|
|
48
|
+
|
|
49
|
+
**`VocdoniCensus3Client`, `TokenCensus`, `StrategyCensus`**
|
|
50
|
+
|
|
51
|
+
**What happens now:** Census3 is shut down. Every `VocdoniCensus3Client` call fails: PROD (`census3.vocdoni.io`) answers HTTP 404, and the DEV and STG Census3 hosts do not resolve (DNS error). The chain does not reject these censuses: `TokenCensus` and `StrategyCensus` publish as `CensusType.WEIGHTED` (origin `OFF_CHAIN_TREE_WEIGHTED`), which it accepts. The failure is the Census3 call that feeds them.
|
|
52
|
+
|
|
53
|
+
**Do instead:** snapshot the holders yourself (indexer, explorer or RPC) and build a `WeightedCensus` with the balances as `bigint` weights.
|
|
54
|
+
|
|
55
|
+
## RemoteSigner
|
|
56
|
+
|
|
57
|
+
**`RemoteSigner` against the Vocdoni SaaS**
|
|
58
|
+
|
|
59
|
+
**What happens now:** `/auth/login` and `/auth/refresh` still work, but saas-backend removed `/transactions` and `/transactions/message` in October 2026, so signing fails.
|
|
60
|
+
|
|
61
|
+
**Do instead:**
|
|
62
|
+
|
|
63
|
+
- Sign with a local `Wallet`.
|
|
64
|
+
- Or move to [[vocdoni-integrator-sdk]], which talks to the SaaS API.
|
|
65
|
+
- `RemoteSigner` works only against a self-hosted service that implements the five routes it calls: `/auth/login`, `/auth/refresh`, `/auth/addresses`, `/transactions`, `/transactions/message`.
|
|
66
|
+
|
|
67
|
+
## Old SDK and upgrading to 0.10.0
|
|
68
|
+
|
|
69
|
+
**`@vocdoni/sdk` 0.8.3 and older on paginated or count calls** (`/accounts/page/…`, `/elections/{id}/votes/count`, …)
|
|
70
|
+
|
|
71
|
+
**What happens now:** 410 with code 4067.
|
|
72
|
+
|
|
73
|
+
**Do instead:** upgrade to `@vocdoni/sdk` 0.10.0. When you upgrade, also check:
|
|
74
|
+
|
|
75
|
+
- Code that used the `cspSign` result as a string must pass the object to `cspVote`, or read `.signature` from it. `new CspVote` still takes the string.
|
|
76
|
+
- An explicit weight of `0n` now throws. Omit the weight to reuse the one the CSP signed.
|
|
77
|
+
- CSP elections now publish as `OFF_CHAIN_CA_V2`, so the CSP must derive the V2 salt: use `vocdoni/blind-csp` v0.2.0 or later. See [CSP salt (blind-csp)](#csp-salt-blind-csp).
|
|
78
|
+
- Details and examples are in `csp.md`.
|
|
79
|
+
|
|
80
|
+
## STG faucet
|
|
81
|
+
|
|
82
|
+
**`EnvOptions.STG` with `createAccount()` and no `faucetPackage`**
|
|
83
|
+
|
|
84
|
+
**What happens now:** the STG faucet (`api-stg.faucet.vocdoni.net`) can fail its TLS handshake. When it works, STG needs no special handling.
|
|
85
|
+
|
|
86
|
+
**Do instead:** if the STG faucet fails (for example a TLS handshake error from `api-stg.faucet.vocdoni.net`), use `EnvOptions.DEV` for testing, or pass a `faucetPackage` signed by a funded account.
|
|
87
|
+
|
|
88
|
+
## CSP salt (blind-csp)
|
|
89
|
+
|
|
90
|
+
**CSP elections created with `@vocdoni/sdk` 0.10.0 against `vocdoni/blind-csp` older than v0.2.0**
|
|
91
|
+
|
|
92
|
+
**What happens now:** 0.10.0 publishes CSP censuses as `OFF_CHAIN_CA_V2`, which is verified with the V2 salt. `blind-csp` releases before v0.2.0 sign with the legacy salt, so votes fail signature verification.
|
|
93
|
+
|
|
94
|
+
**Do instead:**
|
|
95
|
+
|
|
96
|
+
- Upgrade `blind-csp` to v0.2.0 or later. It derives the V2 salt for these elections, but signs weight 1 for every voter, so it serves unweighted votes only.
|
|
97
|
+
- For weighted votes, `@vocdoni/sdk` needs a CSP that implements the blind-csp API and signs per-voter weights with the V2 salt. The Vocdoni SaaS CSP signs weights but is reached through [[vocdoni-integrator-sdk]], not this SDK (see `csp.md`).
|
|
98
|
+
- Last resort, for a CSP you cannot upgrade: pin `@vocdoni/sdk` 0.9.x, only for non-sensitive, unweighted elections. It creates legacy `OFF_CHAIN_CA` elections, which the chain accepts with a deprecation warning and plans to reject. Their salt is `processID[:20]` (chain ID plus organisation address prefix), shared by every election of the organisation, so a blind signature for one election also verifies on the others, and the salt does not bind the vote weight.
|
|
@@ -142,4 +142,3 @@ await waitFor(electionId, ElectionStatus.RESULTS);
|
|
|
142
142
|
|
|
143
143
|
- `elections.md` — election creation, status transitions, lifecycle methods.
|
|
144
144
|
- `voting.md` — submitting votes that contribute to these tallies.
|
|
145
|
-
- `anonymous.md` — special caveat: vote IDs are not deterministic, pass `voteId` to check methods.
|
|
@@ -17,7 +17,7 @@ const voteId = await client.submitVote(vote);
|
|
|
17
17
|
console.log(`${client.explorerUrl}/verify/#/${voteId}`);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
`submitVote` returns the vote ID
|
|
20
|
+
`submitVote` returns the vote ID. You can hand it to the voter to look up their receipt.
|
|
21
21
|
|
|
22
22
|
## Vote shape
|
|
23
23
|
|
|
@@ -67,12 +67,6 @@ const previousVoteId = await client.hasAlreadyVoted();
|
|
|
67
67
|
// returns the vote ID (string) if they voted, or null otherwise
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
For anonymous elections, you must pass `voteId` (the SDK can't derive it deterministically):
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
await client.hasAlreadyVoted({ voteId: '<known vote id>' });
|
|
74
|
-
```
|
|
75
|
-
|
|
76
70
|
## How many times can they still vote?
|
|
77
71
|
|
|
78
72
|
If the election allows overwrites (`voteType.maxVoteOverwrites > 0`), each address can resubmit up to that many additional times. To check:
|
|
@@ -84,8 +78,6 @@ const remaining = await client.votesLeftCount();
|
|
|
84
78
|
const canVote = await client.isAbleToVote(); // sugar: votesLeftCount() > 0
|
|
85
79
|
```
|
|
86
80
|
|
|
87
|
-
For anonymous elections, again pass `voteId`.
|
|
88
|
-
|
|
89
81
|
## `submitVote` — step-by-step
|
|
90
82
|
|
|
91
83
|
When you need progress (UI spinners, telemetry), use the async-generator variant:
|
|
@@ -94,9 +86,7 @@ When you need progress (UI spinners, telemetry), use the async-generator variant
|
|
|
94
86
|
for await (const step of client.submitVoteSteps(vote)) {
|
|
95
87
|
switch (step.key) {
|
|
96
88
|
case 'get-election': /* fetched election metadata */ break;
|
|
97
|
-
case 'get-proof': /* census proof fetched */ break;
|
|
98
|
-
case 'get-signature': /* CSP/anon signature obtained */ break;
|
|
99
|
-
case 'calc-zk-proof': /* ZK proof generated (anonymous only) */ break;
|
|
89
|
+
case 'get-proof': /* census proof fetched, or CSP signature attached to the vote */ break;
|
|
100
90
|
case 'generate-tx': /* tx built */ break;
|
|
101
91
|
case 'sign-tx': /* tx signed */ break;
|
|
102
92
|
case 'done': console.log('voteId', step.voteId); break;
|
|
@@ -109,41 +99,47 @@ for await (const step of client.submitVoteSteps(vote)) {
|
|
|
109
99
|
### `Vote` — standard ballot
|
|
110
100
|
|
|
111
101
|
```ts
|
|
112
|
-
new Vote(votes: Array<number | bigint
|
|
102
|
+
new Vote(votes: Array<number | bigint>, memo?: string);
|
|
113
103
|
```
|
|
114
104
|
|
|
115
|
-
For all non-
|
|
105
|
+
For all non-CSP elections.
|
|
116
106
|
|
|
117
|
-
###
|
|
107
|
+
### Vote memo (0.10.0)
|
|
118
108
|
|
|
119
109
|
```ts
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const vote = new AnonymousVote(
|
|
123
|
-
[0], // votes
|
|
124
|
-
undefined, // signature — optional; SDK can generate from client.wallet
|
|
125
|
-
'mypassword', // password used to derive the SIK; default '0'
|
|
126
|
-
);
|
|
110
|
+
const vote = new Vote([0], 'optional note');
|
|
111
|
+
vote.memo = 'or set it later';
|
|
127
112
|
```
|
|
128
113
|
|
|
129
|
-
|
|
114
|
+
- Max 256 UTF-8 bytes. Longer throws `Memo cannot be longer than 256 bytes`. An empty memo is omitted.
|
|
115
|
+
- The chain stores the memo verbatim and serves it in the clear, even on `secretUntilTheEnd` elections. Do not put anything secret in it.
|
|
116
|
+
- The SDK's vote-info types don't expose it. Read it from the raw API: `GET ${client.url}/votes/${voteId}`, field `memo` (base64).
|
|
117
|
+
- `cspVote` copies the memo of the `Vote` it wraps.
|
|
118
|
+
|
|
119
|
+
`AnonymousVote` still exists in the SDK, but the chain rejects anonymous elections, see `removed-features.md`.
|
|
130
120
|
|
|
131
121
|
### `CspVote` — blind-signature ballot
|
|
132
122
|
|
|
133
123
|
```ts
|
|
134
|
-
import { CspVote } from '@vocdoni/sdk';
|
|
124
|
+
import { CspProofType, CspVote, Vote } from '@vocdoni/sdk';
|
|
125
|
+
|
|
126
|
+
const sig = await client.cspSign(voterAddress, token); // { signature, weight }
|
|
127
|
+
|
|
128
|
+
// Normal path: pass the cspSign result straight to cspVote.
|
|
129
|
+
const vote = client.cspVote(new Vote([0]), sig);
|
|
135
130
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
// Direct constructor: takes the hex string, not the cspSign object.
|
|
132
|
+
const directVote = new CspVote(
|
|
133
|
+
[0], // votes
|
|
134
|
+
sig.signature, // required: string
|
|
135
|
+
CspProofType.ECDSA_BLIND_PIDSALTED, // optional; SDK default
|
|
136
|
+
/* weight? */ sig.weight, // must match the weight the CSP signed
|
|
141
137
|
);
|
|
142
138
|
```
|
|
143
139
|
|
|
144
140
|
The full CSP flow is in `csp.md`.
|
|
145
141
|
|
|
146
|
-
`submitVote` accepts
|
|
142
|
+
`submitVote` accepts `Vote` and `CspVote` transparently — it dispatches to the right proof generator based on the election's census type.
|
|
147
143
|
|
|
148
144
|
## Defaulting to the client's stored state
|
|
149
145
|
|
|
@@ -163,8 +159,8 @@ If you call them without setting `electionId` (and without an `electionId` optio
|
|
|
163
159
|
## Pattern: vote with a different wallet on the same client
|
|
164
160
|
|
|
165
161
|
```ts
|
|
166
|
-
const client = new VocdoniSDKClient({ env: EnvOptions.
|
|
167
|
-
await client.createAccount();
|
|
162
|
+
const client = new VocdoniSDKClient({ env: EnvOptions.DEV, wallet: creator });
|
|
163
|
+
await client.createAccount({ sik: false });
|
|
168
164
|
// … create election …
|
|
169
165
|
client.setElectionId(electionId);
|
|
170
166
|
|
|
@@ -184,7 +180,7 @@ import { Wallet } from '@ethersproject/wallet';
|
|
|
184
180
|
import { EnvOptions, VocdoniSDKClient, Vote } from '@vocdoni/sdk';
|
|
185
181
|
|
|
186
182
|
await Promise.all(voters.map((voter) => {
|
|
187
|
-
const c = new VocdoniSDKClient({ env: EnvOptions.
|
|
183
|
+
const c = new VocdoniSDKClient({ env: EnvOptions.DEV, wallet: voter, electionId });
|
|
188
184
|
return c.submitVote(new Vote([Math.round(Math.random())]));
|
|
189
185
|
}));
|
|
190
186
|
```
|
|
@@ -206,4 +202,4 @@ Each `submitVote` fetches its own proof and signs independently; no shared state
|
|
|
206
202
|
|
|
207
203
|
- `elections.md` and `election-types.md` — vote shape per election kind.
|
|
208
204
|
- `results.md` — read back vote counts, status.
|
|
209
|
-
- `
|
|
205
|
+
- `csp.md` — the CSP flow for `CspVote`. `removed-features.md` — why `AnonymousVote` no longer works.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vocdoni-sequencer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reference skill for vocdoni-sequencer (voconed), the minimal single-node Vochain that replaced vocdoni-node behind the Vocdoni SaaS API: what changed for consumers of the /v2 API (removed routes, no anonymous voting or Census3, ballots validated at submission), running it locally with Postgres, and how it differs from the Davinci sequencer.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Vocdoni",
|
|
7
|
+
"url": "https://vocdoni.io"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/vocdoni/skills",
|
|
10
|
+
"repository": "https://github.com/vocdoni/skills",
|
|
11
|
+
"license": "AGPL-3.0-or-later",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"claude-code",
|
|
14
|
+
"skills",
|
|
15
|
+
"vocdoni",
|
|
16
|
+
"vochain",
|
|
17
|
+
"voconed",
|
|
18
|
+
"sequencer",
|
|
19
|
+
"blockchain"
|
|
20
|
+
]
|
|
21
|
+
}
|