hyper-multisig-cli 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/bin.js +15 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -173,3 +173,15 @@ Do as the logs instruct, and add your target key to 2 or more seeders. For this
|
|
|
173
173
|
Once the program detects at least 2 seeders have fully downloaded the multisig drive, it will inform you it is done. Shut down with ctrl-c.
|
|
174
174
|
|
|
175
175
|
Note: for any future updates to your multisig core, remove the `first-commit` flag.
|
|
176
|
+
|
|
177
|
+
## Recovering From Incompletely Seeded Commit (Advanced)
|
|
178
|
+
|
|
179
|
+
If the committer's process ends prematurely, after committing but before the commit got fully seeded, the multisig drive ends up in an incomplete state: the swarm knows its length has been updated, but does not have all new blocks.
|
|
180
|
+
|
|
181
|
+
Re-committing will trigger a 'TARGET_CORE_NOT_FULLY_SEEDED' error, which needs to be skipped for this recovery. But no other checks should be skipped.
|
|
182
|
+
|
|
183
|
+
Use the `--skip-target-well-seeded` flag to re-commit the drive. Note: re-committing is also possible from another machine.
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
hyper-multisig commit --skip-target-well-seeded ...
|
|
187
|
+
```
|
package/bin.js
CHANGED
|
@@ -42,10 +42,12 @@ const cmdVerify = command(
|
|
|
42
42
|
const cmdCommit = command(
|
|
43
43
|
'commit',
|
|
44
44
|
description('Commit multisig'),
|
|
45
|
+
flag('--swarm-client-only', 'Swarm in client mode only'),
|
|
45
46
|
flag(
|
|
46
47
|
'--first-commit',
|
|
47
48
|
'Set when this is the first commit to the multisig target, so it skips those checks'
|
|
48
49
|
),
|
|
50
|
+
flag('--skip-target-well-seeded', 'Skip checking multisig target is well seeded'),
|
|
49
51
|
flag('--force-dangerous', 'Advanced option, it might break the core on misuse'),
|
|
50
52
|
flag('--peer-update-timeout <ms>', 'Peer update timeout in ms'),
|
|
51
53
|
arg('request', 'Signing request'),
|
|
@@ -165,7 +167,7 @@ async function verify() {
|
|
|
165
167
|
quorum
|
|
166
168
|
})
|
|
167
169
|
}
|
|
168
|
-
setupProgressLogs(runner, type, firstCommit)
|
|
170
|
+
setupProgressLogs(runner, type, firstCommit, true)
|
|
169
171
|
|
|
170
172
|
const res = await runner.done()
|
|
171
173
|
|
|
@@ -178,7 +180,9 @@ async function verify() {
|
|
|
178
180
|
async function commit() {
|
|
179
181
|
const request = cmdCommit.args.request
|
|
180
182
|
const responses = cmdCommit.rest || []
|
|
181
|
-
const { firstCommit, forceDangerous, peerUpdateTimeout } =
|
|
183
|
+
const { swarmClientOnly, firstCommit, skipTargetWellSeeded, forceDangerous, peerUpdateTimeout } =
|
|
184
|
+
cmdCommit.flags
|
|
185
|
+
|
|
182
186
|
if (!request || !responses?.length) throw new Error('Invalid command')
|
|
183
187
|
|
|
184
188
|
console.info(`Committing request ${request}`)
|
|
@@ -191,7 +195,9 @@ async function commit() {
|
|
|
191
195
|
if (type === 'core') {
|
|
192
196
|
const srcCore = store.get({ key: idEnc.decode(srcKey) })
|
|
193
197
|
runner = multisig.commitCore(publicKeys, namespace, srcCore, request, responses, {
|
|
198
|
+
swarmAsServer: !swarmClientOnly,
|
|
194
199
|
skipTargetChecks: firstCommit,
|
|
200
|
+
skipTargetWellSeeded,
|
|
195
201
|
force: forceDangerous,
|
|
196
202
|
peerUpdateTimeout: peerUpdateTimeout,
|
|
197
203
|
quorum
|
|
@@ -199,13 +205,15 @@ async function commit() {
|
|
|
199
205
|
} else {
|
|
200
206
|
const srcDrive = new Hyperdrive(store, idEnc.decode(srcKey))
|
|
201
207
|
runner = multisig.commitDrive(publicKeys, namespace, srcDrive, request, responses, {
|
|
208
|
+
swarmAsServer: !swarmClientOnly,
|
|
202
209
|
skipTargetChecks: firstCommit,
|
|
210
|
+
skipTargetWellSeeded,
|
|
203
211
|
force: forceDangerous,
|
|
204
212
|
peerUpdateTimeout: peerUpdateTimeout,
|
|
205
213
|
quorum
|
|
206
214
|
})
|
|
207
215
|
}
|
|
208
|
-
setupProgressLogs(runner, type, firstCommit)
|
|
216
|
+
setupProgressLogs(runner, type, firstCommit, false)
|
|
209
217
|
|
|
210
218
|
const res = await runner.done()
|
|
211
219
|
|
|
@@ -301,14 +309,14 @@ async function seed() {
|
|
|
301
309
|
goodbye(() => clearInterval(interval))
|
|
302
310
|
}
|
|
303
311
|
|
|
304
|
-
function setupProgressLogs(req, name, firstCommit) {
|
|
312
|
+
function setupProgressLogs(req, name, firstCommit, dryRun) {
|
|
305
313
|
req.on('verify-committable-start', (srcKey, tgtKey) => {
|
|
306
314
|
console.log(
|
|
307
315
|
`Verifying the ${name} is safe to commit: source ${idEnc.normalize(srcKey)} (hex: ${srcKey.toString('hex')}) to multisig target ${idEnc.normalize(tgtKey)} (hex: ${tgtKey.toString('hex')})`
|
|
308
316
|
)
|
|
309
317
|
})
|
|
310
318
|
req.on('commit-start', () => {
|
|
311
|
-
console.log(`Committing the ${name}...`)
|
|
319
|
+
console.log(dryRun ? `Dry run the ${name} commit` : `Committing the ${name}...`)
|
|
312
320
|
})
|
|
313
321
|
req.on('verify-committed-start', (key) => {
|
|
314
322
|
console.log(`Committed the ${name}, key ${idEnc.normalize(key)} (hex: ${key.toString('hex')})`)
|
|
@@ -328,7 +336,8 @@ function printRequest(request) {
|
|
|
328
336
|
key: runner.id,
|
|
329
337
|
keyHex: runner.key.toString('hex'),
|
|
330
338
|
length: runner.length,
|
|
331
|
-
treeHash: idEnc.normalize(runner.treeHash)
|
|
339
|
+
treeHash: idEnc.normalize(runner.treeHash),
|
|
340
|
+
treeHashHex: runner.treeHash.toString('hex')
|
|
332
341
|
}
|
|
333
342
|
console.log('Request:', JSON.stringify(reqMsg, null, 2))
|
|
334
343
|
console.log('To sign, run:', `\nhypercore-sign ${reqStr}`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyper-multisig-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "CLI of hyper-multisig",
|
|
5
5
|
"main": "bin.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"bare-fs": "^4.5.4",
|
|
22
22
|
"corestore": "^7.8.0",
|
|
23
23
|
"graceful-goodbye": "^1.3.3",
|
|
24
|
-
"hyper-multisig": "^2.
|
|
24
|
+
"hyper-multisig": "^2.3.0",
|
|
25
25
|
"hypercore-id-encoding": "^1.3.0",
|
|
26
26
|
"hypercore-signing-request": "^5.0.1",
|
|
27
27
|
"hyperdrive": "^13.2.1",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"bare-subprocess": "^5.2.2",
|
|
37
37
|
"brittle": "^3.19.1",
|
|
38
38
|
"hypercore-crypto": "^3.6.1",
|
|
39
|
-
"hypercore-sign": "^
|
|
39
|
+
"hypercore-sign-lib": "^1.1.0",
|
|
40
40
|
"hyperdht": "^6.29.0",
|
|
41
41
|
"lunte": "^1.6.0",
|
|
42
42
|
"newline-decoder": "^1.0.2",
|