Skip to content

test: speed up send_shield_cycle from 58s to 44s - #2741

Merged
zancas merged 4 commits into
devfrom
speed_up_tests
Aug 24, 2026
Merged

test: speed up send_shield_cycle from 58s to 44s#2741
zancas merged 4 commits into
devfrom
speed_up_tests

Conversation

@zancas

@zancas zancas commented Aug 24, 2026

Copy link
Copy Markdown
Member

Profiling showed that zebra's getblocktemplate dominates this test. Each template builds a fresh shielded coinbase with a proof. An empty template costs about 2.2 seconds. A transaction-bearing template costs about 4.5 seconds.

This branch lands three speed-ups and the instrumentation that found them.

  1. Infrastructure pin bump. The pin moves to 89cf104a2, the merge of feat(zcash_local_net)!: prefetch block templates via getblocktemplate long polling infrastructure#284. Zebrad::generate_blocks now parks a long-poll getblocktemplate after each mined block. Zebrad precomputes the next coinbase during harness work. Mining drops from 28.3 to 23.2 seconds mean.
  2. Converge before the confirmation sync. follow_proposal raced the indexer with a bare sync_and_await. The wasted confirm round cost about nine seconds. sync_client_to_tip barriers on indexer convergence first.
  3. Proving-key warmup. The PostNu6_3 Orchard proving key now builds during environment setup, in parallel with the network launch. This removes over a second from the measured send path.
  4. Phase timers. A timed helper logs each phase's label and elapsed seconds across the whole call graph. These timers produced the measurements above.

The measured mean run time falls from 58.4 seconds to about 44 seconds. A run through the merged pin confirmed 45.6 seconds.

🤖 Generated with Claude Code

zancas and others added 4 commits August 24, 2026 13:25
Move zcash_local_net and zingo_test_vectors from 537f84d3d to
89cf104a2, the merge of infrastructure PR #284. Zebrad::generate_blocks
now parks a long-poll getblocktemplate after each mined block, so
zebrad precomputes the next shielded coinbase during harness work.
Separation blocks drop from 2.5s to 0.4-1.6s, and send_shield_cycle
mining drops from 28.3s to 23.2s mean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
follow_proposal confirmed transactions with sender.sync_and_await,
which raced the indexer: the wallet often synced before the indexer
served the confirmation block, wasting an entire extra confirm round.
Replace the bare sync with sync_client_to_tip, which barriers on
indexer convergence to the mined height first. This removes the
wasted confirm[1] round and saves about nine seconds per run.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
send_shield_cycle built the PostNu6_3 Orchard proving key lazily on
the first send, costing over a second inside the measured send path.
Add warm_orchard_proving_key to testutils and await it with
tokio::join! alongside CC::setup, so the key builds while the local
network launches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add timed, a helper that logs a phase label and its elapsed wall-clock
seconds around any future, and wrap the send_shield_cycle call graph
with it: environment setup, client construction, chain-height
increases, indexer convergence, wallet syncs, proposal and send steps,
and each confirmation round. The test installs a tracing subscriber so
the phase log reaches stdout. These timers produced the measurements
behind the preceding speed-ups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zancas

zancas commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

Test only PR, tested and benchmarked.

@zancas
zancas merged commit 6f236dc into dev Aug 24, 2026
20 checks passed
@zancas
zancas deleted the speed_up_tests branch August 24, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant