You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/0000-arbitrary-multisig/0000-arbitrary-multisig.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -238,7 +238,7 @@ Before executing spawn syscall, the root script must create 2 pipes via [pipe](h
238
238
239
239
In spawn syscall, the root script must pass `root_to_leaf_pipe[0]` and `leaf_to_root_pipe[1]` in this exact order to the invoked leaf script. The leaf script uses [Inherited File Descriptors](https://github.com/nervosnetwork/rfcs/blob/bd5d3ff73969bdd2571f804260a538781b45e996/rfcs/0050-vm-syscalls-3/0050-vm-syscalls-3.md#inherited-file-descriptors) syscall to gather 2 file descriptors for the leaf script to use.
240
240
241
-
When the spawn syscall succeeds, the root script would continuously send signature data packet via `root_to_leaf_pipe[1]` to the leaf script. The leaf script loops to read such packets from `root_to_leaf_pipe[0]`. Right now, 2 formats exist for verification:
241
+
When the spawn syscall succeeds, the root script would continuously send certain packets described below via `root_to_leaf_pipe[1]` to the leaf script. The leaf script loops to read such packets from `root_to_leaf_pipe[0]`. Right now, 2 formats exist for verification:
242
242
243
243
### Signature Packet Format 1
244
244
@@ -274,7 +274,7 @@ If all verification work succeeds, the leaf script sends the following response
274
274
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
275
275
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
276
276
277
-
The leaf script then waits to read more packets for verification from `root_to_leaf_pipe[0]`. There is no situation when a leaf script terminates with a success exit code. We rely on CKB's behavior that when the root VM terminates, all the child VMs also terminate.
277
+
The leaf script then waits to read more packets for verification from `root_to_leaf_pipe[0]`.
278
278
279
279
### Signature Packet Format 2
280
280
@@ -313,10 +313,22 @@ If all verification work succeeds, the leaf script sends the following response
313
313
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
314
314
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
315
315
316
-
The leaf script then waits to read more packets for verification from `root_to_leaf_pipe[0]`. There is no situation when a leaf script terminates with a success exit code. We rely on CKB's behavior that when the root VM terminates, all the child VMs also terminate.
316
+
The leaf script then waits to read more packets for verification from `root_to_leaf_pipe[0]`.
317
317
318
318
This signature packet format is in fact designed for `ALGO_ID` of `63`, when an arbitrary script is loaded for signature verification. Signature packet format 2 can be used to exchange signatures to valid between root script and the arbitrary leaf script.
319
319
320
+
### Terminating Packet Format
321
+
322
+
A terminating packet might be sent by the root script to terminate a leaf script. The format is as follows:
323
+
324
+
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
325
+
* 3 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
326
+
* 0 encoded in [VLQ](https://en.wikipedia.org/wiki/Variable-length_quantity) format.
327
+
328
+
Upon receiving this packet, the leaf script terminates with zero as return code immediately, it does not send any response packet.
329
+
330
+
Normally, a root script does not need to terminate a leaf script. When the VM instance with VM ID 0 terminates, all child VMs terminate automatically. This packet is only suitable when too many child VM isntances have been created by the current running script group. In this case, the root script might choose to terminate some leaf scripts first, then spawn new ones.
331
+
320
332
## Exec
321
333
322
334
A root script might use exec syscall to invoke a leaf script, when the following conditions are met:
0 commit comments