Skip to content

Commit

Permalink
update vm syscalls, error codes. fix table format
Browse files Browse the repository at this point in the history
  • Loading branch information
linnnsss committed Oct 9, 2024
1 parent 067e3bc commit ba80733
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 36 deletions.
17 changes: 13 additions & 4 deletions website/docs/script/common-script-error-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ title: "Common Script Error Code"

CKB defines some basic error codes:

- 1: CKB_INDEX_OUT_OF_BOUND, means you have finished fetching all indices in a kind
- 2: CKB_ITEM_MISSING, means an entity is not present, such as fetching a type script from a cell that doesn’t have one.
- 3: CKB_LENGTH_NOT_ENOUGH, means some data length is wrong such as invalid script args or signature length.
- 4: CKB_INVALID_DATA, means there is something wrong with the [molecule serialization](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0008-serialization/0008-serialization.md).
| No. | Error code | Discription |
| --- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 1 | CKB_INDEX_OUT_OF_BOUND | All indices of the specified type have been fetched. |
| 2 | CKB_ITEM_MISSING | The requested entity is not present, such as fetching a Type Script from a cell that doesn’t have one. |
| 3 | CKB_LENGTH_NOT_ENOUGH | The data length is invalid, such as incorrect script arguments or signature length. |
| 4 | CKB_INVALID_DATA | Error in [molecule serialization](https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0008-serialization/0008-serialization.md). |
| 5 | CKB_WAIT_FAILURE | The file descriptor is invalid during syscall [Wait](https://github.com/nervosnetwork/rfcs/diffs?base_sha=198fc90ab7582953ed85a6655e88e51346857475&bytes=0&commentable=true&head_user=libraries&lines=0&pull_number=436&responsive=true&sha1=198fc90ab7582953ed85a6655e88e51346857475&sha2=cb0d1c2fde54b8520c33b7ac91f9e2e150df2ab2&short_path=fe60e15&start_entry=0&sticky=true&unchanged=expanded&w=false#wait). |
| 6 | CKB_INVALID_FD | The file descriptor is not owned by this process. |
| 7 | CKB_OTHER_END_CLOSED | The other end of the pipe is closed. |
| 8 | CKB_MAX_VMS_SPAWNED | The maximum count of spawned processes has been reached. |
| 9 | CKB_MAX_FDS_CREATED | The maximum count of created pipes has been reached. |

In scenarios where read, write, or wait operations block each other, the system could enter a deadlock state. In such cases, CKB-VM will throw an internal error and terminate immediately.

Molecule Error Codes from [CKB standard C library](https://github.com/nervosnetwork/ckb-c-stdlib/blob/61c7819c9ccf164f5e13d8439c554f80857e2c4b/molecule/molecule2_reader.h#L78-L85)

Expand Down
Loading

0 comments on commit ba80733

Please sign in to comment.