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

New verification model #913

Merged
merged 13 commits into from Jun 1, 2019

Conversation

@xxuejie
Copy link
Member

commented May 29, 2019

Based on feedbacks gathered earlier, we are revising our verification
model with the following changes:

  • When validating a transaction, CKB will grab all lock scripts from
    all inputs, and group them based on lock script hash. The script in
    each group will only be run once. The lock script itself will have
    to do the validation task for all inputs in the same group
  • CKB will also grab all type scripts from inputs and outputs(notice
    different from previous version, the type scripts in inputs are
    included here as well), and group them based on type script hash as
    well. Each type script in each group will also be run once. The type
    script itself needs to handle the validation task within the group
  • Syscalls are also revised to allow fetching all the
    inputs/outputs/witnesses within a single group.
  • Input args is removed since the functionality can be replicated elsewhere

@xxuejie xxuejie requested review from nervosnetwork/ckb-dev May 29, 2019

@nervos-bot

This comment has been minimized.

Copy link

commented May 29, 2019

@jjyr is assigned as the chief reviewer

@nervos-bot

This comment has been minimized.

Copy link

commented May 29, 2019

CI status of the fork branch is Build Status

script/src/syscalls/load_cell.rs Show resolved Hide resolved
script/src/syscalls/load_witness.rs Show resolved Hide resolved
script/src/syscalls/mod.rs Outdated Show resolved Hide resolved
script/src/verify.rs Show resolved Hide resolved
core/src/transaction.rs Outdated Show resolved Hide resolved
@janx
Copy link
Member

left a comment

Can we add a test case to cover the fix?

fix: use separate lock and type groups in case of duplicate script
fd67f74

script/src/verify.rs Show resolved Hide resolved
script/src/verify.rs Show resolved Hide resolved

@xxuejie xxuejie force-pushed the xxuejie:new-verification-model branch from 3461699 to 2f5f10e May 30, 2019

@xxuejie xxuejie requested review from janx, jjyr and doitian May 30, 2019

core/src/transaction.rs Outdated Show resolved Hide resolved
@jjyr

jjyr approved these changes May 31, 2019

@janx

janx approved these changes Jun 1, 2019

@xxuejie xxuejie force-pushed the xxuejie:new-verification-model branch from fe90d61 to 1713322 Jun 1, 2019

xxuejie added some commits May 28, 2019

feat: new transaction verification model
Based on feedbacks gathered earlier, we are revising our verification
model with the following changes:

* When validating a transaction, CKB will grab all lock scripts from
  all inputs, and group them based on lock script hash. The script in
  each group will only be run once. The lock script itself will have
  to do the validation task for all inputs in the same group
* CKB will also grab all type scripts from inputs and outputs(notice
  different from previous version, the type scripts in inputs are
  included here as well), and group them based on type script hash as
  well. Each type script in each group will also be run once. The type
  script itself needs to handle the validation task within the group
* Syscalls are also revised to allow fetching all the
  inputs/outputs/witnesses within a single group.

The default secp256k1_blake160_sighash_all lock script is compiled
from the following source:

https://github.com/nervosnetwork/ckb-system-scripts/blob/e00ba451dccb7a516454ea9606de3a21c8f9a80c/c/secp256k1_blake160_sighash_all.c

The exact gcc version used in the compilation can be located in the
following docker image:

xxuejie/riscv-gnu-toolchain-rv64imac:20190529

@xxuejie xxuejie force-pushed the xxuejie:new-verification-model branch from 1713322 to 8e41474 Jun 1, 2019

@zhangsoledad zhangsoledad merged commit 3c4bd8f into nervosnetwork:develop Jun 1, 2019

4 checks passed

Nervos CI Build Passed via Travis
Details
Nervos Integration Build Passed via Travis
Details
Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details

@xxuejie xxuejie deleted the xxuejie:new-verification-model branch Jun 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.