From 108f089e138b9f8a4d9bbfec57bb4ded1b6f6534 Mon Sep 17 00:00:00 2001 From: Linfeng Qian Date: Mon, 21 Jun 2021 17:53:15 +0800 Subject: [PATCH] chore: update ckb to 0.43 BREAKING CHANGE: Remove rpc method get_cellbase_output_capacity_details --- Cargo.lock | 189 ++++++++++++++------------------ Cargo.toml | 30 ++--- Makefile | 10 +- ckb-index/Cargo.toml | 8 +- ckb-index/src/index/key.rs | 12 +- ckb-index/src/index/mod.rs | 2 +- ckb-sdk-types/Cargo.toml | 16 +-- ckb-sdk/Cargo.toml | 20 ++-- ckb-sdk/src/rpc/client.rs | 16 +-- ckb-sdk/src/rpc/mod.rs | 10 +- ckb-sdk/src/rpc/types.rs | 31 ------ ckb-sdk/src/types/address.rs | 21 ++-- ckb-sdk/src/wallet/bip32.rs | 8 +- ckb-sdk/src/wallet/error.rs | 2 +- plugin-protocol/Cargo.toml | 10 +- plugin-protocol/src/convert.rs | 9 -- plugin-protocol/src/lib.rs | 4 +- plugin-protocol/src/method.rs | 2 - rust-toolchain | 2 +- src/main.rs | 7 +- src/plugin/builtin.rs | 12 +- src/plugin/manager.rs | 17 +-- src/subcommands/dao/builder.rs | 14 +-- src/subcommands/dao/mod.rs | 2 +- src/subcommands/rpc.rs | 32 +----- src/subcommands/tx.rs | 8 +- src/subcommands/util.rs | 10 +- src/subcommands/wallet/index.rs | 6 +- src/utils/completer.rs | 2 +- src/utils/index.rs | 24 +--- src/utils/other.rs | 6 +- src/utils/yaml_ser.rs | 56 +++++----- test/Cargo.toml | 14 +-- test/src/spec/dao.rs | 9 +- test/src/spec/wallet.rs | 2 +- 35 files changed, 248 insertions(+), 375 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 545c2ada..e5760164 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,15 +280,15 @@ name = "bytes" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" -dependencies = [ - "serde", -] [[package]] name = "bytes" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +dependencies = [ + "serde", +] [[package]] name = "cassowary" @@ -341,15 +341,15 @@ dependencies = [ [[package]] name = "ckb-build-info" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaaaacce0931fa7eb810de6cfc5de4736cf39e3744fd0ba8bff2999858c3d34e" +checksum = "14fcc6207eef9a1f0b51413fecaffaba7809a03b516d704d7ce935b61e003c18" [[package]] name = "ckb-chain-spec" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c3d6d98f6c8592932c061a278e017cd600bdb4d944c93972f2986eafdf2026" +checksum = "3e6bcbee936135cb6385867c77ae6a010e2ad898aedc627ab0ab078b7be15dbd" dependencies = [ "ckb-crypto", "ckb-dao-utils", @@ -367,16 +367,16 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b3207ab3dc8839b992bdc3abe168de0f66b5264ce433568499ae3ca8e3f043" +checksum = "6d9b8a0d84e40deb3b7d2ad153f1313bd7ae890a2a8ac1e2f87ce07d5ad37a32" dependencies = [ "crossbeam-channel", ] [[package]] name = "ckb-cli" -version = "0.42.1" +version = "0.43.0" dependencies = [ "ansi_term", "atty", @@ -431,7 +431,7 @@ dependencies = [ [[package]] name = "ckb-cli-plugin-protocol" -version = "0.42.1" +version = "0.43.0" dependencies = [ "ckb-index", "ckb-jsonrpc-types", @@ -444,12 +444,12 @@ dependencies = [ [[package]] name = "ckb-crypto" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a314bde06f29f906aeba70942cb11bfdd07679a025fa5869e43206b3c306cc" +checksum = "c23fb466dd3511efe3aedfdddbca626f18221e2e7ccd5c9a26956042665c043e" dependencies = [ "ckb-fixed-hash", - "faster-hex 0.4.1", + "faster-hex 0.6.0", "lazy_static", "rand 0.7.3", "secp256k1", @@ -458,9 +458,9 @@ dependencies = [ [[package]] name = "ckb-dao-utils" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "259144017b59c2ecfbf3eba9fe0088059a3fb476ca1e029692f937bad74d5529" +checksum = "e06a6e833294cb27f8da7c0d302a6c2f9e777fd70884cbedcaab5c641501331f" dependencies = [ "byteorder", "ckb-error", @@ -469,9 +469,9 @@ dependencies = [ [[package]] name = "ckb-error" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95122d1d3a75c7ad02e60dcb7bc1ce43cc23dc6939bfeae340aa088637ea311" +checksum = "58559e6acb083fbdf222c282416dda60a35db2507da65788333a331d9b9f74f4" dependencies = [ "anyhow", "ckb-occupied-capacity", @@ -481,9 +481,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1767eb66f487a0b1900ba4c81a244885cddac378bccf524c4b94372391241f6b" +checksum = "bf5d3266a67e9e59de592540895a71541f381194d4e91eb83d783b631d1ad2b3" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -491,20 +491,20 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8398353fbc7a09c67470eafd2aa6decaeb81bb1860dd077c71022abf77bd01" +checksum = "2c5fa9ee9e7c100ce2c645182ee4a495d71971d3193ce8eeffabf2b26f401674" dependencies = [ - "faster-hex 0.4.1", + "faster-hex 0.6.0", "serde", "thiserror", ] [[package]] name = "ckb-fixed-hash-macros" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de82af1bf5bd7c202386326fc4fdea481a2d3b737e881a7dffaedce324531b3" +checksum = "b2e569adf7436b5d6c651df449bf6415f3377cf90aedfe4bb439ff9a4fa90ea4" dependencies = [ "ckb-fixed-hash-core", "proc-macro2", @@ -514,9 +514,9 @@ dependencies = [ [[package]] name = "ckb-hash" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4087c33ba7477417a984f3a742f0d61b79db1ae4e26c3b5ada473cecfc34d609" +checksum = "2decd1914e05f50fc69156f8f74b710aa8d5217d300f40875cacfe55d37e1394" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "ckb-index" -version = "0.42.1" +version = "0.43.0" dependencies = [ "bincode", "ckb-rocksdb", @@ -538,12 +538,12 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee5a15ecb996b7139edd099e58ad7511192ebda9f27917d82922a9423958996" +checksum = "104ed751a955058782af060ae430c4fd5da2a8dfc49ece375e93a43818b967e3" dependencies = [ "ckb-types", - "faster-hex 0.4.1", + "faster-hex 0.6.0", "jsonrpc-core 14.2.0", "serde", "serde_json", @@ -562,18 +562,18 @@ dependencies = [ [[package]] name = "ckb-logger" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732ae1f9d0b61f68b7cd3bf6eeeb1b2019b950abd8e3e759e2d26226c9212f03" +checksum = "284e4f2a91ea186c337485f9da48ae95dc7dc1ef77c64161aad507e3bb6331a7" dependencies = [ "log", ] [[package]] name = "ckb-occupied-capacity" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c6f011da1c92a71fe8f6d6819dbe55b7c86c3c589b2557c6b5aa9a9dc3cecd" +checksum = "be7a7388d783e275a4191ca90373d2d0622add8584e373d5ce54a43fcdb84636" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -581,18 +581,18 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4ae2960352d5bfef9ac3ba6a4dc4823f688ec63ee2f9d696f6b9fa71ff0fd1" +checksum = "eee2140566e0bcd569ba7ed2ffc11bef4a25baf2c4bb8a25a95e3af9c5297b7c" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2d510805c4046a5fe92b7745eb2a8c348831959511410c61476bacfb681a0" +checksum = "5404109aa77fb77c5589fed71ff8af23020f76a0c8f5b49797687b77d9f1b399" dependencies = [ "ckb-occupied-capacity-core", "quote", @@ -601,9 +601,9 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdef4b2303d2c67b0b1f930a7394c62afdff2758b6dc1f3c0a5bfe0d6174e66c" +checksum = "24e5026e94c161908f0a4229dd530d9ab1957b6a341153c0d75888be22c01cb9" dependencies = [ "byteorder", "ckb-hash", @@ -615,9 +615,9 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9542a3502fdd076036c31febe172df08a2fab78ee3775ad84401b2e35c42056e" +checksum = "04ec9fdc7d73d97a16766a7ea421f65a1a1996a3dd29d98596f72511d0105531" dependencies = [ "numext-fixed-uint", "serde", @@ -625,9 +625,9 @@ dependencies = [ [[package]] name = "ckb-resource" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8376b8dba145efc86802923b5576c2b6902ead1b4a5cdff4caec0db7d7b8d3d" +checksum = "2528c53487d7f0fce177c1124ed81fb81970cedb64d14380a1093ba3be5e8886" dependencies = [ "ckb-system-scripts", "ckb-types", @@ -652,9 +652,9 @@ dependencies = [ [[package]] name = "ckb-script" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6b279bde94ffe01e77a1a7042d9b9bcb781326c6c9c5132960e745a07f0e6a" +checksum = "6fff32929465afdaf63031323afe619265ff5e4e23b91350ff2b239f3c3cf6ed" dependencies = [ "byteorder", "ckb-chain-spec", @@ -665,14 +665,14 @@ dependencies = [ "ckb-types", "ckb-vm", "ckb-vm-definitions", - "faster-hex 0.4.1", + "faster-hex 0.6.0", "goblin", "serde", ] [[package]] name = "ckb-sdk" -version = "0.42.1" +version = "0.43.0" dependencies = [ "aes-ctr", "bech32", @@ -708,7 +708,7 @@ dependencies = [ [[package]] name = "ckb-sdk-types" -version = "0.42.1" +version = "0.43.0" dependencies = [ "ckb-crypto", "ckb-error", @@ -722,12 +722,12 @@ dependencies = [ [[package]] name = "ckb-system-scripts" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261dd95a93c09ea24397c85b4fbca061e1da2d6573189749aeb99fe840aaf0c9" +checksum = "cfbce46ad2de7563c7e456888d4a29df3d461106a989836c08627d044409e928" dependencies = [ "blake2b-rs", - "faster-hex 0.3.1", + "faster-hex 0.6.0", "includedir", "includedir_codegen", "phf", @@ -735,21 +735,21 @@ dependencies = [ [[package]] name = "ckb-traits" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0b9e189491a26e5a6cea88d8af4ca22a0c6367aef2e0d1881547e482808d12" +checksum = "ae497445ed00428bed649ee47fbcd563501f40a3344cb7e46e96e24edd863398" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b20fae4c3f7b4b0fe6d483fb924592f9a26f74fd8598e1e9d5730b34a6fe3066" +checksum = "2468390210f63c96bec68ec98b4e99b173ade5d9abde60582c5f318b96b57f8a" dependencies = [ "bit-vec", - "bytes 0.5.6", + "bytes 1.0.1", "ckb-channel", "ckb-error", "ckb-fixed-hash", @@ -765,23 +765,23 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63404867d81d0f872c15cb6309ba357bb1b305c8dd7bf8bd779b9d485db9ba21" +checksum = "ad697237465879640be333df47c339d3d021312d5d13bea72cea31175f28c17f" dependencies = [ "linked-hash-map", - "parking_lot 0.10.2", + "parking_lot", "regex", ] [[package]] name = "ckb-vm" -version = "0.19.3" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc2fb181a6653bb13315dc7f60fbe32cd3d697553b24687613da984faf2a2c5" +checksum = "2f4b7a3a2f19771d379884030417094c55986ccbc0d5caaaa651f7421ead4bb4" dependencies = [ "byteorder", - "bytes 0.5.6", + "bytes 1.0.1", "cc", "ckb-vm-definitions", "derive_more", @@ -793,9 +793,9 @@ dependencies = [ [[package]] name = "ckb-vm-definitions" -version = "0.19.3" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea76d3867d00736c64876ab0cd304be73691b91990a90ebbf100d36af85fdb05" +checksum = "f5dd4b68248ffd8283d693a477f9594d195ceac25f6aa7f98e99d1b8f43f9b3e" [[package]] name = "clap" @@ -1068,6 +1068,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348138dd23e03bb0018caef99647fb1a5befec5ff4b501991de88f09854d4c28" +[[package]] +name = "faster-hex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b02a61fea82de8484f9d7ce99b698b0e190ef8de71035690a961a43d7b18a2ad" + [[package]] name = "flate2" version = "1.0.20" @@ -1698,7 +1704,7 @@ dependencies = [ "jsonrpc-server-utils", "log", "net2", - "parking_lot 0.11.1", + "parking_lot", "unicase", ] @@ -1712,7 +1718,7 @@ dependencies = [ "jsonrpc-core 17.0.0", "lazy_static", "log", - "parking_lot 0.11.1", + "parking_lot", "rand 0.7.3", "serde", ] @@ -1768,15 +1774,6 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "lock_api" version = "0.4.4" @@ -1897,13 +1894,13 @@ dependencies = [ [[package]] name = "molecule" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "663f76cc52219e5957e2f5563cce9d89f98aa8503c9c898b5c412d97df663998" +checksum = "c58d1147f4d0d51ce72c56a6099ae5dbfd007b250271bb965f82dd10fca2bf02" dependencies = [ - "bytes 0.5.6", - "cfg-if 0.1.10", - "faster-hex 0.4.1", + "bytes 1.0.1", + "cfg-if 1.0.0", + "faster-hex 0.6.0", ] [[package]] @@ -2133,16 +2130,6 @@ dependencies = [ "unsigned-varint", ] -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - [[package]] name = "parking_lot" version = "0.11.1" @@ -2150,22 +2137,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", - "lock_api 0.4.4", - "parking_lot_core 0.8.3", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi 0.3.9", + "lock_api", + "parking_lot_core", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 61f3e3ef..42c856cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,24 @@ [package] name = "ckb-cli" -version = "0.42.1" +version = "0.43.0" license = "MIT" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" description = "ckb command line interface" [dependencies] -ckb-jsonrpc-types = "=0.42.0" -ckb-hash = "=0.42.0" -ckb-crypto = { version = "=0.42.0", features = ["secp"] } -ckb-build-info = "=0.42.0" -ckb-types = "=0.42.0" -ckb-util = "=0.42.0" -ckb-resource = "=0.42.0" -ckb-dao-utils = "=0.42.0" -ckb-chain-spec = "=0.42.0" -ckb-sdk = { path = "ckb-sdk", version = "=0.42.1" } -ckb-index = { path = "ckb-index", version = "=0.42.1" } -plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=0.42.1" } +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" } jsonrpc-core-client = "17" jsonrpc-core = "17" jsonrpc-derive = "17" @@ -30,7 +30,7 @@ env_logger = "0.6" crossbeam-channel = "0.3" clap = "=3.0.0-beta.1" clap_generate = "=3.0.0-beta.1" -serde = { version = "1.0", features = ["rc"] } +serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" serde_yaml = "0.8.9" @@ -61,7 +61,7 @@ tui = "0.6.0" termion = "1.5" [build-dependencies] -ckb-build-info = "=0.42.0" +ckb-build-info = "=0.43.0" [workspace] members = ["ckb-sdk", "ckb-index", "ckb-sdk-types", "plugin-protocol"] diff --git a/Makefile b/Makefile index df40a1e5..d8761246 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,17 @@ -CLIPPY_OPTS := -A clippy::mutable_key_type +# -D clippy::fallible_impl_from +CLIPPY_OPTS := -D warnings -D clippy::clone_on_ref_ptr -D clippy::enum_glob_use \ + -A clippy::mutable_key_type -A clippy::upper_case_acronyms fmt: cargo fmt --all -- --check cd test && cargo fmt --all -- --check clippy: - RUSTFLAGS='-F warnings' cargo clippy --all --tests -- ${CLIPPY_OPTS} - cp -f Cargo.lock test/Cargo.lock && cd test && RUSTFLAGS='-F warnings' cargo clippy --all -- ${CLIPPY_OPTS} + cargo clippy --all --all-targets --all-features -- ${CLIPPY_OPTS} + cp -f Cargo.lock test/Cargo.lock && cd test && cargo clippy --all -- ${CLIPPY_OPTS} test: - RUSTFLAGS='-F warnings' RUST_BACKTRACE=full cargo test --all + RUST_BACKTRACE=full cargo test --all ci: fmt clippy test security-audit git diff --exit-code Cargo.lock diff --git a/ckb-index/Cargo.toml b/ckb-index/Cargo.toml index 3f689d37..e050107e 100644 --- a/ckb-index/Cargo.toml +++ b/ckb-index/Cargo.toml @@ -1,17 +1,17 @@ [package] name = "ckb-index" -version = "0.42.1" +version = "0.43.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" description = "ckb-cli index database" [dependencies] -serde = { version = "1.0", features = ["rc"] } +serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" bincode = "1.1.4" log = "0.4.6" failure = "0.1.5" -ckb-types = "=0.42.0" -ckb-sdk = { path = "../ckb-sdk", version = "=0.42.1" } +ckb-types = "=0.43.0" +ckb-sdk = { path = "../ckb-sdk", version = "=0.43.0" } rocksdb = { package = "ckb-rocksdb", version = "=0.15.1", features = ["snappy"] } diff --git a/ckb-index/src/index/key.rs b/ckb-index/src/index/key.rs index d299f2a6..a0382ffc 100644 --- a/ckb-index/src/index/key.rs +++ b/ckb-index/src/index/key.rs @@ -489,15 +489,15 @@ impl Key { } } -impl Into> for &Key { - fn into(self) -> Vec { - self.to_bytes() +impl From<&Key> for Vec { + fn from(key: &Key) -> Vec { + key.to_bytes() } } -impl Into> for Key { - fn into(self) -> Vec { - (&self).into() +impl From for Vec { + fn from(key: Key) -> Vec { + From::from(&key) } } diff --git a/ckb-index/src/index/mod.rs b/ckb-index/src/index/mod.rs index e0ee464d..83e7e649 100644 --- a/ckb-index/src/index/mod.rs +++ b/ckb-index/src/index/mod.rs @@ -121,7 +121,7 @@ impl<'a> IndexDatabase<'a> { reader .get(&Key::BlockDelta(last_header.number()).to_bytes()) .map(|bytes| bincode::deserialize(&bytes).unwrap()) - .ok_or_else(|| IndexError::LongFork)? + .ok_or(IndexError::LongFork)? }; let mut txn = RocksTxn::new(self.db, self.cf); last_block_delta.rollback(&mut txn); diff --git a/ckb-sdk-types/Cargo.toml b/ckb-sdk-types/Cargo.toml index 1bb8e748..2e783b55 100644 --- a/ckb-sdk-types/Cargo.toml +++ b/ckb-sdk-types/Cargo.toml @@ -1,20 +1,20 @@ [package] name = "ckb-sdk-types" -version = "0.42.1" +version = "0.43.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" description = "ckb-cli sdk common types" [dependencies] -serde = { version = "1.0", features = ["rc"] } +serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" -ckb-types = "=0.42.0" -ckb-traits = "=0.42.0" -ckb-jsonrpc-types = "=0.42.0" -ckb-hash = "=0.42.0" -ckb-error = "=0.42.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" [dev-dependencies] -ckb-crypto = { version = "=0.42.0", features = ["secp"] } +ckb-crypto = { version = "=0.43.0", features = ["secp"] } diff --git a/ckb-sdk/Cargo.toml b/ckb-sdk/Cargo.toml index 6c6c321a..add1d402 100644 --- a/ckb-sdk/Cargo.toml +++ b/ckb-sdk/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "ckb-sdk" -version = "0.42.1" +version = "0.43.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" description = "ckb-cli sdk" [dependencies] -serde = { version = "1.0", features = ["rc"] } +serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" bech32 = "0.6.0" @@ -30,11 +30,11 @@ tokio = { version = "1" } bytes = "1" futures = "0.3" -ckb-types = "=0.42.0" -ckb-error = "=0.42.0" -ckb-script = "=0.42.0" -ckb-jsonrpc-types = "=0.42.0" -ckb-hash = "=0.42.0" -ckb-resource = "=0.42.0" -ckb-crypto = { version = "=0.42.0", features = ["secp"] } -ckb-sdk-types = { path = "../ckb-sdk-types", version="=0.42.1" } \ No newline at end of file +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 diff --git a/ckb-sdk/src/rpc/client.rs b/ckb-sdk/src/rpc/client.rs index c2ee8133..19899192 100644 --- a/ckb-sdk/src/rpc/client.rs +++ b/ckb-sdk/src/rpc/client.rs @@ -1,7 +1,7 @@ use ckb_jsonrpc_types::{ - BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, CellWithStatus, - ChainInfo, Consensus, Cycle, EpochNumber, EpochView, ExtraLoggerConfig, HeaderView, JsonBytes, - LocalNode, MainLoggerConfig, OutPoint, RawTxPool, RemoteNode, Script, Timestamp, Transaction, + 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, }; @@ -70,7 +70,6 @@ jsonrpc!(pub struct RawHttpRpcClient { pub fn get_block(&mut self, hash: H256) -> Option; pub fn get_block_by_number(&mut self, number: BlockNumber) -> Option; pub fn get_block_hash(&mut self, number: BlockNumber) -> Option; - pub fn get_cellbase_output_capacity_details(&mut self, hash: H256) -> Option; pub fn get_current_epoch(&mut self) -> EpochView; pub fn get_epoch_by_number(&mut self, number: EpochNumber) -> Option; pub fn get_header(&mut self, hash: H256) -> Option; @@ -171,15 +170,6 @@ impl HttpRpcClient { .map(|opt| opt.map(Into::into)) .map_err(|err| err.to_string()) } - pub fn get_cellbase_output_capacity_details( - &mut self, - hash: H256, - ) -> Result, String> { - self.client - .get_cellbase_output_capacity_details(hash) - .map(|opt| opt.map(Into::into)) - .map_err(|err| err.to_string()) - } pub fn get_current_epoch(&mut self) -> Result { self.client .get_current_epoch() diff --git a/ckb-sdk/src/rpc/mod.rs b/ckb-sdk/src/rpc/mod.rs index 453338ff..c14b87ac 100644 --- a/ckb-sdk/src/rpc/mod.rs +++ b/ckb-sdk/src/rpc/mod.rs @@ -5,9 +5,9 @@ mod types; pub use client::{HttpRpcClient, RawHttpRpcClient}; pub use primitive::{Capacity, EpochNumberWithFraction, Since, Timestamp}; pub use types::{ - Alert, AlertMessage, BannedAddr, Block, BlockReward, BlockView, Byte32, CellDep, CellInput, - CellOutput, ChainInfo, DepType, EpochView, Header, HeaderView, JsonBytes, LocalNode, - MerkleProof, NodeAddress, OutPoint, ProposalShortId, RemoteNode, Script, ScriptHashType, - Transaction, TransactionProof, TransactionView, TransactionWithStatus, TxPoolInfo, TxStatus, - Uint128, UncleBlock, UncleBlockView, + Alert, AlertMessage, BannedAddr, Block, BlockView, Byte32, CellDep, CellInput, CellOutput, + ChainInfo, DepType, EpochView, Header, HeaderView, JsonBytes, LocalNode, MerkleProof, + NodeAddress, OutPoint, ProposalShortId, RemoteNode, Script, ScriptHashType, Transaction, + TransactionProof, TransactionView, TransactionWithStatus, TxPoolInfo, TxStatus, Uint128, + UncleBlock, UncleBlockView, }; diff --git a/ckb-sdk/src/rpc/types.rs b/ckb-sdk/src/rpc/types.rs index e4390bab..003a2d4b 100644 --- a/ckb-sdk/src/rpc/types.rs +++ b/ckb-sdk/src/rpc/types.rs @@ -568,37 +568,6 @@ impl From for EpochView { } } -#[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Hash, Debug)] -pub struct BlockReward { - pub total: Capacity, - pub primary: Capacity, - pub secondary: Capacity, - pub tx_fee: Capacity, - pub proposal_reward: Capacity, -} -impl From for BlockReward { - fn from(json: rpc_types::BlockReward) -> BlockReward { - BlockReward { - total: json.total.into(), - primary: json.primary.into(), - secondary: json.secondary.into(), - tx_fee: json.tx_fee.into(), - proposal_reward: json.proposal_reward.into(), - } - } -} -impl From for core::BlockReward { - fn from(json: BlockReward) -> Self { - Self { - total: core::Capacity::shannons(json.total.0), - primary: core::Capacity::shannons(json.primary.0), - secondary: core::Capacity::shannons(json.secondary.0), - tx_fee: core::Capacity::shannons(json.tx_fee.0), - proposal_reward: core::Capacity::shannons(json.proposal_reward.0), - } - } -} - #[derive(Clone, Default, Serialize, Deserialize, PartialEq, Eq, Hash, Debug)] pub struct TransactionProof { /// Block hash diff --git a/ckb-sdk/src/types/address.rs b/ckb-sdk/src/types/address.rs index 3b77a585..00248692 100644 --- a/ckb-sdk/src/types/address.rs +++ b/ckb-sdk/src/types/address.rs @@ -179,6 +179,7 @@ impl From<&AddressPayload> for Script { } impl From