diff --git a/Cargo.lock b/Cargo.lock index 2ebd5a15..238a5295 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -534,15 +534,15 @@ dependencies = [ [[package]] name = "ckb-build-info" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f676ddce37812148df8a188ac0c04b508812ba56afdf310d7999e5a68f91973" +checksum = "eca18f6c998bac413cdc07481257d96e00c38a5bec48b492559dc58381644480" [[package]] name = "ckb-chain-spec" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e8e0a043138e2dadf851d7c7c3377846951a9f35e28de0d27b1810fe759a70" +checksum = "09a05c9a585f23869ad2394d006a42fb6746de499d91a2d5e302139ada37578d" dependencies = [ "cacache", "ckb-constant", @@ -563,9 +563,9 @@ dependencies = [ [[package]] name = "ckb-channel" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcdf3f5242842f1735bfa1e38755f679ac071b2b451e0e8b87b9a80bf6147767" +checksum = "c2fd0ddde8f1b686e5b484cb0e1eb7cb1151f54665f28ae610b75cc4309caf84" dependencies = [ "crossbeam-channel", ] @@ -583,6 +583,7 @@ dependencies = [ "chrono", "ckb-build-info", "ckb-chain-spec", + "ckb-channel", "ckb-cli-plugin-protocol", "ckb-crypto", "ckb-error", @@ -647,15 +648,18 @@ dependencies = [ [[package]] name = "ckb-constant" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f4de41ddef453148c70bde26afc1cc26d2e22143e08555d7865e9cb0f523b1" +checksum = "59fd9af8f095f8b3466c3e4fc0263b4081e36e210e0064ea7eb77977a3b6744d" +dependencies = [ + "phf 0.12.1", +] [[package]] name = "ckb-crypto" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05df423a624b1d082ca0820c355d10b8855bb9699bf05154d613bf6693dbc1b7" +checksum = "ab6e4dda4c1ffbc459cc42b0d4588ca043ee1194b7c915e1c013dd9f54b51f1d" dependencies = [ "ckb-fixed-hash", "faster-hex", @@ -666,9 +670,9 @@ dependencies = [ [[package]] name = "ckb-dao-utils" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75356f7744ea9c0012a1eb48a46e37b23beeaa59e575defc4dab59a27506d1b7" +checksum = "fa5f159facde270f3885407358dad02cc998877937ee89a3bd8cc4875807ea97" dependencies = [ "byteorder", "ckb-error", @@ -677,9 +681,9 @@ dependencies = [ [[package]] name = "ckb-error" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44f328a850d94e1d7a8843b7107fa245a083bcb263f5eb7da2e8892daa766c6" +checksum = "de47e9a184320eeacfe882c7d3080148a850448f4f1be33e2e3e4702d3a58499" dependencies = [ "anyhow", "ckb-occupied-capacity", @@ -689,9 +693,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41ef9f1e9495ffa6cdc9694b7f438b0af360b958b543112c2d96b01ce3ca6f9" +checksum = "213d1978797e12679bd3f8fc6743319037f5a9e78b198df0f697ee1dd8637c2c" dependencies = [ "ckb-fixed-hash-core", "ckb-fixed-hash-macros", @@ -699,9 +703,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-core" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5338f04fcdd0b217203c43d05af4b5cc2971ce4f1ecb0df2162e06aa3779def" +checksum = "215c8367d8f8206f47bd77edfbed05ecb8053879b11548dff044739af3ad611c" dependencies = [ "ckb_schemars", "faster-hex", @@ -711,9 +715,9 @@ dependencies = [ [[package]] name = "ckb-fixed-hash-macros" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de2b2aeebd799da3170220c88dffc3f50257e657d276d59ffe38f533de26459" +checksum = "24c0410093f4c0c067b5f8d8f99db0bbf33700fb7df3fff6f8c2666de46fd416" dependencies = [ "ckb-fixed-hash-core", "proc-macro2", @@ -723,9 +727,9 @@ dependencies = [ [[package]] name = "ckb-gen-types" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "255da9cda52578622b7b8a437eb22942bfdbe90d7896f86a002fa8e4cc1804c8" +checksum = "e57ad8b6edc20d1614780e9034475e1edac24f3ef5edc197cbd6f0bc9b20eea6" dependencies = [ "cfg-if 1.0.0", "ckb-error", @@ -734,13 +738,15 @@ dependencies = [ "ckb-occupied-capacity", "molecule", "numext-fixed-uint", + "seq-macro", + "strum", ] [[package]] name = "ckb-hash" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a74fb43c0f092a5ea388d31e4579cada2cc14e45dd5818b996f348613efe202" +checksum = "96bc608fd850b8f88fa07ed6fd432175eef4d83ab093c82bb6800333181993bb" dependencies = [ "blake2b-ref", "blake2b-rs", @@ -748,22 +754,23 @@ dependencies = [ [[package]] name = "ckb-jsonrpc-types" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e1fb6611ec4626ec5876b7dac828027faac9ab0289c90f630109eae23f1e3da" +checksum = "93fd050ea71b67f1e4d304b3450c939a87a30dea5b27ba30c0231e2b75d51959" dependencies = [ "ckb-types", "ckb_schemars", "faster-hex", + "seq-macro", "serde", "serde_json", ] [[package]] name = "ckb-logger" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dee2e03aff24f041876ba9e8c6c3389edd003041e82ab59c57e6e0674806fbc" +checksum = "ecd17904c92d089059dbdb036722422a5e7d0946a0ea47fc625e877bce6d5426" dependencies = [ "log", ] @@ -779,9 +786,9 @@ dependencies = [ [[package]] name = "ckb-mock-tx-types" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21143dcf9fd2a02656bcf4b2fb99500916e298207e3448dda3988db775f8972" +checksum = "08f05c40c36a5109007a3721cdf940153a19bafade295407df0bad5113a524e4" dependencies = [ "ckb-jsonrpc-types", "ckb-traits", @@ -791,9 +798,9 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d80645639dd38cf0c91d06cd2e8bd3489557479968e6fb8ed2d35d7fdde5dd" +checksum = "5e67f664b639e30bd21597e917d552a506a3d95e3c90b3eae8c8967e430a3f5e" dependencies = [ "ckb-occupied-capacity-core", "ckb-occupied-capacity-macros", @@ -801,18 +808,18 @@ dependencies = [ [[package]] name = "ckb-occupied-capacity-core" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af825d54b795fab2b9e934ab5b5f9fa1090f69b98cc60e3a6d363336b5ee1726" +checksum = "48ad9c557a7500b3dfcfbb20a2419faddc172cf86ca9ca6e805eafdf532429ac" dependencies = [ "serde", ] [[package]] name = "ckb-occupied-capacity-macros" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca553126a0269427c31b3dbca8d720a4c79267a80c9a0e6c589a86d460a6201b" +checksum = "fd78121f24a35ed4a33030da00b07d7adf479204c2b44067f222ff6eb97e7e6e" dependencies = [ "ckb-occupied-capacity-core", "quote", @@ -821,9 +828,9 @@ dependencies = [ [[package]] name = "ckb-pow" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b4deffe39636e0f55bb888612b48026db58dd10dca1efadf7a54827b8b61fe" +checksum = "2d34cfa54433ce70a9965bd377a692be20e0579e2e3366fe539c1b1a2f024faf" dependencies = [ "byteorder", "ckb-hash", @@ -835,9 +842,9 @@ dependencies = [ [[package]] name = "ckb-rational" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd60f92eafb05be8fd7ec091841c7e28503a61e061b54e1010b2d0f3a0b13763" +checksum = "284f8728233280773075f9f8a1e90b246f5cd43a896cdc4e1eff58496a34dbca" dependencies = [ "numext-fixed-uint", "serde", @@ -845,24 +852,24 @@ dependencies = [ [[package]] name = "ckb-resource" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "893c593af418c218c4f2cea26d6964e3289651a887b049c0370fbb14392e92c1" +checksum = "4e2616e521eaf99a349516c5e5c6ee56d4a91da60cd6fa3aa7d50e08acfd67be" dependencies = [ "ckb-system-scripts 0.5.4", "ckb-types", "includedir", "includedir_codegen", - "phf", + "phf 0.8.0", "serde", "walkdir", ] [[package]] name = "ckb-script" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e392689735f78ecd624b5583c9c9be560c2ff444e0f9114461fa061d5ff4c1be" +checksum = "8806961e94e46bca8c9f1612237fa49a479b43116627c25030b77e72cd3f0bed" dependencies = [ "byteorder", "ckb-chain-spec", @@ -879,9 +886,9 @@ dependencies = [ [[package]] name = "ckb-sdk" -version = "4.2.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aa26b27162a44e53bbacad96bb7a822579b9457e65d9fcb43876bd0bb2600e1" +checksum = "9f730b8f7846aa08b27919418763f958d8ff39f65bff0ccdfa3bc24bd69ef421" dependencies = [ "anyhow", "async-iterator", @@ -957,7 +964,7 @@ dependencies = [ "faster-hex", "includedir", "includedir_codegen", - "phf", + "phf 0.8.0", ] [[package]] @@ -970,27 +977,26 @@ dependencies = [ "faster-hex", "includedir", "includedir_codegen", - "phf", + "phf 0.8.0", ] [[package]] name = "ckb-traits" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80fcf192e9832c5b1213a2f4dcc58812ad77ae9599aec3170652db07d9c2fb0f" +checksum = "5d6f061d2788746ab9cd596fb9aa39d92ae3abce730c1792c2a2e064165c1ced" dependencies = [ "ckb-types", ] [[package]] name = "ckb-types" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32bd5b5b4a2d991ee05852641c8272498df27abd0cef0f16979f6af6cb5fd97d" +checksum = "90a5f1e62fa0e969386928163607d22dd3563857ec134440ffe46a5ca68bb8fc" dependencies = [ "bit-vec", "bytes 1.6.1", - "ckb-channel", "ckb-constant", "ckb-error", "ckb-fixed-hash", @@ -1009,13 +1015,12 @@ dependencies = [ [[package]] name = "ckb-util" -version = "0.202.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ad33025a25b46ec8d28abde909953cad5442d6cc4b2c951f0c0859df6c14b6" +checksum = "a8bef9c44650fc332dc72d419a60d25ccde5d6f9cc3bbbad33483ff55b305ae5" dependencies = [ "linked-hash-map", "parking_lot 0.12.3", - "regex", ] [[package]] @@ -1094,7 +1099,7 @@ version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error", "proc-macro2", "quote", @@ -1755,7 +1760,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812f314a99fb5b7f0f9d0a8388539578f83f3aca6a65f588b8dbeefb731e2f98" dependencies = [ - "siphasher", + "siphasher 0.3.11", ] [[package]] @@ -1788,6 +1793,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -2159,7 +2170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afd126bd778c00c43a9dc76d1609a0894bf4222088088b2217ccc0ce9e816db7" dependencies = [ "flate2", - "phf", + "phf 0.8.0", ] [[package]] @@ -2855,7 +2866,18 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "phf_shared", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7" +dependencies = [ + "phf_macros", + "phf_shared 0.12.1", + "serde", ] [[package]] @@ -2864,8 +2886,8 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.8.0", + "phf_shared 0.8.0", ] [[package]] @@ -2874,17 +2896,49 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ - "phf_shared", + "phf_shared 0.8.0", "rand 0.7.3", ] +[[package]] +name = "phf_generator" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cbb1126afed61dd6368748dae63b1ee7dc480191c6262a3b4ff1e29d86a6c5b" +dependencies = [ + "fastrand", + "phf_shared 0.12.1", +] + +[[package]] +name = "phf_macros" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d713258393a82f091ead52047ca779d37e5766226d009de21696c4e667044368" +dependencies = [ + "phf_generator 0.12.1", + "phf_shared 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "phf_shared" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" dependencies = [ - "siphasher", + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981" +dependencies = [ + "siphasher 1.0.1", ] [[package]] @@ -3592,6 +3646,12 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +[[package]] +name = "seq-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" + [[package]] name = "serde" version = "1.0.204" @@ -3750,6 +3810,12 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -3804,6 +3870,27 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "subtle" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index 87a12399..b9d2998f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,17 +10,18 @@ edition = "2021" description = "ckb command line interface" [dependencies] -ckb-jsonrpc-types = "=0.202.0" -ckb-hash = "=0.202.0" -ckb-crypto = { version = "=0.202.0", features = ["secp"] } -ckb-build-info = "=0.202.0" -ckb-types = "=0.202.0" -ckb-util = "=0.202.0" -ckb-error = "=0.202.0" -ckb-script = "=0.202.0" -ckb-chain-spec = "=0.202.0" -ckb-sdk = { version = "4.2.0", features = ["native-tls-vendored"] } -ckb-mock-tx-types = "=0.202.0" +ckb-jsonrpc-types = "1.0" +ckb-hash = "1.0" +ckb-crypto = { version = "1.0", features = ["secp"] } +ckb-build-info = "1.0" +ckb-types = "1.0" +ckb-util = "1.0" +ckb-error = "1.0" +ckb-script = "1.0" +ckb-chain-spec = "1.0" +ckb-channel = "1.0" +ckb-sdk = { version = "5.0", features = ["native-tls-vendored"] } +ckb-mock-tx-types = "1.0" ckb-signer = { path = "ckb-signer", version = "0.4.1" } plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=1.3.1" } jsonrpc-core-client = "18" @@ -66,9 +67,6 @@ tokio = { version = "1", features = ["net", "io-util", "rt"] } futures = "0.3" async-trait = "0.1.88" -# remove this line when ckb-vm stick the version of ckb-vm-definitions -# ckb-vm-definitions = "=0.21.3" - [target.'cfg(unix)'.dependencies] tui = "0.6.0" termion = "1.5" @@ -77,7 +75,7 @@ termion = "1.5" rand = "0.7" [build-dependencies] -ckb-build-info = "=0.202.0" +ckb-build-info = "1.0" [workspace] members = ["ckb-signer", "plugin-protocol"] diff --git a/Makefile b/Makefile index 8c8c8028..5bd9e248 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ ci: fmt clippy test security-audit check-crates check-licenses git diff --exit-code Cargo.lock integration: - bash devtools/ci/integration.sh v0.200.0 $(ARGS) + bash devtools/ci/integration.sh v0.203.0 $(ARGS) integration-spec: @if [ -z "$(SPEC)" ]; then \ @@ -25,7 +25,7 @@ integration-spec: echo "Example: make integration-spec SPEC=deploy_type_id"; \ exit 1; \ fi - bash devtools/ci/integration.sh v0.200.0 --spec=$(SPEC) + bash devtools/ci/integration.sh v0.203.0 --spec=$(SPEC) prod: ## Build binary with release profile. cargo build --locked --release diff --git a/ckb-signer/Cargo.toml b/ckb-signer/Cargo.toml index bb03b4a2..b9c772ac 100644 --- a/ckb-signer/Cargo.toml +++ b/ckb-signer/Cargo.toml @@ -24,7 +24,7 @@ thiserror = "1.0.30" parking_lot = "0.11" anyhow = "1.0.63" -ckb-types = "=0.202.0" -ckb-hash = "=0.202.0" -ckb-crypto = { version = "=0.202.0", features = ["secp"] } -ckb-sdk = { version = "4.2.0", features = ["native-tls-vendored"] } +ckb-types = "1.0" +ckb-hash = "1.0" +ckb-crypto = { version = "1.0", features = ["secp"] } +ckb-sdk = { version = "5.0", features = ["native-tls-vendored"] } diff --git a/plugin-protocol/Cargo.toml b/plugin-protocol/Cargo.toml index 0c1df675..da2039a4 100644 --- a/plugin-protocol/Cargo.toml +++ b/plugin-protocol/Cargo.toml @@ -9,8 +9,8 @@ description = "ckb-cli plugin protocol" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ckb-types = "=0.202.0" -ckb-jsonrpc-types = "=0.202.0" +ckb-types = "1.0" +ckb-jsonrpc-types = "1.0" serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/src/plugin/builtin.rs b/src/plugin/builtin.rs index 52b4124d..79434f2b 100644 --- a/src/plugin/builtin.rs +++ b/src/plugin/builtin.rs @@ -5,9 +5,9 @@ use std::thread::{self, JoinHandle}; use bitcoin::bip32::DerivationPath; use crossbeam_channel::bounded; +use ckb_channel::Request; use ckb_sdk::util::serialize_signature; use ckb_signer::{DerivedKeySet, Key, KeyStore, MasterPrivKey}; -use ckb_types::core::service::Request; use plugin_protocol::{JsonrpcError, KeyStoreRequest, PluginRequest, PluginResponse}; use super::manager::PluginHandler; diff --git a/src/plugin/manager.rs b/src/plugin/manager.rs index 49b7f5f6..3f4589f8 100644 --- a/src/plugin/manager.rs +++ b/src/plugin/manager.rs @@ -12,9 +12,10 @@ use std::thread::{self, JoinHandle}; use bitcoin::bip32::{ChildNumber, DerivationPath}; use crossbeam_channel::{bounded, select, Sender}; +use ckb_channel::Request; use ckb_jsonrpc_types::{BlockNumber, HeaderView, JsonBytes, Script}; use ckb_signer::{DerivedKeySet, MasterPrivKey, CKB_ROOT_PATH}; -use ckb_types::{bytes::Bytes, core::service::Request, H160, H256}; +use ckb_types::{bytes::Bytes, H160, H256}; use super::builtin::{DefaultIndexer, DefaultKeyStore, ERROR_KEYSTORE_REQUIRE_PASSWORD}; use crate::utils::other::read_password; diff --git a/src/subcommands/dao/mod.rs b/src/subcommands/dao/mod.rs index 7e1aa39b..a6b87a76 100644 --- a/src/subcommands/dao/mod.rs +++ b/src/subcommands/dao/mod.rs @@ -192,7 +192,7 @@ impl<'a> DAOSubCommand<'a> { ) -> Result, String> { let dao_type_script = Script::new_builder() .code_hash(DAO_TYPE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .build(); let mut query = CellQueryOptions::new_lock(lock); query.secondary_script = Some(dao_type_script); diff --git a/src/subcommands/deploy/mod.rs b/src/subcommands/deploy/mod.rs index 9c6d25b1..d103a62f 100644 --- a/src/subcommands/deploy/mod.rs +++ b/src/subcommands/deploy/mod.rs @@ -821,7 +821,7 @@ fn load_cell_info( ) -> Result<(H256, Bytes, json_types::CellOutput)> { let out_point = packed::OutPoint::new_builder() .tx_hash(tx_hash.pack()) - .index(index.pack()) + .index(index) .build(); let cell_with_status = rpc_client .get_live_cell(out_point, true, None) @@ -869,7 +869,7 @@ fn load_dep_groups( } => { let out_point = packed::OutPoint::new_builder() .tx_hash(tx_hash.pack()) - .index(index.pack()) + .index(index) .build(); Some((&config.name, out_point)) } @@ -888,7 +888,7 @@ fn load_dep_groups( .map(|cell_recipe| { packed::OutPoint::new_builder() .tx_hash(cell_recipe.tx_hash.pack()) - .index(cell_recipe.index.pack()) + .index(cell_recipe.index) .build() }) .or_else(|| refs_map.get(cell_name).cloned()) diff --git a/src/subcommands/deploy/state_change.rs b/src/subcommands/deploy/state_change.rs index 7355cc00..03fc3924 100644 --- a/src/subcommands/deploy/state_change.rs +++ b/src/subcommands/deploy/state_change.rs @@ -187,7 +187,7 @@ impl ChangeInfo for CellChange { let type_script_opt = type_id_args.map(|type_id_args| { packed::Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(type_id_args.to_vec()).pack()) .build() }); @@ -259,7 +259,7 @@ impl CellChange { }); let type_script = packed::Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(args.to_vec()).pack()) .build(); Some(type_script.calc_script_hash().unpack()) @@ -382,7 +382,7 @@ impl ChangeInfo for DepGroupChange { let type_script_opt = type_id_args.map(|type_id_args| { packed::Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(type_id_args.to_vec()).pack()) .build() }); @@ -466,7 +466,7 @@ impl DepGroupChange { }; let type_script = packed::Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(args.to_vec()).pack()) .build(); Some(type_script.calc_script_hash().unpack()) diff --git a/src/subcommands/mock_tx.rs b/src/subcommands/mock_tx.rs index 4767c9b1..5c0c9f2b 100644 --- a/src/subcommands/mock_tx.rs +++ b/src/subcommands/mock_tx.rs @@ -187,7 +187,7 @@ impl CliSubCommand for MockTxSubCommand<'_> { let sample_script = || { Script::new_builder() .code_hash(SIGHASH_TYPE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(lock_arg.as_bytes().to_vec()).pack()) .build() }; @@ -227,7 +227,7 @@ impl CliSubCommand for MockTxSubCommand<'_> { let tx = TransactionBuilder::default() .input(input) .output(output) - .output_data(Default::default()) + .output_data(ckb_types::packed::Bytes::default()) .witness(Bytes::from("abc").pack()) .build() .data(); diff --git a/src/subcommands/molecule.rs b/src/subcommands/molecule.rs index 196c2776..6749ee6a 100644 --- a/src/subcommands/molecule.rs +++ b/src/subcommands/molecule.rs @@ -352,8 +352,8 @@ impl From for CellbaseWitness { impl From for packed::CellbaseWitness { fn from(json: CellbaseWitness) -> Self { packed::CellbaseWitness::new_builder() - .lock(json.lock.into()) - .message(json.message.into()) + .lock(json.lock) + .message(json.message) .build() } } @@ -390,11 +390,26 @@ impl From for packed::RawTransaction { fn from(json: RawTransaction) -> Self { packed::RawTransaction::new_builder() .version(json.version.pack()) - .cell_deps(json.cell_deps.into_iter().map(Into::into).pack()) - .header_deps(json.header_deps.iter().map(Pack::pack).pack()) - .inputs(json.inputs.into_iter().map(Into::into).pack()) - .outputs(json.outputs.into_iter().map(Into::into).pack()) - .outputs_data(json.outputs_data.into_iter().map(Into::into).pack()) + .cell_deps( + json.cell_deps + .into_iter() + .map(Into::into) + .collect::>(), + ) + .header_deps( + json.header_deps + .into_iter() + .map(Into::into) + .collect::>(), + ) + .inputs(json.inputs.into_iter().map(Into::into).collect::>()) + .outputs(json.outputs.into_iter().map(Into::into).collect::>()) + .outputs_data( + json.outputs_data + .into_iter() + .map(Into::into) + .collect::>(), + ) .build() } } @@ -443,7 +458,7 @@ impl From for packed::RawHeader { .proposals_hash(json.proposals_hash.pack()) .compact_target(json.compact_target.pack()) .extra_hash(json.extra_hash.pack()) - .dao(json.dao.into()) + .dao(json.dao) .build() } } diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 9bc11485..0f524c08 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -659,7 +659,7 @@ impl CliSubCommand for RpcSubCommand<'_> { let out_point = packed::OutPoint::new_builder() .tx_hash(tx_hash.pack()) - .index(index.pack()) + .index(index) .build(); if is_raw_data { let resp = { diff --git a/src/subcommands/sudt.rs b/src/subcommands/sudt.rs index a404914d..0ebf1895 100644 --- a/src/subcommands/sudt.rs +++ b/src/subcommands/sudt.rs @@ -259,7 +259,7 @@ impl<'a> SudtSubCommand<'a> { script_args[20..40].copy_from_slice(&owner_script_hash.as_slice()[0..20]); let script = Script::new_builder() .code_hash(script_id.code_hash.pack()) - .hash_type(script_id.hash_type.into()) + .hash_type(script_id.hash_type) .args(Bytes::from(script_args).pack()) .build(); (TransferAction::Create, script) @@ -373,7 +373,7 @@ impl<'a> SudtSubCommand<'a> { let type_script = udt_type.build_script(&udt_script_id, &owner_script_hash); let cheque_sender_script_hash = Script::new_builder() .code_hash(SIGHASH_TYPE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(sender_account.as_bytes().to_vec()).pack()) .build() .calc_script_hash(); @@ -389,7 +389,7 @@ impl<'a> SudtSubCommand<'a> { .copy_from_slice(&cheque_sender_script_hash.as_slice()[0..20]); let script = Script::new_builder() .code_hash(script_id.code_hash.pack()) - .hash_type(script_id.hash_type.into()) + .hash_type(script_id.hash_type) .args(Bytes::from(script_args).pack()) .build(); (TransferAction::Create, script) @@ -553,7 +553,7 @@ impl<'a> SudtSubCommand<'a> { H160::from_slice(capacity_provider.payload().args().as_ref()).unwrap(); let acp_lock = Script::new_builder() .code_hash(acp_script_id.code_hash.pack()) - .hash_type(acp_script_id.hash_type.into()) + .hash_type(acp_script_id.hash_type) .args(to.payload().args().pack()) .build(); let acp_address = { @@ -575,10 +575,7 @@ impl<'a> SudtSubCommand<'a> { .occupied_capacity(Capacity::bytes(output_data.len()).unwrap()) .unwrap() .as_u64(); - let output = base_output - .as_builder() - .capacity(occupied_capacity.pack()) - .build(); + let output = base_output.as_builder().capacity(occupied_capacity).build(); let builder = CapacityTransferBuilder::new(vec![(output, output_data)]); let mut udt_builder = UdtTxBuilder { plugin_mgr: self.plugin_mgr, @@ -655,18 +652,18 @@ impl<'a> SudtSubCommand<'a> { .copy_from_slice(&sender_script.calc_script_hash().as_slice()[0..20]); Script::new_builder() .code_hash(cheque_script_id.code_hash.pack()) - .hash_type(cheque_script_id.hash_type.into()) + .hash_type(cheque_script_id.hash_type) .args(Bytes::from(script_args).pack()) .build() }; let receiver_acp_script = Script::new_builder() .code_hash(acp_script_id.code_hash.pack()) - .hash_type(acp_script_id.hash_type.into()) + .hash_type(acp_script_id.hash_type) .args(receiver_script.args()) .build(); let type_script = Script::new_builder() .code_hash(udt_script_id.code_hash.pack()) - .hash_type(udt_script_id.hash_type.into()) + .hash_type(udt_script_id.hash_type) .args(owner_script.calc_script_hash().as_bytes().pack()) .build(); @@ -790,13 +787,13 @@ impl<'a> SudtSubCommand<'a> { .copy_from_slice(&sender_script.calc_script_hash().as_slice()[0..20]); Script::new_builder() .code_hash(cheque_script_id.code_hash.pack()) - .hash_type(cheque_script_id.hash_type.into()) + .hash_type(cheque_script_id.hash_type) .args(Bytes::from(script_args).pack()) .build() }; let type_script = Script::new_builder() .code_hash(udt_script_id.code_hash.pack()) - .hash_type(udt_script_id.hash_type.into()) + .hash_type(udt_script_id.hash_type) .args(owner_script.calc_script_hash().as_bytes().pack()) .build(); @@ -1093,7 +1090,7 @@ impl CliSubCommand for SudtSubCommand<'_> { let acp_script_id = get_script_id(&cell_deps, CellDepName::Acp)?; let acp_script = Script::new_builder() .code_hash(acp_script_id.code_hash.pack()) - .hash_type(acp_script_id.hash_type.into()) + .hash_type(acp_script_id.hash_type) .args(sighash_addr.payload().args().pack()) .build(); let acp_payload = AddressPayload::from(acp_script); @@ -1117,7 +1114,7 @@ impl CliSubCommand for SudtSubCommand<'_> { script_args[20..40].copy_from_slice(&sender_script_hash.as_slice()[0..20]); let cheque_script = Script::new_builder() .code_hash(cheque_script_id.code_hash.pack()) - .hash_type(cheque_script_id.hash_type.into()) + .hash_type(cheque_script_id.hash_type) .args(Bytes::from(script_args).pack()) .build(); let cheque_payload = AddressPayload::from(cheque_script); diff --git a/src/subcommands/tui/mod.rs b/src/subcommands/tui/mod.rs index b05963ec..d31cc04e 100644 --- a/src/subcommands/tui/mod.rs +++ b/src/subcommands/tui/mod.rs @@ -21,10 +21,11 @@ use tui::{Frame, Terminal}; // use chrono::{Local, DateTime, TimeZone}; use ckb_sdk::{constants::ONE_CKB, Address, NetworkType}; use ckb_types::{ - core::{service::Request, BlockView}, + core::BlockView, prelude::*, H256, }; +use ckb_channel::Request; use crate::utils::{ genesis_info::GenesisInfo, diff --git a/src/subcommands/tx.rs b/src/subcommands/tx.rs index e9eeb5a2..c8b005af 100644 --- a/src/subcommands/tx.rs +++ b/src/subcommands/tx.rs @@ -304,7 +304,7 @@ impl CliSubCommand for TxSubCommand<'_> { let genesis_info = get_genesis_info(&self.genesis_info, self.rpc_client)?; let out_point = OutPoint::new_builder() .tx_hash(tx_hash.pack()) - .index(index.pack()) + .index(index) .build(); let get_live_cell = |out_point, with_data| { get_live_cell(self.rpc_client, out_point, with_data).map(|(output, _)| output) diff --git a/src/subcommands/util.rs b/src/subcommands/util.rs index 62016456..5276ae18 100644 --- a/src/subcommands/util.rs +++ b/src/subcommands/util.rs @@ -750,7 +750,7 @@ message = "0x" let with_data = m.is_present("with-data"); let out_point = packed::OutPoint::new_builder() .tx_hash(tx_hash.pack()) - .index(index.pack()) + .index(index) .build(); let cell_with_status = self.rpc_client.get_live_cell(out_point, true, None)?; if cell_with_status.status != "live" { diff --git a/src/subcommands/wallet.rs b/src/subcommands/wallet.rs index 526364d9..026db305 100644 --- a/src/subcommands/wallet.rs +++ b/src/subcommands/wallet.rs @@ -430,7 +430,7 @@ impl<'a> WalletSubCommand<'a> { Some( Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(vec![0u8; 32]).pack()) .build(), ) @@ -439,7 +439,7 @@ impl<'a> WalletSubCommand<'a> { }; let to_output = CellOutput::new_builder() .capacity(Capacity::shannons(to_capacity).pack()) - .lock(to_address.payload().into()) + .lock(to_address.payload()) .type_(placeholder_type_script.pack()) .build(); let builder = CapacityTransferBuilder::new(vec![(to_output, to_data)]); @@ -479,7 +479,7 @@ impl<'a> WalletSubCommand<'a> { blake2b.finalize(&mut ret); let type_script = Script::new_builder() .code_hash(TYPE_ID_CODE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(ret.to_vec()).pack()) .build(); let mut outputs = tx.outputs().into_iter().collect::>(); diff --git a/src/utils/mock_tx_helper.rs b/src/utils/mock_tx_helper.rs index 286dd23d..4dcf2ca4 100644 --- a/src/utils/mock_tx_helper.rs +++ b/src/utils/mock_tx_helper.rs @@ -157,14 +157,6 @@ impl<'a> MockTransactionHelper<'a> { .collect::>(); let mut insert_dep = |hash_type, code_hash: &Byte32| -> Result<(), String> { match (hash_type, code_hash) { - (ScriptHashType::Data, data_hash) - | (ScriptHashType::Data1, data_hash) - | (ScriptHashType::Data2, data_hash) => { - let dep = data_deps.get(data_hash).cloned().ok_or_else(|| { - format!("Can not find data hash in mock deps: {}", data_hash) - })?; - cell_deps.insert(dep); - } (ScriptHashType::Type, code_hash) if code_hash.as_slice() == SIGHASH_TYPE_HASH.as_bytes() => { @@ -176,6 +168,12 @@ impl<'a> MockTransactionHelper<'a> { })?; cell_deps.insert(dep); } + (_, data_hash) => { + let dep = data_deps.get(data_hash).cloned().ok_or_else(|| { + format!("Can not find data hash in mock deps: {}", data_hash) + })?; + cell_deps.insert(dep); + } } Ok(()) }; @@ -326,7 +324,7 @@ impl<'a> MockTransactionHelper<'a> { ckb2023: CKB2023::new_dev_default(), }) .build(); - let tip = HeaderBuilder::default().number(0.pack()).build(); + let tip = HeaderBuilder::default().number(0).build(); let tx_verify_env = TxVerifyEnv::new_submit(&tip); let debug_printer: DebugPrinter = Arc::new(|script_hash: &Byte32, message: &str| { @@ -386,7 +384,7 @@ mod test { .expect("Generate hash(H160) from pubkey failed"); let lock_script = Script::new_builder() .code_hash(SIGHASH_TYPE_HASH.pack()) - .hash_type(ScriptHashType::Type.into()) + .hash_type(ScriptHashType::Type) .args(Bytes::from(lock_arg.as_bytes().to_vec()).pack()) .build(); @@ -446,7 +444,7 @@ mod test { .as_advanced_builder() .input(input) .output(output) - .output_data(Default::default()) + .output_data(ckb_types::packed::Bytes::default()) .build() .data(); diff --git a/src/utils/rpc/types.rs b/src/utils/rpc/types.rs index df8a3c24..6f2d4071 100644 --- a/src/utils/rpc/types.rs +++ b/src/utils/rpc/types.rs @@ -71,7 +71,7 @@ impl From