From 6123c653106fd869572d531c52ad47853a28d26b Mon Sep 17 00:00:00 2001 From: zhangsoledad <787953403@qq.com> Date: Tue, 16 Apr 2019 17:02:40 +0800 Subject: [PATCH] Squashed commit of the following: commit c80e5e7cab8e73fbb0cf3318a008d7b2b730ab74 Author: zhangsoledad <787953403@qq.com> Date: Tue Apr 16 16:46:17 2019 +0800 Squashed commit of the following: commit aa53bdda2b8fbd384a46836cccb288bbf0b7ae9f Merge: dbfb81c da88ddb Author: Jiang Jinyang Date: Tue Apr 16 01:17:01 2019 -0500 Merge pull request #473 from u2/cellbase_maturity feature: cellbase maturity verify commit da88ddb54b8b24f721bbe96d9325fc959397bb93 Author: u2 Date: Mon Apr 15 17:52:26 2019 +0800 feature: cellbase maturity verify commit dbfb81cea902ba4d923f78685ed0b0bfddce7a3a Merge: 6250bd8 2cdbe4a Author: Quake Wang Date: Mon Apr 15 18:05:02 2019 +0900 Merge pull request #474 from jjyr/fix-valid-since-rpc fix: valid_since use String instead u64 in RPC commit 2cdbe4a78cf1eb05be2f2db9142ae3b0cea80d5e Author: jjy Date: Mon Apr 15 14:30:53 2019 +0800 fix: valid_since use String instead u64 in RPC commit 6250bd8b47c5ae947f65dc3303ea14ea6da6042b Merge: 8d69722 dfd5c8a Author: ian Date: Mon Apr 15 10:03:51 2019 +0800 Merge pull request #470 from doitian/configure-sentry chore: add sentry tags commit 8d6972292bee6bab50c95d418dda891b2bdd33e6 Merge: 554ba4e ec6336f Author: ian Date: Sun Apr 14 19:37:51 2019 +0800 Merge pull request #471 from nervosnetwork/quake/cuckoo_verify_panic fix: CuckooEngine verify invalid length proof should not panic commit ec6336fadcfd863a8d7c6e3fbed1147bcfda3751 Author: quake wang Date: Sun Apr 14 12:59:37 2019 +0900 fix: CuckooEngine verify invalid length proof should not panic commit dfd5c8aa16bf153b70316d5544ab03c2029faa67 Author: ian Date: Sun Apr 14 11:16:09 2019 +0800 chore: add more sentry tags commit e452c642e79a5c07756b7c5b31c4667814dc8079 Author: ian Date: Sun Apr 14 09:05:32 2019 +0800 chore: add sentry tags commit 554ba4e6ec503fd38d7ba45f794d4658026a82c4 Merge: 3b5ceed d6fa197 Author: Quake Wang Date: Sun Apr 14 10:06:12 2019 +0900 Merge pull request #467 from doitian/wrong-option-name docs: fix wrong option name commit 3b5ceed73c3c9c5333308321c0ef2efcdd04774c Merge: 0db3859 b0003b6 Author: Quake Wang Date: Sun Apr 14 10:05:38 2019 +0900 Merge pull request #468 from doitian/require-config-file-to-start feat: ckb must loads config files from file system. commit 0db38593547686629b8fb361d362de47b4ae4a61 Merge: ac79f50 7662ee0 Author: Quake Wang Date: Sun Apr 14 10:03:06 2019 +0900 Merge pull request #450 from nervosnetwork/quake/index_store_trait_merge refactor: merge ChainIndex and ChainStore trait commit ac79f50e7c72e911cdcb43f694cddc9be47b5741 Merge: e70407c febcae0 Author: ian Date: Sun Apr 14 08:24:04 2019 +0800 Merge pull request #469 from jjyr/fix-peer-store-unique fix: PeerStore unique constraint failed commit febcae0216461ab15e911fe6a80a38ef8c2c1515 Author: jjy Date: Sat Apr 13 23:17:01 2019 +0800 fix: PeerStore unique constraint failed commit b0003b6c0c8a1f48c3a12b8c112e32ef0d20ace8 Author: ian Date: Sat Apr 13 21:55:35 2019 +0800 feat: ckb must loads config files from file system. This is a **BREAKING CHANGE**. It is a mechanism to avoid starting ckb in a wrong directory by accident. commit d6fa19772df67a36407d88342ba22fc55500d324 Author: ian Date: Sat Apr 13 21:00:51 2019 +0800 docs: fix wrong option name commit e70407ca549e87e56606f25d655947d785ba281e Merge: d3acea8 4c3d283 Author: ian Date: Sat Apr 13 13:03:19 2019 +0800 Merge pull request #463 from doitian/fix-docker-image-name docs: fix docker image name commit d3acea8d2a4d9634321bd17d665855f18108de83 Merge: 1afbd86 75d0bc7 Author: Quake Wang Date: Sat Apr 13 11:40:23 2019 +0900 Merge pull request #464 from yangby-cryptape/mv-txtrace-to-jsonrpc-types refactor: don't have to build rocksdb when use all jsonrpc types commit 75d0bc734680f1745d1aa3e292d17257bd7e8876 Author: Boyu Yang Date: Sat Apr 13 09:26:34 2019 +0800 refactor: don't have to build rocksdb when use all jsonrpc types commit 4c3d2830d7b98323a80cc0c08648b5bfcf77d88c Author: ian Date: Fri Apr 12 22:41:37 2019 +0800 docs: fix docker image name Use the full name `nervos/ckb`. commit 1afbd869eafcaaf14e2b9c672dff8f8ea21f9a3a Merge: 0800b17 62bcb82 Author: ian Date: Fri Apr 12 22:20:57 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 62bcb826b9b30caffbe4f00b11342aff48388b59 Merge: 0f86904 fb82031 Author: ian Date: Fri Apr 12 22:20:00 2019 +0800 Merge branch 'master' into rc/v0.9.0 commit 0800b17079a2c93ac09d7d3b9e3fbae8ed92c933 Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit fb820310e6d55f6ba650dc135d32822e5e8af104 Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit 0f86904bfe87dfc6e68bb0f05d6a01e973f7ba2c Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit 09fcdd9c19237230a66e2f6cdffba776fa069e26 Author: ian Date: Fri Apr 12 21:13:18 2019 +0800 chore: drop bors bors is not stable. We'll run the integration test after PR merged to develop and RC branches. commit 63a1bb6f5b2ddd6849e2937800c70b2caadb745b Merge: 14d8ffc ac1fb97 Author: ian Date: Fri Apr 12 21:47:19 2019 +0800 Merge pull request #460 from doitian/drop-bors chore: drop bors commit 14d8ffc007069fa026faa61f6d20776a182ed0e0 Merge: f986b24 3cf197c Author: ian Date: Fri Apr 12 21:46:49 2019 +0800 Merge pull request #448 from zhangsoledad/zhangsoledad/relay_filter feat: relay known filter commit f986b24ad7f54993ffa38272ea595607d8be42ce Merge: 9de1418 a12a5fd Author: ian Date: Fri Apr 12 21:46:15 2019 +0800 Merge pull request #455 from nervosnetwork/thewawar/fix-sqlite-start fix: Sqlite can not start commit 9de1418cad3ab8a5f2f089b398d73a2355c59b1f Merge: bdc8ace eb7045c Author: ian Date: Fri Apr 12 21:30:40 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit eb7045cd23db5f70d7ae25fe970d7eba15e6125e Merge: 900e53d cbee1d4 Author: ian Date: Fri Apr 12 21:25:36 2019 +0800 Merge pull request #458 from nervosnetwork/dockerfile chore: update Dockerfile [skip ci] commit ac1fb97b25cfe6205d757f5c0b0a3c2806a0d8c2 Author: ian Date: Fri Apr 12 21:13:18 2019 +0800 chore: drop bors bors is not stable. We'll run the integration test after PR merged to develop and RC branches. commit cbee1d4f8d57b2258e97b00fe436f5c4e01c151a Author: ian Date: Fri Apr 12 14:22:31 2019 +0800 chore: update Dockerfile [skip ci] commit 7662ee0f0811f8d6e2a007000b898eafb5ffc004 Author: quake wang Date: Fri Apr 12 21:06:06 2019 +0900 chore: re-enable some clippy hint commit 884bfa1b9e47296c2ac45624be76401f0dbf9a73 Author: quake wang Date: Fri Apr 12 20:30:03 2019 +0900 chore: rebase develop commit d6ca06e71bdc30af197f6b82fe32c908d8001cbe Author: quake wang Date: Fri Apr 12 12:10:14 2019 +0900 chore: remove unused ChainIndex file commit 586b89c1a7a21d8aba185a328053ef08777bd5c9 Author: quake wang Date: Fri Apr 12 11:55:08 2019 +0900 chore: remove some unused `Send` and `static` trait bounds commit 1b69bb67376e6b1fea2b2a995e2afd28a076cf1a Author: quake wang Date: Fri Apr 12 11:27:39 2019 +0900 refactor: merge ChainIndex and ChainStore trait, remove unused `Clone` impl of CompactBlockMedianTimeView commit a12a5fd4b5600775f6f4a011ad6c362866337673 Author: Linfeng Qian Date: Fri Apr 12 16:26:26 2019 +0800 fix: Sqlite can not start commit bdc8aceb429d4a57f6a82ca0899ef9031d327381 Merge: 9485f1a db84513 Author: bors[bot] Date: Fri Apr 12 08:17:42 2019 +0000 Merge #452 452: chore: upgrade p2p dependence r=zhangsoledad a=driftluo Co-authored-by: piaoliu <441594700@qq.com> commit 3cf197cfd9eb96ab1d55a22a41489caf3268bc01 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 20:59:08 2019 +0800 refactor: remove unused bloom_filter protocol commit 32b79b51cb010e39301b4258c791b28d0f23bb65 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 20:52:37 2019 +0800 feat: relay known filter commit 900e53d2b43b8e35ab93bf8c6b3a3e111efce691 Author: ian Date: Fri Apr 12 15:13:13 2019 +0800 chore: deploy github releases as prerelease [skip ci] commit db84513bb10aef2843526f94bd0410c00714e053 Author: piaoliu <441594700@qq.com> Date: Fri Apr 12 15:02:02 2019 +0800 chore: upgrade p2p dependence commit 9485f1ab2becadd68e650d425c7818e94318e35a Merge: 9b05508 4f5aadf Author: bors[bot] Date: Fri Apr 12 04:37:44 2019 +0000 Merge #451 451: chore: bump rust toolchain to 1.34.0 r=zhangsoledad a=zhangsoledad * Dockerfile updated * remove redundant_closure * switch stabilized std TryFrom * AtomicU64 Co-authored-by: zhangsoledad <787953403@qq.com> commit 4f5aadf31c8aab576c2f8a3f6fcda753917b1883 Author: zhangsoledad <787953403@qq.com> Date: Fri Apr 12 11:45:11 2019 +0800 chore: bump rust toolchain to 1.34.0 commit 9b055082a3bce536343dc64fed98d5038ff71626 Author: ian Date: Fri Apr 12 10:47:01 2019 +0800 docs: update quick start [skip ci] commit cfaf75ba5a7bf074c7c83a17e932011ad32f0737 Author: ian Date: Fri Apr 12 09:57:34 2019 +0800 docs: update nighly builds link commit f4c7b1bbf6786c1e49ec760c7c72fdfd201153b3 Author: ian Date: Fri Apr 12 09:55:01 2019 +0800 chore: fix quick start docs commit 7c8c65f1f84836f6dee683183641854f61c5fd72 Author: ian Date: Fri Apr 12 10:47:01 2019 +0800 docs: update quick start [skip ci] commit d22a4dcf4354e80ce9976a9ca54fb5381d4c3b61 Author: ian Date: Fri Apr 12 09:57:34 2019 +0800 docs: update nighly builds link commit dadc3cd3c175f373bcdce671cd93423441402614 Author: ian Date: Fri Apr 12 09:55:01 2019 +0800 chore: fix quick start docs commit b58721dbf7dd1f990eb6b2356da141379d8d2374 Merge: 69d06e1 ef16437 Author: bors[bot] Date: Fri Apr 12 00:06:55 2019 +0000 Merge #372 372: feat: tx valid since r=quake a=jjyr Co-authored-by: jjy commit ef164376a3fbfa822a03bcd40381ffe04a21e99a Author: jjy Date: Fri Apr 12 00:48:00 2019 +0800 fix: tx-valid-since rebase commit 69d06e1745dadecfe5603058afb2750a6f0ceb94 Merge: 60b8c1a 6573165 Author: ian Date: Fri Apr 12 00:22:42 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 65731656f2c785c2b358f5b89412fc440c727219 Author: ian Date: Fri Apr 12 00:21:45 2019 +0800 chore: ckb version tweaks (#449) - rerun build.rs to get latest version info when any file has changed. - include pre version. commit d5fd9881248ec7123f9fc4c3b0389a7312922714 Author: jjy Date: Thu Apr 11 22:51:48 2019 +0800 fix: update cfb verifier commit 527edad5b44dfd5089521cc1b61fb10dc4a1d27b Author: jjy Date: Wed Apr 10 14:47:34 2019 +0800 fix: tx valid_since rebase commit c7f1f3f2391483e3d416b6f58d6671338290d73b Author: jjy Date: Wed Apr 10 14:22:14 2019 +0800 fix: verify tx valid_since remain flags must be empty commit cba3e03c2fc3f1b9dba398edd235948880962972 Author: jjy Date: Tue Apr 9 15:56:28 2019 +0800 fix: rebase witness commit 9b21859fe090735fd384f690dba8bd5be2703875 Author: jjy Date: Tue Apr 9 13:40:40 2019 +0800 fix: cellbase input valid_since should be 0 commit e9205729baac40ae84076ce96af5920651899f34 Author: jjy Date: Tue Apr 9 13:32:15 2019 +0800 fix: update valid_since timestamp represent accoding to RFC0017 commit d78b17151ba4fe306bd0d3bb32f82a2f700ff4c9 Author: jjy Date: Mon Apr 8 16:09:12 2019 +0800 fix: regenerate protocol commit 620d1ab6247e92c7fcfccb02d1066d61577421a0 Author: jjy Date: Mon Apr 8 10:17:11 2019 +0800 fix: ignore immature tx error in relay commit d1973bbebe573182365b9d1ce3e34a8159f9d100 Author: jjy Date: Sun Apr 7 19:19:03 2019 +0800 refactor: ChainState use tx_pool_config.txs_verify_cache_size commit 5a944a86fb0a27d874866d0d9672b0c57e7e9914 Author: jjy Date: Sun Apr 7 12:06:40 2019 +0800 refactor: remove unused clippy annotation commit 44f2a22aab6f9664ddb19aa5c654a4347da2f11c Author: jjy Date: Sat Apr 6 21:53:33 2019 +0800 fix: from parent block to calculate median_block_timestamp commit 9abfd688f95484b949bf17c0468c62b2ef067c0f Author: jjy Date: Sat Apr 6 20:16:42 2019 +0800 doc: fix send_transaction RPC doc commit fd2ee8cbc7f6a7537104264f9613a51d24f69d48 Author: jjy Date: Sat Apr 6 17:04:46 2019 +0800 refactor: move ChainState initialize into new commit 644f7aad2edc76baf746d640ab34e9ecaaecfc65 Author: jjy Date: Sat Apr 6 11:11:31 2019 +0800 feat: move valid_since field from tx to CellInput commit 04d7dded5ef3f922ca0f405a166d10eea8bf1c00 Author: jjy Date: Mon Apr 1 15:19:51 2019 +0800 fix: RPC add valid_since field commit 2925b97a108232a21b20d2371d529b351186d0c8 Author: jjy Date: Fri Mar 29 16:27:55 2019 +0800 fix: update test always_success_type_hash for tx valid_since commit 076c768b5f1fe8ce7637d64f36ba4bf723eb2e59 Author: jjy Date: Fri Mar 29 14:52:42 2019 +0800 feat: tx valid since commit 60b8c1a9b5344d14a274e00cb24beae32ac876a0 Merge: 1a759e2 a2e8b45 Author: ian Date: Thu Apr 11 23:48:49 2019 +0800 Merge #435 435: refactor: store module BREAKCHANGE: This PR is a break change since we changed the rocksdb's column family name and column list, need to delete old database. This PR refactor db and chain store, make it easy to switch different key-value store implementation. - [x] Refactor `Batch` to associated type - [x] Refactor `ChainIndex` - [x] Remove some static lifetime bound for `ChainIndex` - [x] Change `Col` from Option to u32 - [x] Move `Cachedb` to db module Co-authored-by: quake wang commit 1a759e28fbd30af77a24ebc7f3d92fe7b8836cf4 Author: ian Date: Thu Apr 11 20:32:53 2019 +0800 chore: unshallow repo before building package [skip ci] commit 7ee9967be5cbb25e8bf13a1a9002f164a97ec17d Author: ian Date: Thu Apr 11 20:16:17 2019 +0800 chore: do not cache release build [skip ci] commit 06616596ec227a2c586ee432bfb3924d72f4e981 Merge: 76cc48d 45a5fca Author: ian Date: Thu Apr 11 20:10:51 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 45a5fca20ec431720c008948981e9f25bc4ca2f7 Author: ian Date: Thu Apr 11 20:09:05 2019 +0800 docs: how to get old versions of ckb commit 0974dc4efe37169945e8551ac0d13ece5a9b0215 Author: ian Date: Thu Apr 11 10:17:29 2019 +0800 docs: build ckb from master commit 8decb6cbb2ced796a1d1735098bb09349ecc4c6f Author: ian Date: Thu Apr 11 19:42:57 2019 +0800 chore: publish artifacts directly commit 6ec071792f0a24f6718ee7820a4f9083c59dd8b3 Author: ian Date: Thu Apr 11 17:13:19 2019 +0800 chore: fix package script commit 76cc48d435254dbc0028ddea3ae0658625f010e3 Merge: 04f090e b42f9d4 Author: bors[bot] Date: Thu Apr 11 07:59:55 2019 +0000 Merge #441 441: feat: use hex string represent lock args in config r=quake a=zhangsoledad Co-authored-by: zhangsoledad <787953403@qq.com> commit b42f9d4e3f08ea3a19a0994d6aa305b7a58a2ca9 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 10:55:34 2019 +0800 feat: use hex string represent lock args in config commit 04f090e8e2a467a2776870a7d21828a6bfc0ad68 Author: ian Date: Thu Apr 11 10:17:29 2019 +0800 docs: build ckb from master commit 991e864cb800355bf47cd20781f5c6a7cb0f4d01 Merge: 017568b b23e7d3 Author: ian Date: Thu Apr 11 10:17:00 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit b23e7d3f6c6bcf70577e158bb1d70705873ca83f Merge: e1ac356 0aefcc9 Author: ian Date: Thu Apr 11 09:47:55 2019 +0800 Merge pull request #424 from nervosnetwork/testnet-hotfix-2019-04-09 fix: apply hotfix for bugs found in test commit a2e8b4588b69e3b2e3c89e514ff4cdef2d0b17b4 Author: quake wang Date: Thu Apr 11 10:11:01 2019 +0900 chore: resolve some error handle issue commit 017568b9ad4dbedef2cc6651b7530ecbde33e02a Merge: 4902e15 c812c16 Author: bors[bot] Date: Wed Apr 10 17:26:39 2019 +0000 Merge #439 439: fix: mining bug caused by type changes in RPC r=zhangsoledad a=xxuejie Co-authored-by: Xuejie Xiao commit c812c1612f0c6f84baed846af6b2f538de8972a8 Author: Xuejie Xiao Date: Wed Apr 10 15:25:32 2019 +0000 fix: mining bug caused by type changes in RPC commit 0aefcc9822d87645819d814a2a9ac7aacfd761e1 Author: Linfeng Qian Date: Tue Apr 9 11:31:04 2019 +0800 fix: rustfmt commit 66ac6a1308b1740301340998e8c6c77824d40814 Author: piaoliu <441594700@qq.com> Date: Fri Apr 5 13:37:46 2019 +0800 fix: upgrage p2p dependence, fix cpu abnormal occupation commit 4648db29cc001320619d161fbfc02fac626dd2b4 Author: Linfeng Qian Date: Thu Apr 4 18:00:05 2019 +0800 chore: Downgrade some log level from debug to trace commit b00844bede5802875c53b02a2dcce81086686b64 Author: Linfeng Qian Date: Thu Apr 4 17:38:21 2019 +0800 fix: Remove sender when channel disconnected commit 973b8aac3511b226edf7073780cf2cac38f29dd0 Author: Linfeng Qian Date: Thu Apr 4 14:18:54 2019 +0800 fix: Uncomment eviction disconnect code commit 52c529ecff80fd4051e26a1ab8344a749368c50d Author: Linfeng Qian Date: Wed Apr 3 16:11:10 2019 +0800 fix: Temporary remove peer eviction logic commit 9995c5c755411be8585e5b91264663fad0aa4da8 Author: Linfeng Qian Date: Wed Apr 3 15:30:11 2019 +0800 fix: Network error handling commit f55cec5eff1166bada042c67408c1d447bb368ce Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 3 14:21:32 2019 +0800 feat: experimental deadlock detection commit e1ac356d33d309d4ed0dcf9be000150cec590478 Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 22:11:44 2019 +0800 fix: create tempfile in root dir prevent cross-device link (#438) commit 4902e1555f0e5555a473133bbec633762f65c0b6 Merge: b580f33 0e65c5b Author: bors[bot] Date: Wed Apr 10 14:03:45 2019 +0000 Merge #437 437: fix: RPC `local_node_info` returns duplicated addr r=jjyr a=rink1969 fix https://github.com/nervosnetwork/ckb/issues/436 Co-authored-by: rink1969 commit b34a0c0067a6171a022e42be82841c96dcb1c9dc Author: zhangsoledad <787953403@qq.com> Date: Tue Apr 2 19:18:08 2019 +0800 fix: temp fix tx relay flood commit b580f33b90d5ceca6b089e08ba617709db47753d Merge: 29c0a4d 2338d48 Author: bors[bot] Date: Wed Apr 10 12:32:38 2019 +0000 Merge #434 434: feat: Change all u64 fields in RPC to String r=xxuejie a=xxuejie This PR actually contains 2 parts: * refactor: Use TryFrom when parsing RPC request data * feat: Change capacity field to String type in RPC Co-authored-by: Xuejie Xiao commit 29c0a4d9fc380f1fff3f02f814527cd4e3ee9d0e Merge: f5a17c1 641f146 Author: bors[bot] Date: Wed Apr 10 11:41:16 2019 +0000 Merge #392 392: refactor: avoid recursive lock r=doitian a=zhangsoledad Co-authored-by: zhangsoledad <787953403@qq.com> commit 0e65c5bae580e5f1d2782de69f966850acb64a31 Author: rink1969 Date: Wed Apr 10 17:16:18 2019 +0800 fix: return duplicated addr see the issue for details fixes issue #436 commit 4c06dcaf28a7fb8b76454091d8ea9ed672bcfe99 Author: quake wang Date: Wed Apr 10 19:10:31 2019 +0900 refactor: move cachedb to db module commit 641f146b4aa6f68bcf26905226decbd26d555ee7 Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 17:52:24 2019 +0800 refactor: get rid of `let _ =` pattern commit d600e922c5e210f0592bee176d5907edb5b631da Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 17:51:17 2019 +0800 fix: accept_connection protocol registry commit ecb4ec0b120b43c0dac126a66bb27c3532cc6ebc Author: quake wang Date: Wed Apr 10 18:51:02 2019 +0900 refactor: change Col from Option to u32 commit bee5bb9601f656e52a40e0bc4564df8730f97491 Author: quake wang Date: Wed Apr 10 18:36:18 2019 +0900 chore: rebase develop commit 6bd407530ab6ea79b86b9e9f6087106ededa8d6f Author: quake wang Date: Wed Apr 10 18:23:41 2019 +0900 chore: rebase develop commit 89bfb95065436fb792214284a39e1f618affaf26 Author: quake wang Date: Wed Apr 10 18:02:17 2019 +0900 refactor: remove static bound for ChainIndex commit f37264b3b1098c5e921f460bf30c0fa4c7ff4d60 Author: quake wang Date: Wed Apr 10 16:47:47 2019 +0900 refactor: add helper methods to batch commit 5ca1dbe9f18e49aeaecd3ccb9bd9721a824faab6 Author: quake wang Date: Wed Apr 10 13:09:30 2019 +0900 refactor: batch function commit 06b4fc9f25c4e672b191948af3fdf729246045b6 Author: quake wang Date: Wed Apr 10 12:18:13 2019 +0900 refactor: rename diskdb to rocksdb commit f745bad219bf62c70ef636e6f0052f2557f0c9b3 Author: quake wang Date: Wed Apr 10 10:20:59 2019 +0900 refactor: change DbBatch to assoicated type commit 8d6b5f6c069aea4ddfc1088f1344544af2222717 Author: quake wang Date: Tue Apr 9 12:37:05 2019 +0900 refactor: change DbBatch to assoicated type (WIP) commit d7d658ead520d6494d60243d92a7eb543cbe712c Author: quake wang Date: Mon Apr 8 17:59:51 2019 +0900 feat: add DBIterator commit 7901f50d49f1a9199e43979a33c2108790814277 Author: quake wang Date: Mon Apr 8 16:18:12 2019 +0900 chore: remove unused COLUMN_BLOCK_TRANSACTION_IDS column commit f5b8a0127d379b847421fae86331eab646d89743 Author: quake wang Date: Mon Apr 8 15:59:15 2019 +0900 chore: private field commit 2338d488b9a8d46d75d571f4b9092ec4e06b5abb Author: Xuejie Xiao Date: Wed Apr 10 07:18:02 2019 +0000 feat: Change all u64 fields in RPC to String commit 6fb5964639213c213617f69a1e89a532bfd536e1 Author: Xuejie Xiao Date: Wed Apr 10 04:17:41 2019 +0000 refactor: Change the code to properly process errors commit f37cf2caf087ba1b7cb525a5a45850e311bd4e36 Author: Xuejie Xiao Date: Wed Apr 10 03:35:07 2019 +0000 fix: Add proper returns when parsing fails in miner commit 9925d4e369d52076ec3d87dc9a5c1327eaf9291f Author: Xuejie Xiao Date: Wed Apr 10 02:38:19 2019 +0000 feat: Change capacity field to String type in RPC commit 4c8166ca4722fde3d6a1a9f427b05dfaaed080bb Author: Xuejie Xiao Date: Wed Apr 10 02:34:41 2019 +0000 refactor: Use TryFrom when parsing RPC request data commit f5a17c16e73c22a96efc21353c8318ccf906dc27 Author: dependabot[bot] Date: Wed Apr 10 09:31:43 2019 +0800 chore(deps): bump serde from 1.0.89 to 1.0.90 (#432) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.89 to 1.0.90. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.89...v1.0.90) Signed-off-by: dependabot[bot] commit 98f97e240d6c0e70f65c5776f59566c2cff6a711 Author: dependabot[bot] Date: Wed Apr 10 09:23:22 2019 +0800 chore(deps): bump serde_bytes from 0.10.5 to 0.11.1 (#433) Bumps [serde_bytes](https://github.com/serde-rs/bytes) from 0.10.5 to 0.11.1. - [Release notes](https://github.com/serde-rs/bytes/releases) - [Commits](https://github.com/serde-rs/bytes/compare/0.10.5...0.11.1) Signed-off-by: dependabot[bot] commit 378e223ee10c4a25099900c03bace992f6613fa0 Author: dependabot[bot] Date: Wed Apr 10 09:21:57 2019 +0800 chore(deps): bump bincode from 1.1.2 to 1.1.3 (#430) Bumps [bincode](https://github.com/TyOverby/bincode) from 1.1.2 to 1.1.3. - [Release notes](https://github.com/TyOverby/bincode/releases) - [Commits](https://github.com/TyOverby/bincode/compare/v1.1.2...v1.1.3) Signed-off-by: dependabot[bot] commit 78a3add6438b0ba9cb1772e1d0d5859cdcc83849 Author: dependabot[bot] Date: Wed Apr 10 09:20:57 2019 +0800 chore(deps): bump regex from 1.1.4 to 1.1.5 (#431) Bumps [regex](https://github.com/rust-lang/regex) from 1.1.4 to 1.1.5. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.1.4...1.1.5) Signed-off-by: dependabot[bot] commit 244c22bf790ca5ec4a9e448b1250193bb265ce7c Author: dependabot[bot] Date: Wed Apr 10 09:20:31 2019 +0800 chore(deps): bump hyper from 0.12.25 to 0.12.26 (#429) Bumps [hyper](https://github.com/hyperium/hyper) from 0.12.25 to 0.12.26. - [Release notes](https://github.com/hyperium/hyper/releases) - [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/hyper/compare/v0.12.25...v0.12.26) Signed-off-by: dependabot[bot] commit 6de07fd540d5d3a50004d950fb39f5876f73ae68 Author: dependabot[bot] Date: Wed Apr 10 09:20:18 2019 +0800 chore(deps): bump flatbuffers-verifier from 0.1.8 to 0.1.9 (#428) Bumps [flatbuffers-verifier](https://github.com/nervosnetwork/cfb) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/nervosnetwork/cfb/releases) - [Commits](https://github.com/nervosnetwork/cfb/commits) Signed-off-by: dependabot[bot] commit f0f11e44b0de9554e20f27acac1d6e2d853244d8 Author: dependabot[bot] Date: Wed Apr 10 09:19:50 2019 +0800 chore(deps): bump criterion from 0.2.10 to 0.2.11 (#427) Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.2.10 to 0.2.11. - [Release notes](https://github.com/bheisler/criterion.rs/releases) - [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/bheisler/criterion.rs/compare/0.2.10...0.2.11) Signed-off-by: dependabot[bot] commit 0590131fc2f4a415ae88bd9e2821054009ddcd20 Merge: 0974742 ba0f88f Author: bors[bot] Date: Tue Apr 9 15:24:22 2019 +0000 Merge #404 404: feat: Update embedded script r=doitian a=xxuejie The embedded secp256k1_blake2b_sighash_all script is compiled from https://github.com/nervosnetwork/ckb-system-scripts/blob/384da8adc0564a228f54ae4122adda12d966f9bc/c/secp256k1_blake2b_sighash_all.c Co-authored-by: Xuejie Xiao commit 09747424b8ac5830e605508e0d113b2aa7974fd5 Merge: de3d185 c581ea3 Author: bors[bot] Date: Tue Apr 9 14:36:47 2019 +0000 Merge #422 422: feat: Remove version from Script r=doitian a=xxuejie NOTE: This is a breaking change Co-authored-by: Xuejie Xiao commit fc7defef14fdb573846b4f154f50b7c7e0eb0a4f Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 4 20:33:33 2019 +0800 refactor: avoid recursive lock commit de3d1856cb94bf07ba2082d4f0aba8a2bf3765a3 Merge: 7797cb3 24831f1 Author: bors[bot] Date: Tue Apr 9 09:18:35 2019 +0000 Merge #418 418: fix: try to repair a corrupted rocksdb automatically r=quake a=yangby-cryptape I have test this patch with a corrupted database (from @TheWaWaR). But I can not reproduce the bug by myself, so I did not write any test case. The database works, but the data is still corrupted (**because `header` add new fields?**): ``` 2019-04-09 07:39:24.154 +00:00 main WARN ckb_db::diskdb Try repairing the rocksdb since Corruption: SST file is ahead of WALs ... 2019-04-09 07:39:24.384 +00:00 main WARN ckb_db::diskdb Try opening the repaired rocksdb ... thread 'main' panicked at 'header deserializing should be ok: Custom("invalid length 3, expected a 0x-prefixed hex string with 64 digits")', src/libcore/result.rs:997:5 stack backtrace: ``` Ref: - [RocksDB: Repairer](https://github.com/facebook/rocksdb/wiki/RocksDB-Repairer) - [RocksDB: WAL Recovery Modes](https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes) - [`pub fn set_wal_recovery_mode(&mut self, mode: DBRecoveryMode)`](https://github.com/rust-rocksdb/rust-rocksdb/blob/267d92cbf9fdcbce9052ef06d7cb90b3111c6c54/src/db_options.rs#L1042-L1046) Co-authored-by: Boyu Yang commit c581ea3dfc1f40f2396dcee9e8517ba4526f057c Author: Xuejie Xiao Date: Tue Apr 9 08:28:58 2019 +0000 feat: Remove version from Script NOTE: This is a breaking change commit 24831f107c27e13405d9d62846b7c8d079651cf2 Author: Boyu Yang Date: Tue Apr 9 13:52:56 2019 +0800 fix: try to repair a corrupted rocksdb automatically commit 7797cb3e233901f5c9d2f8a145ddcf21ef72c4df Merge: 32be9aa 5cb72d8 Author: bors[bot] Date: Tue Apr 9 06:54:29 2019 +0000 Merge #419 419: chore: use new constructors to make fixed structs more readable r=zhangsoledad a=yangby-cryptape Should I delete this unit test? https://github.com/nervosnetwork/ckb/blob/32be9aa704fce9c269b93b247b64e5a87dece575/util/crypto/src/secp/signature.rs#L159-L173 Co-authored-by: Boyu Yang commit 5cb72d86c4276475f44dba15677dbcee309cd24b Author: Boyu Yang Date: Tue Apr 9 11:51:08 2019 +0800 chore: use new constructors to make fixed structs more readable commit ba0f88f5699528122344fff5fefd9887a941d0ae Author: Xuejie Xiao Date: Tue Apr 9 04:58:16 2019 +0000 fix: Fix test commit 32be9aa704fce9c269b93b247b64e5a87dece575 Merge: 2f3914e 3da3e83 2a1b8ef Author: bors[bot] Date: Tue Apr 9 01:50:42 2019 +0000 Merge #414 #416 414: fix: clear tx verfy cache when chain reorg r=doitian a=zhangsoledad 416: chore: ensure cfbc version r=zhangsoledad a=doitian Co-authored-by: zhangsoledad <787953403@qq.com> Co-authored-by: ian commit 2f3914eeb14704dd598307bc90a46af9c07cbe29 Merge: cbe4a8f 196e8e2 Author: bors[bot] Date: Tue Apr 9 00:58:35 2019 +0000 Merge #412 412: chore: add make task to run integration test r=quake a=doitian Co-authored-by: ian commit 2a1b8ef9919b98f2c04956806750a0df4ad4b1c2 Author: ian Date: Mon Apr 8 22:10:34 2019 +0800 chore: ensure cfbc version commit 196e8e269dba10b79fba0f5dfc2a749ce77dda57 Author: ian Date: Mon Apr 8 19:39:51 2019 +0800 chore: add make task to run integration test commit 3da3e83057ebbf27554030d9f41c5c2767c65923 Author: zhangsoledad <787953403@qq.com> Date: Mon Apr 8 19:23:13 2019 +0800 fix: clear tx verfy cache when chain reorg commit 053c58b4dda380d781b622d28951547030dc055b Author: Xuejie Xiao Date: Mon Apr 8 01:20:06 2019 +0000 feat: Update embedded script The embedded secp256k1_blake2b_sighash_all script is compiled from https://github.com/nervosnetwork/ckb-system-scripts/blob/384da8adc0564a228f54ae4122adda12d966f9bc/c/secp256k1_blake2b_sighash_all.c commit 860b520c6f1374382647ecfab2523147b379957b Merge: 12b851a 57e6d94 Author: LinFeng Qian Date: Tue Apr 16 14:53:40 2019 +0800 Merge pull request #475 from zhangsoledad/testnet chore: Merge develop 6250bd8 to testnet commit 57e6d941592fc871939241393a2f165702fb5fff Author: zhangsoledad <787953403@qq.com> Date: Mon Apr 15 18:02:23 2019 +0800 Squashed commit of the following: commit 6250bd8b47c5ae947f65dc3303ea14ea6da6042b Merge: 8d69722 dfd5c8a Author: ian Date: Mon Apr 15 10:03:51 2019 +0800 Merge pull request #470 from doitian/configure-sentry chore: add sentry tags commit 8d6972292bee6bab50c95d418dda891b2bdd33e6 Merge: 554ba4e ec6336f Author: ian Date: Sun Apr 14 19:37:51 2019 +0800 Merge pull request #471 from nervosnetwork/quake/cuckoo_verify_panic fix: CuckooEngine verify invalid length proof should not panic commit ec6336fadcfd863a8d7c6e3fbed1147bcfda3751 Author: quake wang Date: Sun Apr 14 12:59:37 2019 +0900 fix: CuckooEngine verify invalid length proof should not panic commit dfd5c8aa16bf153b70316d5544ab03c2029faa67 Author: ian Date: Sun Apr 14 11:16:09 2019 +0800 chore: add more sentry tags commit e452c642e79a5c07756b7c5b31c4667814dc8079 Author: ian Date: Sun Apr 14 09:05:32 2019 +0800 chore: add sentry tags commit 554ba4e6ec503fd38d7ba45f794d4658026a82c4 Merge: 3b5ceed d6fa197 Author: Quake Wang Date: Sun Apr 14 10:06:12 2019 +0900 Merge pull request #467 from doitian/wrong-option-name docs: fix wrong option name commit 3b5ceed73c3c9c5333308321c0ef2efcdd04774c Merge: 0db3859 b0003b6 Author: Quake Wang Date: Sun Apr 14 10:05:38 2019 +0900 Merge pull request #468 from doitian/require-config-file-to-start feat: ckb must loads config files from file system. commit 0db38593547686629b8fb361d362de47b4ae4a61 Merge: ac79f50 7662ee0 Author: Quake Wang Date: Sun Apr 14 10:03:06 2019 +0900 Merge pull request #450 from nervosnetwork/quake/index_store_trait_merge refactor: merge ChainIndex and ChainStore trait commit ac79f50e7c72e911cdcb43f694cddc9be47b5741 Merge: e70407c febcae0 Author: ian Date: Sun Apr 14 08:24:04 2019 +0800 Merge pull request #469 from jjyr/fix-peer-store-unique fix: PeerStore unique constraint failed commit febcae0216461ab15e911fe6a80a38ef8c2c1515 Author: jjy Date: Sat Apr 13 23:17:01 2019 +0800 fix: PeerStore unique constraint failed commit b0003b6c0c8a1f48c3a12b8c112e32ef0d20ace8 Author: ian Date: Sat Apr 13 21:55:35 2019 +0800 feat: ckb must loads config files from file system. This is a **BREAKING CHANGE**. It is a mechanism to avoid starting ckb in a wrong directory by accident. commit d6fa19772df67a36407d88342ba22fc55500d324 Author: ian Date: Sat Apr 13 21:00:51 2019 +0800 docs: fix wrong option name commit e70407ca549e87e56606f25d655947d785ba281e Merge: d3acea8 4c3d283 Author: ian Date: Sat Apr 13 13:03:19 2019 +0800 Merge pull request #463 from doitian/fix-docker-image-name docs: fix docker image name commit d3acea8d2a4d9634321bd17d665855f18108de83 Merge: 1afbd86 75d0bc7 Author: Quake Wang Date: Sat Apr 13 11:40:23 2019 +0900 Merge pull request #464 from yangby-cryptape/mv-txtrace-to-jsonrpc-types refactor: don't have to build rocksdb when use all jsonrpc types commit 75d0bc734680f1745d1aa3e292d17257bd7e8876 Author: Boyu Yang Date: Sat Apr 13 09:26:34 2019 +0800 refactor: don't have to build rocksdb when use all jsonrpc types commit 4c3d2830d7b98323a80cc0c08648b5bfcf77d88c Author: ian Date: Fri Apr 12 22:41:37 2019 +0800 docs: fix docker image name Use the full name `nervos/ckb`. commit 1afbd869eafcaaf14e2b9c672dff8f8ea21f9a3a Merge: 0800b17 62bcb82 Author: ian Date: Fri Apr 12 22:20:57 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 62bcb826b9b30caffbe4f00b11342aff48388b59 Merge: 0f86904 fb82031 Author: ian Date: Fri Apr 12 22:20:00 2019 +0800 Merge branch 'master' into rc/v0.9.0 commit 0800b17079a2c93ac09d7d3b9e3fbae8ed92c933 Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit fb820310e6d55f6ba650dc135d32822e5e8af104 Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit 0f86904bfe87dfc6e68bb0f05d6a01e973f7ba2c Author: ian Date: Fri Apr 12 22:09:30 2019 +0800 chore: setup integration test in ci - Use Travis Branch Trigger to run integration test. - Use Travis Pull Request Trigger to run unit test. - Run both tests in master branch. commit 09fcdd9c19237230a66e2f6cdffba776fa069e26 Author: ian Date: Fri Apr 12 21:13:18 2019 +0800 chore: drop bors bors is not stable. We'll run the integration test after PR merged to develop and RC branches. commit 63a1bb6f5b2ddd6849e2937800c70b2caadb745b Merge: 14d8ffc ac1fb97 Author: ian Date: Fri Apr 12 21:47:19 2019 +0800 Merge pull request #460 from doitian/drop-bors chore: drop bors commit 14d8ffc007069fa026faa61f6d20776a182ed0e0 Merge: f986b24 3cf197c Author: ian Date: Fri Apr 12 21:46:49 2019 +0800 Merge pull request #448 from zhangsoledad/zhangsoledad/relay_filter feat: relay known filter commit f986b24ad7f54993ffa38272ea595607d8be42ce Merge: 9de1418 a12a5fd Author: ian Date: Fri Apr 12 21:46:15 2019 +0800 Merge pull request #455 from nervosnetwork/thewawar/fix-sqlite-start fix: Sqlite can not start commit 9de1418cad3ab8a5f2f089b398d73a2355c59b1f Merge: bdc8ace eb7045c Author: ian Date: Fri Apr 12 21:30:40 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit eb7045cd23db5f70d7ae25fe970d7eba15e6125e Merge: 900e53d cbee1d4 Author: ian Date: Fri Apr 12 21:25:36 2019 +0800 Merge pull request #458 from nervosnetwork/dockerfile chore: update Dockerfile [skip ci] commit ac1fb97b25cfe6205d757f5c0b0a3c2806a0d8c2 Author: ian Date: Fri Apr 12 21:13:18 2019 +0800 chore: drop bors bors is not stable. We'll run the integration test after PR merged to develop and RC branches. commit cbee1d4f8d57b2258e97b00fe436f5c4e01c151a Author: ian Date: Fri Apr 12 14:22:31 2019 +0800 chore: update Dockerfile [skip ci] commit 7662ee0f0811f8d6e2a007000b898eafb5ffc004 Author: quake wang Date: Fri Apr 12 21:06:06 2019 +0900 chore: re-enable some clippy hint commit 884bfa1b9e47296c2ac45624be76401f0dbf9a73 Author: quake wang Date: Fri Apr 12 20:30:03 2019 +0900 chore: rebase develop commit d6ca06e71bdc30af197f6b82fe32c908d8001cbe Author: quake wang Date: Fri Apr 12 12:10:14 2019 +0900 chore: remove unused ChainIndex file commit 586b89c1a7a21d8aba185a328053ef08777bd5c9 Author: quake wang Date: Fri Apr 12 11:55:08 2019 +0900 chore: remove some unused `Send` and `static` trait bounds commit 1b69bb67376e6b1fea2b2a995e2afd28a076cf1a Author: quake wang Date: Fri Apr 12 11:27:39 2019 +0900 refactor: merge ChainIndex and ChainStore trait, remove unused `Clone` impl of CompactBlockMedianTimeView commit a12a5fd4b5600775f6f4a011ad6c362866337673 Author: Linfeng Qian Date: Fri Apr 12 16:26:26 2019 +0800 fix: Sqlite can not start commit bdc8aceb429d4a57f6a82ca0899ef9031d327381 Merge: 9485f1a db84513 Author: bors[bot] Date: Fri Apr 12 08:17:42 2019 +0000 Merge #452 452: chore: upgrade p2p dependence r=zhangsoledad a=driftluo Co-authored-by: piaoliu <441594700@qq.com> commit 3cf197cfd9eb96ab1d55a22a41489caf3268bc01 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 20:59:08 2019 +0800 refactor: remove unused bloom_filter protocol commit 32b79b51cb010e39301b4258c791b28d0f23bb65 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 20:52:37 2019 +0800 feat: relay known filter commit 900e53d2b43b8e35ab93bf8c6b3a3e111efce691 Author: ian Date: Fri Apr 12 15:13:13 2019 +0800 chore: deploy github releases as prerelease [skip ci] commit db84513bb10aef2843526f94bd0410c00714e053 Author: piaoliu <441594700@qq.com> Date: Fri Apr 12 15:02:02 2019 +0800 chore: upgrade p2p dependence commit 9485f1ab2becadd68e650d425c7818e94318e35a Merge: 9b05508 4f5aadf Author: bors[bot] Date: Fri Apr 12 04:37:44 2019 +0000 Merge #451 451: chore: bump rust toolchain to 1.34.0 r=zhangsoledad a=zhangsoledad * Dockerfile updated * remove redundant_closure * switch stabilized std TryFrom * AtomicU64 Co-authored-by: zhangsoledad <787953403@qq.com> commit 4f5aadf31c8aab576c2f8a3f6fcda753917b1883 Author: zhangsoledad <787953403@qq.com> Date: Fri Apr 12 11:45:11 2019 +0800 chore: bump rust toolchain to 1.34.0 commit 9b055082a3bce536343dc64fed98d5038ff71626 Author: ian Date: Fri Apr 12 10:47:01 2019 +0800 docs: update quick start [skip ci] commit cfaf75ba5a7bf074c7c83a17e932011ad32f0737 Author: ian Date: Fri Apr 12 09:57:34 2019 +0800 docs: update nighly builds link commit f4c7b1bbf6786c1e49ec760c7c72fdfd201153b3 Author: ian Date: Fri Apr 12 09:55:01 2019 +0800 chore: fix quick start docs commit 7c8c65f1f84836f6dee683183641854f61c5fd72 Author: ian Date: Fri Apr 12 10:47:01 2019 +0800 docs: update quick start [skip ci] commit d22a4dcf4354e80ce9976a9ca54fb5381d4c3b61 Author: ian Date: Fri Apr 12 09:57:34 2019 +0800 docs: update nighly builds link commit dadc3cd3c175f373bcdce671cd93423441402614 Author: ian Date: Fri Apr 12 09:55:01 2019 +0800 chore: fix quick start docs commit b58721dbf7dd1f990eb6b2356da141379d8d2374 Merge: 69d06e1 ef16437 Author: bors[bot] Date: Fri Apr 12 00:06:55 2019 +0000 Merge #372 372: feat: tx valid since r=quake a=jjyr Co-authored-by: jjy commit ef164376a3fbfa822a03bcd40381ffe04a21e99a Author: jjy Date: Fri Apr 12 00:48:00 2019 +0800 fix: tx-valid-since rebase commit 69d06e1745dadecfe5603058afb2750a6f0ceb94 Merge: 60b8c1a 6573165 Author: ian Date: Fri Apr 12 00:22:42 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 65731656f2c785c2b358f5b89412fc440c727219 Author: ian Date: Fri Apr 12 00:21:45 2019 +0800 chore: ckb version tweaks (#449) - rerun build.rs to get latest version info when any file has changed. - include pre version. commit d5fd9881248ec7123f9fc4c3b0389a7312922714 Author: jjy Date: Thu Apr 11 22:51:48 2019 +0800 fix: update cfb verifier commit 527edad5b44dfd5089521cc1b61fb10dc4a1d27b Author: jjy Date: Wed Apr 10 14:47:34 2019 +0800 fix: tx valid_since rebase commit c7f1f3f2391483e3d416b6f58d6671338290d73b Author: jjy Date: Wed Apr 10 14:22:14 2019 +0800 fix: verify tx valid_since remain flags must be empty commit cba3e03c2fc3f1b9dba398edd235948880962972 Author: jjy Date: Tue Apr 9 15:56:28 2019 +0800 fix: rebase witness commit 9b21859fe090735fd384f690dba8bd5be2703875 Author: jjy Date: Tue Apr 9 13:40:40 2019 +0800 fix: cellbase input valid_since should be 0 commit e9205729baac40ae84076ce96af5920651899f34 Author: jjy Date: Tue Apr 9 13:32:15 2019 +0800 fix: update valid_since timestamp represent accoding to RFC0017 commit d78b17151ba4fe306bd0d3bb32f82a2f700ff4c9 Author: jjy Date: Mon Apr 8 16:09:12 2019 +0800 fix: regenerate protocol commit 620d1ab6247e92c7fcfccb02d1066d61577421a0 Author: jjy Date: Mon Apr 8 10:17:11 2019 +0800 fix: ignore immature tx error in relay commit d1973bbebe573182365b9d1ce3e34a8159f9d100 Author: jjy Date: Sun Apr 7 19:19:03 2019 +0800 refactor: ChainState use tx_pool_config.txs_verify_cache_size commit 5a944a86fb0a27d874866d0d9672b0c57e7e9914 Author: jjy Date: Sun Apr 7 12:06:40 2019 +0800 refactor: remove unused clippy annotation commit 44f2a22aab6f9664ddb19aa5c654a4347da2f11c Author: jjy Date: Sat Apr 6 21:53:33 2019 +0800 fix: from parent block to calculate median_block_timestamp commit 9abfd688f95484b949bf17c0468c62b2ef067c0f Author: jjy Date: Sat Apr 6 20:16:42 2019 +0800 doc: fix send_transaction RPC doc commit fd2ee8cbc7f6a7537104264f9613a51d24f69d48 Author: jjy Date: Sat Apr 6 17:04:46 2019 +0800 refactor: move ChainState initialize into new commit 644f7aad2edc76baf746d640ab34e9ecaaecfc65 Author: jjy Date: Sat Apr 6 11:11:31 2019 +0800 feat: move valid_since field from tx to CellInput commit 04d7dded5ef3f922ca0f405a166d10eea8bf1c00 Author: jjy Date: Mon Apr 1 15:19:51 2019 +0800 fix: RPC add valid_since field commit 2925b97a108232a21b20d2371d529b351186d0c8 Author: jjy Date: Fri Mar 29 16:27:55 2019 +0800 fix: update test always_success_type_hash for tx valid_since commit 076c768b5f1fe8ce7637d64f36ba4bf723eb2e59 Author: jjy Date: Fri Mar 29 14:52:42 2019 +0800 feat: tx valid since commit 60b8c1a9b5344d14a274e00cb24beae32ac876a0 Merge: 1a759e2 a2e8b45 Author: ian Date: Thu Apr 11 23:48:49 2019 +0800 Merge #435 435: refactor: store module BREAKCHANGE: This PR is a break change since we changed the rocksdb's column family name and column list, need to delete old database. This PR refactor db and chain store, make it easy to switch different key-value store implementation. - [x] Refactor `Batch` to associated type - [x] Refactor `ChainIndex` - [x] Remove some static lifetime bound for `ChainIndex` - [x] Change `Col` from Option to u32 - [x] Move `Cachedb` to db module Co-authored-by: quake wang commit 1a759e28fbd30af77a24ebc7f3d92fe7b8836cf4 Author: ian Date: Thu Apr 11 20:32:53 2019 +0800 chore: unshallow repo before building package [skip ci] commit 7ee9967be5cbb25e8bf13a1a9002f164a97ec17d Author: ian Date: Thu Apr 11 20:16:17 2019 +0800 chore: do not cache release build [skip ci] commit 06616596ec227a2c586ee432bfb3924d72f4e981 Merge: 76cc48d 45a5fca Author: ian Date: Thu Apr 11 20:10:51 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit 45a5fca20ec431720c008948981e9f25bc4ca2f7 Author: ian Date: Thu Apr 11 20:09:05 2019 +0800 docs: how to get old versions of ckb commit 0974dc4efe37169945e8551ac0d13ece5a9b0215 Author: ian Date: Thu Apr 11 10:17:29 2019 +0800 docs: build ckb from master commit 8decb6cbb2ced796a1d1735098bb09349ecc4c6f Author: ian Date: Thu Apr 11 19:42:57 2019 +0800 chore: publish artifacts directly commit 6ec071792f0a24f6718ee7820a4f9083c59dd8b3 Author: ian Date: Thu Apr 11 17:13:19 2019 +0800 chore: fix package script commit 76cc48d435254dbc0028ddea3ae0658625f010e3 Merge: 04f090e b42f9d4 Author: bors[bot] Date: Thu Apr 11 07:59:55 2019 +0000 Merge #441 441: feat: use hex string represent lock args in config r=quake a=zhangsoledad Co-authored-by: zhangsoledad <787953403@qq.com> commit b42f9d4e3f08ea3a19a0994d6aa305b7a58a2ca9 Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 10:55:34 2019 +0800 feat: use hex string represent lock args in config commit 04f090e8e2a467a2776870a7d21828a6bfc0ad68 Author: ian Date: Thu Apr 11 10:17:29 2019 +0800 docs: build ckb from master commit 991e864cb800355bf47cd20781f5c6a7cb0f4d01 Merge: 017568b b23e7d3 Author: ian Date: Thu Apr 11 10:17:00 2019 +0800 Merge branch 'rc/v0.9.0' into develop commit b23e7d3f6c6bcf70577e158bb1d70705873ca83f Merge: e1ac356 0aefcc9 Author: ian Date: Thu Apr 11 09:47:55 2019 +0800 Merge pull request #424 from nervosnetwork/testnet-hotfix-2019-04-09 fix: apply hotfix for bugs found in test commit a2e8b4588b69e3b2e3c89e514ff4cdef2d0b17b4 Author: quake wang Date: Thu Apr 11 10:11:01 2019 +0900 chore: resolve some error handle issue commit 017568b9ad4dbedef2cc6651b7530ecbde33e02a Merge: 4902e15 c812c16 Author: bors[bot] Date: Wed Apr 10 17:26:39 2019 +0000 Merge #439 439: fix: mining bug caused by type changes in RPC r=zhangsoledad a=xxuejie Co-authored-by: Xuejie Xiao commit c812c1612f0c6f84baed846af6b2f538de8972a8 Author: Xuejie Xiao Date: Wed Apr 10 15:25:32 2019 +0000 fix: mining bug caused by type changes in RPC commit 0aefcc9822d87645819d814a2a9ac7aacfd761e1 Author: Linfeng Qian Date: Tue Apr 9 11:31:04 2019 +0800 fix: rustfmt commit 66ac6a1308b1740301340998e8c6c77824d40814 Author: piaoliu <441594700@qq.com> Date: Fri Apr 5 13:37:46 2019 +0800 fix: upgrage p2p dependence, fix cpu abnormal occupation commit 4648db29cc001320619d161fbfc02fac626dd2b4 Author: Linfeng Qian Date: Thu Apr 4 18:00:05 2019 +0800 chore: Downgrade some log level from debug to trace commit b00844bede5802875c53b02a2dcce81086686b64 Author: Linfeng Qian Date: Thu Apr 4 17:38:21 2019 +0800 fix: Remove sender when channel disconnected commit 973b8aac3511b226edf7073780cf2cac38f29dd0 Author: Linfeng Qian Date: Thu Apr 4 14:18:54 2019 +0800 fix: Uncomment eviction disconnect code commit 52c529ecff80fd4051e26a1ab8344a749368c50d Author: Linfeng Qian Date: Wed Apr 3 16:11:10 2019 +0800 fix: Temporary remove peer eviction logic commit 9995c5c755411be8585e5b91264663fad0aa4da8 Author: Linfeng Qian Date: Wed Apr 3 15:30:11 2019 +0800 fix: Network error handling commit f55cec5eff1166bada042c67408c1d447bb368ce Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 3 14:21:32 2019 +0800 feat: experimental deadlock detection commit e1ac356d33d309d4ed0dcf9be000150cec590478 Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 22:11:44 2019 +0800 fix: create tempfile in root dir prevent cross-device link (#438) commit 4902e1555f0e5555a473133bbec633762f65c0b6 Merge: b580f33 0e65c5b Author: bors[bot] Date: Wed Apr 10 14:03:45 2019 +0000 Merge #437 437: fix: RPC `local_node_info` returns duplicated addr r=jjyr a=rink1969 fix https://github.com/nervosnetwork/ckb/issues/436 Co-authored-by: rink1969 commit b34a0c0067a6171a022e42be82841c96dcb1c9dc Author: zhangsoledad <787953403@qq.com> Date: Tue Apr 2 19:18:08 2019 +0800 fix: temp fix tx relay flood commit b580f33b90d5ceca6b089e08ba617709db47753d Merge: 29c0a4d 2338d48 Author: bors[bot] Date: Wed Apr 10 12:32:38 2019 +0000 Merge #434 434: feat: Change all u64 fields in RPC to String r=xxuejie a=xxuejie This PR actually contains 2 parts: * refactor: Use TryFrom when parsing RPC request data * feat: Change capacity field to String type in RPC Co-authored-by: Xuejie Xiao commit 29c0a4d9fc380f1fff3f02f814527cd4e3ee9d0e Merge: f5a17c1 641f146 Author: bors[bot] Date: Wed Apr 10 11:41:16 2019 +0000 Merge #392 392: refactor: avoid recursive lock r=doitian a=zhangsoledad Co-authored-by: zhangsoledad <787953403@qq.com> commit 0e65c5bae580e5f1d2782de69f966850acb64a31 Author: rink1969 Date: Wed Apr 10 17:16:18 2019 +0800 fix: return duplicated addr see the issue for details fixes issue #436 commit 4c06dcaf28a7fb8b76454091d8ea9ed672bcfe99 Author: quake wang Date: Wed Apr 10 19:10:31 2019 +0900 refactor: move cachedb to db module commit 641f146b4aa6f68bcf26905226decbd26d555ee7 Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 17:52:24 2019 +0800 refactor: get rid of `let _ =` pattern commit d600e922c5e210f0592bee176d5907edb5b631da Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 17:51:17 2019 +0800 fix: accept_connection protocol registry commit ecb4ec0b120b43c0dac126a66bb27c3532cc6ebc Author: quake wang Date: Wed Apr 10 18:51:02 2019 +0900 refactor: change Col from Option to u32 commit bee5bb9601f656e52a40e0bc4564df8730f97491 Author: quake wang Date: Wed Apr 10 18:36:18 2019 +0900 chore: rebase develop commit 6bd407530ab6ea79b86b9e9f6087106ededa8d6f Author: quake wang Date: Wed Apr 10 18:23:41 2019 +0900 chore: rebase develop commit 89bfb95065436fb792214284a39e1f618affaf26 Author: quake wang Date: Wed Apr 10 18:02:17 2019 +0900 refactor: remove static bound for ChainIndex commit f37264b3b1098c5e921f460bf30c0fa4c7ff4d60 Author: quake wang Date: Wed Apr 10 16:47:47 2019 +0900 refactor: add helper methods to batch commit 5ca1dbe9f18e49aeaecd3ccb9bd9721a824faab6 Author: quake wang Date: Wed Apr 10 13:09:30 2019 +0900 refactor: batch function commit 06b4fc9f25c4e672b191948af3fdf729246045b6 Author: quake wang Date: Wed Apr 10 12:18:13 2019 +0900 refactor: rename diskdb to rocksdb commit f745bad219bf62c70ef636e6f0052f2557f0c9b3 Author: quake wang Date: Wed Apr 10 10:20:59 2019 +0900 refactor: change DbBatch to assoicated type commit 8d6b5f6c069aea4ddfc1088f1344544af2222717 Author: quake wang Date: Tue Apr 9 12:37:05 2019 +0900 refactor: change DbBatch to assoicated type (WIP) commit d7d658ead520d6494d60243d92a7eb543cbe712c Author: quake wang Date: Mon Apr 8 17:59:51 2019 +0900 feat: add DBIterator commit 7901f50d49f1a9199e43979a33c2108790814277 Author: quake wang Date: Mon Apr 8 16:18:12 2019 +0900 chore: remove unused COLUMN_BLOCK_TRANSACTION_IDS column commit f5b8a0127d379b847421fae86331eab646d89743 Author: quake wang Date: Mon Apr 8 15:59:15 2019 +0900 chore: private field commit 2338d488b9a8d46d75d571f4b9092ec4e06b5abb Author: Xuejie Xiao Date: Wed Apr 10 07:18:02 2019 +0000 feat: Change all u64 fields in RPC to String commit 6fb5964639213c213617f69a1e89a532bfd536e1 Author: Xuejie Xiao Date: Wed Apr 10 04:17:41 2019 +0000 refactor: Change the code to properly process errors commit f37cf2caf087ba1b7cb525a5a45850e311bd4e36 Author: Xuejie Xiao Date: Wed Apr 10 03:35:07 2019 +0000 fix: Add proper returns when parsing fails in miner commit 9925d4e369d52076ec3d87dc9a5c1327eaf9291f Author: Xuejie Xiao Date: Wed Apr 10 02:38:19 2019 +0000 feat: Change capacity field to String type in RPC commit 4c8166ca4722fde3d6a1a9f427b05dfaaed080bb Author: Xuejie Xiao Date: Wed Apr 10 02:34:41 2019 +0000 refactor: Use TryFrom when parsing RPC request data commit f5a17c16e73c22a96efc21353c8318ccf906dc27 Author: dependabot[bot] Date: Wed Apr 10 09:31:43 2019 +0800 chore(deps): bump serde from 1.0.89 to 1.0.90 (#432) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.89 to 1.0.90. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.89...v1.0.90) Signed-off-by: dependabot[bot] commit 98f97e240d6c0e70f65c5776f59566c2cff6a711 Author: dependabot[bot] Date: Wed Apr 10 09:23:22 2019 +0800 chore(deps): bump serde_bytes from 0.10.5 to 0.11.1 (#433) Bumps [serde_bytes](https://github.com/serde-rs/bytes) from 0.10.5 to 0.11.1. - [Release notes](https://github.com/serde-rs/bytes/releases) - [Commits](https://github.com/serde-rs/bytes/compare/0.10.5...0.11.1) Signed-off-by: dependabot[bot] commit 378e223ee10c4a25099900c03bace992f6613fa0 Author: dependabot[bot] Date: Wed Apr 10 09:21:57 2019 +0800 chore(deps): bump bincode from 1.1.2 to 1.1.3 (#430) Bumps [bincode](https://github.com/TyOverby/bincode) from 1.1.2 to 1.1.3. - [Release notes](https://github.com/TyOverby/bincode/releases) - [Commits](https://github.com/TyOverby/bincode/compare/v1.1.2...v1.1.3) Signed-off-by: dependabot[bot] commit 78a3add6438b0ba9cb1772e1d0d5859cdcc83849 Author: dependabot[bot] Date: Wed Apr 10 09:20:57 2019 +0800 chore(deps): bump regex from 1.1.4 to 1.1.5 (#431) Bumps [regex](https://github.com/rust-lang/regex) from 1.1.4 to 1.1.5. - [Release notes](https://github.com/rust-lang/regex/releases) - [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-lang/regex/compare/1.1.4...1.1.5) Signed-off-by: dependabot[bot] commit 244c22bf790ca5ec4a9e448b1250193bb265ce7c Author: dependabot[bot] Date: Wed Apr 10 09:20:31 2019 +0800 chore(deps): bump hyper from 0.12.25 to 0.12.26 (#429) Bumps [hyper](https://github.com/hyperium/hyper) from 0.12.25 to 0.12.26. - [Release notes](https://github.com/hyperium/hyper/releases) - [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md) - [Commits](https://github.com/hyperium/hyper/compare/v0.12.25...v0.12.26) Signed-off-by: dependabot[bot] commit 6de07fd540d5d3a50004d950fb39f5876f73ae68 Author: dependabot[bot] Date: Wed Apr 10 09:20:18 2019 +0800 chore(deps): bump flatbuffers-verifier from 0.1.8 to 0.1.9 (#428) Bumps [flatbuffers-verifier](https://github.com/nervosnetwork/cfb) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/nervosnetwork/cfb/releases) - [Commits](https://github.com/nervosnetwork/cfb/commits) Signed-off-by: dependabot[bot] commit f0f11e44b0de9554e20f27acac1d6e2d853244d8 Author: dependabot[bot] Date: Wed Apr 10 09:19:50 2019 +0800 chore(deps): bump criterion from 0.2.10 to 0.2.11 (#427) Bumps [criterion](https://github.com/bheisler/criterion.rs) from 0.2.10 to 0.2.11. - [Release notes](https://github.com/bheisler/criterion.rs/releases) - [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/bheisler/criterion.rs/compare/0.2.10...0.2.11) Signed-off-by: dependabot[bot] commit 0590131fc2f4a415ae88bd9e2821054009ddcd20 Merge: 0974742 ba0f88f Author: bors[bot] Date: Tue Apr 9 15:24:22 2019 +0000 Merge #404 404: feat: Update embedded script r=doitian a=xxuejie The embedded secp256k1_blake2b_sighash_all script is compiled from https://github.com/nervosnetwork/ckb-system-scripts/blob/384da8adc0564a228f54ae4122adda12d966f9bc/c/secp256k1_blake2b_sighash_all.c Co-authored-by: Xuejie Xiao commit 09747424b8ac5830e605508e0d113b2aa7974fd5 Merge: de3d185 c581ea3 Author: bors[bot] Date: Tue Apr 9 14:36:47 2019 +0000 Merge #422 422: feat: Remove version from Script r=doitian a=xxuejie NOTE: This is a breaking change Co-authored-by: Xuejie Xiao commit fc7defef14fdb573846b4f154f50b7c7e0eb0a4f Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 4 20:33:33 2019 +0800 refactor: avoid recursive lock commit de3d1856cb94bf07ba2082d4f0aba8a2bf3765a3 Merge: 7797cb3 24831f1 Author: bors[bot] Date: Tue Apr 9 09:18:35 2019 +0000 Merge #418 418: fix: try to repair a corrupted rocksdb automatically r=quake a=yangby-cryptape I have test this patch with a corrupted database (from @TheWaWaR). But I can not reproduce the bug by myself, so I did not write any test case. The database works, but the data is still corrupted (**because `header` add new fields?**): ``` 2019-04-09 07:39:24.154 +00:00 main WARN ckb_db::diskdb Try repairing the rocksdb since Corruption: SST file is ahead of WALs ... 2019-04-09 07:39:24.384 +00:00 main WARN ckb_db::diskdb Try opening the repaired rocksdb ... thread 'main' panicked at 'header deserializing should be ok: Custom("invalid length 3, expected a 0x-prefixed hex string with 64 digits")', src/libcore/result.rs:997:5 stack backtrace: ``` Ref: - [RocksDB: Repairer](https://github.com/facebook/rocksdb/wiki/RocksDB-Repairer) - [RocksDB: WAL Recovery Modes](https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes) - [`pub fn set_wal_recovery_mode(&mut self, mode: DBRecoveryMode)`](https://github.com/rust-rocksdb/rust-rocksdb/blob/267d92cbf9fdcbce9052ef06d7cb90b3111c6c54/src/db_options.rs#L1042-L1046) Co-authored-by: Boyu Yang commit c581ea3dfc1f40f2396dcee9e8517ba4526f057c Author: Xuejie Xiao Date: Tue Apr 9 08:28:58 2019 +0000 feat: Remove version from Script NOTE: This is a breaking change commit 24831f107c27e13405d9d62846b7c8d079651cf2 Author: Boyu Yang Date: Tue Apr 9 13:52:56 2019 +0800 fix: try to repair a corrupted rocksdb automatically commit 7797cb3e233901f5c9d2f8a145ddcf21ef72c4df Merge: 32be9aa 5cb72d8 Author: bors[bot] Date: Tue Apr 9 06:54:29 2019 +0000 Merge #419 419: chore: use new constructors to make fixed structs more readable r=zhangsoledad a=yangby-cryptape Should I delete this unit test? https://github.com/nervosnetwork/ckb/blob/32be9aa704fce9c269b93b247b64e5a87dece575/util/crypto/src/secp/signature.rs#L159-L173 Co-authored-by: Boyu Yang commit 5cb72d86c4276475f44dba15677dbcee309cd24b Author: Boyu Yang Date: Tue Apr 9 11:51:08 2019 +0800 chore: use new constructors to make fixed structs more readable commit ba0f88f5699528122344fff5fefd9887a941d0ae Author: Xuejie Xiao Date: Tue Apr 9 04:58:16 2019 +0000 fix: Fix test commit 32be9aa704fce9c269b93b247b64e5a87dece575 Merge: 2f3914e 3da3e83 2a1b8ef Author: bors[bot] Date: Tue Apr 9 01:50:42 2019 +0000 Merge #414 #416 414: fix: clear tx verfy cache when chain reorg r=doitian a=zhangsoledad 416: chore: ensure cfbc version r=zhangsoledad a=doitian Co-authored-by: zhangsoledad <787953403@qq.com> Co-authored-by: ian commit 2f3914eeb14704dd598307bc90a46af9c07cbe29 Merge: cbe4a8f 196e8e2 Author: bors[bot] Date: Tue Apr 9 00:58:35 2019 +0000 Merge #412 412: chore: add make task to run integration test r=quake a=doitian Co-authored-by: ian commit 2a1b8ef9919b98f2c04956806750a0df4ad4b1c2 Author: ian Date: Mon Apr 8 22:10:34 2019 +0800 chore: ensure cfbc version commit 196e8e269dba10b79fba0f5dfc2a749ce77dda57 Author: ian Date: Mon Apr 8 19:39:51 2019 +0800 chore: add make task to run integration test commit 3da3e83057ebbf27554030d9f41c5c2767c65923 Author: zhangsoledad <787953403@qq.com> Date: Mon Apr 8 19:23:13 2019 +0800 fix: clear tx verfy cache when chain reorg commit 053c58b4dda380d781b622d28951547030dc055b Author: Xuejie Xiao Date: Mon Apr 8 01:20:06 2019 +0000 feat: Update embedded script The embedded secp256k1_blake2b_sighash_all script is compiled from https://github.com/nervosnetwork/ckb-system-scripts/blob/384da8adc0564a228f54ae4122adda12d966f9bc/c/secp256k1_blake2b_sighash_all.c commit 12b851ad54f382be710526c7d6ac8f30ca2dd5aa Author: jjy Date: Sat Apr 13 23:17:01 2019 +0800 fix: PeerStore unique constraint failed commit a0b29184e5df6892599877eef3ed305e1aa89d4e Author: zhangsoledad <787953403@qq.com> Date: Thu Apr 11 20:52:37 2019 +0800 feat: relay known filter commit 29834804ef4ae9e814ec3060c93897be8f29b411 Author: Linfeng Qian Date: Sat Apr 13 22:31:18 2019 +0800 revert: Insert repeat transaction in pool commit e74668b9a89fb96d279298c0eddc2b99dcfbe344 Author: zhangsoledad <787953403@qq.com> Date: Sat Apr 13 20:46:48 2019 +0800 fix: block download commit 47849981d717b1be5683e5bb50babcd0f6326569 Merge: 53c9eca db31c9d Author: LinFeng Qian Date: Sat Apr 13 20:46:58 2019 +0800 Merge pull request #466 from zhangsoledad/zhangsoledad/fix_conflic_verify fix: conflict transaction verify commit db31c9d9d9f7937cb1c1ca4bef2bcceebbaaed3b Author: zhangsoledad <787953403@qq.com> Date: Sat Apr 13 18:39:00 2019 +0800 fix: conflict transaction verify commit 2420de5ad7264fddc60f2b9f9b8f1917c1bc40be Author: zhangsoledad <787953403@qq.com> Date: Wed Apr 10 21:57:50 2019 +0800 fix: create tempfile in root dir prevent cross-device link commit 53c9ecac5bc150f2744831d852a9c1e14db26d94 Author: Linfeng Qian Date: Fri Apr 12 12:47:27 2019 +0800 fix: Repeat process orphan block commit 980c99c6dd70a3b3433e7d133880ed3440958676 Author: Qian Linfeng Date: Thu Apr 11 22:31:57 2019 +0800 fix: Insert repeat transaction in pool commit 2ebc3fe98ba73da002624061a4edbe9d9790c5cc Author: Linfeng Qian Date: Thu Apr 11 12:45:50 2019 +0800 chore: Reduce log level commit 28dbfd25ed8046954d165c94addfb7af6b83a127 Author: Linfeng Qian Date: Thu Apr 11 10:20:29 2019 +0800 fix: Testnet hot fix --- Cargo.lock | 2 + chain/src/chain.rs | 4 +- chain/src/tests/basic.rs | 18 +- core/Cargo.toml | 1 + core/src/cell.rs | 77 ++- network/src/peers_registry.rs | 4 +- network/src/protocols/discovery.rs | 2 +- network/src/protocols/identify.rs | 6 +- network/src/protocols/mod.rs | 5 +- rpc/src/module/chain.rs | 2 +- script/src/verify.rs | 30 +- shared/Cargo.toml | 1 + shared/src/cell_set.rs | 83 ++- shared/src/chain_state.rs | 66 ++- shared/src/tests/cell_set.rs | 82 +++ shared/src/tests/data/no1/cell_set.json | 548 ++++++++++++++++++ shared/src/tests/data/no1/cell_set_diff.json | 99 ++++ shared/src/tests/data/no1/txs.json | 117 ++++ shared/src/tests/mod.rs | 1 + shared/src/tx_pool/types.rs | 10 +- sync/src/relayer/transaction_process.rs | 1 - sync/src/synchronizer/block_fetcher.rs | 2 +- sync/src/synchronizer/block_pool.rs | 6 + sync/src/synchronizer/headers_process.rs | 20 +- sync/src/synchronizer/mod.rs | 12 +- util/jsonrpc-types/src/cell.rs | 7 +- verification/src/error.rs | 1 + .../src/tests/transaction_verifier.rs | 82 +-- verification/src/transaction_verifier.rs | 19 +- 29 files changed, 1132 insertions(+), 176 deletions(-) create mode 100644 shared/src/tests/cell_set.rs create mode 100644 shared/src/tests/data/no1/cell_set.json create mode 100644 shared/src/tests/data/no1/cell_set_diff.json create mode 100644 shared/src/tests/data/no1/txs.json diff --git a/Cargo.lock b/Cargo.lock index 128b54ba85..87c9111400 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -414,6 +414,7 @@ dependencies = [ "faster-hex 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "hash 0.9.0-pre", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "numext-fixed-hash 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "numext-fixed-uint 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "occupied-capacity 0.9.0-pre", @@ -658,6 +659,7 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 55e3da60c2..33698a6ebf 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -458,9 +458,9 @@ impl ChainService { if found_error.is_none() { let mut seen_inputs = FnvHashSet::default(); - let cell_set_diff_cp = OverlayCellProvider::new(&cell_set_diff, chain_state); + let cell_set_overlay = chain_state.new_cell_set_overlay(&cell_set_diff); let block_cp = BlockCellProvider::new(b); - let cell_provider = OverlayCellProvider::new(&block_cp, &cell_set_diff_cp); + let cell_provider = OverlayCellProvider::new(&block_cp, &cell_set_overlay); let resolved: Vec = b .commit_transactions() diff --git a/chain/src/tests/basic.rs b/chain/src/tests/basic.rs index 120cb5cc7e..ed1e10e080 100644 --- a/chain/src/tests/basic.rs +++ b/chain/src/tests/basic.rs @@ -2,7 +2,7 @@ use crate::tests::util::{create_transaction, gen_block, start_chain}; use ckb_chain_spec::consensus::Consensus; use ckb_core::block::Block; use ckb_core::block::BlockBuilder; -use ckb_core::cell::{CellMeta, CellProvider, CellStatus}; +use ckb_core::cell::{CellProvider, CellStatus}; use ckb_core::header::HeaderBuilder; use ckb_core::script::Script; use ckb_core::transaction::{CellInput, CellOutput, OutPoint, TransactionBuilder}; @@ -66,7 +66,7 @@ fn test_genesis_transaction_spend() { shared .chain_state() .lock() - .cell(&OutPoint::new(genesis_tx_hash, 0)), + .get_cell_status(&OutPoint::new(genesis_tx_hash, 0)), CellStatus::Dead ); } @@ -110,7 +110,7 @@ fn test_transaction_spend_in_same_block() { shared .chain_state() .lock() - .cell(&OutPoint::new(hash.clone(), 0)), + .get_cell_status(&OutPoint::new(hash.clone(), 0)), CellStatus::Unknown ); } @@ -163,7 +163,7 @@ fn test_transaction_spend_in_same_block() { shared .chain_state() .lock() - .cell(&OutPoint::new(hash.clone(), 0)), + .get_cell_status(&OutPoint::new(hash.clone(), 0)), CellStatus::Dead ); } @@ -172,12 +172,8 @@ fn test_transaction_spend_in_same_block() { shared .chain_state() .lock() - .cell(&OutPoint::new(tx2_hash, 0)), - CellStatus::Live(CellMeta { - cell_output: tx2_output, - block_number: Some(4), - cellbase: false, - }) + .get_cell_status(&OutPoint::new(tx2_hash, 0)), + CellStatus::live_output(tx2_output, Some(4), false) ); } @@ -370,7 +366,7 @@ fn test_genesis_transaction_fetch() { let (_chain_controller, shared) = start_chain(Some(consensus), false); let out_point = OutPoint::new(root_hash, 0); - let state = shared.chain_state().lock().cell(&out_point); + let state = shared.chain_state().lock().get_cell_status(&out_point); assert!(state.is_live()); } diff --git a/core/Cargo.toml b/core/Cargo.toml index 1eaef7458e..4b20689555 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -21,3 +21,4 @@ fnv = "1.0.3" ckb-merkle-tree = {path = "../util/merkle-tree"} faster-hex = "0.3" serde_bytes = "0.11.1" +log = "0.4" diff --git a/core/src/cell.rs b/core/src/cell.rs index 7d00742141..2f970aa248 100644 --- a/core/src/cell.rs +++ b/core/src/cell.rs @@ -6,7 +6,13 @@ use numext_fixed_hash::H256; use std::iter::Chain; use std::slice; -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, Eq, PartialEq, Debug)] +pub enum LiveCell { + Null, + Output(CellMeta), +} + +#[derive(Clone, Eq, PartialEq, Debug)] pub struct CellMeta { pub cell_output: CellOutput, pub block_number: Option, @@ -17,12 +23,16 @@ impl CellMeta { pub fn is_cellbase(&self) -> bool { self.cellbase } + + pub fn capacity(&self) -> Capacity { + self.cell_output.capacity + } } #[derive(Clone, PartialEq, Debug)] pub enum CellStatus { /// Cell exists and has not been spent. - Live(CellMeta), + Live(LiveCell), /// Cell exists and has been spent. Dead, /// Cell does not exist. @@ -30,6 +40,22 @@ pub enum CellStatus { } impl CellStatus { + pub fn null() -> CellStatus { + CellStatus::Live(LiveCell::Null) + } + + pub fn live_output( + cell_output: CellOutput, + block_number: Option, + cellbase: bool, + ) -> CellStatus { + CellStatus::Live(LiveCell::Output(CellMeta { + cell_output, + block_number, + cellbase, + })) + } + pub fn is_live(&self) -> bool { match *self { CellStatus::Live(_) => true, @@ -45,16 +71,16 @@ impl CellStatus { self == &CellStatus::Unknown } - pub fn get_live(&self) -> Option<&CellMeta> { + pub fn get_live_output(&self) -> Option<&CellMeta> { match *self { - CellStatus::Live(ref output) => Some(output), + CellStatus::Live(LiveCell::Output(ref output)) => Some(output), _ => None, } } - pub fn take_live(self) -> Option { + pub fn take_live_output(self) -> Option { match self { - CellStatus::Live(output) => Some(output), + CellStatus::Live(LiveCell::Output(output)) => Some(output), _ => None, } } @@ -70,6 +96,14 @@ pub struct ResolvedTransaction { pub trait CellProvider { fn cell(&self, out_point: &OutPoint) -> CellStatus; + + fn get_cell_status(&self, out_point: &OutPoint) -> CellStatus { + if out_point.is_null() { + CellStatus::Live(LiveCell::Null) + } else { + self.cell(out_point) + } + } } pub struct OverlayCellProvider<'a, O, CP> { @@ -92,10 +126,10 @@ where CP: CellProvider, { fn cell(&self, out_point: &OutPoint) -> CellStatus { - match self.overlay.cell(out_point) { + match self.overlay.get_cell_status(out_point) { CellStatus::Live(co) => CellStatus::Live(co), CellStatus::Dead => CellStatus::Dead, - CellStatus::Unknown => self.cell_provider.cell(out_point), + CellStatus::Unknown => self.cell_provider.get_cell_status(out_point), } } } @@ -127,11 +161,9 @@ impl<'a> CellProvider for BlockCellProvider<'a> { .outputs() .get(out_point.index as usize) { - Some(x) => CellStatus::Live(CellMeta { - cell_output: x.clone(), - block_number: Some(self.block.header().number()), - cellbase: *i == 0, - }), + Some(x) => { + CellStatus::live_output(x.clone(), Some(self.block.header().number()), *i == 0) + } None => CellStatus::Unknown, } } else { @@ -150,7 +182,7 @@ pub fn resolve_transaction( .iter() .map(|input| { if seen_inputs.insert(input.clone()) { - cell_provider.cell(input) + cell_provider.get_cell_status(input) } else { CellStatus::Dead } @@ -162,7 +194,7 @@ pub fn resolve_transaction( .iter() .map(|dep| { if seen_inputs.insert(dep.clone()) { - cell_provider.cell(dep) + cell_provider.get_cell_status(dep) } else { CellStatus::Dead } @@ -208,8 +240,8 @@ impl ResolvedTransaction { self.input_cells .iter() .filter_map(|cell_status| { - if let CellStatus::Live(cell_meta) = cell_status { - Some(cell_meta.cell_output.capacity) + if let CellStatus::Live(LiveCell::Output(cell_meta)) = cell_status { + Some(cell_meta.capacity()) } else { None } @@ -231,7 +263,7 @@ mod tests { impl CellProvider for CellMemoryDb { fn cell(&self, o: &OutPoint) -> CellStatus { match self.cells.get(o) { - Some(&Some(ref cell)) => CellStatus::Live(cell.clone()), + Some(&Some(ref cell_meta)) => CellStatus::Live(LiveCell::Output(cell_meta.clone())), Some(&None) => CellStatus::Dead, None => CellStatus::Unknown, } @@ -270,8 +302,11 @@ mod tests { db.cells.insert(p1.clone(), Some(o.clone())); db.cells.insert(p2.clone(), None); - assert_eq!(CellStatus::Live(o), db.cell(&p1)); - assert_eq!(CellStatus::Dead, db.cell(&p2)); - assert_eq!(CellStatus::Unknown, db.cell(&p3)); + assert_eq!( + CellStatus::Live(LiveCell::Output(o)), + db.get_cell_status(&p1) + ); + assert_eq!(CellStatus::Dead, db.get_cell_status(&p2)); + assert_eq!(CellStatus::Unknown, db.get_cell_status(&p3)); } } diff --git a/network/src/peers_registry.rs b/network/src/peers_registry.rs index 32a350c2cb..1c0a8874df 100644 --- a/network/src/peers_registry.rs +++ b/network/src/peers_registry.rs @@ -128,11 +128,11 @@ impl PeersRegistry { let mut peers = self.peers.write(); if let Some(peer) = peers.get_mut(&peer_id) { + debug!(target: "network", "add peer protocol: peer_id={:?}, session_id={}, protocol_id={}", peer_id, session_id, protocol_id); peer.protocols.insert(protocol_id, protocol_version); return Ok(RegisterResult::Exist(peer.peer_index)); } - let inbound = session_type.is_inbound(); let mut peer_id_by_index = self.peer_id_by_index.write(); if !self.is_reserved(&peer_id) { @@ -146,7 +146,7 @@ impl PeersRegistry { let connection_status = self._connection_status(peers.iter()); // check peers connection limitation - if inbound { + if session_type.is_inbound() { if connection_status.unreserved_inbound >= self.max_inbound && !self._try_evict_inbound_peer(&mut peers, &mut peer_id_by_index) { diff --git a/network/src/protocols/discovery.rs b/network/src/protocols/discovery.rs index e92f13ee0c..ba45d63582 100644 --- a/network/src/protocols/discovery.rs +++ b/network/src/protocols/discovery.rs @@ -199,7 +199,7 @@ impl Stream for DiscoveryService { .peer_store() .add_discovered_addr(&peer_id, addr) { - warn!(target: "network", "add_discovered_addr failed {:?}", peer_id); + debug!(target: "network", "add_discovered_addr failed {:?}", peer_id); } } } diff --git a/network/src/protocols/identify.rs b/network/src/protocols/identify.rs index 0589050bd6..67b30f27a4 100644 --- a/network/src/protocols/identify.rs +++ b/network/src/protocols/identify.rs @@ -1,6 +1,6 @@ // use crate::peer_store::Behaviour; use crate::NetworkState; -use log::{debug, trace, warn}; +use log::{debug, trace}; use p2p::{ multiaddr::{Multiaddr, Protocol}, secio::PeerId, @@ -59,7 +59,7 @@ impl Callback for IdentifyCallback { let peer_store = self.network_state.peer_store(); for addr in addrs { if !peer_store.add_discovered_addr(&peer_id, addr) { - warn!(target: "network", "add_discovered_addr failed {:?}", peer_id); + debug!(target: "network", "add_discovered_addr failed {:?}", peer_id); } } } @@ -108,7 +108,7 @@ impl Callback for IdentifyCallback { .peer_store() .add_discovered_addr(local_peer_id, transformed_addr) { - warn!(target: "network", "add_discovered_addr failed {:?}", local_peer_id); + debug!(target: "network", "add_discovered_addr failed {:?}", local_peer_id); } } // NOTE: for future usage diff --git a/network/src/protocols/mod.rs b/network/src/protocols/mod.rs index 4c4e9955ec..6c1bd8227b 100644 --- a/network/src/protocols/mod.rs +++ b/network/src/protocols/mod.rs @@ -356,7 +356,10 @@ impl CKBProtocolContext for DefaultCKBProtocolContext { .ok_or_else(|| PeerError::NotFound(peer_id.to_owned())) .and_then(|peer| { peer.protocol_version(protocol_id) - .ok_or_else(|| PeerError::ProtocolNotFound(peer_id.to_owned(), protocol_id)) + .ok_or_else(|| { + warn!(target: "network", "can not get protocol version: peer={:?}, protocol_id={}", peer, protocol_id); + PeerError::ProtocolNotFound(peer_id.to_owned(), protocol_id) + }) .map(|_| peer.session_id) })?; diff --git a/rpc/src/module/chain.rs b/rpc/src/module/chain.rs index 8f87fe580d..43a78d8f85 100644 --- a/rpc/src/module/chain.rs +++ b/rpc/src/module/chain.rs @@ -111,7 +111,7 @@ impl ChainRpc for ChainRpcImpl { .shared .chain_state() .lock() - .cell(&(out_point.try_into().map_err(|_| Error::parse_error())?)) + .get_cell_status(&(out_point.try_into().map_err(|_| Error::parse_error())?)) .into()) } diff --git a/script/src/verify.rs b/script/src/verify.rs index 069f479b5b..03fae354d5 100644 --- a/script/src/verify.rs +++ b/script/src/verify.rs @@ -34,7 +34,7 @@ impl<'a> TransactionScriptsVerifier<'a> { .iter() .map(|cell| { &cell - .get_live() + .get_live_output() .expect("already verifies that all dep cells are valid") .cell_output }) @@ -44,7 +44,7 @@ impl<'a> TransactionScriptsVerifier<'a> { .iter() .map(|cell| { &cell - .get_live() + .get_live_output() .expect("already verifies that all input cells are valid") .cell_output }) @@ -201,7 +201,7 @@ impl<'a> TransactionScriptsVerifier<'a> { #[cfg(test)] mod tests { use super::*; - use ckb_core::cell::{CellMeta, CellStatus}; + use ckb_core::cell::{CellMeta, CellStatus, LiveCell}; use ckb_core::script::Script; use ckb_core::transaction::{CellInput, CellOutput, OutPoint, TransactionBuilder}; use ckb_core::Capacity; @@ -231,7 +231,7 @@ mod tests { let rtx = ResolvedTransaction { transaction, dep_cells: vec![], - input_cells: vec![CellStatus::Live(dummy_cell)], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -293,8 +293,8 @@ mod tests { let rtx = ResolvedTransaction { transaction, - dep_cells: vec![CellStatus::Live(dep_cell)], - input_cells: vec![CellStatus::Live(dummy_cell)], + dep_cells: vec![CellStatus::Live(LiveCell::Output(dep_cell))], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -356,8 +356,8 @@ mod tests { let rtx = ResolvedTransaction { transaction, - dep_cells: vec![CellStatus::Live(dep_cell)], - input_cells: vec![CellStatus::Live(dummy_cell)], + dep_cells: vec![CellStatus::Live(LiveCell::Output(dep_cell))], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -421,8 +421,8 @@ mod tests { let rtx = ResolvedTransaction { transaction, - dep_cells: vec![CellStatus::Live(dep_cell)], - input_cells: vec![CellStatus::Live(dummy_cell)], + dep_cells: vec![CellStatus::Live(LiveCell::Output(dep_cell))], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -479,7 +479,7 @@ mod tests { let rtx = ResolvedTransaction { transaction, dep_cells: vec![], - input_cells: vec![CellStatus::Live(dummy_cell)], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -545,8 +545,8 @@ mod tests { let rtx = ResolvedTransaction { transaction, - dep_cells: vec![CellStatus::Live(dep_cell)], - input_cells: vec![CellStatus::Live(dummy_cell)], + dep_cells: vec![CellStatus::Live(LiveCell::Output(dep_cell))], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); @@ -609,8 +609,8 @@ mod tests { let rtx = ResolvedTransaction { transaction, - dep_cells: vec![CellStatus::Live(dep_cell)], - input_cells: vec![CellStatus::Live(dummy_cell)], + dep_cells: vec![CellStatus::Live(LiveCell::Output(dep_cell))], + input_cells: vec![CellStatus::Live(LiveCell::Output(dummy_cell))], }; let verifier = TransactionScriptsVerifier::new(&rtx); diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 06f3a6fd08..b37d6d34f9 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -29,3 +29,4 @@ linked-hash-map = { git = "https://github.com/nervosnetwork/linked-hash-map", re env_logger = "0.6" tempfile = "3.0" rand = "0.6" +serde_json = "1.0" diff --git a/shared/src/cell_set.rs b/shared/src/cell_set.rs index 0d7f940c74..1dd45dd65e 100644 --- a/shared/src/cell_set.rs +++ b/shared/src/cell_set.rs @@ -1,12 +1,11 @@ use ckb_core::block::Block; -use ckb_core::cell::{CellProvider, CellStatus}; use ckb_core::transaction::OutPoint; use ckb_core::transaction_meta::TransactionMeta; use fnv::{FnvHashMap, FnvHashSet}; use numext_fixed_hash::H256; use serde_derive::{Deserialize, Serialize}; -#[derive(Default, Debug, Clone)] +#[derive(Default, Clone, Deserialize, Serialize)] pub struct CellSetDiff { pub old_inputs: FnvHashSet, pub old_outputs: FnvHashSet, @@ -39,19 +38,26 @@ impl CellSetDiff { } } -impl CellProvider for CellSetDiff { - fn cell(&self, out_point: &OutPoint) -> CellStatus { - if self.new_inputs.contains(out_point) { - CellStatus::Dead - } else { - CellStatus::Unknown +#[derive(Debug, PartialEq, Eq, Clone)] +pub struct CellSetOverlay<'a> { + origin: &'a FnvHashMap, + new: FnvHashMap, + removed: FnvHashSet, +} + +impl<'a> CellSetOverlay<'a> { + pub fn get(&self, hash: &H256) -> Option<&TransactionMeta> { + if self.removed.get(hash).is_some() { + return None; } + + self.new.get(hash).or_else(|| self.origin.get(hash)) } } #[derive(Default, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] pub struct CellSet { - inner: FnvHashMap, + pub(crate) inner: FnvHashMap, } impl CellSet { @@ -61,6 +67,50 @@ impl CellSet { } } + pub fn new_overlay<'a>(&'a self, diff: &CellSetDiff) -> CellSetOverlay<'a> { + let mut new = FnvHashMap::default(); + let mut removed = FnvHashSet::default(); + + for hash in &diff.old_outputs { + if self.inner.get(&hash).is_some() { + removed.insert(hash.clone()); + } + } + + for (hash, (number, cellbase, len)) in diff.new_outputs.clone() { + removed.remove(&hash); + if cellbase { + new.insert(hash, TransactionMeta::new_cellbase(number, len)); + } else { + new.insert(hash, TransactionMeta::new(number, len)); + } + } + + for old_input in &diff.old_inputs { + if let Some(meta) = self.inner.get(&old_input.hash) { + let meta = new + .entry(old_input.hash.clone()) + .or_insert_with(|| meta.clone()); + meta.unset_dead(old_input.index as usize); + } + } + + for new_input in &diff.new_inputs { + if let Some(meta) = self.inner.get(&new_input.hash) { + let meta = new + .entry(new_input.hash.clone()) + .or_insert_with(|| meta.clone()); + meta.set_dead(new_input.index as usize); + } + } + + CellSetOverlay { + new, + removed, + origin: &self.inner, + } + } + pub fn is_dead(&self, o: &OutPoint) -> Option { self.inner.get(&o.hash).map(|x| x.is_dead(o.index as usize)) } @@ -122,18 +172,3 @@ impl CellSet { }); } } - -impl CellProvider for CellSet { - fn cell(&self, out_point: &OutPoint) -> CellStatus { - match self.get(&out_point.hash) { - Some(meta) => { - if meta.is_dead(out_point.index as usize) { - CellStatus::Dead - } else { - CellStatus::Unknown - } - } - None => CellStatus::Unknown, - } - } -} diff --git a/shared/src/chain_state.rs b/shared/src/chain_state.rs index d12838772d..a721f66d19 100644 --- a/shared/src/chain_state.rs +++ b/shared/src/chain_state.rs @@ -1,13 +1,11 @@ -use crate::cell_set::CellSet; -use crate::cell_set::CellSetDiff; +use crate::cell_set::{CellSet, CellSetDiff, CellSetOverlay}; use crate::store::ChainStore; use crate::tx_pool::{PoolEntry, PoolError, StagingTxResult, TxPool, TxPoolConfig}; use crate::tx_proposal_table::TxProposalTable; use ckb_chain_spec::consensus::{Consensus, ProposalWindow}; use ckb_core::block::Block; use ckb_core::cell::{ - resolve_transaction, CellMeta, CellProvider, CellStatus, OverlayCellProvider, - ResolvedTransaction, + resolve_transaction, CellProvider, CellStatus, OverlayCellProvider, ResolvedTransaction, }; use ckb_core::header::{BlockNumber, Header}; use ckb_core::transaction::{OutPoint, ProposalShortId, Transaction}; @@ -15,7 +13,7 @@ use ckb_core::Cycle; use ckb_traits::BlockMedianTimeContext; use ckb_verification::{TransactionError, TransactionVerifier}; use fnv::FnvHashSet; -use log::{error, trace}; +use log::error; use lru_cache::LruCache; use numext_fixed_hash::H256; use numext_fixed_uint::U256; @@ -27,7 +25,7 @@ pub struct ChainState { store: Arc, tip_header: Header, total_difficulty: U256, - cell_set: CellSet, + pub(crate) cell_set: CellSet, proposal_ids: TxProposalTable, // interior mutability for immutable borrow proposal_ids tx_pool: RefCell, @@ -144,7 +142,7 @@ impl ChainState { &self.cell_set } - pub fn is_dead(&self, o: &OutPoint) -> Option { + pub fn is_dead_cell(&self, o: &OutPoint) -> Option { self.cell_set.is_dead(o) } @@ -176,12 +174,7 @@ impl ChainState { let short_id = tx.proposal_short_id(); let rtx = self.resolve_tx_from_pool(&tx, &tx_pool); let verify_result = self.verify_rtx(&rtx, max_cycles); - let tx_hash = tx.hash(); if self.contains_proposal_id(&short_id) { - if !tx_pool.filter.insert(tx_hash.clone()) { - trace!(target: "tx_pool", "discarding already known transaction {:#x}", tx_hash); - return Err(PoolError::Duplicate); - } let entry = PoolEntry::new(tx, 0, verify_result.ok()); self.staging_tx(&mut tx_pool, entry, max_cycles)?; Ok(verify_result.map_err(PoolError::InvalidTx)?) @@ -350,10 +343,6 @@ impl ChainState { attached.extend(blk.commit_transactions().iter().skip(1).cloned()) } - if !detached.is_empty() { - self.txs_verify_cache.borrow_mut().clear(); - } - let retain: Vec<&Transaction> = detached.difference(&attached).collect(); for tx in retain { @@ -418,6 +407,18 @@ impl ChainState { pub fn consensus(&self) -> Arc { Arc::clone(&self.consensus) } + + pub fn new_cell_set_overlay<'a>(&'a self, diff: &CellSetDiff) -> ChainCellSetOverlay<'a, CS> { + ChainCellSetOverlay { + overlay: self.cell_set.new_overlay(diff), + store: Arc::clone(&self.store), + } + } +} + +pub struct ChainCellSetOverlay<'a, CS> { + pub(crate) overlay: CellSetOverlay<'a>, + store: Arc, } impl CellProvider for ChainState { @@ -431,11 +432,34 @@ impl CellProvider for ChainState { .store .get_transaction(&out_point.hash) .expect("store should be consistent with cell_set"); - CellStatus::Live(CellMeta { - cell_output: tx.outputs()[out_point.index as usize].clone(), - block_number: Some(tx_meta.block_number()), - cellbase: tx_meta.is_cellbase(), - }) + CellStatus::live_output( + tx.outputs()[out_point.index as usize].clone(), + Some(tx_meta.block_number()), + tx_meta.is_cellbase(), + ) + } + } + None => CellStatus::Unknown, + } + } +} + +impl<'a, CS: ChainStore> CellProvider for ChainCellSetOverlay<'a, CS> { + fn cell(&self, out_point: &OutPoint) -> CellStatus { + match self.overlay.get(&out_point.hash) { + Some(tx_meta) => { + if tx_meta.is_dead(out_point.index as usize) { + CellStatus::Dead + } else { + let tx = self + .store + .get_transaction(&out_point.hash) + .expect("store should be consistent with cell_set"); + CellStatus::live_output( + tx.outputs()[out_point.index as usize].clone(), + Some(tx_meta.block_number()), + tx_meta.is_cellbase(), + ) } } None => CellStatus::Unknown, diff --git a/shared/src/tests/cell_set.rs b/shared/src/tests/cell_set.rs new file mode 100644 index 0000000000..aa4d67c5c6 --- /dev/null +++ b/shared/src/tests/cell_set.rs @@ -0,0 +1,82 @@ +use crate::cell_set::{CellSet, CellSetDiff}; +use crate::{ + shared::{Shared, SharedBuilder}, + store::ChainKVStore, +}; +use ckb_core::cell::{resolve_transaction, CellStatus, LiveCell}; +use ckb_core::transaction::Transaction; +use ckb_db::memorydb::MemoryKeyValueDB; +use fnv::FnvHashSet; +use std::fs::File; +use std::io::BufReader; +use std::path::Path; + +fn cell_set() -> CellSet { + let file = File::open( + Path::new(env!("CARGO_MANIFEST_DIR")).join("./src/tests/data/no1/cell_set.json"), + ) + .unwrap(); + let reader = BufReader::new(file); + serde_json::from_reader(reader).unwrap() +} + +fn cell_set_diff() -> CellSetDiff { + let file = File::open( + Path::new(env!("CARGO_MANIFEST_DIR")).join("./src/tests/data/no1/cell_set_diff.json"), + ) + .unwrap(); + let reader = BufReader::new(file); + serde_json::from_reader(reader).unwrap() +} + +fn transcations() -> Vec { + let file = + File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join("./src/tests/data/no1/txs.json")) + .unwrap(); + let reader = BufReader::new(file); + serde_json::from_reader(reader).unwrap() +} + +fn new_shared() -> Shared> { + SharedBuilder::::new().build() +} + +#[test] +fn case_no1() { + let shared = new_shared(); + let mut chain_state = shared.chain_state().lock(); + chain_state.cell_set = cell_set(); + + let cell_set_diff = cell_set_diff(); + let cell_set_overlay = chain_state.new_cell_set_overlay(&cell_set_diff); + + let transcations = transcations(); + // let cell_provider = OverlayCellProvider::new(&overlay, &cell_set); + + let mut seen_inputs = FnvHashSet::default(); + + //Outpoint::null should be live + let rtx0 = resolve_transaction(&transcations[0], &mut seen_inputs, &cell_set_overlay); + assert_eq!(rtx0.input_cells[0], CellStatus::Live(LiveCell::Null)); + + let out_point = transcations[1].inputs()[0].previous_output.clone(); + + // cell A (0x8aa8799cd6ad56dd6929fd6ac05f5cab6a5339562297abb619839ab2da519f35, 0) + // A is dead in old fork + assert_eq!( + cell_set() + .get(&out_point.hash) + .map(|mate| mate.is_dead(out_point.index as usize)), + Some(true) + ); + + // A include in cell_set_diff old_inputs + // A is live in cell_set_overlay + assert_eq!( + cell_set_overlay + .overlay + .get(&out_point.hash) + .map(|mate| mate.is_dead(out_point.index as usize)), + Some(false) + ); +} diff --git a/shared/src/tests/data/no1/cell_set.json b/shared/src/tests/data/no1/cell_set.json new file mode 100644 index 0000000000..90a3ab89bc --- /dev/null +++ b/shared/src/tests/data/no1/cell_set.json @@ -0,0 +1,548 @@ +{ + "inner": { + "0xca3fed5b686b03340565255d192e40dbb2efb89399ef031ab8aeb0412219bf09": { + "block_number": 10137, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xc9c6611fba877275be11a986189fbb6b29326f52e5de08fe00cdcdf0a284f4c1": { + "block_number": 10168, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x1f14ce01f31d07be1a5b22c3a68e64b975f4bef5ce66650d25418837a05d343e": { + "block_number": 10134, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xcd16a5760f2aec0f38a9987ca8f294753cbc5ae08bef542352ab204a2e6e9f39": { + "block_number": 10139, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x22aa96d7504f41e5ce45db96a423be33bfdbe3f342547fa5a7fcad2014cae285": { + "block_number": 10148, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x98016e8fd9b084eb75287a70bede12127cc0d16167713c6dc4860bc5e8b4a8c3": { + "block_number": 10158, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x0c09664c2676a74fa3e67f570c586c79ee39ab43b4507f6847abf2f97155ca20": { + "block_number": 10143, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x83643963780119a6a2ad78defbc54d4f27ce2e23f84887ae499657da5353f46e": { + "block_number": 10155, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xa7525c99513e717d692ccea518827deb16bfb3d446984c568dcbe783d9e4973d": { + "block_number": 10110, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x59d69409d5a1db054afd79d151eb6c0e814355ca124143c7e00ec948e23bfe4d": { + "block_number": 10152, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x44257d53f3c298d7b312c0ecad19155d2464d1d6a6767ccc6cc91ecf66ce7a7a": { + "block_number": 10140, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x8fae2f7ae7d772f89d59233293faec343773ff887d532170f2fcd4e014eaed45": { + "block_number": 10113, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x5264da5c89a80e6710a38bfb6d4b4f253e28f449221695d25f2f53931af7895d": { + "block_number": 10157, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xb6182fda77fd30dca301e60b54ed32cf0044dc0bf18d6c12cb190555d4d148af": { + "block_number": 10156, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x3ada486933e94b4bc677f7da0547c3c14dc5b5b90be720802a5ec7d8c0f207c1": { + "block_number": 10154, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xf2357b2bcbdf943419e840db7fb10027dba358ce85180ea9820728411079d544": { + "block_number": 10149, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x3eeb2c9c5cac551a0edf1788a189f290f92907b760244d6bdf28cdd8c8c8894d": { + "block_number": 10121, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xbea241d645a80eb083db5ffe6a5a69b731d194a419ab19dc0419a67dda61e542": { + "block_number": 10123, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x50ba4351fb26baf21d1e658da6d8751f585aa05ebacb1cbf412d033db2ccc148": { + "block_number": 10161, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x368da99c0fc2b4fa96ac1f3990e2e72e91772ea4357ccd449996d69f1dcd5715": { + "block_number": 10132, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x2d6bd912dc4cd288193bf0476540a2734cf9dcf1990eacc6090bd3092dcb7e0a": { + "block_number": 10124, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x2fdc6e1d0dcad095b257de2fb18fcdcd6bf04d66102f76dc47beeb4be5d4a0c5": { + "block_number": 10141, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xf40eb9ad6534bb347051cb752d043efcbffce1f7ef01bfde9b440a154ad70623": { + "block_number": 10107, + "dead_cell": { + "bits": [ + 0 + ] + } + }, + "0x0c37d8126fb903abff78556aca7f85a022b290630a39905eaaf3cf3aef27dd09": { + "block_number": 10107, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x0c2b2db6eb0cae01ae39f6df6098d1a5faac9a611105ce63c920247acbfbf9dc": { + "block_number": 10116, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x6f8f99a8822681af13ec3cb421ba8132ff1971c00f48cec5bbe85f67c1c42f27": { + "block_number": 10146, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x05a1b94456e3cf55d94ccaa0323f43fd71cb819d98b8fffde9547afe57948b26": { + "block_number": 10117, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x720a679b3c2775f4d855d7af121bb271a1dc0ade1fac1a35747fc6370c4080e2": { + "block_number": 10106, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x7e757f06f48960b952a1467a5063d6ccea140e16133475b1be4f6d6181b36d8d": { + "block_number": 10133, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x633c9f27ff9758540cbc46724b49c749232c586530dd6bfdee62cf581c7b1a7a": { + "block_number": 10153, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x5b08ca643d0d874aaa01973d331a4d0113e80d52f41133f06df04cf7b5d5ac4a": { + "block_number": 10138, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x2a1ec1ee1a3e5c14caa90b088f181decf39d033732e6e7cb8a9b59b19b5c0dec": { + "block_number": 10135, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x5289c5498c1742721277c3000a540ccb8a3fbcbe9e33f55ec052dfdd083e7af0": { + "block_number": 10166, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x50f1bbf4a7d4b1aacb6ac4c2bf223550f1c1ccd3a1ce648a9cf35589f9195d1a": { + "block_number": 10119, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x52e84d3b55bc53a76cddf7335dbea3e089694ad054fbaf6a81bcf66a8dfac529": { + "block_number": 10109, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xb7229ea51faa43ae414bc7db3d1a7af57703458ee65cd3722fc6de62d537d83a": { + "block_number": 10147, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x3a98197ed2e37711832c72ea5b8c97574969c2751cc61fa81a3309a6d3c01a90": { + "block_number": 10118, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x6816ee33791397ebd4999dede17918307e02a32f10c873475444c68629711708": { + "block_number": 10163, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x9e8a13e77260543e49ab295d753215aa18786018d4adf8a602cd29f18742be7d": { + "block_number": 10125, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x59faa51aaaecdee170d9c676e1288fd7a72bdcc80c7ebe8849bf1f3f2f627f8b": { + "block_number": 10169, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x41c753149fca012b721172e5c47ff70f36d0c47a23d8846a0b18419c51652830": { + "block_number": 10131, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xd5ca8675eb735f21f842c346f6432bdc6a5fe08b467054528e1119a6bf7cf75b": { + "block_number": 10111, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x21b1574d43e74be01c1704be137c9105b2bd8e237261a0a8a801f9b86771f1e8": { + "block_number": 10162, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x60108e648fc51ac1b0b5aa486d9d00fda4e4ce170f90cdd681ae3a27886fc65c": { + "block_number": 10105, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x976fad66aa52af17f3e55c1742d0666efe8c6f5dc7e0c9518b54ac2ece61bb0c": { + "block_number": 10112, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x9bd0e65bb360f72313a1d196da459087e36a31c08799e8d518c80a329d1191b7": { + "block_number": 10167, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xd17146b581625d7dda1ff8a92092483eea912bb92fc394e2b81d576e036a0600": { + "block_number": 10127, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xa4847b1dd77d415c51b56dbd7d58e3239e8eb82eef0e5b6aacee1f7d5aaab167": { + "block_number": 10150, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xbae3b3c4553bbd6c479110d6a564338a8df43e25de3beed04f5ba8e370648004": { + "block_number": 10115, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x82511936e9aad7bee4e6f98572eaa08996019b448534aef6cf6e197ce4d1ed47": { + "block_number": 10108, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x83554ee97c797a8ee703f68a223335bf2d6340a2daa7948702c1df7725a3a682": { + "block_number": 10120, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x4fd43974b264552505a653e546d58bd26fd005b0d147aa0315adf58583b93fc6": { + "block_number": 10128, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x12addef8dfc66171c9665b8dda25900414088e9416e22a117934fc41f5789226": { + "block_number": 10142, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xcf65332ad0016ada2302db809dbb9dcb3de5c8298285adf9609d9b89eacb4082": { + "block_number": 10136, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xeac0f9c489d2cde6f5795fb678b7a12c85b7fa70d1cde21cbf030b9692f982db": { + "block_number": 10122, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x35cf55fb58424b33c6d5739319af58ca5547b9a537a628c8a335e04c24131bf9": { + "block_number": 10165, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xcf75114467b80b70c70827861dc30959f9e3bd815b0da9842d3ae4b8146bf838": { + "block_number": 10130, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x7fe6b4dc2f69f8b02b55efec28bba19a25373f2a230175f2caa77588b51540df": { + "block_number": 10160, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x6e50a8a650d52a6413726a96a269be18db33d656ff358539317eaabea9d003df": { + "block_number": 10145, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xaa414e6a8aec762bbe59d7fb12d634770204eef4c70a90d8ce24707ddddac8bd": { + "block_number": 10159, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0xc0ca2179d5874cbf38eed8fc7d3bf7bb9b37d3f96f1e28f0e76297454eab92f9": { + "block_number": 10151, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x9ca72b2c6ecb40c0a820b036f0fde7d890526ef0751de58f2cda4afb6357e5d2": { + "block_number": 10144, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x8aa8799cd6ad56dd6929fd6ac05f5cab6a5339562297abb619839ab2da519f35": { + "block_number": 10093, + "dead_cell": { + "bits": [ + 192 + ] + } + }, + "0x25af5273e8c377e89852634b3657cfbf59930e595af298eeb6f0b16ce3939e3f": { + "block_number": 10126, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x0e55254bf204330d6584a28ac716fee47283e2ec29765943845d8d3fc7f7d985": { + "block_number": 10114, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x9bcac81123bbe99ff04a6b68fe608e1c831e452214d51cfb2b21a5669f9a270a": { + "block_number": 10129, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x651946163c6d34de0340c19f4c9d999d6186283b8574d746c2553bc3542426d2": { + "block_number": 10104, + "dead_cell": { + "bits": [ + 128 + ] + } + }, + "0x73c689fec3bd65b4ad88f63bbb6d056887b0af168070a2a6f4a7b9cfb687ee64": { + "block_number": 10164, + "dead_cell": { + "bits": [ + 128 + ] + } + } + } +} diff --git a/shared/src/tests/data/no1/cell_set_diff.json b/shared/src/tests/data/no1/cell_set_diff.json new file mode 100644 index 0000000000..a8d062c745 --- /dev/null +++ b/shared/src/tests/data/no1/cell_set_diff.json @@ -0,0 +1,99 @@ +{ + "old_inputs": [ + { + "hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "index": 4294967295 + }, + { + "hash": "0x8aa8799cd6ad56dd6929fd6ac05f5cab6a5339562297abb619839ab2da519f35", + "index": 0 + } + ], + "old_outputs": [ + "0x7e757f06f48960b952a1467a5063d6ccea140e16133475b1be4f6d6181b36d8d", + "0x82511936e9aad7bee4e6f98572eaa08996019b448534aef6cf6e197ce4d1ed47", + "0xf2357b2bcbdf943419e840db7fb10027dba358ce85180ea9820728411079d544", + "0x05a1b94456e3cf55d94ccaa0323f43fd71cb819d98b8fffde9547afe57948b26", + "0x3a98197ed2e37711832c72ea5b8c97574969c2751cc61fa81a3309a6d3c01a90", + "0x12addef8dfc66171c9665b8dda25900414088e9416e22a117934fc41f5789226", + "0xd5ca8675eb735f21f842c346f6432bdc6a5fe08b467054528e1119a6bf7cf75b", + "0x9bd0e65bb360f72313a1d196da459087e36a31c08799e8d518c80a329d1191b7", + "0x368da99c0fc2b4fa96ac1f3990e2e72e91772ea4357ccd449996d69f1dcd5715", + "0x0e55254bf204330d6584a28ac716fee47283e2ec29765943845d8d3fc7f7d985", + "0xcf65332ad0016ada2302db809dbb9dcb3de5c8298285adf9609d9b89eacb4082", + "0x59d69409d5a1db054afd79d151eb6c0e814355ca124143c7e00ec948e23bfe4d", + "0xbea241d645a80eb083db5ffe6a5a69b731d194a419ab19dc0419a67dda61e542", + "0x9bcac81123bbe99ff04a6b68fe608e1c831e452214d51cfb2b21a5669f9a270a", + "0x633c9f27ff9758540cbc46724b49c749232c586530dd6bfdee62cf581c7b1a7a", + "0xa7525c99513e717d692ccea518827deb16bfb3d446984c568dcbe783d9e4973d", + "0x44257d53f3c298d7b312c0ecad19155d2464d1d6a6767ccc6cc91ecf66ce7a7a", + "0x2d6bd912dc4cd288193bf0476540a2734cf9dcf1990eacc6090bd3092dcb7e0a", + "0xd17146b581625d7dda1ff8a92092483eea912bb92fc394e2b81d576e036a0600", + "0xa4847b1dd77d415c51b56dbd7d58e3239e8eb82eef0e5b6aacee1f7d5aaab167", + "0x6f8f99a8822681af13ec3cb421ba8132ff1971c00f48cec5bbe85f67c1c42f27", + "0xaa414e6a8aec762bbe59d7fb12d634770204eef4c70a90d8ce24707ddddac8bd", + "0x1f14ce01f31d07be1a5b22c3a68e64b975f4bef5ce66650d25418837a05d343e", + "0x6e50a8a650d52a6413726a96a269be18db33d656ff358539317eaabea9d003df", + "0x2fdc6e1d0dcad095b257de2fb18fcdcd6bf04d66102f76dc47beeb4be5d4a0c5", + "0x5264da5c89a80e6710a38bfb6d4b4f253e28f449221695d25f2f53931af7895d", + "0x4fd43974b264552505a653e546d58bd26fd005b0d147aa0315adf58583b93fc6", + "0x5289c5498c1742721277c3000a540ccb8a3fbcbe9e33f55ec052dfdd083e7af0", + "0x83554ee97c797a8ee703f68a223335bf2d6340a2daa7948702c1df7725a3a682", + "0x60108e648fc51ac1b0b5aa486d9d00fda4e4ce170f90cdd681ae3a27886fc65c", + "0x651946163c6d34de0340c19f4c9d999d6186283b8574d746c2553bc3542426d2", + "0x9ca72b2c6ecb40c0a820b036f0fde7d890526ef0751de58f2cda4afb6357e5d2", + "0x21b1574d43e74be01c1704be137c9105b2bd8e237261a0a8a801f9b86771f1e8", + "0x976fad66aa52af17f3e55c1742d0666efe8c6f5dc7e0c9518b54ac2ece61bb0c", + "0x6816ee33791397ebd4999dede17918307e02a32f10c873475444c68629711708", + "0x50ba4351fb26baf21d1e658da6d8751f585aa05ebacb1cbf412d033db2ccc148", + "0xeac0f9c489d2cde6f5795fb678b7a12c85b7fa70d1cde21cbf030b9692f982db", + "0xcd16a5760f2aec0f38a9987ca8f294753cbc5ae08bef542352ab204a2e6e9f39", + "0xcf75114467b80b70c70827861dc30959f9e3bd815b0da9842d3ae4b8146bf838", + "0x2a1ec1ee1a3e5c14caa90b088f181decf39d033732e6e7cb8a9b59b19b5c0dec", + "0x5b08ca643d0d874aaa01973d331a4d0113e80d52f41133f06df04cf7b5d5ac4a", + "0x0c09664c2676a74fa3e67f570c586c79ee39ab43b4507f6847abf2f97155ca20", + "0x35cf55fb58424b33c6d5739319af58ca5547b9a537a628c8a335e04c24131bf9", + "0xca3fed5b686b03340565255d192e40dbb2efb89399ef031ab8aeb0412219bf09", + "0x0c2b2db6eb0cae01ae39f6df6098d1a5faac9a611105ce63c920247acbfbf9dc", + "0x52e84d3b55bc53a76cddf7335dbea3e089694ad054fbaf6a81bcf66a8dfac529", + "0x50f1bbf4a7d4b1aacb6ac4c2bf223550f1c1ccd3a1ce648a9cf35589f9195d1a", + "0x7fe6b4dc2f69f8b02b55efec28bba19a25373f2a230175f2caa77588b51540df", + "0xf40eb9ad6534bb347051cb752d043efcbffce1f7ef01bfde9b440a154ad70623", + "0x22aa96d7504f41e5ce45db96a423be33bfdbe3f342547fa5a7fcad2014cae285", + "0x720a679b3c2775f4d855d7af121bb271a1dc0ade1fac1a35747fc6370c4080e2", + "0xb6182fda77fd30dca301e60b54ed32cf0044dc0bf18d6c12cb190555d4d148af", + "0xbae3b3c4553bbd6c479110d6a564338a8df43e25de3beed04f5ba8e370648004", + "0x83643963780119a6a2ad78defbc54d4f27ce2e23f84887ae499657da5353f46e", + "0x0c37d8126fb903abff78556aca7f85a022b290630a39905eaaf3cf3aef27dd09", + "0x9e8a13e77260543e49ab295d753215aa18786018d4adf8a602cd29f18742be7d", + "0x3eeb2c9c5cac551a0edf1788a189f290f92907b760244d6bdf28cdd8c8c8894d", + "0x3ada486933e94b4bc677f7da0547c3c14dc5b5b90be720802a5ec7d8c0f207c1", + "0x98016e8fd9b084eb75287a70bede12127cc0d16167713c6dc4860bc5e8b4a8c3", + "0x41c753149fca012b721172e5c47ff70f36d0c47a23d8846a0b18419c51652830", + "0x8fae2f7ae7d772f89d59233293faec343773ff887d532170f2fcd4e014eaed45", + "0xc9c6611fba877275be11a986189fbb6b29326f52e5de08fe00cdcdf0a284f4c1", + "0x59faa51aaaecdee170d9c676e1288fd7a72bdcc80c7ebe8849bf1f3f2f627f8b", + "0x73c689fec3bd65b4ad88f63bbb6d056887b0af168070a2a6f4a7b9cfb687ee64", + "0xc0ca2179d5874cbf38eed8fc7d3bf7bb9b37d3f96f1e28f0e76297454eab92f9", + "0x25af5273e8c377e89852634b3657cfbf59930e595af298eeb6f0b16ce3939e3f", + "0xb7229ea51faa43ae414bc7db3d1a7af57703458ee65cd3722fc6de62d537d83a" + ], + "new_inputs": [ + { + "hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "index": 4294967295 + } + ], + "new_outputs": { + "0x60108e648fc51ac1b0b5aa486d9d00fda4e4ce170f90cdd681ae3a27886fc65c": [ + 10105, + true, + 1 + ], + "0x651946163c6d34de0340c19f4c9d999d6186283b8574d746c2553bc3542426d2": [ + 10104, + true, + 1 + ] + } +} diff --git a/shared/src/tests/data/no1/txs.json b/shared/src/tests/data/no1/txs.json new file mode 100644 index 0000000000..ed54e187d5 --- /dev/null +++ b/shared/src/tests/data/no1/txs.json @@ -0,0 +1,117 @@ +[ + { + "version": 0, + "deps": [], + "inputs": [ + { + "previous_output": { + "hash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "index": 4294967295 + }, + "valid_since": 0, + "args": [ + [ + 122, + 39, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + } + ], + "outputs": [ + { + "capacity": 50000, + "data": [], + "lock": { + "version": 0, + "args": [], + "binary_hash": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "type": null + } + ], + "witnesses": [] + }, + { + "version": 0, + "deps": [ + { + "hash": "0x206925a8e9636a5546d554f1eb9d26c98bb2d99d4afb40cb761701bae102b96e", + "index": 0 + } + ], + "inputs": [ + { + "previous_output": { + "hash": "0x8aa8799cd6ad56dd6929fd6ac05f5cab6a5339562297abb619839ab2da519f35", + "index": 0 + }, + "valid_since": 0, + "args": [] + } + ], + "outputs": [ + { + "capacity": 10000, + "data": [], + "lock": { + "version": 0, + "args": [ + [ + 143, + 10, + 149, + 67, + 130, + 113, + 87, + 43, + 67, + 128, + 75, + 230, + 27, + 240, + 134, + 51, + 236, + 232, + 108, + 229, + 77, + 162, + 171, + 130, + 173, + 161, + 54, + 109, + 162, + 96, + 17, + 17 + ] + ], + "binary_hash": "0xc6acd8c9a165e882be671793dfef2947c9f4d2a8e241498ae805d9a21a9d5111" + }, + "type": null + }, + { + "capacity": 40000, + "data": [], + "lock": { + "version": 0, + "args": [], + "binary_hash": "0x0000000000000000000000000000000000000000000000000000000000000001" + }, + "type": null + } + ], + "witnesses": [] + } +] diff --git a/shared/src/tests/mod.rs b/shared/src/tests/mod.rs index 33a50af6cf..6a1c4b8758 100644 --- a/shared/src/tests/mod.rs +++ b/shared/src/tests/mod.rs @@ -1 +1,2 @@ +mod cell_set; mod shared; diff --git a/shared/src/tx_pool/types.rs b/shared/src/tx_pool/types.rs index 66384bdda5..97ee3ec79f 100644 --- a/shared/src/tx_pool/types.rs +++ b/shared/src/tx_pool/types.rs @@ -1,9 +1,7 @@ //! The primary module containing the implementations of the transaction pool //! and its top-level members. -use ckb_core::cell::CellMeta; -use ckb_core::cell::CellProvider; -use ckb_core::cell::CellStatus; +use ckb_core::cell::{CellProvider, CellStatus}; use ckb_core::transaction::{CellOutput, OutPoint, ProposalShortId, Transaction}; use ckb_core::Cycle; use ckb_verification::TransactionError; @@ -222,11 +220,7 @@ impl CellProvider for StagingPool { if x.is_some() { CellStatus::Dead } else { - CellStatus::Live(CellMeta { - cell_output: self.get_output(o).expect("output"), - block_number: None, - cellbase: false, - }) + CellStatus::live_output(self.get_output(o).expect("output"), None, false) } } else if self.edges.get_outer(o).is_some() { CellStatus::Dead diff --git a/sync/src/relayer/transaction_process.rs b/sync/src/relayer/transaction_process.rs index 29cddc97e9..8632390587 100644 --- a/sync/src/relayer/transaction_process.rs +++ b/sync/src/relayer/transaction_process.rs @@ -80,7 +80,6 @@ impl<'a, CS: ChainStore> TransactionProcess<'a, CS> { } Err(PoolError::InvalidTx(TransactionError::UnknownInput)) | Err(PoolError::InvalidTx(TransactionError::Conflict)) - | Err(PoolError::Duplicate) | Err(PoolError::InvalidTx(TransactionError::Immature)) | Err(PoolError::InvalidTx(TransactionError::CellbaseImmaturity)) => { // this error may occured when peer's tip is different with us, diff --git a/sync/src/synchronizer/block_fetcher.rs b/sync/src/synchronizer/block_fetcher.rs index 77acff4b35..2a4cc76885 100644 --- a/sync/src/synchronizer/block_fetcher.rs +++ b/sync/src/synchronizer/block_fetcher.rs @@ -192,7 +192,7 @@ where if block_status == BlockStatus::VALID_MASK && inflight.insert(to_fetch_hash.clone().clone()) { - debug!( + trace!( target: "sync", "[Synchronizer] inflight insert {:?}------------{:x}", to_fetch.number(), to_fetch_hash diff --git a/sync/src/synchronizer/block_pool.rs b/sync/src/synchronizer/block_pool.rs index 5b300428c2..332f916515 100644 --- a/sync/src/synchronizer/block_pool.rs +++ b/sync/src/synchronizer/block_pool.rs @@ -54,6 +54,12 @@ impl OrphanBlockPool { pub fn is_empty(&self) -> bool { self.len() == 0 } + + pub fn contains(&self, block: &Block) -> bool { + self.blocks + .read() + .contains_key(block.header().parent_hash()) + } } #[cfg(test)] diff --git a/sync/src/synchronizer/headers_process.rs b/sync/src/synchronizer/headers_process.rs index 92ee135d2c..e1fac11677 100644 --- a/sync/src/synchronizer/headers_process.rs +++ b/sync/src/synchronizer/headers_process.rs @@ -325,15 +325,16 @@ where } } - pub fn duplicate_check(&self, state: &mut ValidationResult) -> Result<(), ()> { - let status = self.synchronizer.get_block_status(&self.header.hash()); - if status != BlockStatus::UNKNOWN { - if (status & BlockStatus::FAILED_MASK) == status { - state.invalid(Some(ValidationError::FailedMask)); - } - if (status & BlockStatus::FAILED_MASK) == status {} - return Err(()); - } + //FIXME: status flag + pub fn duplicate_check(&self, _state: &mut ValidationResult) -> Result<(), ()> { + // let status = self.synchronizer.get_block_status(&self.header.hash()); + // if status != BlockStatus::UNKNOWN { + // if (status & BlockStatus::FAILED_MASK) == status { + // state.invalid(Some(ValidationError::FailedMask)); + // } + // if (status & BlockStatus::FAILED_MASK) == status {} + // return Err(()); + // } Ok(()) } @@ -429,7 +430,6 @@ impl Default for ValidationState { #[derive(Debug)] pub enum ValidationError { Verify(VerifyError), - FailedMask, Version, InvalidParent, } diff --git a/sync/src/synchronizer/mod.rs b/sync/src/synchronizer/mod.rs index 5c403930b7..e8456ddb4c 100644 --- a/sync/src/synchronizer/mod.rs +++ b/sync/src/synchronizer/mod.rs @@ -420,6 +420,11 @@ impl Synchronizer { //TODO: process block which we don't request pub fn process_new_block(&self, peer: PeerIndex, block: Block) { + if self.orphan_block_pool.contains(&block) { + debug!(target: "sync", "block {} already in orphan pool", block.header().hash()); + return; + } + match self.get_block_status(&block.header().hash()) { BlockStatus::VALID_MASK => { self.insert_new_block(peer, block); @@ -431,7 +436,6 @@ impl Synchronizer { } fn accept_block(&self, peer: PeerIndex, block: &Arc) -> Result<(), FailureError> { - // TODO: some transactions' verification can be skiped. self.chain.process_block(Arc::clone(&block))?; self.mark_block_stored(block.header().hash().clone()); self.peers.set_last_common_header(peer, &block.header()); @@ -476,7 +480,7 @@ impl Synchronizer { } } else { debug!( - target: "sync", "[Synchronizer] accept_block {:?} error {:?}", + target: "sync", "[Synchronizer] accept_block {:?} error {}", block, accept_ret.unwrap_err() ) @@ -679,7 +683,9 @@ impl Synchronizer { debug!(target: "sync", "poll find_blocks_to_fetch select peers"); for peer in peers { if let Some(v_fetch) = self.get_blocks_to_fetch(peer) { - self.send_getblocks(&v_fetch, nc, peer); + if !v_fetch.is_empty() { + self.send_getblocks(&v_fetch, nc, peer); + } } } } diff --git a/util/jsonrpc-types/src/cell.rs b/util/jsonrpc-types/src/cell.rs index f34959fe78..32aab04633 100644 --- a/util/jsonrpc-types/src/cell.rs +++ b/util/jsonrpc-types/src/cell.rs @@ -1,5 +1,5 @@ use crate::blockchain::{CellOutput, OutPoint}; -use ckb_core::cell::CellStatus; +use ckb_core::cell::{CellStatus, LiveCell}; use ckb_core::script::Script; use ckb_core::Capacity; use serde_derive::{Deserialize, Serialize}; @@ -23,7 +23,10 @@ pub struct CellWithStatus { impl From for CellWithStatus { fn from(status: CellStatus) -> Self { let (cell, status) = match status { - CellStatus::Live(cell) => (Some(cell), "live"), + CellStatus::Live(cell) => match cell { + LiveCell::Null => (None, "live"), + LiveCell::Output(o) => (Some(o), "live"), + }, CellStatus::Dead => (None, "dead"), CellStatus::Unknown => (None, "unknown"), }; diff --git a/verification/src/error.rs b/verification/src/error.rs index 37e02ad2f7..5f841847bd 100644 --- a/verification/src/error.rs +++ b/verification/src/error.rs @@ -132,6 +132,7 @@ pub enum DifficultyError { #[derive(Debug, PartialEq, Clone, Copy, Eq)] pub enum TransactionError { NullInput, + NullDep, /// Occur output's bytes_len exceed capacity CapacityOverflow, DuplicateInputs, diff --git a/verification/src/tests/transaction_verifier.rs b/verification/src/tests/transaction_verifier.rs index 5d72f076c8..a5c57653af 100644 --- a/verification/src/tests/transaction_verifier.rs +++ b/verification/src/tests/transaction_verifier.rs @@ -3,8 +3,8 @@ use super::super::transaction_verifier::{ ValidSinceVerifier, }; use crate::error::TransactionError; +use ckb_core::cell::CellStatus; use ckb_core::cell::ResolvedTransaction; -use ckb_core::cell::{CellMeta, CellStatus}; use ckb_core::script::Script; use ckb_core::transaction::{CellInput, CellOutput, OutPoint, TransactionBuilder}; use ckb_traits::BlockMedianTimeContext; @@ -40,11 +40,11 @@ pub fn test_capacity_outofbound() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: None, - cellbase: false, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + None, + false, + )], }; let verifier = CapacityVerifier::new(&rtx); @@ -63,11 +63,11 @@ pub fn test_cellbase_maturity() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: Some(30), - cellbase: true, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + Some(30), + true, + )], }; let tip_number = 70; @@ -98,16 +98,16 @@ pub fn test_capacity_invalid() { transaction, dep_cells: Vec::new(), input_cells: vec![ - CellStatus::Live(CellMeta { - cell_output: CellOutput::new(49, Vec::new(), Script::default(), None), - block_number: None, - cellbase: false, - }), - CellStatus::Live(CellMeta { - cell_output: CellOutput::new(100, Vec::new(), Script::default(), None), - block_number: None, - cellbase: false, - }), + CellStatus::live_output( + CellOutput::new(49, Vec::new(), Script::default(), None), + None, + false, + ), + CellStatus::live_output( + CellOutput::new(100, Vec::new(), Script::default(), None), + None, + false, + ), ], }; let verifier = CapacityVerifier::new(&rtx); @@ -173,11 +173,11 @@ pub fn test_valid_since() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: Some(1), - cellbase: false, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + Some(1), + false, + )], }; let median_time_context = FakeMedianTime { @@ -201,11 +201,11 @@ pub fn test_valid_since() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: Some(1), - cellbase: false, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + Some(1), + false, + )], }; let median_time_context = FakeMedianTime { @@ -229,11 +229,11 @@ pub fn test_valid_since() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: Some(1), - cellbase: false, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + Some(1), + false, + )], }; let verifier = ValidSinceVerifier::new(&rtx, &median_time_context, 4); @@ -265,11 +265,11 @@ pub fn test_valid_since() { let rtx = ResolvedTransaction { transaction, dep_cells: Vec::new(), - input_cells: vec![CellStatus::Live(CellMeta { - cell_output: CellOutput::new(50, Vec::new(), Script::default(), None), - block_number: Some(1), - cellbase: false, - })], + input_cells: vec![CellStatus::live_output( + CellOutput::new(50, Vec::new(), Script::default(), None), + Some(1), + false, + )], }; let verifier = ValidSinceVerifier::new(&rtx, &median_time_context, 4); diff --git a/verification/src/transaction_verifier.rs b/verification/src/transaction_verifier.rs index ebbbe9e330..d8f189486e 100644 --- a/verification/src/transaction_verifier.rs +++ b/verification/src/transaction_verifier.rs @@ -1,5 +1,5 @@ use crate::error::TransactionError; -use ckb_core::transaction::{Capacity, Transaction, TX_VERSION}; +use ckb_core::transaction::{Capacity, OutPoint, Transaction, TX_VERSION}; use ckb_core::{ cell::{CellMeta, CellStatus, ResolvedTransaction}, BlockNumber, Cycle, @@ -165,7 +165,7 @@ impl<'a> MaturityVerifier<'a> { pub fn verify(&self) -> Result<(), TransactionError> { let cellbase_immature = |cell_status: &CellStatus| -> bool { - match cell_status.get_live() { + match cell_status.get_live_output() { Some(ref meta) if meta.is_cellbase() && self.tip_number @@ -222,15 +222,18 @@ impl<'a> NullVerifier<'a> { pub fn verify(&self) -> Result<(), TransactionError> { let transaction = self.transaction; + if transaction.deps().iter().any(OutPoint::is_null) { + return Err(TransactionError::NullDep); + } + if transaction .inputs() .iter() .any(|input| input.previous_output.is_null()) { - Err(TransactionError::NullInput) - } else { - Ok(()) + return Err(TransactionError::NullInput); } + Ok(()) } } @@ -250,8 +253,8 @@ impl<'a> CapacityVerifier<'a> { .resolved_transaction .input_cells .iter() - .filter_map(CellStatus::get_live) - .fold(0, |acc, cell| acc + cell.cell_output.capacity); + .filter_map(CellStatus::get_live_output) + .fold(0, |acc, meta| acc + meta.capacity()); let outputs_total = self .resolved_transaction @@ -435,7 +438,7 @@ where // verify time lock self.verify_absolute_lock(valid_since)?; - let cell = match cell_status.get_live() { + let cell = match cell_status.get_live_output() { Some(cell) => cell, None => return Err(TransactionError::Conflict), };