diff --git a/Cargo.lock b/Cargo.lock index a8880fef..ccf4f40e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,6 +58,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "anyhow" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" + [[package]] name = "arrayref" version = "0.3.6" @@ -189,6 +195,12 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "blake2b-ref" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95916998c798756098a4eb1b3f2cd510659705a9817bf203d61abd30fbec3e7b" + [[package]] name = "blake2b-rs" version = "0.1.5" @@ -320,13 +332,13 @@ dependencies = [ [[package]] name = "ckb-build-info" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" [[package]] name = "ckb-chain-spec" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-crypto", "ckb-dao-utils", @@ -337,22 +349,21 @@ dependencies = [ "ckb-rational", "ckb-resource", "ckb-types", - "failure", "serde", "toml", ] [[package]] name = "ckb-channel" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "0.38.0" +version = "0.39.0" dependencies = [ "ansi_term", "atty", @@ -418,43 +429,42 @@ dependencies = [ [[package]] name = "ckb-crypto" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash", - "failure", "faster-hex 0.4.1", "lazy_static", "rand 0.6.5", "secp256k1", + "thiserror", ] [[package]] name = "ckb-dao-utils" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-error", "ckb-types", - "enum-display-derive", - "failure", ] [[package]] name = "ckb-error" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ + "anyhow", "ckb-occupied-capacity", - "enum-display-derive", - "failure", + "derive_more", + "thiserror", ] [[package]] name = "ckb-fixed-hash" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -462,18 +472,18 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ - "failure", "faster-hex 0.4.1", "serde", + "thiserror", ] [[package]] name = "ckb-fixed-hash-macros" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-fixed-hash-core", "proc-macro2 1.0.24", @@ -483,15 +493,16 @@ dependencies = [ [[package]] name = "ckb-hash" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ + "blake2b-ref", "blake2b-rs", ] [[package]] name = "ckb-index" -version = "0.38.0" +version = "0.39.0" dependencies = [ "bincode", "ckb-rocksdb", @@ -505,8 +516,8 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-types", "faster-hex 0.4.1", @@ -528,16 +539,16 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "log 0.4.11", ] [[package]] name = "ckb-occupied-capacity" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -545,16 +556,16 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-occupied-capacity-core", "quote 1.0.3", @@ -563,8 +574,8 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-hash", @@ -576,16 +587,17 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "numext-fixed-uint", + "serde", ] [[package]] name = "ckb-resource" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -609,8 +621,8 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "byteorder", "ckb-chain-spec", @@ -621,7 +633,6 @@ dependencies = [ "ckb-types", "ckb-vm", "ckb-vm-definitions", - "failure", "faster-hex 0.4.1", "goblin", "serde", @@ -629,7 +640,7 @@ dependencies = [ [[package]] name = "ckb-sdk" -version = "0.38.0" +version = "0.39.0" dependencies = [ "aes-ctr", "bech32", @@ -637,6 +648,7 @@ dependencies = [ "byteorder", "chrono", "ckb-crypto", + "ckb-error", "ckb-hash", "ckb-jsonrpc-types", "ckb-resource", @@ -660,7 +672,7 @@ dependencies = [ [[package]] name = "ckb-sdk-types" -version = "0.38.0" +version = "0.39.0" dependencies = [ "ckb-crypto", "ckb-error", @@ -687,16 +699,16 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "bit-vec", "bytes 0.5.4", @@ -706,7 +718,6 @@ dependencies = [ "ckb-hash", "ckb-occupied-capacity", "ckb-rational", - "failure", "merkle-cbt", "molecule", "numext-fixed-uint", @@ -715,8 +726,8 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.38.0-pre" -source = "git+https://github.com/nervosnetwork/ckb?tag=v0.38.0-rc1#2fc90553e79eb5fe88db5461eb50324e588a9fc8" +version = "0.39.0-pre" +source = "git+https://github.com/nervosnetwork/ckb?tag=v0.39.0-rc2#2d4f9a11f5efa5b50dabacf0a224f65af9bff66c" dependencies = [ "linked-hash-map", "parking_lot 0.7.1", @@ -725,9 +736,9 @@ dependencies = [ [[package]] name = "ckb-vm" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c8acac1ef10d936825955474c2a12c5bbde9b824a450b3b6dfe3724112d8ae5" +checksum = "bfc2fb181a6653bb13315dc7f60fbe32cd3d697553b24687613da984faf2a2c5" dependencies = [ "byteorder", "bytes 0.5.4", @@ -736,15 +747,15 @@ dependencies = [ "derive_more", "goblin", "libc", - "memmap", + "mapr", "scroll", ] [[package]] name = "ckb-vm-definitions" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e91a4ae2eb8a79ad9ba78471bff0eb82ea313a4d6a04b2d454c6553b13fa9" +checksum = "ea76d3867d00736c64876ab0cd304be73691b91990a90ebbf100d36af85fdb05" [[package]] name = "clap" @@ -1022,16 +1033,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "enum-display-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f76eb63c4bfc6fce5000f106254701b741fc9a65ee08445fde0ff39e583f1c" -dependencies = [ - "quote 0.3.15", - "syn 0.11.11", -] - [[package]] name = "env_logger" version = "0.6.2" @@ -1603,6 +1604,16 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "mapr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a28a55dbc005b2f6f123c4058933d57add373d362f6fd3a76aab4fe6973500" +dependencies = [ + "libc", + "winapi 0.3.8", +] + [[package]] name = "matches" version = "0.1.8" @@ -1621,16 +1632,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi 0.3.8", -] - [[package]] name = "memoffset" version = "0.5.4" @@ -2132,12 +2133,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" - [[package]] name = "quote" version = "0.6.13" @@ -2572,18 +2567,18 @@ dependencies = [ [[package]] name = "secp256k1" -version = "0.17.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2932dc07acd2066ff2e3921a4419606b220ba6cd03a9935123856cc534877056" +checksum = "c6179428c22c73ac0fbb7b5579a56353ce78ba29759b3b8575183336ea74cdfb" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.1.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab2c26f0d3552a0f12e639ae8a64afc2e3db9c52fe32f5fc6c289d38519f220" +checksum = "11553d210db090930f4432bea123b31f70bbf693ace14504ea2a35e796c28dd2" dependencies = [ "cc", ] @@ -2787,17 +2782,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -dependencies = [ - "quote 0.3.15", - "synom", - "unicode-xid 0.0.4", -] - [[package]] name = "syn" version = "0.15.44" @@ -2831,15 +2815,6 @@ dependencies = [ "syn 1.0.48", ] -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -dependencies = [ - "unicode-xid 0.0.4", -] - [[package]] name = "synstructure" version = "0.12.3" @@ -3140,9 +3115,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] @@ -3223,12 +3198,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" - [[package]] name = "unicode-xid" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index bc5ac39f..2e2201a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,20 +1,20 @@ [package] name = "ckb-cli" -version = "0.38.0" +version = "0.39.0" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" [dependencies] -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-util = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-dao-utils = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } ckb-sdk = { path = "ckb-sdk" } ckb-index = { path = "ckb-index" } plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol" } @@ -23,7 +23,7 @@ jsonrpc-core = "10.1" jsonrpc-derive = "10.1" jsonrpc-http-server = "10.1" jsonrpc-server-utils = "10.1" -secp256k1 = {version = "0.17.0" } +secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" env_logger = "0.6" crossbeam-channel = "0.3" @@ -57,7 +57,7 @@ tui = "0.6.0" termion = "1.5" [build-dependencies] -ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-build-info = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } [workspace] members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"] diff --git a/Makefile b/Makefile index 10c8c50a..76f05acc 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ci: fmt clippy test security-audit git diff --exit-code Cargo.lock integration: - bash devtools/ci/integration.sh v0.38.0-rc1 + bash devtools/ci/integration.sh v0.39.0-rc2 prod: ## Build binary with release profile. cargo build --release diff --git a/ckb-index/Cargo.toml b/ckb-index/Cargo.toml index a5391a7f..4faf4bbc 100644 --- a/ckb-index/Cargo.toml +++ b/ckb-index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-index" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -11,6 +11,6 @@ serde_derive = "1.0" bincode = "1.1.4" log = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } ckb-sdk = { path = "../ckb-sdk" } rocksdb = { package = "ckb-rocksdb", version = "=0.13.0", features = ["snappy"] } diff --git a/ckb-sdk-types/Cargo.toml b/ckb-sdk-types/Cargo.toml index f83c2bc2..d95ab93b 100644 --- a/ckb-sdk-types/Cargo.toml +++ b/ckb-sdk-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk-types" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -9,11 +9,11 @@ license = "MIT" serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-traits = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } [dev-dependencies] -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } diff --git a/ckb-sdk-types/src/transaction.rs b/ckb-sdk-types/src/transaction.rs index 889737ad..0f436b96 100644 --- a/ckb-sdk-types/src/transaction.rs +++ b/ckb-sdk-types/src/transaction.rs @@ -221,18 +221,24 @@ impl CellProvider for Resource { } impl CellDataProvider for Resource { - fn load_cell_data(&self, cell: &CellMeta) -> Option<(Bytes, Byte32)> { + fn load_cell_data(&self, cell: &CellMeta) -> Option { cell.mem_cell_data .as_ref() .map(ToOwned::to_owned) .or_else(|| self.get_cell_data(&cell.out_point)) } - fn get_cell_data(&self, out_point: &OutPoint) -> Option<(Bytes, Byte32)> { + fn get_cell_data(&self, out_point: &OutPoint) -> Option { self.required_cells .get(out_point) .and_then(|cell_meta| cell_meta.mem_cell_data.clone()) } + + fn get_cell_data_hash(&self, out_point: &OutPoint) -> Option { + self.required_cells + .get(out_point) + .and_then(|cell_meta| cell_meta.mem_cell_data_hash.clone()) + } } impl HeaderProvider for Resource { diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index a80c7c6d..a103c3f9 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -12,7 +12,7 @@ serde_json = "1.0" bech32 = "0.6.0" log = "0.4.6" reqwest = "0.9" -secp256k1 = "0.17.0" +secp256k1 = { version = "0.19", features = ["recovery"] } faster-hex = "0.4" fnv = "1.0.3" aes-ctr = "0.3.0" @@ -25,10 +25,11 @@ uuid = { version = "0.7.4", features = ["v4"] } chrono = "0.4.6" failure = "0.1.5" -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-error = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-script = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-resource = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } ckb-sdk-types = { path = "../ckb-sdk-types" } diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index 6aabaf09..b1bf4f8c 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -1,9 +1,9 @@ use ckb_jsonrpc_types::{ BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellOutputWithOutPoint, - CellTransaction, CellWithStatus, ChainInfo, EpochNumber, EpochView, ExtraLoggerConfig, - HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, MainLoggerConfig, OutPoint, - PeerState, RemoteNode, Script, Timestamp, Transaction, TransactionProof, TransactionWithStatus, - TxPoolInfo, Uint64, Version, + CellTransaction, CellWithStatus, ChainInfo, Consensus, EpochNumber, EpochView, + ExtraLoggerConfig, HeaderView, JsonBytes, LiveCell, LocalNode, LockHashIndexState, + MainLoggerConfig, OutPoint, PeerState, RawTxPool, RemoteNode, Script, Timestamp, Transaction, + TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, }; use super::types; @@ -87,6 +87,7 @@ jsonrpc!(pub struct RawHttpRpcClient { ) -> TransactionProof; pub fn verify_transaction_proof(&mut self, tx_proof: TransactionProof) -> Vec; pub fn get_fork_block(&mut self, block_hash: H256) -> Option; + pub fn get_consensus(&mut self) -> Consensus; // Indexer pub fn deindex_lock_hash(&mut self, lock_hash: H256) -> (); @@ -132,6 +133,7 @@ jsonrpc!(pub struct RawHttpRpcClient { // Pool pub fn send_transaction(&mut self, tx: Transaction) -> H256; pub fn tx_pool_info(&mut self) -> TxPoolInfo; + pub fn get_raw_tx_pool(&mut self, verbose: Option) -> RawTxPool; // Stats pub fn get_blockchain_info(&mut self) -> ChainInfo; @@ -294,6 +296,12 @@ impl HttpRpcClient { .map(|opt| opt.map(Into::into)) .map_err(|err| err.to_string()) } + pub fn get_consensus(&mut self) -> Result { + self.client + .get_consensus() + .map(Into::into) + .map_err(|err| err.to_string()) + } // Indexer #[deprecated(since = "0.36.0", note = "Use standalone ckb-indexer")] @@ -424,6 +432,13 @@ impl HttpRpcClient { .map_err(|err| err.to_string()) } + pub fn get_raw_tx_pool(&mut self, verbose: Option) -> Result { + self.client + .get_raw_tx_pool(verbose) + .map(Into::into) + .map_err(|err| err.to_string()) + } + // Stats pub fn get_blockchain_info(&mut self) -> Result { self.client diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index 01be16d6..69c391d5 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -1,9 +1,10 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize, Serializer}; +use std::collections::HashMap; use std::convert::TryFrom; pub use ckb_jsonrpc_types::{ - self as rpc_types, Byte32, DepType, JsonBytes, ProposalShortId, ScriptHashType, TxStatus, - Uint128, + self as rpc_types, Byte32, DepType, JsonBytes, ProposalShortId, ScriptHashType, TxPoolIds, + TxStatus, Uint128, }; use ckb_types::{core, packed, prelude::*, H256, U256}; @@ -13,6 +14,7 @@ use crate::constants::{DAO_TYPE_HASH, MULTISIG_TYPE_HASH, SIGHASH_TYPE_HASH}; type Version = u32; type BlockNumber = u64; type EpochNumber = u64; +type Cycle = u64; type AlertId = u32; type AlertPriority = u32; type Uint32 = u32; @@ -655,6 +657,102 @@ impl From for rpc_types::MerkleProof { } } +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct ProposalWindow { + /// The closest distance between the proposal and the commitment. + pub closest: BlockNumber, + /// The farthest distance between the proposal and the commitment. + pub farthest: BlockNumber, +} +impl From for ProposalWindow { + fn from(json: rpc_types::ProposalWindow) -> ProposalWindow { + ProposalWindow { + closest: json.closest.into(), + farthest: json.farthest.into(), + } + } +} + +/// Consensus defines various parameters that influence chain consensus +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct Consensus { + /// Names the network. + pub id: String, + /// The genesis block hash + pub genesis_hash: H256, + /// The dao type hash + pub dao_type_hash: Option, + /// The secp256k1_blake160_sighash_all_type_hash + pub secp256k1_blake160_sighash_all_type_hash: Option, + /// The secp256k1_blake160_multisig_all_type_hash + pub secp256k1_blake160_multisig_all_type_hash: Option, + /// The initial primary_epoch_reward + pub initial_primary_epoch_reward: Capacity, + /// The secondary primary_epoch_reward + pub secondary_epoch_reward: Capacity, + /// The maximum amount of uncles allowed for a block + pub max_uncles_num: Uint64, + /// The expected orphan_rate + pub orphan_rate_target: core::RationalU256, + /// The expected epoch_duration + pub epoch_duration_target: Uint64, + /// The two-step-transaction-confirmation proposal window + pub tx_proposal_window: ProposalWindow, + /// The two-step-transaction-confirmation proposer reward ratio + pub proposer_reward_ratio: core::RationalU256, + /// The Cellbase maturity + pub cellbase_maturity: EpochNumberWithFraction, + /// This parameter indicates the count of past blocks used in the median time calculation + pub median_time_block_count: Uint64, + /// Maximum cycles that all the scripts in all the commit transactions can take + pub max_block_cycles: Cycle, + /// Maximum number of bytes to use for the entire block + pub max_block_bytes: Uint64, + /// The block version number supported + pub block_version: Version, + /// The tx version number supported + pub tx_version: Version, + /// The "TYPE_ID" in hex + pub type_id_code_hash: H256, + /// The Limit to the number of proposals per block + pub max_block_proposals_limit: Uint64, + /// Primary reward is cut in half every halving_interval epoch + pub primary_epoch_reward_halving_interval: Uint64, + /// Keep difficulty be permanent if the pow is dummy + pub permanent_difficulty_in_dummy: bool, +} +impl From for Consensus { + fn from(json: rpc_types::Consensus) -> Consensus { + Consensus { + id: json.id, + genesis_hash: json.genesis_hash, + dao_type_hash: json.dao_type_hash, + secp256k1_blake160_sighash_all_type_hash: json.secp256k1_blake160_sighash_all_type_hash, + secp256k1_blake160_multisig_all_type_hash: json + .secp256k1_blake160_multisig_all_type_hash, + initial_primary_epoch_reward: json.initial_primary_epoch_reward.into(), + secondary_epoch_reward: json.secondary_epoch_reward.into(), + max_uncles_num: json.max_uncles_num.into(), + orphan_rate_target: json.orphan_rate_target, + epoch_duration_target: json.epoch_duration_target.into(), + tx_proposal_window: json.tx_proposal_window.into(), + proposer_reward_ratio: json.proposer_reward_ratio, + cellbase_maturity: json.cellbase_maturity.into(), + median_time_block_count: json.median_time_block_count.into(), + max_block_cycles: json.max_block_cycles.into(), + max_block_bytes: json.max_block_bytes.into(), + block_version: json.block_version.into(), + tx_version: json.tx_version.into(), + type_id_code_hash: json.type_id_code_hash, + max_block_proposals_limit: json.max_block_proposals_limit.into(), + primary_epoch_reward_halving_interval: json + .primary_epoch_reward_halving_interval + .into(), + permanent_difficulty_in_dummy: json.permanent_difficulty_in_dummy, + } + } +} + // ========= // cell.rs // ========= @@ -1052,6 +1150,83 @@ impl From for TxPoolInfo { } } +/// Transaction verbose info +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Debug)] +pub struct TxVerbosity { + /// Consumed cycles. + pub cycles: Uint64, + /// The transaction serialized size in block. + pub size: Uint64, + /// The transaction fee. + pub fee: Capacity, + /// Size of in-tx-pool ancestor transactions + pub ancestors_size: Uint64, + /// Cycles of in-tx-pool ancestor transactions + pub ancestors_cycles: Uint64, + /// Number of in-tx-pool ancestor transactions + pub ancestors_count: Uint64, +} +impl From for TxVerbosity { + fn from(json: rpc_types::TxVerbosity) -> TxVerbosity { + TxVerbosity { + cycles: json.cycles.into(), + size: json.size.into(), + fee: json.fee.into(), + ancestors_size: json.ancestors_size.into(), + ancestors_cycles: json.ancestors_cycles.into(), + ancestors_count: json.ancestors_count.into(), + } + } +} + +#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Debug)] +pub struct TxPoolVerbosity { + /// Pending tx verbose info + pub pending: HashMap, + /// Proposed tx verbose info + pub proposed: HashMap, +} +impl From for TxPoolVerbosity { + fn from(json: rpc_types::TxPoolVerbosity) -> TxPoolVerbosity { + TxPoolVerbosity { + pending: json + .pending + .into_iter() + .map(|(key, value)| (key, value.into())) + .collect(), + proposed: json + .proposed + .into_iter() + .map(|(key, value)| (key, value.into())) + .collect(), + } + } +} + +/// All transactions in tx-pool. +/// +/// `RawTxPool` is equivalent to [`TxPoolIds`][] `|` [`TxPoolVerbosity`][]. +/// +/// [`TxPoolIds`]: struct.TxPoolIds.html +/// [`TxPoolVerbosity`]: struct.TxPoolVerbosity.html +#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] +#[serde(untagged)] +pub enum RawTxPool { + /// verbose = false + Ids(TxPoolIds), + /// verbose = true + Verbose(TxPoolVerbosity), +} + +impl From for RawTxPool { + fn from(json: rpc_types::RawTxPool) -> RawTxPool { + match json { + rpc_types::RawTxPool::Ids(ids) => RawTxPool::Ids(ids), + rpc_types::RawTxPool::Verbose(verbose) => RawTxPool::Verbose(verbose.into()), + } + } +} + // ========= // sync.rs // ========= diff --git a/ckb-sdk/src/transaction.rs b/ckb-sdk/src/transaction.rs index b77820de..1bffc150 100644 --- a/ckb-sdk/src/transaction.rs +++ b/ckb-sdk/src/transaction.rs @@ -1,3 +1,4 @@ +use ckb_error::OtherError; use ckb_hash::new_blake2b; use ckb_jsonrpc_types as rpc_types; use ckb_script::TransactionScriptsVerifier; @@ -8,7 +9,6 @@ use ckb_types::{ prelude::*, H160, H256, }; -use failure::Error as FailureError; use fnv::FnvHashSet; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; @@ -180,7 +180,7 @@ impl<'a> MockTransactionHelper<'a> { let hash_type = lock .hash_type() .try_into() - .map_err(|err: FailureError| err.to_string())?; + .map_err(|err: OtherError| err.to_string())?; insert_dep(hash_type, &lock.code_hash())?; } for output in tx.outputs().into_iter() { @@ -188,7 +188,7 @@ impl<'a> MockTransactionHelper<'a> { let hash_type = script .hash_type() .try_into() - .map_err(|err: FailureError| err.to_string())?; + .map_err(|err: OtherError| err.to_string())?; insert_dep(hash_type, &script.code_hash())?; } } diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index f3974e51..1f9767d5 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -8,8 +8,8 @@ edition = "2018" [dependencies] ckb-index = { path = "../ckb-index" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-jsonrpc-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } serde = { version = "1.0", features = ["rc"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 0b3bda12..7d4df06c 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -183,6 +183,8 @@ impl<'a> RpcSubCommand<'a> { App::new("get_fork_block") .about("Returns the information about a fork block by hash") .arg(arg_hash.clone().about("The fork block hash")), + App::new("get_consensus") + .about("Return various consensus parameters"), // [Indexer] App::new("deindex_lock_hash") .arg(arg_hash.clone().about("Lock script hash")) @@ -275,6 +277,9 @@ impl<'a> RpcSubCommand<'a> { App::new("ping_peers").about("Requests that a ping is sent to all connected peers, to measure ping time"), // [Pool] App::new("tx_pool_info").about("Get transaction pool information"), + App::new("get_raw_tx_pool") + .about("Returns all transaction ids in tx pool as a json array of string transaction ids") + .arg(Arg::with_name("verbose").long("verbose").about("True for a json object, false for array of transaction ids")), // [`Stats`] App::new("get_blockchain_info").about("Get chain information"), // [`IntegrationTest`] @@ -600,6 +605,19 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { Ok(Output::new_output(resp)) } } + ("get_consensus", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + if is_raw_data { + let resp = self + .raw_rpc_client + .get_consensus() + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.get_consensus()?; + Ok(Output::new_output(resp)) + } + } // [Indexer] ("deindex_lock_hash", Some(m)) => { let hash: H256 = FixedHashParser::::default().from_matches(m, "hash")?; @@ -803,6 +821,20 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { Ok(Output::new_output(resp)) } } + ("get_raw_tx_pool", Some(m)) => { + let is_raw_data = is_raw_data || m.is_present("raw-data"); + let verbose = m.is_present("verbose"); + if is_raw_data { + let resp = self + .raw_rpc_client + .get_raw_tx_pool(Some(verbose)) + .map_err(|err| err.to_string())?; + Ok(Output::new_output(resp)) + } else { + let resp = self.rpc_client.get_raw_tx_pool(Some(verbose))?; + Ok(Output::new_output(resp)) + } + } // [Stats] ("get_blockchain_info", Some(m)) => { let is_raw_data = is_raw_data || m.is_present("raw-data"); diff --git a/test/Cargo.toml b/test/Cargo.toml index 416c6205..8860d96b 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cli-test" -version = "0.38.0" +version = "0.39.0" authors = ["Linfeng Qian "] edition = "2018" @@ -14,11 +14,11 @@ env_logger = "0.6" toml = "0.5.0" serde_yaml = "0.8.9" ckb-sdk = { path = "../ckb-sdk" } -ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } -ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1", features = ["secp"] } -ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.38.0-rc1" } +ckb-types = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-app-config = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-chain-spec = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } +ckb-crypto = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2", features = ["secp"] } +ckb-hash = { git = "https://github.com/nervosnetwork/ckb", tag = "v0.39.0-rc2" } regex = "1.1.6" # Prevent this from interfering with workspaces diff --git a/test/src/spec/dao.rs b/test/src/spec/dao.rs index 91436eef..a9489fb4 100644 --- a/test/src/spec/dao.rs +++ b/test/src/spec/dao.rs @@ -46,8 +46,8 @@ impl Spec for DaoPrepareOne { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } } @@ -93,8 +93,8 @@ impl Spec for DaoPrepareMultiple { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } } @@ -135,8 +135,8 @@ impl Spec for DaoWithdrawMultiple { } fn modify_spec_toml(&self, spec_toml: &mut ChainSpec) { - spec_toml.params.genesis_epoch_length = EPOCH_LENGTH; - spec_toml.params.permanent_difficulty_in_dummy = true; + spec_toml.params.genesis_epoch_length = Some(EPOCH_LENGTH); + spec_toml.params.permanent_difficulty_in_dummy = Some(true); } }