diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c0925fd95fc..cc6eeac07d7d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,20 +19,12 @@ executors: resource_class: small commands: - rust_setup: - description: Set rustc version - steps: - - run: - name: Set rustc version - command: | - rustup default stable - rustup update stable print_versions: description: Version Info steps: - run: name: Version Info - command: rustc --version; cargo --version; rustup --version + command: rustup --version env_setup: description: Environment Setup steps: @@ -44,6 +36,7 @@ commands: echo 'export LIBRA_DUMP_LOGS=1' >> $BASH_ENV echo 'export CARGO_INCREMENTAL=0' >> $BASH_ENV echo 'export CI_TIMEOUT="timeout 40m"' >> $BASH_ENV + echo 'export RUST_NIGHTLY=nightly-2020-03-18' >> $BASH_ENV install_deps: steps: - run: @@ -52,6 +45,15 @@ commands: sudo apt-get update sudo apt-get install -y cmake curl clang llvm rustup component add clippy rustfmt + rustup toolchain install $RUST_NIGHTLY + - run: + name: Set cargo Environment + command: | + # Use nightly version of cargo to access the new feature resolver + echo 'export CARGO=$(rustup which --toolchain $RUST_NIGHTLY cargo)' >> $BASH_ENV + # Turn on the experimental feature resolver in cargo. See: + # https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#features + echo 'export CARGOFLAGS=-Zfeatures=all' >> $BASH_ENV install_code_coverage_deps: steps: - run: @@ -59,7 +61,7 @@ commands: command: | sudo apt-get update sudo apt-get install lcov - cargo install --force grcov + $CARGO $CARGOFLAGS install --force grcov install_docker_linter: steps: - run: @@ -68,11 +70,6 @@ commands: export HADOLINT=${HOME}/hadolint export HADOLINT_VER=v1.17.4 curl -sL -o ${HADOLINT} "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VER}/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ${HADOLINT} - install_rust_nightly_toolchain: - steps: - - run: - name: Install nightly toolchain for features not in beta/stable - command: rustup install nightly find_dockerfile_changes: steps: - run: @@ -106,7 +103,6 @@ commands: build_setup: steps: - checkout - - rust_setup - print_versions - env_setup - install_deps @@ -127,7 +123,7 @@ jobs: command: ./scripts/git-checks.sh - run: name: Fetch workspace dependencies over network - command: cargo fetch + command: $CARGO $CARGOFLAGS fetch - save_cargo_package_cache - persist_to_workspace: root: /home/circleci/project @@ -148,20 +144,20 @@ jobs: - restore_cargo_package_cache - run: name: cargo lint - command: cargo x lint + command: $CARGO $CARGOFLAGS x lint - run: name: cargo clippy - command: cargo xclippy --workspace --all-targets + command: $CARGO $CARGOFLAGS xclippy --workspace --all-targets - run: name: cargo fmt - command: cargo xfmt --check + command: $CARGO $CARGOFLAGS xfmt --check - run: name: cargo guppy command: | - cargo install cargo-guppy \ + $CARGO $CARGOFLAGS install cargo-guppy \ --git http://github.com/calibra/cargo-guppy \ --rev 8b2bc45c0cd6323a7a2b8170ddad6d2a5b79047b - [[ -z $(cargo guppy dups --target x86_64-unknown-linux-gnu \ + [[ -z $($CARGO $CARGOFLAGS guppy dups --target x86_64-unknown-linux-gnu \ --kind directthirdparty) ]] build-dev: executor: build-executor @@ -172,19 +168,19 @@ jobs: at: /home/circleci/project - restore_cargo_package_cache - run: - command: RUST_BACKTRACE=1 cargo build -j 16 + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p libra-swarm + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p libra-swarm - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p cluster-test + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p cluster-test - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p libra-fuzzer + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p libra-fuzzer - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p language_benchmarks + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p language_benchmarks - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p cost-synthesis + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p cost-synthesis - run: - command: RUST_BACKTRACE=1 cargo build -j 16 -p test-generation + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 -p test-generation - build_teardown build-release: executor: build-executor @@ -196,7 +192,7 @@ jobs: - restore_cargo_package_cache - run: name: Build release - command: RUST_BACKTRACE=1 cargo build -j 16 --release + command: RUST_BACKTRACE=1 $CARGO $CARGOFLAGS build -j 16 --release - build_teardown build-e2e-test: executor: build-executor @@ -209,7 +205,7 @@ jobs: - run: name: Find all e2e tests command: | - cargo x test --package testsuite -- --list | grep "::" | \ + $CARGO $CARGOFLAGS x test --package testsuite -- --list | grep "::" | \ sed 's/: .*$//' > e2e_tests cat e2e_tests - persist_to_workspace: @@ -246,7 +242,7 @@ jobs: RUST_BACKTRACE=1 $CI_TIMEOUT $libratest $target \ --test-threads 1 --exact --nocapture else - RUST_BACKTRACE=1 $CI_TIMEOUT cargo x test $target \ + RUST_BACKTRACE=1 $CI_TIMEOUT $CARGO $CARGOFLAGS x test $target \ --package testsuite -- --test-threads 1 --exact --nocapture fi done @@ -262,7 +258,7 @@ jobs: - run: name: Run all unit tests command: | - RUST_BACKTRACE=1 $CI_TIMEOUT cargo test \ + RUST_BACKTRACE=1 $CI_TIMEOUT $CARGO $CARGOFLAGS test \ --all-features \ --workspace \ --exclude libra-node \ @@ -281,7 +277,7 @@ jobs: name: Run crypto unit tests command: | cd crypto/crypto && \ - RUST_BACKTRACE=1 cargo test \ + RUST_BACKTRACE=1 $CARGO $CARGOFLAGS test \ --features='std fiat_u64_backend fuzzing' \ --no-default-features run-flaky-unit-test: @@ -312,16 +308,16 @@ jobs: steps: - build_setup - run: - name: Install Cargo Audit + name: Install cargo-audit command: | - cargo install --force cargo-audit + $CARGO $CARGOFLAGS install --force cargo-audit - run: # NOTE ignored advisory rules # RUSTSEC-2018-0015 - term # RUSTSEC-2019-0031 - spin name: Audit crates command: | - cargo audit --deny-warnings \ + $CARGO $CARGOFLAGS audit --deny-warnings \ --ignore RUSTSEC-2018-0015 \ --ignore RUSTSEC-2019-0031 - build_teardown @@ -331,7 +327,6 @@ jobs: steps: - build_setup - install_code_coverage_deps - - install_rust_nightly_toolchain - run: name: Setup code coverage output command: echo "export CODECOV_OUTPUT=codecov" >> $BASH_ENV diff --git a/Cargo.lock b/Cargo.lock index f97ac7d38dc8..917b1ac67bce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,13 +52,17 @@ dependencies = [ "libra-crypto 0.1.0", "libra-logger 0.1.0", "libra-mempool 0.1.0", + "libra-proptest-helpers 0.1.0", + "libra-prost-ext 0.1.0", "libra-types 0.1.0", "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "prometheus 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proptest 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "storage-client 0.1.0", + "storage-service 0.1.0", "tokio 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tonic 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "vm-validator 0.1.0", diff --git a/Cargo.toml b/Cargo.toml index 14c119346d16..40c7387fb169 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -108,7 +108,8 @@ members = [ # NOTE: These members should never include crates that require fuzzing # features or test features. These are the crates we want built with no extra -# test-only code included. +# test-only code included. These are essentially the main libra release +# binaries. default-members = [ "client/cli", "language/compiler", diff --git a/admission_control/admission-control-service/Cargo.toml b/admission_control/admission-control-service/Cargo.toml index c5a1b0969583..feaf7537f6d3 100644 --- a/admission_control/admission-control-service/Cargo.toml +++ b/admission_control/admission-control-service/Cargo.toml @@ -32,6 +32,12 @@ serde_json = "1.0" [dev-dependencies] assert_matches = "1.3.0" +proptest = "0.9.4" +libra-mempool = { path = "../../mempool", version = "0.1.0", features = ["fuzzing"] } +libra-proptest-helpers = { path = "../../common/proptest-helpers" } +libra-prost-ext = { path = "../../common/prost-ext", version = "0.1.0" } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } +storage-service = { path = "../../storage/storage-service" } vm-validator = { path = "../../vm-validator", version = "0.1.0" } [features] diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index f81436c33f88..b3331334661a 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -42,6 +42,7 @@ transaction-builder = { path = "../../language/transaction-builder", version = " [dev-dependencies] proptest = "0.9.2" +libra-crypto = { path = "../../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/config/Cargo.toml b/config/Cargo.toml index fcd970fb3367..1fc9491e3de2 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -29,6 +29,9 @@ libra-logger = { path = "../common/logger", version = "0.1.0" } libra-temppath = { path = "../common/temppath", version = "0.1.0" } libra-types = { path = "../types", version = "0.1.0" } +[dev-dependencies] +libra-crypto = { path = "../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } + [features] default = [] fuzzing = ["libra-crypto/fuzzing", "libra-types/fuzzing"] diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index 34bdf629e471..593f1ff37e25 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -31,7 +31,7 @@ prometheus = { version = "0.8.0", default-features = false } proptest = { version = "0.9.4", optional = true } channel = { path = "../common/channel", version = "0.1.0" } -consensus-types = { path = "consensus-types", version = "0.1.0", default-features = false } +consensus-types = { path = "consensus-types", version = "0.1.0" } crash-handler = { path = "../common/crash-handler", version = "0.1.0" } debug-interface = { path = "../common/debug-interface", version = "0.1.0" } executor = { path = "../execution/executor", version = "0.1.0" } @@ -57,6 +57,9 @@ cached = "0.12.0" proptest = "0.9.4" tempfile = "3.1.0" +consensus-types = { path = "consensus-types", version = "0.1.0", features = ["fuzzing"] } +libra-config = { path = "../config", version = "0.1.0", features = ["fuzzing"] } +libra-mempool = { path = "../mempool", version = "0.1.0", features = ["fuzzing"] } vm-genesis = { path = "../language/tools/vm-genesis", version = "0.1.0" } vm-validator = { path = "../vm-validator", version = "0.1.0" } diff --git a/consensus/consensus-types/Cargo.toml b/consensus/consensus-types/Cargo.toml index df633107a571..dc495a5ae330 100644 --- a/consensus/consensus-types/Cargo.toml +++ b/consensus/consensus-types/Cargo.toml @@ -21,6 +21,7 @@ libra-types = { path = "../../types", version = "0.1.0" } [dev-dependencies] proptest = "0.9.4" +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/consensus/safety-rules/Cargo.toml b/consensus/safety-rules/Cargo.toml index 2cab5a96ae40..dfdbcd8aeaf6 100644 --- a/consensus/safety-rules/Cargo.toml +++ b/consensus/safety-rules/Cargo.toml @@ -28,6 +28,8 @@ workspace-builder = { path = "../../common/workspace-builder", version = "0.1.0" criterion = "0.3" rand = { version = "0.6.5", default-features = false } tempfile = "3.1.0" +consensus-types = { path = "../consensus-types", version = "0.1.0", features = ["fuzzing"] } +libra-config = { path = "../../config", version = "0.1.0", features = ["fuzzing"] } [[bench]] name = "safety_rules" diff --git a/consensus/src/chained_bft/chained_bft_smr_test.rs b/consensus/src/chained_bft/chained_bft_smr_test.rs index 6f2fe2e15f7d..1d361a96893f 100644 --- a/consensus/src/chained_bft/chained_bft_smr_test.rs +++ b/consensus/src/chained_bft/chained_bft_smr_test.rs @@ -44,7 +44,6 @@ struct SMRNode { commit_cb_receiver: mpsc::UnboundedReceiver, storage: Arc>, state_sync: mpsc::UnboundedReceiver>, - shared_mempool: MockSharedMempool, } impl SMRNode { @@ -75,7 +74,7 @@ impl SMRNode { let (state_sync_client, state_sync) = mpsc::unbounded(); let (commit_cb_sender, commit_cb_receiver) = mpsc::unbounded::(); let shared_mempool = MockSharedMempool::new(None); - let consensus_to_mempool_sender = shared_mempool.consensus_sender.clone(); + let consensus_to_mempool_sender = shared_mempool.consensus_sender; let mut smr = ChainedBftSMR::new( network_sender, @@ -101,7 +100,6 @@ impl SMRNode { commit_cb_receiver, storage, state_sync, - shared_mempool, } } diff --git a/consensus/src/chained_bft/event_processor_test.rs b/consensus/src/chained_bft/event_processor_test.rs index a624c5514e7c..98912909c46b 100644 --- a/consensus/src/chained_bft/event_processor_test.rs +++ b/consensus/src/chained_bft/event_processor_test.rs @@ -49,7 +49,7 @@ use libra_types::{ block_info::BlockInfo, ledger_info::LedgerInfoWithSignatures, validator_signer::ValidatorSigner, - validator_verifier::{random_validator_verifier, ValidatorVerifier}, + validator_verifier::{random_validator_verifier}, }; use network::peer_manager::{ conn_status_channel, ConnectionRequestSender, PeerManagerRequestSender, @@ -65,7 +65,6 @@ pub struct NodeSetup { storage: Arc>, signer: ValidatorSigner, proposer_author: Author, - validators: Arc, safety_rules_manager: SafetyRulesManager, } @@ -143,7 +142,7 @@ impl NodeSetup { playground.add_node(author, consensus_tx, network_reqs_rx, conn_mgr_reqs_rx); let (self_sender, self_receiver) = channel::new_test(8); - let network = NetworkSender::new(author, network_sender, self_sender, validators.clone()); + let network = NetworkSender::new(author, network_sender, self_sender, validators); let (task, _receiver) = NetworkTask::::new(network_events, self_receiver); @@ -199,7 +198,6 @@ impl NodeSetup { storage, signer, proposer_author, - validators, safety_rules_manager, } } diff --git a/consensus/src/chained_bft/test_utils/mod.rs b/consensus/src/chained_bft/test_utils/mod.rs index 541b9761cd0b..8d7024761cbf 100644 --- a/consensus/src/chained_bft/test_utils/mod.rs +++ b/consensus/src/chained_bft/test_utils/mod.rs @@ -61,20 +61,6 @@ pub fn build_simple_tree() -> ( (vec![genesis_block, a1, a2, a3, b1, b2, c1], block_store) } -pub fn build_chain() -> Vec>> { - let mut inserter = TreeInserter::default(); - let block_store = inserter.block_store(); - let genesis = block_store.root(); - let a1 = inserter.insert_block_with_qc(certificate_for_genesis(), &genesis, 1); - let a2 = inserter.insert_block(&a1, 2, None); - let a3 = inserter.insert_block(&a2, 3, Some(genesis.block_info())); - let a4 = inserter.insert_block(&a3, 4, Some(a1.block_info())); - let a5 = inserter.insert_block(&a4, 5, Some(a2.block_info())); - let a6 = inserter.insert_block(&a5, 6, Some(a3.block_info())); - let a7 = inserter.insert_block(&a6, 7, Some(a4.block_info())); - vec![genesis, a1, a2, a3, a4, a5, a6, a7] -} - pub fn build_empty_tree() -> Arc> { let (initial_data, storage) = EmptyStorage::start_for_testing(); Arc::new(BlockStore::new( diff --git a/execution/executor/Cargo.toml b/execution/executor/Cargo.toml index a6ee38fd5d8d..1c61bafd668e 100644 --- a/execution/executor/Cargo.toml +++ b/execution/executor/Cargo.toml @@ -42,7 +42,8 @@ executor-utils = { path = "../executor-utils", version = "0.1.0" } storage-service = { path = "../../storage/storage-service", version = "0.1.0" } stdlib = { path = "../../language/stdlib", version = "0.1.0" } transaction-builder = { path = "../../language/transaction-builder", version = "0.1.0" } - +libra-config = { path = "../../config", version = "0.1.0", features = ["fuzzing"] } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } vm-genesis = { path = "../../language/tools/vm-genesis", version = "0.1.0" } [features] diff --git a/json-rpc/Cargo.toml b/json-rpc/Cargo.toml index 1b0f6d1e4b13..f73569a31127 100644 --- a/json-rpc/Cargo.toml +++ b/json-rpc/Cargo.toml @@ -37,6 +37,12 @@ libra-temppath = { path = "../common/temppath", version = "0.1.0", optional = tr storage-proto = { path = "../storage/storage-proto", version = "0.1.0" } [dev-dependencies] +proptest = "0.9.2" +libra-mempool = { path = "../mempool", version = "0.1.0", features = ["fuzzing"] } +libra-proptest-helpers = { path = "../common/proptest-helpers" } +libra-temppath = { path = "../common/temppath", version = "0.1.0" } +libra-types = { path = "../types", version = "0.1.0", features = ["fuzzing"] } +libradb = { path = "../storage/libradb", version = "0.1.0", features = ["fuzzing"] } vm-validator = { path = "../vm-validator", version = "0.1.0" } [features] diff --git a/language/libra-vm/Cargo.toml b/language/libra-vm/Cargo.toml index bce064c7c3ef..44708853c214 100644 --- a/language/libra-vm/Cargo.toml +++ b/language/libra-vm/Cargo.toml @@ -36,6 +36,7 @@ serde = { version = "1.0.105", default-features = false } [dev-dependencies] proptest = "0.9" +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/language/move-vm/types/Cargo.toml b/language/move-vm/types/Cargo.toml index 3f1a302620ba..c93cb26f1f12 100644 --- a/language/move-vm/types/Cargo.toml +++ b/language/move-vm/types/Cargo.toml @@ -24,6 +24,7 @@ move-core-types = { path = "../../move-core/types", version = "0.1.0" } [dev-dependencies] proptest = "0.9" +vm = { path = "../../vm", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/language/vm/Cargo.toml b/language/vm/Cargo.toml index 80746108b546..68fd2fb8eb3f 100644 --- a/language/vm/Cargo.toml +++ b/language/vm/Cargo.toml @@ -30,8 +30,9 @@ num-variants = { path = "../../common/num-variants", version = "0.1.0" } [dev-dependencies] proptest = "0.9" proptest-derive = "0.1.1" -libra-proptest-helpers = { path = "../../common/proptest-helpers", version = "0.1.0" } serde_json = "1" +libra-proptest-helpers = { path = "../../common/proptest-helpers", version = "0.1.0" } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/mempool/Cargo.toml b/mempool/Cargo.toml index b4ec36376e85..f50c622c77ab 100644 --- a/mempool/Cargo.toml +++ b/mempool/Cargo.toml @@ -44,6 +44,7 @@ storage-service = { path = "../storage/storage-service", version = "0.1.0", opti [dev-dependencies] parity-multiaddr = { version = "0.7.2", default-features = false } rand = "0.6.5" +storage-service = { path = "../storage/storage-service", version = "0.1.0", features = ["fuzzing"] } [build-dependencies] tonic-build = "0.1" diff --git a/mempool/src/lib.rs b/mempool/src/lib.rs index d53951f9e1cc..c7a33f82334a 100644 --- a/mempool/src/lib.rs +++ b/mempool/src/lib.rs @@ -60,7 +60,7 @@ extern crate prometheus; /// This module provides mocks of shared mempool for tests. -#[cfg(feature = "fuzzing")] +#[cfg(any(test, feature = "fuzzing"))] pub mod mocks; pub use shared_mempool::{ bootstrap, generate_reconfig_subscription, CommitNotification, CommitResponse, diff --git a/network/Cargo.toml b/network/Cargo.toml index 3a235d2f65ab..aba7f5c9c82d 100644 --- a/network/Cargo.toml +++ b/network/Cargo.toml @@ -43,6 +43,9 @@ proptest = { version = "0.9.4", default-features = true, optional = true } [dev-dependencies] criterion = "=0.3.1" noise = { path = "noise", version = "0.1.0", features = ["testing"] } +proptest = { version = "0.9.4", default-features = false } +libra-proptest-helpers = { path = "../common/proptest-helpers", version = "0.1.0" } +libra-types = { path = "../types", version = "0.1.0", features = ["fuzzing"] } socket-bench-server = { path = "socket-bench-server", version = "0.1.0" } [features] diff --git a/secure/storage/Cargo.toml b/secure/storage/Cargo.toml index fe0825fba95f..a90b8fa878aa 100644 --- a/secure/storage/Cargo.toml +++ b/secure/storage/Cargo.toml @@ -24,6 +24,7 @@ toml = { version = "0.5.3", default-features = false } [dev-dependencies] libra-config = { path = "../../config", version = "0.1.0" } +libra-crypto = { path = "../../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } rand = "0.6.5" [features] diff --git a/state-synchronizer/Cargo.toml b/state-synchronizer/Cargo.toml index 9db3c187591a..a4d1e597dc10 100644 --- a/state-synchronizer/Cargo.toml +++ b/state-synchronizer/Cargo.toml @@ -38,6 +38,7 @@ bytes = "0.5.4" config-builder = { path = "../config/config-builder", version = "0.1.0" } libra-crypto = { path = "../crypto/crypto", version = "0.1.0" } +libra-mempool = { path = "../mempool", version = "0.1.0", features = ["fuzzing"] } parity-multiaddr = "0.7.2" vm-genesis = { path = "../language/tools/vm-genesis", version = "0.1.0" } transaction-builder = { path = "../language/transaction-builder", version = "0.1.0" } diff --git a/storage/accumulator/Cargo.toml b/storage/accumulator/Cargo.toml index 64ba45ec4e9c..65eb149752d1 100644 --- a/storage/accumulator/Cargo.toml +++ b/storage/accumulator/Cargo.toml @@ -18,6 +18,7 @@ libra-types = { path = "../../types", version = "0.1.0" } [dev-dependencies] rand = "0.6.5" proptest = "0.9.1" +libra-crypto = { path = "../../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/storage/jellyfish-merkle/Cargo.toml b/storage/jellyfish-merkle/Cargo.toml index 7d07d082929e..ab8bf303cc75 100644 --- a/storage/jellyfish-merkle/Cargo.toml +++ b/storage/jellyfish-merkle/Cargo.toml @@ -30,6 +30,9 @@ libra-types = { path = "../../types", version = "0.1.0" } rand = "0.6.5" proptest = "0.9.2" proptest-derive = "0.1.2" +libra-crypto = { path = "../../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } +libra-nibble = { path = "../../common/nibble", version = "0.1.0", features = ["fuzzing"] } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/storage/libradb/Cargo.toml b/storage/libradb/Cargo.toml index 189f194c66a8..a2fd875959e5 100644 --- a/storage/libradb/Cargo.toml +++ b/storage/libradb/Cargo.toml @@ -41,7 +41,10 @@ libra-temppath = { path = "../../common/temppath", version = "0.1.0", optional = [dev-dependencies] proptest = "0.9.2" proptest-derive = "0.1.2" +jellyfish-merkle = { path = "../jellyfish-merkle", version = "0.1.0", features = ["fuzzing"] } libra-proptest-helpers = { path = "../../common/proptest-helpers", version = "0.1.0" } +libra-temppath = { path = "../../common/temppath", version = "0.1.0" } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } [features] default = [] diff --git a/storage/storage-proto/Cargo.toml b/storage/storage-proto/Cargo.toml index 9a10ab40d56f..aa39a3dfbfe9 100644 --- a/storage/storage-proto/Cargo.toml +++ b/storage/storage-proto/Cargo.toml @@ -23,7 +23,9 @@ libra-types = { path = "../../types", version = "0.1.0" } tonic-build = "0.1" [dev-dependencies] +libra-crypto = { path = "../../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } libra-prost-ext = { path = "../../common/prost-ext", version = "0.1.0" } +libra-types = { path = "../../types", version = "0.1.0", features = ["fuzzing"] } proptest = "0.9.2" proptest-derive = "0.1.0" diff --git a/storage/storage-service/Cargo.toml b/storage/storage-service/Cargo.toml index 336a8778003c..c1e697b047c2 100644 --- a/storage/storage-service/Cargo.toml +++ b/storage/storage-service/Cargo.toml @@ -30,8 +30,10 @@ storage-client = { path = "../storage-client", version = "0.1.0", optional = tru [dev-dependencies] itertools = "0.9.0" -libra-temppath = { path = "../../common/temppath", version = "0.1.0" } proptest = "0.9.2" +libradb = { path = "../libradb", version = "0.1.0", features = ["fuzzing"] } +libra-temppath = { path = "../../common/temppath", version = "0.1.0" } +storage-client = { path = "../storage-client", version = "0.1.0" } [features] default = [] diff --git a/types/Cargo.toml b/types/Cargo.toml index 5643db26bb42..46c50f862aec 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -40,6 +40,7 @@ prost-build = "0.6" regex = "1.3.6" proptest = "0.9.4" proptest-derive = "0.1.2" +libra-crypto = { path = "../crypto/crypto", version = "0.1.0", features = ["fuzzing"] } libra-proptest-helpers = { path = "../common/proptest-helpers", version = "0.1.0" } libra-prost-ext = { path = "../common/prost-ext", version = "0.1.0" } diff --git a/types/src/event.rs b/types/src/event.rs index 0acea4aab983..443929b088cf 100644 --- a/types/src/event.rs +++ b/types/src/event.rs @@ -132,7 +132,7 @@ impl EventHandle { self.count } - #[cfg(feature = "fuzzing")] + #[cfg(any(test, feature = "fuzzing"))] pub fn count_mut(&mut self) -> &mut u64 { &mut self.count } @@ -146,7 +146,7 @@ impl EventHandle { } } - #[cfg(feature = "fuzzing")] + #[cfg(any(test, feature = "fuzzing"))] /// Derive a unique handle by using an AccountAddress and a counter. pub fn new_from_address(addr: &AccountAddress, salt: u64) -> Self { Self { diff --git a/vm-validator/Cargo.toml b/vm-validator/Cargo.toml index 12ac9001a9a6..dc2abc6b677c 100644 --- a/vm-validator/Cargo.toml +++ b/vm-validator/Cargo.toml @@ -27,8 +27,9 @@ rand = "0.6.5" config-builder = { path = "../config/config-builder", version = "0.1.0" } libra-crypto = { path = "../crypto/crypto", version = "0.1.0" } executor = { path = "../execution/executor", version = "0.1.0" } +libra-types = { path = "../types", version = "0.1.0" } +libra-vm = { path = "../language/libra-vm", version = "0.1.0", features = ["fuzzing"] } storage-service = { path = "../storage/storage-service", version = "0.1.0" } -libra-vm = { path = "../language/libra-vm", version = "0.1.0" } transaction-builder = { path = "../language/transaction-builder", version = "0.1.0" } [features] diff --git a/x/src/cargo.rs b/x/src/cargo.rs index deda60aa5a08..26011eb8709a 100644 --- a/x/src/cargo.rs +++ b/x/src/cargo.rs @@ -4,6 +4,7 @@ use crate::{utils::project_root, Result}; use anyhow::anyhow; use std::{ + env, ffi::{OsStr, OsString}, path::Path, process::{Command, Output, Stdio}, @@ -16,7 +17,17 @@ pub struct Cargo { impl Cargo { pub fn new>(command: S) -> Self { - let mut inner = Command::new("cargo"); + let mut inner = match env::var("CARGO") { + Ok(s) => Command::new(&s), + Err(_) => Command::new("cargo"), + }; + if let Ok(s) = env::var("CARGOFLAGS") { + let flags: Vec<&str> = s + .split(char::is_whitespace) + .filter(|&a| a != "") + .collect(); + inner.args(&flags); + } inner.arg(command); Self { inner,