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

Add an optional outputs_validator parameter to send_transaction rpc #1866

Closed
quake opened this issue Dec 7, 2019 · 0 comments · Fixed by #1879
Closed

Add an optional outputs_validator parameter to send_transaction rpc #1866

quake opened this issue Dec 7, 2019 · 0 comments · Fixed by #1879
Assignees
Labels
t:enhancement Type: Feature, refactoring.

Comments

@quake
Copy link
Member

quake commented Dec 7, 2019

Proposal

Outputs validator prevents improperly formed transactions from entering the tx-pool, in most cases the leading cause of client sending these transactions is simply because of bug code or misusing SDK, which results in a none-unlockable transaction.

RPC parameter changes

outputs_validator: Validate the transaction outputs before entering the tx-pool, an optional string parameter, null means using default validator.

Implementation details

CKB will provide two built-in validators, default and passthrough.

For default validator, these checks should conform to the pseudocode described below

transaction.outputs.all{ |output|
    script = output.script
    (script.code_hash == secp256k1_blake160_sighash_all && script.hash_type == "type" && script.args.size == 20) ||
    (script.code_hash == secp256k1_blake160_multisig_all && script.hash_type == "type" && (script.args.size == 20 || (script.args.size == 28 && script.args[20..28].is_valid_since_format))
}
transaction.outputs.all{ |output|
    script = output.type
    script.is_null || script.code_hash == dao && script.hash_type == "type"
}

For passthrough validator, it will skip validation.

@quake quake added the t:enhancement Type: Feature, refactoring. label Dec 7, 2019
@doitian doitian added this to 📬 Needs triage in CKB - Issues Dec 9, 2019
@doitian doitian moved this from 📬 Needs triage to 🔙 Backlog in CKB - Issues Dec 9, 2019
@doitian doitian moved this from 🔙 Backlog to ▶️ To do in CKB - Issues Dec 9, 2019
@doitian doitian moved this from ▶️ To do to 🔙 Chores in CKB - Issues Jan 8, 2020
@doitian doitian moved this from 📬 Needs triage to ⚙️Chores in CKB - Issues Jan 8, 2020
@doitian doitian closed this as completed Jan 8, 2020
CKB - Issues automation moved this from ⚙️Chores to ✅ Closed Jan 8, 2020
bors bot added a commit that referenced this issue Jan 17, 2020
1879:  feat: add `outputs_validator` to `send_transaction` rpc r=doitian,keroro520 a=quake

resolve #1866 

Co-authored-by: quake wang <quake.wang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:enhancement Type: Feature, refactoring.
Projects
CKB - Issues
  
✅ Closed
Development

Successfully merging a pull request may close this issue.

2 participants