Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC33: ckb vm version1 changes #236

Merged
merged 17 commits into from
Mar 18, 2022
Merged

RFC33: ckb vm version1 changes #236

merged 17 commits into from
Mar 18, 2022

Conversation

mohanson
Copy link
Contributor

No description provided.

@mohanson mohanson requested a review from a team as a code owner May 26, 2021 01:25
@mohanson mohanson requested review from doitian and knwang May 26, 2021 01:25
@doitian
Copy link
Member

doitian commented May 27, 2021

See #235, it's planned to use PR number as the RFC number. If you have multiple RFCs to submit, please split it into multiple PRs.

@doitian doitian added the ckb2021 Hard fork scheduled in 2021 label May 27, 2021
@mohanson mohanson changed the title docs: add vm version1 changes RFC: ckb vm version1 changes May 27, 2021
@doitian
Copy link
Member

doitian commented Jun 15, 2021

Please mention #232 how the node selects VM versions.

[rfc232](../0232-ckb-vm-version-selection/0232-ckb-vm-version-selection.md)

@doitian
Copy link
Member

doitian commented Jun 21, 2021

For vm version 1 in CKB, one special rule can be added. If the loaded ELF has an ELF section named “.ckb.forks”, CKB-VM will skip executing the binary, and just treat the program as always success script. The consumed cycles are just the ones used to load the script and boot the VM. CKB nodes of the next fork version (ckb2021) should not relay transactions with ".ckb.forks" section because they cannot verify it.

@doitian doitian added hard-fork b:consensus Break consensus labels Jun 26, 2021
bors bot added a commit to nervosnetwork/ckb that referenced this pull request Jul 1, 2021
2756: feat(hardfork): ckb2021 hardfork features (vm related part) r=doitian,quake a=yangby-cryptape

### Changes

- New hardfork Features

  -  [CKB-RFCs PR 236: RFC: ckb vm version1 changes](nervosnetwork/rfcs#236)

  -  [CKB-RFCs PR 237: RFC: vm syscalls 2](nervosnetwork/rfcs#237)

  -  [CKB-RFCs PR 238: CKB VM version selection](nervosnetwork/rfcs#238)

- All changes are followed to the latest RFCs, except:

  - Add a "edition" field to all configuration files: CKB chain specification or app configurations.

#### CKB Chain Edition

- If no `edition` field, the default edition is `"2019"`.

-  After this PR, the default files created by `ckb init` will be edition `"2021"` files.

   But the public chains will still use the edition `"2019"` CKB chain specification as the built-in spec.

   At present, there are only to public chains: "mainnet" and "testnet".

- The edition `"2019"` doesn't support hardfork parameters.

- How to upgrade from edition `"2019"` to `"2021"`?

  Modify your spec file (default is `specs/dev.toml`), `ckb.toml` and `ckb-miner.toml`:

    - Update all `hash_type = "data"` to `hash_type.kind = "data"` and `hash_type.vm_version = 0`.

    - Update all `hash_type = "type"` to `hash_type.kind = "type"`.

    - Insert `edition = "2021"` into the head of the files.

  After upgrade the edition of chain specification,  the first time to run the CKB, you have to use `--overwrite-spec` parameter. The details of this parameter can be found with `ckb run --help`.

### BREAKING CHANGES

- The field `hash_type` in `Script` is changed from a `String` to an `Object` for all JSON RPC methods.

  The details can be found in the latest RFCs.

- The argument `--ba-hash-type` for `ckb init` is split into two arguments: `--ba-hash-type-kind` and `--ba-hash-type-vm-version`.

  More details can be found with `ckb-release init --help`.

Co-authored-by: mohanson <[email protected]>
Co-authored-by: Boyu Yang <[email protected]>
@doitian doitian mentioned this pull request Jul 23, 2021
14 tasks
@doitian
Copy link
Member

doitian commented Jul 23, 2021

Please change RFC numbers according to #246 . Sorry for the inconvenience.

@doitian doitian changed the title RFC: ckb vm version1 changes RFC33: ckb vm version1 changes Jul 23, 2021
@doitian doitian added the s:fcp Final Comment Period. PR is merged when there's no comments in 14 days. label Mar 4, 2022
@doitian doitian requested review from doitian and quake and removed request for knwang March 4, 2022 02:13
@doitian
Copy link
Member

doitian commented Mar 4, 2022

Assigned reviewers: @quake @doitian

@doitian doitian merged commit 927c5b4 into nervosnetwork:master Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:consensus Break consensus ckb2021 Hard fork scheduled in 2021 hard-fork s:fcp Final Comment Period. PR is merged when there's no comments in 14 days.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants