diff --git a/Cargo.lock b/Cargo.lock index ab1fd82c..e53829d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -341,16 +341,17 @@ dependencies = [ [[package]] name = "ckb-build-info" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14fcc6207eef9a1f0b51413fecaffaba7809a03b516d704d7ce935b61e003c18" +checksum = "8392debcd816808dfb9698f87d3432f09e2abb1db9342774abe89b5e278f8749" [[package]] name = "ckb-chain-spec" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e6bcbee936135cb6385867c77ae6a010e2ad898aedc627ab0ab078b7be15dbd" +checksum = "6545c270115cdbed0b5ec452a4ef8753dac8990ac0996110531041a00f0842f9" dependencies = [ + "ckb-constant", "ckb-crypto", "ckb-dao-utils", "ckb-error", @@ -367,16 +368,16 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9b8a0d84e40deb3b7d2ad153f1313bd7ae890a2a8ac1e2f87ce07d5ad37a32" +checksum = "0048e1732dc769525b332a20a4eb0942f84e1ba3cbcbcb286dacd3a585f6e50a" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "0.43.0" +version = "0.100.0-rc2" dependencies = [ "ansi_term", "atty", @@ -406,7 +407,7 @@ dependencies = [ "futures 0.3.16", "ipnetwork", "itertools", - "jsonrpc-core 17.1.0", + "jsonrpc-core", "jsonrpc-core-client", "jsonrpc-derive", "jsonrpc-http-server", @@ -431,7 +432,7 @@ dependencies = [ [[package]] name = "ckb-cli-plugin-protocol" -version = "0.43.0" +version = "0.100.0-rc2" dependencies = [ "ckb-index", "ckb-jsonrpc-types", @@ -442,11 +443,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "ckb-constant" +version = "0.100.0-rc2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "237ea9a8e7ced2731a46bbbf23b40a7df4c5229bb2226396ba70bfe4cdc85e3c" + [[package]] name = "ckb-crypto" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c23fb466dd3511efe3aedfdddbca626f18221e2e7ccd5c9a26956042665c043e" +checksum = "9c69f679e843fae7294679efdbe6239aaf9469a40f0b3145e075708879b26513" dependencies = [ "ckb-fixed-hash", "faster-hex 0.6.0", @@ -458,9 +465,9 @@ dependencies = [ [[package]] name = "ckb-dao-utils" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06a6e833294cb27f8da7c0d302a6c2f9e777fd70884cbedcaab5c641501331f" +checksum = "915bbb801dee8f14e47714b18b8c8216c574156c7a1bd922fba2f73d73a8f10a" dependencies = [ "byteorder", "ckb-error", @@ -469,9 +476,9 @@ dependencies = [ [[package]] name = "ckb-error" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58559e6acb083fbdf222c282416dda60a35db2507da65788333a331d9b9f74f4" +checksum = "945d804f5648bd3060b0d19336952093f3bbc6cc568533230156d5f579fef24c" dependencies = [ "anyhow", "ckb-occupied-capacity", @@ -481,9 +488,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf5d3266a67e9e59de592540895a71541f381194d4e91eb83d783b631d1ad2b3" +checksum = "c1e74fcc7ab5e6274991cdd7b3a49583b45f63c1d82cda639edd259d7cf73bd2" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -491,9 +498,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c5fa9ee9e7c100ce2c645182ee4a495d71971d3193ce8eeffabf2b26f401674" +checksum = "b845d71fee1b55f68453c8db69b54a43db1370147f0f79909324eaf030a28e2e" dependencies = [ "faster-hex 0.6.0", "serde", @@ -502,9 +509,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-macros" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e569adf7436b5d6c651df449bf6415f3377cf90aedfe4bb439ff9a4fa90ea4" +checksum = "ff13f0f845ae9fb1073239094e6cadaf7af213181e7462df4f73cdb81d6b5ee6" dependencies = [ "ckb-fixed-hash-core", "proc-macro2", @@ -514,9 +521,9 @@ dependencies = [ [[package]] name = "ckb-hash" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2decd1914e05f50fc69156f8f74b710aa8d5217d300f40875cacfe55d37e1394" +checksum = "f409236f9c815cebf15dea49924bf3f316d47682f710fa9493135993a57d7913" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -524,7 +531,7 @@ dependencies = [ [[package]] name = "ckb-index" -version = "0.43.0" +version = "0.100.0-rc2" dependencies = [ "bincode", "ckb-rocksdb", @@ -538,13 +545,12 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104ed751a955058782af060ae430c4fd5da2a8dfc49ece375e93a43818b967e3" +checksum = "b9b11f78288ab8f299caf7b316706ca41d8b7a67a5e20719245d584230dce003" dependencies = [ "ckb-types", "faster-hex 0.6.0", - "jsonrpc-core 14.2.0", "serde", "serde_json", ] @@ -562,18 +568,18 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "284e4f2a91ea186c337485f9da48ae95dc7dc1ef77c64161aad507e3bb6331a7" +checksum = "14feffc8b90fd0e5dead8b8c0609faf5e6b5f3c06ceb487b8f0c91f378dc92cf" dependencies = [ "log", ] [[package]] name = "ckb-occupied-capacity" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be7a7388d783e275a4191ca90373d2d0622add8584e373d5ce54a43fcdb84636" +checksum = "8a42877e9e929241d9965b8fa0337c3dc93715c452df0c305f4a6cceda4ecdda" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -581,18 +587,18 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee2140566e0bcd569ba7ed2ffc11bef4a25baf2c4bb8a25a95e3af9c5297b7c" +checksum = "80447a92eeef022f9dff53413d46900cbab5a8e28bd5ef49c88512a3b8aa5d6d" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5404109aa77fb77c5589fed71ff8af23020f76a0c8f5b49797687b77d9f1b399" +checksum = "bab646c39f21c297ce0fd274bfe27361830adf2d64d0f15b2ef320dea2001cb5" dependencies = [ "ckb-occupied-capacity-core", "quote", @@ -601,9 +607,9 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e5026e94c161908f0a4229dd530d9ab1957b6a341153c0d75888be22c01cb9" +checksum = "98b034068b7746d5cc666c95fcdaf355bd9c302f3d68207e9c6e988e7307c8ad" dependencies = [ "byteorder", "ckb-hash", @@ -615,9 +621,9 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04ec9fdc7d73d97a16766a7ea421f65a1a1996a3dd29d98596f72511d0105531" +checksum = "80648e2f04b2429c96497dfd786edbbaabcde45d3f566ef96bb84c6fe1c3999c" dependencies = [ "numext-fixed-uint", "serde", @@ -625,9 +631,9 @@ dependencies = [ [[package]] name = "ckb-resource" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2528c53487d7f0fce177c1124ed81fb81970cedb64d14380a1093ba3be5e8886" +checksum = "21111aa1eaf33e998163bdc35bb01a22cb5a71660a8c694dbaaa7455668807e1" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -652,9 +658,9 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fff32929465afdaf63031323afe619265ff5e4e23b91350ff2b239f3c3cf6ed" +checksum = "86c9aa8b59733bbf92195d9596a24e369db27614593b522582ab24e2436c255c" dependencies = [ "byteorder", "ckb-chain-spec", @@ -666,13 +672,13 @@ dependencies = [ "ckb-vm", "ckb-vm-definitions", "faster-hex 0.6.0", - "goblin", + "goblin 0.2.3", "serde", ] [[package]] name = "ckb-sdk" -version = "0.43.0" +version = "0.100.0-rc2" dependencies = [ "aes-ctr", "bech32", @@ -680,6 +686,7 @@ dependencies = [ "byteorder", "bytes 1.0.1", "chrono", + "ckb-chain-spec", "ckb-crypto", "ckb-error", "ckb-hash", @@ -692,6 +699,7 @@ dependencies = [ "faster-hex 0.4.1", "fnv", "futures 0.3.16", + "jsonrpc-core", "log", "rand 0.7.3", "reqwest", @@ -708,7 +716,7 @@ dependencies = [ [[package]] name = "ckb-sdk-types" -version = "0.43.0" +version = "0.100.0-rc2" dependencies = [ "ckb-crypto", "ckb-error", @@ -735,20 +743,21 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae497445ed00428bed649ee47fbcd563501f40a3344cb7e46e96e24edd863398" +checksum = "8629d61183ab240fe0c598b5723c16bc9741691df2261574ff04c6fb87cb070d" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2468390210f63c96bec68ec98b4e99b173ade5d9abde60582c5f318b96b57f8a" +checksum = "31588d3154ce8e3bd7d815b6e8223afecbcf3ca05a58a26db371393eb0ffe42a" dependencies = [ "bit-vec", + "bitflags", "bytes 1.0.1", "ckb-channel", "ckb-error", @@ -765,9 +774,9 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.43.0" +version = "0.100.0-rc2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad697237465879640be333df47c339d3d021312d5d13bea72cea31175f28c17f" +checksum = "1d2c191ab04d742624d7e85908239b59dad6188de72834fe99dd8674d2e1c3f2" dependencies = [ "linked-hash-map", "parking_lot", @@ -776,26 +785,29 @@ dependencies = [ [[package]] name = "ckb-vm" -version = "0.19.4" +version = "0.20.0-rc1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4b7a3a2f19771d379884030417094c55986ccbc0d5caaaa651f7421ead4bb4" +checksum = "e0851c9d552594042db904adf283ef8293cfa1d6a930d81dcee894b41d8f35f3" dependencies = [ "byteorder", "bytes 1.0.1", "cc", "ckb-vm-definitions", "derive_more", - "goblin", + "goblin 0.2.3", + "goblin 0.4.0", "libc", "mapr", + "rand 0.7.3", "scroll", + "serde", ] [[package]] name = "ckb-vm-definitions" -version = "0.19.4" +version = "0.20.0-rc1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5dd4b68248ffd8283d693a477f9594d195ceac25f6aa7f98e99d1b8f43f9b3e" +checksum = "fbe88cb6b6f71813eeb83fc1fa5b91a8bf74740b69c4e6fce69b5f24613e633f" [[package]] name = "clap" @@ -1307,6 +1319,17 @@ dependencies = [ "scroll", ] +[[package]] +name = "goblin" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532a09cd3df2c6bbfc795fb0434bff8f22255d1d07328180e918a2e6ce122d4d" +dependencies = [ + "log", + "plain", + "scroll", +] + [[package]] name = "h2" version = "0.2.7" @@ -1636,7 +1659,7 @@ checksum = "a2f81014e2706fde057e9dcb1036cf6bbf9418d972c597be5c7158c984656722" dependencies = [ "derive_more", "futures 0.3.16", - "jsonrpc-core 17.1.0", + "jsonrpc-core", "jsonrpc-pubsub", "log", "serde", @@ -1644,19 +1667,6 @@ dependencies = [ "url 1.7.2", ] -[[package]] -name = "jsonrpc-core" -version = "14.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0747307121ffb9703afd93afbd0fb4f854c38fb873f2c8b90e0e902f27c7b62" -dependencies = [ - "futures 0.1.31", - "log", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "jsonrpc-core" version = "17.1.0" @@ -1702,7 +1712,7 @@ checksum = "522a047cac0958097ee71d047dd71cb84979fd2fa21c7a68fbe12736bef870a2" dependencies = [ "futures 0.3.16", "hyper 0.13.10", - "jsonrpc-core 17.1.0", + "jsonrpc-core", "jsonrpc-server-utils", "log", "net2", @@ -1717,7 +1727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14739e5523a40739882cc34a44ab2dd9356bce5ce102513f5984a9efbe342f3d" dependencies = [ "futures 0.3.16", - "jsonrpc-core 17.1.0", + "jsonrpc-core", "lazy_static", "log", "parking_lot", @@ -1734,7 +1744,7 @@ dependencies = [ "bytes 0.5.6", "futures 0.3.16", "globset", - "jsonrpc-core 17.1.0", + "jsonrpc-core", "lazy_static", "log", "tokio 0.2.25", diff --git a/Cargo.toml b/Cargo.toml index c4fed999..bd48de36 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "ckb-cli" -version = "0.43.0" +version = "0.100.0-rc2" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" description = "ckb command line interface" [dependencies] -ckb-jsonrpc-types = "=0.43.0" -ckb-hash = "=0.43.0" -ckb-crypto = { version = "=0.43.0", features = ["secp"] } -ckb-build-info = "=0.43.0" -ckb-types = "=0.43.0" -ckb-util = "=0.43.0" -ckb-resource = "=0.43.0" -ckb-dao-utils = "=0.43.0" -ckb-chain-spec = "=0.43.0" -ckb-sdk = { path = "ckb-sdk", version = "=0.43.0" } -ckb-index = { path = "ckb-index", version = "=0.43.0" } -plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=0.43.0" } +ckb-jsonrpc-types = "=0.100.0-rc2" +ckb-hash = "=0.100.0-rc2" +ckb-crypto = { version = "=0.100.0-rc2", features = ["secp"] } +ckb-build-info = "=0.100.0-rc2" +ckb-types = "=0.100.0-rc2" +ckb-util = "=0.100.0-rc2" +ckb-resource = "=0.100.0-rc2" +ckb-dao-utils = "=0.100.0-rc2" +ckb-chain-spec = "=0.100.0-rc2" +ckb-sdk = { path = "ckb-sdk", version = "=0.100.0-rc2" } +ckb-index = { path = "ckb-index", version = "=0.100.0-rc2" } +plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=0.100.0-rc2" } jsonrpc-core-client = "17" jsonrpc-core = "17" jsonrpc-derive = "17" @@ -61,7 +61,7 @@ tui = "0.6.0" termion = "1.5" [build-dependencies] -ckb-build-info = "=0.43.0" +ckb-build-info = "=0.100.0-rc2" [workspace] members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"] diff --git a/Makefile b/Makefile index d8761246..fddd5c74 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ ci: fmt clippy test security-audit git diff --exit-code Cargo.lock integration: - bash devtools/ci/integration.sh v0.42.0-rc1 + bash devtools/ci/integration.sh v0.100.0-rc2 prod: ## Build binary with release profile. cargo build --release diff --git a/README.md b/README.md index 4302df86..3129ce87 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ transactions_root: 0xc4991d3e261c27a0ce7ea9801de5f0a5f56ffb82a29d7a6e8e7cf44dbb2 witnesses_root: 0x39116bc1a56f5ca82cf5226f172f97ff8a8d9626ca7e41d8cd92e76666e069f8 proposals_hash: 0x0000000000000000000000000000000000000000000000000000000000000000 difficulty: 0x4000000 -uncles_hash: 0x0000000000000000000000000000000000000000000000000000000000000000 +extra_hash: 0x0000000000000000000000000000000000000000000000000000000000000000 uncles_count: "0" dao: 0x0100000000000000af9a31ce318a230000cc083d71c4350000d774f0356a0000 nonce: "1876243812404095811" diff --git a/ckb-index/Cargo.toml b/ckb-index/Cargo.toml index e050107e..45aaa3ca 100644 --- a/ckb-index/Cargo.toml +++ b/ckb-index/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-index" -version = "0.43.0" +version = "0.100.0-rc2" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -12,6 +12,6 @@ serde_derive = "1.0" bincode = "1.1.4" log = "0.4.6" failure = "0.1.5" -ckb-types = "=0.43.0" -ckb-sdk = { path = "../ckb-sdk", version = "=0.43.0" } +ckb-types = "=0.100.0-rc2" +ckb-sdk = { path = "../ckb-sdk", version = "=0.100.0-rc2" } rocksdb = { package = "ckb-rocksdb", version = "=0.15.1", features = ["snappy"] } diff --git a/ckb-sdk-types/Cargo.toml b/ckb-sdk-types/Cargo.toml index 2e783b55..963eb9a9 100644 --- a/ckb-sdk-types/Cargo.toml +++ b/ckb-sdk-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk-types" -version = "0.43.0" +version = "0.100.0-rc2" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -10,11 +10,11 @@ description = "ckb-cli sdk common types" serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" -ckb-types = "=0.43.0" -ckb-traits = "=0.43.0" -ckb-jsonrpc-types = "=0.43.0" -ckb-hash = "=0.43.0" -ckb-error = "=0.43.0" +ckb-types = "=0.100.0-rc2" +ckb-traits = "=0.100.0-rc2" +ckb-jsonrpc-types = "=0.100.0-rc2" +ckb-hash = "=0.100.0-rc2" +ckb-error = "=0.100.0-rc2" [dev-dependencies] -ckb-crypto = { version = "=0.43.0", features = ["secp"] } +ckb-crypto = { version = "=0.100.0-rc2", features = ["secp"] } diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index 8920cd3a..00982950 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "0.43.0" +version = "0.100.0-rc2" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -29,12 +29,14 @@ tokio-util = { version = "0.6", features = ["codec"] } tokio = { version = "1" } bytes = "1" futures = "0.3" +jsonrpc-core = "17" -ckb-types = "=0.43.0" -ckb-error = "=0.43.0" -ckb-script = "=0.43.0" -ckb-jsonrpc-types = "=0.43.0" -ckb-hash = "=0.43.0" -ckb-resource = "=0.43.0" -ckb-crypto = { version = "=0.43.0", features = ["secp"] } -ckb-sdk-types = { path = "../ckb-sdk-types", version="=0.43.0" } \ No newline at end of file +ckb-types = "=0.100.0-rc2" +ckb-error = "=0.100.0-rc2" +ckb-script = "=0.100.0-rc2" +ckb-jsonrpc-types = "=0.100.0-rc2" +ckb-chain-spec = "=0.100.0-rc2" +ckb-hash = "=0.100.0-rc2" +ckb-resource = "=0.100.0-rc2" +ckb-crypto = { version = "=0.100.0-rc2", features = ["secp"] } +ckb-sdk-types = { path = "../ckb-sdk-types", version="=0.100.0-rc2" } \ No newline at end of file diff --git a/ckb-sdk/src/pubsub/mod.rs b/ckb-sdk/src/pubsub/mod.rs index 1870303e..9b02b5a7 100644 --- a/ckb-sdk/src/pubsub/mod.rs +++ b/ckb-sdk/src/pubsub/mod.rs @@ -211,18 +211,18 @@ where // Since the current subscription state, the return value may be a notification, // we need to ensure that the unsubscribed message returns before jumping out - match serde_json::from_slice::(&resp) { + match serde_json::from_slice::(&resp) { Ok(output) => break output, Err(_) => self.pending_recv.push_back(resp), } }; match output { - ckb_jsonrpc_types::response::Output::Success(_) => { + jsonrpc_core::response::Output::Success(_) => { self.topic_list.remove(&id); Ok(()) } - ckb_jsonrpc_types::response::Output::Failure(e) => { + jsonrpc_core::response::Output::Failure(e) => { Err(io::Error::new(io::ErrorKind::InvalidData, e.error)) } } @@ -251,7 +251,7 @@ where let parse = |data: bytes::BytesMut, topic_list: &HashMap| -> io::Result<(String, F)> { - let output = serde_json::from_slice::(&data) + let output = serde_json::from_slice::(&data) .expect("must parse to notification"); let message = output .params @@ -309,14 +309,14 @@ async fn subscribe( loop { let resp = io.next().await; let resp = resp.ok_or_else::(|| io::ErrorKind::BrokenPipe.into())??; - match serde_json::from_slice::(&resp) { + match serde_json::from_slice::(&resp) { Ok(output) => match output { - ckb_jsonrpc_types::response::Output::Success(success) => { + jsonrpc_core::response::Output::Success(success) => { let res = serde_json::from_value::(success.result).unwrap(); topic_list.insert(res, topic.as_ref().to_owned()); break Ok(()); } - ckb_jsonrpc_types::response::Output::Failure(e) => { + jsonrpc_core::response::Output::Failure(e) => { return Err(io::Error::new(io::ErrorKind::InvalidData, e.error)) } }, diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index 19899192..0d8781f3 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -1,8 +1,8 @@ use ckb_jsonrpc_types::{ BannedAddr, Block, BlockNumber, BlockTemplate, BlockView, CellWithStatus, ChainInfo, Consensus, Cycle, EpochNumber, EpochView, ExtraLoggerConfig, HeaderView, JsonBytes, LocalNode, - MainLoggerConfig, OutPoint, RawTxPool, RemoteNode, Script, Timestamp, Transaction, - TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, + MainLoggerConfig, OutPoint, OutputsValidator, RawTxPool, RemoteNode, Script, Timestamp, + Transaction, TransactionProof, TransactionWithStatus, TxPoolInfo, Uint64, Version, }; use super::primitive; @@ -45,12 +45,12 @@ macro_rules! jsonrpc { req_json.insert("params".to_owned(), params); let resp = $selff.client.post($selff.url.clone()).json(&req_json).send()?; - let output = resp.json::()?; + let output = resp.json::()?; match output { - ckb_jsonrpc_types::response::Output::Success(success) => { + jsonrpc_core::response::Output::Success(success) => { serde_json::from_value(success.result).map_err(Into::into) }, - ckb_jsonrpc_types::response::Output::Failure(failure) => { + jsonrpc_core::response::Output::Failure(failure) => { Err(failure.error.into()) } } @@ -108,7 +108,7 @@ jsonrpc!(pub struct RawHttpRpcClient { pub fn ping_peers(&mut self) -> (); // Pool - pub fn send_transaction(&mut self, tx: Transaction) -> H256; + pub fn send_transaction(&mut self, tx: Transaction, outputs_validator: Option) -> H256; pub fn tx_pool_info(&mut self) -> TxPoolInfo; pub fn get_raw_tx_pool(&mut self, verbose: Option) -> RawTxPool; @@ -330,9 +330,13 @@ impl HttpRpcClient { } // Pool - pub fn send_transaction(&mut self, tx: packed::Transaction) -> Result { + pub fn send_transaction( + &mut self, + tx: packed::Transaction, + outputs_validator: Option, + ) -> Result { self.client - .send_transaction(tx.into()) + .send_transaction(tx.into(), outputs_validator) .map_err(|err| err.to_string()) } pub fn tx_pool_info(&mut self) -> Result { diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index 003a2d4b..b1dd191e 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -356,7 +356,7 @@ pub struct Header { pub parent_hash: H256, pub transactions_root: H256, pub proposals_hash: H256, - pub uncles_hash: H256, + pub extra_hash: H256, pub dao: Byte32, pub nonce: Uint128, } @@ -371,7 +371,7 @@ impl From for Header { parent_hash: json.parent_hash, transactions_root: json.transactions_root, proposals_hash: json.proposals_hash, - uncles_hash: json.uncles_hash, + extra_hash: json.extra_hash, dao: json.dao, nonce: json.nonce, } @@ -388,7 +388,7 @@ impl From
for packed::Header { transactions_root, proposals_hash, compact_target, - uncles_hash, + extra_hash, dao, nonce, } = json; @@ -401,7 +401,7 @@ impl From
for packed::Header { .transactions_root(transactions_root.pack()) .proposals_hash(proposals_hash.pack()) .compact_target(compact_target.pack()) - .uncles_hash(uncles_hash.pack()) + .extra_hash(extra_hash.pack()) .dao(dao.into()) .build(); packed::Header::new_builder() diff --git a/ckb-sdk/src/test-data/genesis_block.json b/ckb-sdk/src/test-data/genesis_block.json index e43e74cc..f09d7a13 100644 --- a/ckb-sdk/src/test-data/genesis_block.json +++ b/ckb-sdk/src/test-data/genesis_block.json @@ -10,7 +10,7 @@ "proposals_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "timestamp": "0x16d9a80e052", "transactions_root": "0x4338ea13c6eabc6392a31562131990996c9cd8df9e6c8f890a5799f2a73ec208", - "uncles_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extra_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "version": "0x0" }, "proposals": [], diff --git a/ckb-sdk/src/transaction.rs b/ckb-sdk/src/transaction.rs index 1bffc150..152ffd25 100644 --- a/ckb-sdk/src/transaction.rs +++ b/ckb-sdk/src/transaction.rs @@ -1,14 +1,19 @@ +use ckb_chain_spec::consensus::ConsensusBuilder; use ckb_error::OtherError; use ckb_hash::new_blake2b; use ckb_jsonrpc_types as rpc_types; -use ckb_script::TransactionScriptsVerifier; +use ckb_script::{TransactionScriptsVerifier, TxVerifyEnv}; use ckb_types::{ bytes::Bytes, - core::{cell::resolve_transaction, Capacity, Cycle, ScriptHashType}, + core::{ + cell::resolve_transaction, hardfork::HardForkSwitch, Capacity, Cycle, + EpochNumberWithFraction, HeaderView, ScriptHashType, + }, packed::{Byte32, CellInput, CellOutput, OutPoint, Script, WitnessArgs}, prelude::*, H160, H256, }; + use fnv::FnvHashSet; use std::collections::{HashMap, HashSet}; use std::convert::TryInto; @@ -157,7 +162,7 @@ impl<'a> MockTransactionHelper<'a> { let sighash_type_hash = genesis_info.sighash_type_hash(); let mut insert_dep = |hash_type, code_hash: &Byte32| -> Result<(), String> { match (hash_type, code_hash) { - (ScriptHashType::Data, data_hash) => { + (ScriptHashType::Data, data_hash) | (ScriptHashType::Data1, data_hash) => { let dep = data_deps.get(data_hash).cloned().ok_or_else(|| { format!("Can not find data hash in mock deps: {}", data_hash) })?; @@ -317,6 +322,25 @@ impl<'a> MockTransactionHelper<'a> { max_cycle: Cycle, loader: L, ) -> Result { + let (consensus, tx_env) = { + let enable_epoch_number = 200; + let commit_epoch_number = 200 + 100; + let epoch = EpochNumberWithFraction::new(commit_epoch_number, 0, 1); + let header = HeaderView::new_advanced_builder() + .epoch(epoch.pack()) + .build(); + let tx_env = TxVerifyEnv::new_commit(&header); + let hardfork_switch = HardForkSwitch::new_without_any_enabled() + .as_builder() + .rfc_0232(enable_epoch_number) + .build() + .unwrap(); + let consensus = ConsensusBuilder::default() + .hardfork_switch(hardfork_switch) + .build(); + (consensus, tx_env) + }; + let resource = Resource::from_both(self.mock_tx, loader)?; let tx = self.mock_tx.core_transaction(); let rtx = { @@ -325,7 +349,7 @@ impl<'a> MockTransactionHelper<'a> { .map_err(|err| format!("Resolve transaction error: {:?}", err))? }; - let mut verifier = TransactionScriptsVerifier::new(&rtx, &resource); + let mut verifier = TransactionScriptsVerifier::new(&rtx, &consensus, &resource, &tx_env); verifier.set_debug_printer(|script_hash, message| { println!("script: {:x}, debug: {}", script_hash, message); }); diff --git a/ckb-sdk/src/types/address.rs b/ckb-sdk/src/types/address.rs index 00248692..90e04740 100644 --- a/ckb-sdk/src/types/address.rs +++ b/ckb-sdk/src/types/address.rs @@ -91,7 +91,7 @@ impl AddressPayload { match self { AddressPayload::Short { .. } => AddressType::Short, AddressPayload::Full { hash_type, .. } => match hash_type { - ScriptHashType::Data => AddressType::FullData, + ScriptHashType::Data | ScriptHashType::Data1 => AddressType::FullData, ScriptHashType::Type => AddressType::FullType, }, } diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index 9b58e1a9..7ab449ad 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-cli-plugin-protocol" -version = "0.43.0" +version = "0.100.0-rc2" authors = ["Nervos Core Dev "] edition = "2018" license = "MIT" @@ -9,9 +9,9 @@ description = "ckb-cli plugin protocol" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ckb-index = { path = "../ckb-index", version = "=0.43.0" } -ckb-types = "=0.43.0" -ckb-jsonrpc-types = "=0.43.0" +ckb-index = { path = "../ckb-index", version = "=0.100.0-rc2" } +ckb-types = "=0.100.0-rc2" +ckb-jsonrpc-types = "=0.100.0-rc2" serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/src/subcommands/dao/util.rs b/src/subcommands/dao/util.rs index 3be33c1a..3ddffa1e 100644 --- a/src/subcommands/dao/util.rs +++ b/src/subcommands/dao/util.rs @@ -106,7 +106,7 @@ pub(crate) fn send_transaction( ); } - let resp = rpc_client.send_transaction(transaction.data())?; + let resp = rpc_client.send_transaction(transaction.data(), None)?; Ok(Output::new_output(resp)) } diff --git a/src/subcommands/mock_tx.rs b/src/subcommands/mock_tx.rs index ebe62ce6..ec71f95f 100644 --- a/src/subcommands/mock_tx.rs +++ b/src/subcommands/mock_tx.rs @@ -409,7 +409,10 @@ impl<'a> CliSubCommand for MockTxSubCommand<'a> { let (mock_tx, _cycle) = complete_tx(m, false, true)?; let resp = self .rpc_client - .send_transaction(mock_tx.core_transaction().data()) + .send_transaction( + mock_tx.core_transaction().data(), + Some(json_types::OutputsValidator::Passthrough), + ) .map_err(|err| format!("Send transaction error: {}", err))?; Ok(Output::new_output(resp)) } diff --git a/src/subcommands/molecule.rs b/src/subcommands/molecule.rs index f0e67b9e..d1da9e3e 100644 --- a/src/subcommands/molecule.rs +++ b/src/subcommands/molecule.rs @@ -398,7 +398,7 @@ struct RawHeader { pub epoch: json_types::EpochNumberWithFraction, pub transactions_root: H256, pub proposals_hash: H256, - pub uncles_hash: H256, + pub extra_hash: H256, pub dao: json_types::Byte32, } @@ -413,7 +413,7 @@ impl From for RawHeader { transactions_root: input.transactions_root().unpack(), proposals_hash: input.proposals_hash().unpack(), compact_target: input.compact_target().unpack(), - uncles_hash: input.uncles_hash().unpack(), + extra_hash: input.extra_hash().unpack(), dao: input.dao().into(), } } @@ -430,7 +430,7 @@ impl From for packed::RawHeader { .transactions_root(json.transactions_root.pack()) .proposals_hash(json.proposals_hash.pack()) .compact_target(json.compact_target.pack()) - .uncles_hash(json.uncles_hash.pack()) + .extra_hash(json.extra_hash.pack()) .dao(json.dao.into()) .build() } diff --git a/src/subcommands/tx.rs b/src/subcommands/tx.rs index 1d98774e..df946494 100644 --- a/src/subcommands/tx.rs +++ b/src/subcommands/tx.rs @@ -557,7 +557,7 @@ impl<'a> CliSubCommand for TxSubCommand<'a> { } let resp = self .rpc_client - .send_transaction(tx.data()) + .send_transaction(tx.data(), Some(json_types::OutputsValidator::Passthrough)) .map_err(|err| format!("Send transaction error: {}", err))?; Ok(Output::new_output(resp)) } diff --git a/src/subcommands/wallet/mod.rs b/src/subcommands/wallet/mod.rs index 5cbdf2d1..3c571764 100644 --- a/src/subcommands/wallet/mod.rs +++ b/src/subcommands/wallet/mod.rs @@ -482,9 +482,14 @@ impl<'a> WalletSubCommand<'a> { helper.add_signature(lock_arg, signature)?; } let tx = helper.build_tx(&mut get_live_cell_fn, skip_check)?; + let outputs_validator = if is_type_id || skip_check || skip_check_to_address { + Some(json_types::OutputsValidator::Passthrough) + } else { + None + }; let tx_hash = self .rpc_client - .send_transaction(tx.data()) + .send_transaction(tx.data(), outputs_validator) .map_err(|err| format!("Send transaction error: {}", err))?; assert_eq!(tx.hash(), tx_hash.pack()); Ok(tx) diff --git a/test/Cargo.toml b/test/Cargo.toml index fcc302eb..031598e9 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cli-test" -version = "0.43.0" +version = "0.100.0-rc2" authors = ["Linfeng Qian "] edition = "2018" @@ -13,12 +13,12 @@ log = "0.4" env_logger = "0.6" toml = "0.5.0" serde_yaml = "0.8.9" -ckb-sdk = { path = "../ckb-sdk", version = "0.43.0" } -ckb-types = "=0.43.0" -ckb-app-config = "=0.43.0" -ckb-chain-spec = "=0.43.0" -ckb-crypto = { version = "=0.43.0", features = ["secp"] } -ckb-hash = "=0.43.0" +ckb-sdk = { path = "../ckb-sdk", version = "0.100.0-rc2" } +ckb-types = "=0.100.0-rc2" +ckb-app-config = "=0.100.0-rc2" +ckb-chain-spec = "=0.100.0-rc2" +ckb-crypto = { version = "=0.100.0-rc2", features = ["secp"] } +ckb-hash = "=0.100.0-rc2" regex = "1.1.6" # Prevent this from interfering with workspaces diff --git a/test/src/setup.rs b/test/src/setup.rs index 1ec84e75..895bdd6b 100644 --- a/test/src/setup.rs +++ b/test/src/setup.rs @@ -107,7 +107,7 @@ impl Setup { fn modify_ckb_toml(&self, spec: &dyn Spec) { let path = Path::new(&self.ckb_dir).join("ckb.toml"); let content = fs::read_to_string(&path).unwrap(); - let mut ckb_toml: CKBAppConfig = toml::from_str(&content).unwrap(); + let mut ckb_toml: CKBAppConfig = CKBAppConfig::load_from_slice(content.as_bytes()).unwrap(); // Setup [block_assembler] ckb_toml.block_assembler = Some(Miner::block_assembler()); diff --git a/test/src/spec/plugin.rs b/test/src/spec/plugin.rs index 2144c733..1c05e265 100644 --- a/test/src/spec/plugin.rs +++ b/test/src/spec/plugin.rs @@ -59,8 +59,12 @@ impl Spec for Plugin { assert_eq!(privkey_content, "0303030303030303030303030303030303030303030303030303030303030303\n0404040404040404040404040404040404040404040404040404040404040404"); let output = setup.cli(&format!("wallet transfer --from-account {} --to-address ckt1qyqt8xaupvm8837nv3gtc9x0ekkj64vud3jq5t63cs --capacity 1000 --tx-fee 0.1", Miner::address())); - // Means the signature is filled but is wrong: https://github.com/nervosnetwork/ckb-system-scripts/wiki/Error-codes - assert!(output.contains("ValidationFailure(-31)")); + // Means the signature is filled but is wrong: https://nervosnetwork.github.io/ckb-script-error-codes/by-data-hash/709f3fda12f561cfacf92273c57a98fede188a3f1a59b1f888d113f9cce08649.html#-31 + assert!( + output.contains("cause: ValidationFailure: see the error code -31 in the page"), + "{}", + output + ); let output = setup .cli("account extended-address --lock-arg 0xef8484612fefa725097ecef6dce0e19e0d77fb79");