2

How can I make the tests pass?

Steps to reproduce:

  1. git clone https://github.com/paritytech/polkadot
  2. cd polkadot
  3. cargo build
  4. cargo test
$ cargo test
⚡ Found 3 strongly connected components which includes at least one cycle each
cycle(001) ∈ α: DisputeCoordinator ~~{"DisputeDistributionMessage"}~~> DisputeDistribution ~~{"DisputeCoordinatorMessage"}~~>  *
cycle(002) ∈ β: CandidateBacking ~~{"ProvisionerMessage"}~~> Provisioner ~~{"CandidateBackingMessage"}~~>  *
cycle(003) ∈ γ: NetworkBridgeRx ~~{"GossipSupportMessage"}~~> GossipSupport ~~{"NetworkBridgeRxMessage"}~~>  *
    Finished test [unoptimized + debuginfo] target(s) in 2.15s
     Running unittests src/main.rs (target/debug/deps/polkadot-45cd41598fdd19a5)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/benchmark_block.rs (target/debug/deps/benchmark_block-36e2726cfcdc7e80)

running 1 test
2022-12-01 16:42:50 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:42:50 ParentBlockRandomness did not provide entropy    
2022-12-01 16:42:50 Block 1 with     2 tx used 212.10% of its weight (    20,145,091 of      9,497,706 ns) - OVER WEIGHT!    
test benchmark_block_works has been running for over 60 seconds
2022-12-01 16:43:57 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:43:57 Essential task `transaction-pool-task-0` failed. Shutting down service.    
2022-12-01 16:43:57 ParentBlockRandomness did not provide entropy    
2022-12-01 16:43:57 Block 1 with     2 tx used 446.49% of its weight (    46,758,523 of     10,472,472 ns) - OVER WEIGHT!    
2022-12-01 16:44:55 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:44:55 ParentBlockRandomness did not provide entropy    
2022-12-01 16:44:55 Block 1 with     2 tx used 186.84% of its weight (    16,926,553 of      9,059,511 ns) - OVER WEIGHT!    
2022-12-01 16:45:46 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:45:46 ParentBlockRandomness did not provide entropy    
2022-12-01 16:45:46 Block 1 with     2 tx used 179.78% of its weight (    14,686,623 of      8,169,364 ns) - OVER WEIGHT!    
test benchmark_block_works ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 231.51s

     Running tests/benchmark_extrinsic.rs (target/debug/deps/benchmark_extrinsic-405b7d564d961c0a)

