Verify block signatures before taking the ledger writer (#5246) * Benchmark block processing and the ledger writer contention it causes A dev node with two thousand opened accounts processes rounds of one-raw transfers between neighbouring accounts through the block processor from the bootstrap source, with elections, backlog scans and the bounded backlog switched off. A competing thread takes and releases the ledger writer once a millisecond, as confirmation processing would, and records how long each acquisition waited. Reported per run: blocks per second, the competing writer's wait percentiles and the number of times it got the lock. * Verify block signatures before taking the ledger writer The block processor used to check every signature inside the ledger write transaction. It now resolves each block's signer under a read transaction, verifies the batch in parallel and hands the verdicts to the ledger, so the writer is held for the ledger updates alone and other writers such as confirmation processing get it sooner. nano::signed_message carries a signer, message and signature with nothing verified. nano::signature_verification is the verdict on one and mints itself through its static verify, the single producer; a dummy exists for tests behind a dev-network assert, like vote_permit. nano::signature_verifier shares a batch between the calling thread and a pool of extra threads, sized by verification_threads under [node.block_processor]. The unused signature_checker_threads key is removed. ledger::block_signer resolves the account the ledger will check a block against, nullopt when the predecessor is missing. ledger::process takes an optional verdict and reuses it only when it covers the exact signer, hash and signature it would check; a verdict about another block is a caller bug and asserts. The signer may legitimately differ when an epoch block's predecessor is rolled back between the two transactions, in which case the ledger verifies itself. The verdict rides on block_context, so the batch loop stays a plain range-for. The block processing benchmark gains a verification_threads sweep.
__________
Type: commit
Hash: 6b49a6c44d3187ff8b590c7eb29b4ede72bf19ce
Created: today
__________
gr0v1ty/nano-node:6b49a6c44d3187ff8b590c7eb29b4ede72bf19ce
| Test Case | Status | Duration | Median Deviation | Log | Graph |
|---|---|---|---|---|---|
| 5n4pr_conf_10k_bintree | PASS | 112 s | -1.0 s | GitHub job logs | Show |
| 5n4pr_conf_10k_change | PASS | 128 s | -6.0 s | GitHub job logs | Show |
| 5n4pr_conf_change_dependant | PASS | 109 s | -6.0 s | GitHub job logs | - |
| 5n4pr_conf_change_independant | FAIL | 3 s | -109.0 s | Test log | - |
| 5n4pr_conf_send_dependant | PASS | 105 s | -9.0 s | GitHub job logs | - |
| 5n4pr_conf_send_independant | PASS | 129 s | 15.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_bintree | PASS | 113 s | 0.0 s | GitHub job logs | - |
| 5n4pr_rocks_10k_change | FAIL | 3 s | -155.0 s | Test log | - |