Skip to content

[WIP] Add multisig_v1 to devnet. #4872

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ ckb-spawn = { path = "util/spawn", version = "=0.202.0-pre" }
ckb-stop-handler = { path = "util/stop-handler", version = "=0.202.0-pre" }
ckb-store = { path = "store", version = "=0.202.0-pre" }
ckb-sync = { path = "sync", version = "=0.202.0-pre" }
ckb-system-scripts = "=0.5.4"
ckb-system-scripts-v0_5_4 = { package="ckb-system-scripts", version="=0.5.4" }
ckb-system-scripts-v0_6_0 = { package="ckb-system-scripts", git="https://github.com/nervosnetwork/ckb-system-scripts", branch="master" }
ckb-systemtime = { path = "util/systemtime", version = "=0.202.0-pre" }
ckb-test-chain-utils = { path = "util/test-chain-utils", version = "=0.202.0-pre" }
ckb-traits = { path = "traits", version = "=0.202.0-pre" }
Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ckb-hash.workspace = true
ckb-test-chain-utils.workspace = true
ckb-dao-utils.workspace = true
ckb-dao.workspace = true
ckb-system-scripts.workspace = true
ckb-system-scripts-v0_5_4.workspace = true
ckb-crypto.workspace = true
ckb-jsonrpc-types.workspace = true
ckb-verification.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion benches/benches/benchmarks/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ckb_dao::DaoCalculator;
use ckb_dao_utils::genesis_dao_data;
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_store::ChainStore;
use ckb_system_scripts::BUNDLED_CELL;
use ckb_system_scripts_v0_5_4::BUNDLED_CELL;
use ckb_test_chain_utils::always_success_cell;
use ckb_types::{
H160, H256, U256,
Expand Down
5 changes: 3 additions & 2 deletions resource/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ phf = "0.8.0" # ckb-resource's build script need this, and cargo shear think ckb
includedir.workspace = true
serde = { workspace = true, features = ["derive"] }
ckb-types.workspace = true
ckb-system-scripts.workspace = true
ckb-system-scripts-v0_5_4.workspace = true

[build-dependencies]
includedir_codegen.workspace = true
walkdir.workspace = true
ckb-types.workspace = true
ckb-system-scripts.workspace = true
ckb-system-scripts-v0_5_4.workspace = true
ckb-system-scripts-v0_6_0.workspace = true

[dev-dependencies]
tempfile.workspace = true
Expand Down
22 changes: 16 additions & 6 deletions resource/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ use std::io::{BufWriter, Write};
use std::path::Path;
use walkdir::WalkDir;

use ckb_system_scripts::{
CODE_HASH_DAO, CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL,
CODE_HASH_SECP256K1_BLAKE160_SIGHASH_ALL, CODE_HASH_SECP256K1_DATA,
use ckb_system_scripts_v_0_5_4::{
CODE_HASH_DAO, CODE_HASH_SECP256K1_BLAKE160_SIGHASH_ALL, CODE_HASH_SECP256K1_DATA,
};

use ckb_system_scripts_v_0_6_4::CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL as CODE_HASH_SECP256K1_BLAKE160_MULTISIG_LEGACY_ALL;
use ckb_system_scripts_v_0_6_4::CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL as CODE_HASH_SECP256K1_BLAKE160_MULTISIG_V1_ALL;

fn main() {
let mut bundled = includedir_codegen::start("BUNDLED");

Expand Down Expand Up @@ -58,9 +60,17 @@ fn main() {

writeln!(
&mut out_file,
"/// Data hash of the cell containing secp256k1 blake160 multisig all lock script.\n\
pub const CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL: H256 = {:?};",
H256(CODE_HASH_SECP256K1_BLAKE160_MULTISIG_ALL)
"/// Data hash of the cell containing secp256k1 blake160 multisig(legacy) all lock script.\n\
pub const CODE_HASH_SECP256K1_BLAKE160_MULTISIG_LEGACY_ALL: H256 = {:?};",
H256(CODE_HASH_SECP256K1_BLAKE160_MULTISIG_LEGACY_ALL)
)
.expect("write to code_hashes.rs");

writeln!(
&mut out_file,
"/// Data hash of the cell containing secp256k1 blake160 multisig(v1) all lock script.\n\
pub const CODE_HASH_SECP256K1_BLAKE160_MULTISIG_V1_ALL: H256 = {:?};",
H256(CODE_HASH_SECP256K1_BLAKE160_MULTISIG_V1_ALL)
)
.expect("write to code_hashes.rs");

Expand Down
11 changes: 9 additions & 2 deletions resource/specs/dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ file = { bundled = "specs/cells/secp256k1_data" }
create_type_id = false
capacity = 1_048_617_0000_0000
[[genesis.system_cells]]
file = { bundled = "specs/cells/secp256k1_blake160_multisig_all" }
file = { bundled = "specs/cells/secp256k1_blake160_multisig_legacy_all" }
create_type_id = true
capacity = 100_000_0000_0000

# TODO: @eval-exec , bundle multisig legacy and v1 to resources
[[genesis.system_cells]]
file = { bundled = "specs/cells/secp256k1_blake160_multisig_v1_all" }
create_type_id = true
capacity = 100_000_0000_0000

Expand All @@ -53,7 +59,8 @@ files = [
name = "secp256k1_blake160_multisig_all"
files = [
{ bundled = "specs/cells/secp256k1_data" },
{ bundled = "specs/cells/secp256k1_blake160_multisig_all" },
{ bundled = "specs/cells/secp256k1_blake160_multisig_legacy_all" },
{ bundled = "specs/cells/secp256k1_blake160_multisig_v1_all" },
]

# For first 11 block
Expand Down
4 changes: 4 additions & 0 deletions resource/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ use std::io::{self, BufReader, Cursor, Read};
use std::path::{Path, PathBuf};

use ckb_system_scripts::BUNDLED_CELL;
/// get multisig_legacy from v_0_5_4
use ckb_system_scripts_v0_5_4::BUNDLED_CELL as BUNDLED_CELL_v0_5_4;
/// get multisg_v1 from v0_6_0
use ckb_system_scripts_v0_6_0::BUNDLED_CELL as BUNDLED_CELL_v0_6_0;

mod bundled {
#![allow(missing_docs, clippy::unreadable_literal)]
Expand Down
4 changes: 3 additions & 1 deletion rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,8 @@ The response looks like below when `verbosity` is 0.

Return various consensus parameters.

Notes: The `secp256k1_blake160_multisig_all_type_hash` the hash created on genesis block, CKB may upgrade the multisig script: https://github.com/nervosnetwork/ckb-system-scripts

###### Returns

If any hardfork feature has `epoch=null`, it means the feature will never be activated.
Expand Down Expand Up @@ -7544,4 +7546,4 @@ For example, a cellbase transaction is not allowed in `send_transaction` RPC.
### ERROR `PoolRejectedInvalidated`
(-1112): The transaction is rejected for ref cell consuming.
### ERROR `Indexer`
(-1200): The indexer error.
(-1200): The indexer error.
2 changes: 2 additions & 0 deletions rpc/src/module/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,8 @@ pub trait ChainRpc {

/// Return various consensus parameters.
///
/// Notes: The `secp256k1_blake160_multisig_all_type_hash` the hash created on genesis block, CKB may upgrade the multisig script: https://github.com/nervosnetwork/ckb-system-scripts
///
/// ## Returns
///
/// If any hardfork feature has `epoch=null`, it means the feature will never be activated.
Expand Down
Loading