running 2 tests
2022-12-01 16:45:46 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2022-12-01 16:45:46 [0] 💸 generated 1 npos targets    
2022-12-01 16:45:46 Took active validators from set with wrong size    
2022-12-01 16:45:46 Took active validators from set with wrong size    
2022-12-01 16:45:46 Took active validators from set with wrong size.    
2022-12-01 16:45:46 Took active validators from set with wrong size    
Error: 
   0: Other: can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got polkadot

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: 
   0: Other: can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got ksmcc3

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: 
   0: Other: can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got westend2

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Error: 
   0: Other: can only use subcommand with --chain [polkadot-dev, kusama-dev, westend-dev, rococo-dev, wococo-dev], got rococo_v2_2

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
test benchmark_extrinsic_rejects_non_dev_runtimes ... ok
2022-12-01 16:45:56 🔨 Initializing Genesis block/state (state: 0xd6e4…c48c, header-hash: 0x300d…9518)    
2022-12-01 16:45:56 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2022-12-01 16:46:08 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-12-01 16:46:08 Essential task `transaction-pool-task-0` failed. Shutting down service.    
2022-12-01 16:46:08 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 Running 1 warmups...    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 Executing block 1 times    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 Building block, this takes some time...    
2022-12-01 16:46:08 Extrinsics per block: 1    
2022-12-01 16:46:08 Running 1 warmups...    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 Executing block 1 times    
2022-12-01 16:46:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:08 Executing a system::remark extrinsic takes[ns]:
Total: 2292161
Min: 2292161, Max: 2292161
Average: 2292161, Median: 2292161, Stddev: 0
Percentiles 99th, 95th, 75th: 2292161, 2292161, 2292161    
2022-12-01 16:46:08 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2022-12-01 16:46:08 [0] 💸 generated 1 npos targets    
2022-12-01 16:46:08 Took active validators from set with wrong size    
2022-12-01 16:46:08 Took active validators from set with wrong size    
2022-12-01 16:46:08 Took active validators from set with wrong size.    
2022-12-01 16:46:08 Took active validators from set with wrong size    
2022-12-01 16:46:19 🔨 Initializing Genesis block/state (state: 0xd6e4…c48c, header-hash: 0x300d…9518)    
2022-12-01 16:46:19 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2022-12-01 16:46:30 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-12-01 16:46:30 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 Running 1 warmups...    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 Executing block 1 times    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 Building block, this takes some time...    
2022-12-01 16:46:30 Extrinsics per block: 1    
2022-12-01 16:46:30 Running 1 warmups...    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 Executing block 1 times    
2022-12-01 16:46:30 ParentBlockRandomness did not provide entropy    
2022-12-01 16:46:30 Executing a balances::transfer_keep_alive extrinsic takes[ns]:
Total: 2148076
Min: 2148076, Max: 2148076
Average: 2148076, Median: 2148076, Stddev: 0
Percentiles 99th, 95th, 75th: 2148076, 2148076, 2148076    
2022-12-01 16:46:30 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2022-12-01 16:46:30 [0] 💸 generated 1 npos targets    
2022-12-01 16:46:30 Took active validators from set with wrong size    
2022-12-01 16:46:30 Took active validators from set with wrong size    
2022-12-01 16:46:30 Took active validators from set with wrong size.    
2022-12-01 16:46:30 Took active validators from set with wrong size    
2022-12-01 16:46:43 🔨 Initializing Genesis block/state (state: 0x19ee…acdb, header-hash: 0xbf52…a822)    
2022-12-01 16:46:43 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
test benchmark_extrinsic_works has been running for over 60 seconds
2022-12-01 16:46:55 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-12-01 16:46:55 Essential task `txpool-background` failed. Shutting down service.    

[...] 

