Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve height target calculation for watchdog canister #327

Merged
merged 9 commits into from
Sep 23, 2024

Conversation

maksymar
Copy link
Contributor

@maksymar maksymar commented Sep 23, 2024

This PR makes calculation of height target for watchdog canister more strict.

  • Before: The target height is the median of explorer heights if there are enough explorers (>= min_explorers).
  • After: The target height is the median only if enough explorers (>= min_explorers) are within a defined range of the median.

Configs (currently in prod):

  • mainnet -- explorers 6, min_explorers 3, blocks range [-2, 2]
  • testnet -- explorers 3, min_explorers 2, blocks range [-1000, 1000]

Making the height target calculation more strict for the testnet is necessary because the testnet has fewer explorers and greater instability, leading to large block height divergences. A stricter calculation helps reduce noise and false positives by ensuring only explorers with closely aligned heights are considered valid, improving accuracy and stability.

Mainnet explorers:
image
image

Testnet explorers:
image
image

Copy link

github-actions bot commented Sep 23, 2024

canbench 🏋 (dir: .)

No significant performance changes detected ✅

./canbench_results.yml is up to date ✅

~/work/bitcoin-canister/bitcoin-canister/scripts ~/work/bitcoin-canister/bitcoin-canister
~/work/bitcoin-canister/bitcoin-canister

---------------------------------------------------

Benchmark: insert_300_blocks
  total:
    instructions: 561.73 M (-0.01%) (change within noise threshold)
    heap_increase: 6 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: get_metrics
  total:
    instructions: 87.01 M (0.01%) (change within noise threshold)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: insert_block_headers
  total:
    instructions: 3.90 B (0.00%) (change within noise threshold)
    heap_increase: 2 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: insert_block_headers_multiple_times
  total:
    instructions: 13.90 B (0.02%) (change within noise threshold)
    heap_increase: 7 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

Benchmark: pre_upgrade_with_many_unstable_blocks
  total:
    instructions: 5.82 B (0.21%) (change within noise threshold)
    heap_increase: 4097 pages (no change)
    stable_memory_increase: 1792 pages (no change)

  serialize_blocktree (scope):
    instructions: 2.39 B (0.45%) (change within noise threshold)
    heap_increase: 2048 pages (no change)
    stable_memory_increase: 0 pages (no change)

  serialize_blocktree_flatten (scope):
    instructions: 201.60 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  serialize_blocktree_serialize_seq (scope):
    instructions: 2.39 B (0.45%) (change within noise threshold)
    heap_increase: 2048 pages (no change)
    stable_memory_increase: 0 pages (no change)

---------------------------------------------------

watchdog/src/health.rs Show resolved Hide resolved
watchdog/src/health.rs Show resolved Hide resolved
watchdog/src/health.rs Show resolved Hide resolved
@maksymar maksymar enabled auto-merge (squash) September 23, 2024 12:15
@maksymar maksymar merged commit c225201 into master Sep 23, 2024
27 checks passed
@maksymar maksymar deleted the maksym/height-calc branch September 23, 2024 12:30
maksymar added a commit that referenced this pull request Sep 23, 2024
…canister (#328)

This PR re-enables the `api.bitaps.com` explorer for the testnet.

It was previously disabled due to instability, but with the stricter
height target calculation introduced in
[PR327](#327), this
should improve the stability of testnet alerts.
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.

2 participants