diff --git a/Cargo.lock b/Cargo.lock index 8f5b457e6..c863eda12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,829 +1,931 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "abc-rust-error" version = "0.1.0" dependencies = [ "abc-rust-lint", "eyre", "stable-eyre", "thiserror", ] [[package]] name = "abc-rust-lint" version = "0.1.0" [[package]] name = "addr2line" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ "gimli", ] [[package]] name = "adler" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ "memchr", ] [[package]] name = "ansi_term" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] [[package]] name = "atomic-polyfill" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14bf7b4f565e5e717d7a7a65b2a05c0b8c96e4db636d6f780f03b15108cdd1b" dependencies = [ "critical-section", ] [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", ] [[package]] name = "bare-metal" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" dependencies = [ "rustc_version 0.2.3", ] [[package]] name = "bare-metal" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" [[package]] name = "bindgen" version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ "bitflags", "cexpr", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", ] [[package]] name = "bit_field" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" [[package]] name = "bitcoinsuite-core" version = "0.1.0" dependencies = [ "abc-rust-lint", "hex", "hex-literal", "thiserror", ] [[package]] name = "bitfield" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bzip2-sys" version = "0.1.11+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" dependencies = [ "cc", "libc", "pkg-config", ] [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" dependencies = [ "jobserver", ] [[package]] name = "cexpr" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chronik-db" version = "0.1.0" dependencies = [ "abc-rust-error", "abc-rust-lint", "bitcoinsuite-core", "hex", "postcard", "pretty_assertions", "rocksdb", "serde", "tempdir", "thiserror", ] +[[package]] +name = "chronik-ffi" +version = "0.1.0" +dependencies = [ + "abc-rust-lint", + "cxx", + "cxx-build", +] + [[package]] name = "clang-sys" version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", "libloading", ] [[package]] name = "cobs" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "cortex-m" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd20d4ac4aa86f4f75f239d59e542ef67de87cce2c282818dc6e84155d3ea126" dependencies = [ "bare-metal 0.2.5", "bitfield", "embedded-hal", "volatile-register", ] [[package]] name = "critical-section" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95da181745b56d4bd339530ec393508910c909c784e8962d15d722bacf0bcbcd" dependencies = [ "bare-metal 1.0.0", "cfg-if", "cortex-m", "riscv", ] [[package]] name = "ctor" version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" dependencies = [ "quote", "syn", ] +[[package]] +name = "cxx" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "873c2e83af70859af2aaecd1f5d862f3790b747b1f4f50fb45a931d000ac0422" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49edea7163bbc7a39e3d829b4b0b66a9d30486973152842b7413f2c7b5632bf" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46b787c15af80277db5c88c6ac6c502ae545e622f010e06f95e540d34931acf" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba3f3a7efa46626878fb5d324fabca4d19d2956b6ae97ce43044ef4515f5abc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "diff" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "embedded-hal" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" dependencies = [ "nb 0.1.3", "void", ] [[package]] name = "eyre" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" dependencies = [ "indenter", "once_cell", ] [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "gimli" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hash32" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" dependencies = [ "byteorder", ] [[package]] name = "heapless" version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f6733da246dc2af610133c8be0667170fd68e8ca5630936b520300eee8846f9" dependencies = [ "atomic-polyfill", "hash32", "rustc_version 0.4.0", "serde", "spin", "stable_deref_trait", ] [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "indenter" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "jobserver" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" dependencies = [ "libc", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libloading" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if", "winapi", ] [[package]] name = "librocksdb-sys" version = "0.6.1+6.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" dependencies = [ "bindgen", "bzip2-sys", "cc", "glob", "libc", "libz-sys", ] [[package]] name = "libz-sys" version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "pkg-config", "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cae2cd7ba2f3f63938b9c724475dfb7b9861b545a90324476324ed21dbc8c8" +dependencies = [ + "cc", +] + [[package]] name = "lock_api" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ "autocfg", "scopeguard", ] [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", ] [[package]] name = "nb" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" dependencies = [ "nb 1.0.0", ] [[package]] name = "nb" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" [[package]] name = "nom" version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] [[package]] name = "once_cell" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "output_vt100" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ "winapi", ] [[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "pkg-config" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "postcard" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41f5465c5e5a38e04552d8fb53ebcf4f58124ab3bbd0c02add043b33f82792e5" dependencies = [ "cobs", "heapless", "serde", ] [[package]] name = "pretty_assertions" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563" dependencies = [ "ansi_term", "ctor", "diff", "output_vt100", ] [[package]] name = "proc-macro2" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" dependencies = [ "fuchsia-cprng", "libc", "rand_core 0.3.1", "rdrand", "winapi", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ "rand_core 0.4.2", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" dependencies = [ "rand_core 0.3.1", ] [[package]] name = "regex" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ "winapi", ] [[package]] name = "riscv" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6907ccdd7a31012b70faf2af85cd9e5ba97657cc3987c4f13f8e4d2c2a088aba" dependencies = [ "bare-metal 1.0.0", "bit_field", "riscv-target", ] [[package]] name = "riscv-target" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" dependencies = [ "lazy_static", "regex", ] [[package]] name = "rocksdb" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" dependencies = [ "libc", "librocksdb-sys", ] [[package]] name = "rustc-demangle" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ "semver 0.9.0", ] [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver 1.0.12", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ "semver-parser", ] [[package]] name = "semver" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "shlex" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "spin" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" dependencies = [ "lock_api", ] [[package]] name = "stable-eyre" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "556fec8c2da34c70b75f16d88df8a8cd7e652e567ff097b7e9df0022c8695cc4" dependencies = [ "backtrace", "eyre", "indenter", ] [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "syn" version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "tempdir" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" dependencies = [ "rand", "remove_dir_all", ] +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "unicode-ident" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + [[package]] name = "vcell" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "volatile-register" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" dependencies = [ "vcell", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index ee4e377e1..06ea64acd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,11 @@ # Copyright (c) 2022 The Bitcoin developers [workspace] members = [ "chronik/abc-rust-error", "chronik/abc-rust-lint", "chronik/bitcoinsuite-core", "chronik/chronik-db", + "chronik/chronik-ffi", ] diff --git a/chronik/CMakeLists.txt b/chronik/CMakeLists.txt index bd26c1275..605f3ee6d 100644 --- a/chronik/CMakeLists.txt +++ b/chronik/CMakeLists.txt @@ -1,89 +1,114 @@ # Copyright (c) 2022 The Bitcoin developers set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Corrosion 0.2.0 REQUIRED) set(REQUIRED_RUST_VERSION "1.61.0") if(Rust_VERSION VERSION_LESS REQUIRED_RUST_VERSION) message(FATAL_ERROR "Minimum required Rust version is " "${REQUIRED_RUST_VERSION}, but found ${Rust_VERSION}") endif() set(CARGO_BUILD_DIR "${CMAKE_BINARY_DIR}/cargo/build") set_property(DIRECTORY "${CMAKE_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${CARGO_BUILD_DIR}" ) get_property( RUSTC_EXECUTABLE TARGET Rust::Rustc PROPERTY IMPORTED_LOCATION ) get_filename_component(RUST_BIN_DIR ${RUSTC_EXECUTABLE} DIRECTORY) include(DoOrFail) find_program_or_fail(RUSTDOC_EXECUTABLE rustdoc PATHS "${RUST_BIN_DIR}" ) function(add_cargo_custom_target TARGET) add_custom_target(${TARGET} COMMAND "${CMAKE_COMMAND}" -E env CARGO_TARGET_DIR="${CARGO_BUILD_DIR}" CARGO_BUILD_RUSTC="$" CARGO_BUILD_RUSTDOC="${RUSTDOC_EXECUTABLE}" "$" ${ARGN} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) endfunction() function(add_crate_test_targets CRATE) set(CRATE_TEST_TARGET "check-crate-${CRATE}") add_custom_target("${CRATE_TEST_TARGET}") set(CLIPPY_TARGET "${CRATE_TEST_TARGET}-clippy") add_cargo_custom_target("${CLIPPY_TARGET}" clippy --package "${CRATE}-*" -- -D warnings ) set(TEST_TARGET "${CRATE_TEST_TARGET}-test") add_cargo_custom_target("${TEST_TARGET}" test --package "${CRATE}-*" ) add_dependencies("${CRATE_TEST_TARGET}" "${CLIPPY_TARGET}" "${TEST_TARGET}" ) add_dependencies("check-crates" "${CRATE_TEST_TARGET}" ) endfunction() add_custom_target("check-crates") add_crate_test_targets(abc-rust) add_crate_test_targets(bitcoinsuite) add_crate_test_targets(chronik) +# Compile Rust, generates chronik-ffi-static +corrosion_import_crate(MANIFEST_PATH "chronik-ffi/Cargo.toml") + +# cxx crate generates some source files at this location +set(CXXBRIDGE_GENERATED_FOLDER + "${CARGO_BUILD_DIR}/${Rust_CARGO_TARGET}/cxxbridge") +set(CXXBRIDGE_GENERATED_CPP_FILES + "${CXXBRIDGE_GENERATED_FOLDER}/chronik-ffi/src/ffi.rs.cc") +add_custom_command( + OUTPUT + ${CXXBRIDGE_GENERATED_CPP_FILES} + COMMAND + "${CMAKE_COMMAND}" + -E env + "echo" "Generating cxx bridge files" + DEPENDS chronik-ffi-static +) + # Chronik library add_library(chronik chronik-cpp/chronik.cpp + chronik-cpp/chronik_bridge.cpp + ${CXXBRIDGE_GENERATED_CPP_FILES} +) +target_include_directories(chronik + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CXXBRIDGE_GENERATED_FOLDER}" ) -target_include_directories(chronik PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_link_libraries(chronik util + chronik-ffi-static ) # Add chronik to server target_link_libraries(server chronik ) diff --git a/chronik/chronik-cpp/chronik.cpp b/chronik/chronik-cpp/chronik.cpp index 09ef00a3a..387eaebae 100644 --- a/chronik/chronik-cpp/chronik.cpp +++ b/chronik/chronik-cpp/chronik.cpp @@ -1,20 +1,21 @@ // Copyright (c) 2022 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include #include #include #include +#include namespace chronik { void Start([[maybe_unused]] const Config &config, [[maybe_unused]] const NodeContext &node) { - LogPrintf("Starting Chronik...\n"); + chronik_bridge::setup_bridge(); } void Stop() { LogPrintf("Stopping Chronik...\n"); } } // namespace chronik diff --git a/chronik/chronik-cpp/chronik_bridge.cpp b/chronik/chronik-cpp/chronik_bridge.cpp new file mode 100644 index 000000000..cec1eb642 --- /dev/null +++ b/chronik/chronik-cpp/chronik_bridge.cpp @@ -0,0 +1,12 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include +#include + +namespace chronik_bridge { + +void log_println(rust::Str msg) { LogPrintf("%s\n", std::string(msg)); } + +} // namespace chronik_bridge diff --git a/chronik/chronik-cpp/chronik_bridge.h b/chronik/chronik-cpp/chronik_bridge.h new file mode 100644 index 000000000..d0b48ba93 --- /dev/null +++ b/chronik/chronik-cpp/chronik_bridge.h @@ -0,0 +1,17 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_CHRONIK_CPP_CHRONIK_BRIDGE_H +#define BITCOIN_CHRONIK_CPP_CHRONIK_BRIDGE_H + +#include +#include + +namespace chronik_bridge { + +void log_println(rust::Str msg); + +} // namespace chronik_bridge + +#endif // BITCOIN_CHRONIK_CPP_CHRONIK_BRIDGE_H diff --git a/chronik/chronik-ffi/Cargo.toml b/chronik/chronik-ffi/Cargo.toml new file mode 100644 index 000000000..ebbc9415d --- /dev/null +++ b/chronik/chronik-ffi/Cargo.toml @@ -0,0 +1,22 @@ +# Copyright (c) 2022 The Bitcoin developers + +[package] +name = "chronik-ffi" +version = "0.1.0" +edition = "2021" +rust-version = "1.61.0" +license = "MIT" + +[lib] +# Compile to C-ABI +crate-type = ["staticlib"] + +[dependencies] +abc-rust-lint = { path = "../abc-rust-lint" } + +# Bridge to C++ +cxx = "1.0" + +[build-dependencies] +# Build scripts for the cxx crate +cxx-build = "1.0" diff --git a/chronik/chronik-ffi/build.rs b/chronik/chronik-ffi/build.rs new file mode 100644 index 000000000..e58cf7d7f --- /dev/null +++ b/chronik/chronik-ffi/build.rs @@ -0,0 +1,9 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +fn main() { + // Build the C++ sources and headers for bridging Rust and C++. + let _build = cxx_build::bridge("src/ffi.rs"); + println!("cargo:rerun-if-changed=src/ffi.rs"); +} diff --git a/chronik/chronik-ffi/src/bridge.rs b/chronik/chronik-ffi/src/bridge.rs new file mode 100644 index 000000000..ec679930b --- /dev/null +++ b/chronik/chronik-ffi/src/bridge.rs @@ -0,0 +1,12 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +//! Rust side of the bridge; these structs and functions are exposed to C++. + +use crate::ffi; + +/// Setup the Chronik bridge. Currently only logs to bitcoind. +pub fn setup_bridge() { + ffi::log_println("Starting Chronik..."); +} diff --git a/chronik/chronik-ffi/src/ffi.rs b/chronik/chronik-ffi/src/ffi.rs new file mode 100644 index 000000000..48e9f1ab2 --- /dev/null +++ b/chronik/chronik-ffi/src/ffi.rs @@ -0,0 +1,23 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +//! Module containing the cxx definitions for the bridge between Rust and C++. + +pub use self::ffi_inner::*; +use crate::bridge::setup_bridge; + +#[allow(unsafe_code)] +#[cxx::bridge(namespace = "chronik_bridge")] +mod ffi_inner { + unsafe extern "C++" { + include!("chronik-cpp/chronik_bridge.h"); + + /// Print the message to bitcoind's logs. + fn log_println(msg: &str); + } + + extern "Rust" { + fn setup_bridge(); + } +} diff --git a/chronik/chronik-ffi/src/lib.rs b/chronik/chronik-ffi/src/lib.rs new file mode 100644 index 000000000..86f8d522a --- /dev/null +++ b/chronik/chronik-ffi/src/lib.rs @@ -0,0 +1,10 @@ +// Copyright (c) 2022 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +//! Foreign-function interface to bitcoind. Bridges Rust to and from C++. + +abc_rust_lint::lint! { + pub mod bridge; + pub mod ffi; +} diff --git a/cmake/platforms/Linux32.cmake b/cmake/platforms/Linux32.cmake index 5ae3d277a..2537e487a 100644 --- a/cmake/platforms/Linux32.cmake +++ b/cmake/platforms/Linux32.cmake @@ -1,31 +1,34 @@ # Copyright (c) 2019 The Bitcoin developers set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR i686) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-pc-linux-gnu) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "i686-unknown-linux-gnu") + # Cross compilers to use for C and C++ set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_COMPILER g++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # Target environment on the build host system # Set 1st to directory with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}") # We also may have built dependencies for the native platform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # Modify default behavior of FIND_XXX() commands to: # - search for headers in the target environment, # - search the libraries in the target environment first then the host (to find # the compiler supplied libraries), # - search for programs in the build host environment. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) string(APPEND CMAKE_C_FLAGS_INIT " -m32") string(APPEND CMAKE_CXX_FLAGS_INIT " -m32") diff --git a/cmake/platforms/Linux64.cmake b/cmake/platforms/Linux64.cmake index d5e6d3c78..d366a5474 100644 --- a/cmake/platforms/Linux64.cmake +++ b/cmake/platforms/Linux64.cmake @@ -1,31 +1,34 @@ # Copyright (c) 2019 The Bitcoin developers set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR x86_64) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "x86_64-unknown-linux-gnu") + # Cross compilers to use for C and C++ set(CMAKE_C_COMPILER gcc) set(CMAKE_CXX_COMPILER g++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # Target environment on the build host system # Set 1st to directory with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}") # We also may have built dependencies for the native platform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # Modify default behavior of FIND_XXX() commands to: # - search for headers in the target environment, # - search the libraries in the target environment first then the host (to find # the compiler supplied libraries), # - search for programs in the build host environment. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) string(APPEND CMAKE_C_FLAGS_INIT " -m64") string(APPEND CMAKE_CXX_FLAGS_INIT " -m64") diff --git a/cmake/platforms/LinuxAArch64.cmake b/cmake/platforms/LinuxAArch64.cmake index af267e3ec..2ed8c26ec 100644 --- a/cmake/platforms/LinuxAArch64.cmake +++ b/cmake/platforms/LinuxAArch64.cmake @@ -1,29 +1,32 @@ # Copyright (c) 2019 The Bitcoin developers set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR aarch64) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "aarch64-unknown-linux-gnu") + # Cross compilers to use for C and C++ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # Target environment on the build host system # Set 1st to directory with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}" "/usr/${TOOLCHAIN_PREFIX}" ) # We also may have built dependencies for the native platform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # Modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/platforms/LinuxARM.cmake b/cmake/platforms/LinuxARM.cmake index e298bd14a..d58018243 100644 --- a/cmake/platforms/LinuxARM.cmake +++ b/cmake/platforms/LinuxARM.cmake @@ -1,29 +1,32 @@ # Copyright (c) 2019 The Bitcoin developers set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-linux-gnueabihf) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "arm-unknown-linux-gnueabihf") + # Cross compilers to use for C and C++ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # Target environment on the build host system # Set 1st to directory with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}" "/usr/${TOOLCHAIN_PREFIX}" ) # We also may have built dependencies for the native platform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # Modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/platforms/OSX.cmake b/cmake/platforms/OSX.cmake index 07763ee9e..337cca8b9 100644 --- a/cmake/platforms/OSX.cmake +++ b/cmake/platforms/OSX.cmake @@ -1,54 +1,57 @@ # Copyright (c) 2017 The Bitcoin developers set(CMAKE_SYSTEM_NAME Darwin) set(CMAKE_SYSTEM_PROCESSOR x86_64) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-apple-darwin16) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "x86_64-apple-darwin") + # On OSX, we use clang by default. set(CMAKE_C_COMPILER clang) set(CMAKE_CXX_COMPILER clang++) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(OSX_MIN_VERSION 10.12) # OSX_SDK_VERSION 10.15.1 # Note: don't use XCODE_VERSION, it's a cmake built-in variable ! set(SDK_XCODE_VERSION 11.3.1) set(SDK_XCODE_BUILD_ID 11C505) set(LD64_VERSION 530) # On OSX we use various stuff from Apple's SDK. set(OSX_SDK_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/SDKs/Xcode-${SDK_XCODE_VERSION}-${SDK_XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers") set(CMAKE_OSX_SYSROOT "${OSX_SDK_PATH}") set(CMAKE_OSX_DEPLOYMENT_TARGET ${OSX_MIN_VERSION}) set(CMAKE_OSX_ARCHITECTURES x86_64) # target environment on the build host system # set 1st to dir with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};${OSX_SDK_PATH}") # We also may have built dependencies for the native plateform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # When cross-compiling for Darwin using Clang, -mlinker-version must be passed # to ensure that modern linker features are enabled. string(APPEND CMAKE_CXX_FLAGS_INIT " -stdlib=libc++ -mlinker-version=${LD64_VERSION}") # Ensure we use an OSX specific version the binary manipulation tools. find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}-ar) find_program(CMAKE_INSTALL_NAME_TOOL ${TOOLCHAIN_PREFIX}-install_name_tool) find_program(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld) find_program(CMAKE_NM ${TOOLCHAIN_PREFIX}-nm) find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy) find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump) find_program(CMAKE_OTOOL ${TOOLCHAIN_PREFIX}-otool) find_program(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-ranlib) find_program(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip) diff --git a/cmake/platforms/Win32.cmake b/cmake/platforms/Win32.cmake index c605ac8df..788e74292 100644 --- a/cmake/platforms/Win32.cmake +++ b/cmake/platforms/Win32.cmake @@ -1,27 +1,30 @@ # Copyright (c) 2017 The Bitcoin developers set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR i686) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "i686-pc-windows-gnu") + # cross compilers to use for C and C++ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # target environment on the build host system # set 1st to dir with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};/usr/${TOOLCHAIN_PREFIX}") # We also may have built dependencies for the native plateform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/platforms/Win64.cmake b/cmake/platforms/Win64.cmake index 2494e6f90..9c7f26d5b 100644 --- a/cmake/platforms/Win64.cmake +++ b/cmake/platforms/Win64.cmake @@ -1,27 +1,30 @@ # Copyright (c) 2017 The Bitcoin developers set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR x86_64) set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) +# Set Corrosion Rust target +set(Rust_CARGO_TARGET "x86_64-pc-windows-gnu") + # cross compilers to use for C and C++ set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN_PREFIX}) # target environment on the build host system # set 1st to dir with the cross compiler's C/C++ headers/libs set(CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX};/usr/${TOOLCHAIN_PREFIX}") # We also may have built dependencies for the native plateform. set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/depends/${TOOLCHAIN_PREFIX}/native") # modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml index ef743e340..fa3da2616 100644 --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -1,564 +1,574 @@ --- # Templates can be referenced in builds to avoid duplication templates: gitian_builds: script: | "${TOPLEVEL}/contrib/teamcity/gitian.sh" timeout: 7200 artifacts: gitian-results: '' check+secp256k1: targets: - - all - install - install-secp256k1 - - check - check-secp256k1 - check-functional diff-node: runOnDiffRegex: - cmake/ - src/ - test/ - CMakeLists.txt secp256k1: runOnDiffRegex: - src/secp256k1/ Werror: true targets: - - secp256k1 - install-secp256k1 - - check-secp256k1 ibd: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log ibd-no-assumevalid-checkpoint: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -assumevalid=0 -checkpoints=0 -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log # The build descriptions. # If a script is defined, then this will be the only step to run. # Otherwise a list of targets can be specified, grouped by parallel runs. # Example: # targets: # - - build11 # - build12 # - - build21 # - build22 # Will run: # ninja build11 build12 # ninja build21 build22 builds: build-asan: Werror: true clang: true fail_fast: true cmake_flags: - '-DCMAKE_CXX_FLAGS=-DARENA_DEBUG' - '-DCRYPTO_USE_ASM=OFF' - '-DENABLE_SANITIZERS=address' templates: - check+secp256k1 timeout: 2400 env: ASAN_OPTIONS: log_path=stdout LSAN_OPTIONS: log_path=stdout build-bench: runOnDiffRegex: - src/bench/ Werror: true targets: - - all - install-bitcoin-bench - - bench-bitcoin timeout: 1200 artifacts: src/bench/BitcoinABC_Bench.csv: bench/BitcoinABC_Bench.csv src/bench/BitcoinABC_Bench.json: bench/BitcoinABC_Bench.json post_build: | "${TOPLEVEL}/contrib/teamcity/nanobench_json_to_teamcity_messages.py" \ "Bitcoin ABC Benchmark" \ "${BUILD_DIR}/src/bench/BitcoinABC_Bench.json" build-chronik: runOnDiffRegex: - chronik/ cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - check-crates - - all - install - - check - check-functional build-clang: Werror: true clang: true targets: - - all - install - install-secp256k1 - - check - check-secp256k1 templates: - diff-node timeout: 1200 build-clang-tidy: clang: true cmake_flags: - '-DENABLE_CLANG_TIDY=ON' targets: - - all - - check templates: - diff-node timeout: 1800 build-coverage: gcc: true cmake_flags: - '-DENABLE_COVERAGE=ON' - '-DENABLE_BRANCH_COVERAGE=ON' targets: - - coverage-check-extended post_build: | "${TOPLEVEL}/contrib/teamcity/upload-coverage.sh" check-extended timeout: 4800 artifacts: coverage.tar.gz: coverage.tar.gz build-debug: Werror: true cmake_flags: - '-DCMAKE_BUILD_TYPE=Debug' templates: - check+secp256k1 - diff-node timeout: 1200 build-diff: Werror: true targets: - - all - install - install-secp256k1 - - check-all - check-upgrade-activated templates: - diff-node timeout: 1200 build-docs: targets: - - doc-rpc - doc-doxygen post_build: | xvfb-run -a -e /dev/stderr ninja install-manpages-html timeout: 600 artifacts: doc/*: doc build-fuzzer: runOnDiffRegex: - src/test/fuzz/ - test/fuzz/ clang: true Werror: true cmake_flags: - '-DENABLE_SANITIZERS=fuzzer' targets: - - bitcoin-fuzzers build-ibd: templates: - ibd build-ibd-no-assumevalid-checkpoint: templates: - ibd-no-assumevalid-checkpoint build-linux32: cross_build: static_depends: linux32 toolchain: Linux32 + cmake_flags: + - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux64: cross_build: static_depends: linux64 toolchain: Linux64 + cmake_flags: + - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux-aarch64: cross_build: static_depends: linux-aarch64 toolchain: LinuxAArch64 emulator: qemu-aarch64-static cmake_flags: + - '-DBUILD_BITCOIN_CHRONIK=ON' # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/aarch64-linux-gnu build-linux-arm: cross_build: static_depends: linux-arm toolchain: LinuxARM emulator: qemu-arm-static cmake_flags: + - '-DBUILD_BITCOIN_CHRONIK=ON' # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf build-make-generator: generator: name: 'Unix Makefiles' command: make flags: - '-k' templates: - check+secp256k1 timeout: 1200 build-master: Werror: true targets: - - all - install - install-secp256k1 - - check-extended - check-upgrade-activated-extended timeout: 4800 build-native-osx: templates: - check+secp256k1 timeout: 3600 build-osx: cross_build: static_depends: osx toolchain: OSX + # Uncomment to build Chronik once the cxx crate is working for OSX + # cmake_flags: + # - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - all - install - install-secp256k1 - install-tests post_build: | export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin16/native/lib/python3/dist-packages:${PYTHONPATH:-}" ninja osx-dmg timeout: 3600 artifacts: Bitcoin-ABC.dmg: Bitcoin-ABC.dmg build-secp256k1: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' templates: - secp256k1 timeout: 600 build-secp256k1-java: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_JNI=ON' - '-DUSE_JEMALLOC=OFF' templates: - secp256k1 timeout: 600 build-secp256k1-bench: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' targets: - - install-secp256k1-bench - - bench-secp256k1 timeout: 1200 build-tsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=thread' targets: - - all - install - - check - check-functional timeout: 2400 env: TSAN_OPTIONS: log_path=stdout build-ubsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=undefined' templates: - check+secp256k1 timeout: 2400 env: UBSAN_OPTIONS: log_path=stdout build-win64: cross_build: static_depends: win64 toolchain: Win64 cmake_flags: + - '-DBUILD_BITCOIN_CHRONIK=ON' - "-DBUILD_BITCOIN_SEEDER=OFF" - "-DCPACK_STRIP_FILES=ON" - "-DUSE_JEMALLOC=OFF" targets: - - all - install - install-secp256k1 - install-tests - - package post_build: | wine "${ARTIFACT_DIR}/bin/test_bitcoin.exe" --run_test=\!radix_tests,rcu_tests timeout: 3600 artifacts: bitcoin-abc-*-x86_64-w64-mingw32.exe: bitcoin-abc-x86_64-w64-mingw32.exe build-without-bip70: Werror: true cmake_flags: - '-DENABLE_BIP70=OFF' targets: - - all - install - - check - check-functional timeout: 1800 build-without-cli: Werror: true cmake_flags: - '-DBUILD_BITCOIN_CLI=OFF' targets: - - all - install - - check-functional timeout: 1200 build-without-qt: Werror: true cmake_flags: - '-DBUILD_BITCOIN_QT=OFF' targets: - - all - install - - check timeout: 1200 build-without-wallet: Werror: true cmake_flags: - '-DBUILD_BITCOIN_WALLET=OFF' targets: - - all - install - - check - check-functional templates: - diff-node timeout: 1200 build-without-zmq: Werror: true cmake_flags: - '-DBUILD_BITCOIN_ZMQ=OFF' targets: - - all - install - - check - check-functional timeout: 1800 check-buildbot: runOnDiffRegex: - contrib/buildbot/ targets: - - check-buildbot timeout: 600 check-seeds: targets: - - bitcoind - bitcoin-cli post_build: | # Run on different ports to avoid a race where the rpc port used in the first run # may not be closed in time for the second to start. SEEDS_DIR="${TOPLEVEL}"/contrib/seeds RPC_PORT=18832 "${SEEDS_DIR}"/check-seeds.sh main 80 RPC_PORT=18833 "${SEEDS_DIR}"/check-seeds.sh test 70 timeout: 600 check-source-control-tools: cmake_flags: - '-DENABLE_SOURCE_CONTROL_TOOLS_TESTS=ON' targets: - - check-source-control-tools timeout: 600 gitian-linux: templates: - gitian_builds env: OS_NAME: linux gitian-osx: templates: - gitian_builds env: OS_NAME: osx gitian-win: templates: - gitian_builds env: OS_NAME: win lint-circular-dependencies: runOnDiffRegex: - src/ - test/lint/ script: | "${TOPLEVEL}/test/lint/lint-circular-dependencies.sh" cashtab-tests: runOnDiffRegex: - web/cashtab/ artifacts: coverage.tar.gz: coverage.tar.gz env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab.xml" script: | pushd "${TOPLEVEL}/web/cashtab" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test --coverage -- \ --reporters=default \ --reporters=jest-junit \ --coverageReporters=text \ --coverageReporters=lcov \ --coverageReporters=teamcity # Generate a summary report lcov \ --rc lcov_branch_coverage=1 \ --summary coverage/lcov.info \ > coverage/lcov-report/coverage-summary.txt 2>&1 pushd coverage/lcov-report tar -czf ../coverage.tar.gz -- * popd mv coverage/coverage.tar.gz "${BUILD_DIR}/" cashtab-components-tests: runOnDiffRegex: - web/cashtab-components/ env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Components Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Components Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab-components.xml" script: | pushd "${TOPLEVEL}/web/cashtab-components" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test -- \ --reporters=default \ --reporters=jest-junit