2022-12-01 16:49:27 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:27 Per-extrinsic execution overhead [ns]:
Total: 9205765
Min: 1458056, Max: 2569258
Average: 1841153, Median: 1687580, Stddev: 411441.5
Percentiles 99th, 95th, 75th: 2569258, 2569258, 1998034    
2022-12-01 16:49:27 Writing weights to "/tmp/.tmpukovTg/extrinsic_weights.rs"    
2022-12-01 16:49:27 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2022-12-01 16:49:27 [0] 💸 generated 1 npos targets    
2022-12-01 16:49:27 Took active validators from set with wrong size    
2022-12-01 16:49:27 Took active validators from set with wrong size    
2022-12-01 16:49:27 Took active validators from set with wrong size.    
2022-12-01 16:49:27 Took active validators from set with wrong size    
2022-12-01 16:49:37 🔨 Initializing Genesis block/state (state: 0x90f5…9992, header-hash: 0x6556…b1be)    
2022-12-01 16:49:37 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
test benchmark_overhead_works has been running for over 60 seconds
2022-12-01 16:49:47 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-12-01 16:49:47 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 Running 5 warmups...    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 Executing block 5 times    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 Per-block execution overhead [ns]:
Total: 74899660
Min: 13700020, Max: 18086693
Average: 14979932, Median: 14000104, Stddev: 1642355.19
Percentiles 99th, 95th, 75th: 18086693, 18086693, 15218890    
2022-12-01 16:49:47 Writing weights to "/tmp/.tmpumO2Ak/block_weights.rs"    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 Running 5 warmups...    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 Executing block 5 times    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:47 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 Building block, this takes some time...    
2022-12-01 16:49:48 Extrinsics per block: 5    
2022-12-01 16:49:48 Running 5 warmups...    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 Executing block 5 times    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 ParentBlockRandomness did not provide entropy    
2022-12-01 16:49:48 Per-extrinsic execution overhead [ns]:
Total: 6517901
Min: 1054132, Max: 1551289
Average: 1303580, Median: 1334773, Stddev: 211142.12
Percentiles 99th, 95th, 75th: 1551289, 1551289, 1510116    
2022-12-01 16:49:48 Writing weights to "/tmp/.tmpumO2Ak/extrinsic_weights.rs"    
2022-12-01 16:49:48 Took active validators from set with wrong size    
2022-12-01 16:49:48 Took active validators from set with wrong size    
2022-12-01 16:49:48 Took active validators from set with wrong size.    
2022-12-01 16:49:48 Took active validators from set with wrong size    
2022-12-01 16:49:58 🔨 Initializing Genesis block/state (state: 0x2a6d…a321, header-hash: 0xd5b3…562d)    
2022-12-01 16:49:58 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2022-12-01 16:50:08 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2022-12-01 16:50:08 Essential task `transaction-pool-task-0` failed. Shutting down service.    
2022-12-01 16:50:08 Essential task `transaction-pool-task-1` failed. Shutting down service.    
2022-12-01 16:50:08 Essential task `txpool-background` failed. Shutting down service.    
2022-12-01 16:50:08 Essential task `basic-block-import-worker` failed. Shutting down service.    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Running 5 warmups...    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Executing block 5 times    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Per-block execution overhead [ns]:
Total: 40636642
Min: 7998039, Max: 8340508
Average: 8127328, Median: 8123421, Stddev: 125547.9
Percentiles 99th, 95th, 75th: 8340508, 8340508, 8169301    
2022-12-01 16:50:08 Writing weights to "/tmp/.tmpGAgaPp/block_weights.rs"    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Running 5 warmups...    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Executing block 5 times    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Building block, this takes some time...    
2022-12-01 16:50:08 Extrinsics per block: 5    
2022-12-01 16:50:08 Running 5 warmups...    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Executing block 5 times    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 ParentBlockRandomness did not provide entropy    
2022-12-01 16:50:08 Per-extrinsic execution overhead [ns]:
Total: 6334846
Min: 1069196, Max: 1617444
Average: 1266969, Median: 1081994, Stddev: 239853.73
Percentiles 99th, 95th, 75th: 1617444, 1617444, 1496373    
2022-12-01 16:50:08 Writing weights to "/tmp/.tmpGAgaPp/extrinsic_weights.rs"    
test benchmark_overhead_works ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 89.02s

     Running tests/benchmark_storage_works.rs (target/debug/deps/benchmark_storage_works-4795d37400fcf997)

running 1 test
Error: 
   0: Invalid input: Compile with --features=runtime-benchmarks to enable storage benchmarks.

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
test benchmark_storage_works ... FAILED

failures:

---- benchmark_storage_works stdout ----
thread 'benchmark_storage_works' panicked at 'assertion failed: benchmark_storage(\"rocksdb\", base_path).success()', tests/benchmark_storage_works.rs:31:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    benchmark_storage_works

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

error: test failed, to rerun pass `--test benchmark_storage_works`
0

2 Answers 2

0

You should try again but follow the steps in the hacking on polkadot section. You are probably missing some dependencies

1
  • yeah it seems like Substrate is a dependency for Polkadot to work. Is that correct?
    – amab8901
    Commented Dec 4, 2022 at 5:48
2

https://github.com/paritytech/polkadot/pull/6376 should fix this.
Sorry for the inconvenience.

In the meantime to make it pass you can use the same command that the CI uses:

cargo test --workspace --profile testnet --verbose --locked --features=runtime-benchmarks,runtime-metrics

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.