Skip to content

fix(zetaclient): backport respect DisableTssBlockScan in Bitcoin observer #4598

Open
skosito wants to merge 1 commit into
release/zetaclient/v37from
respect-disable-tss-block-scan-in-btc-observer-v37
Open

fix(zetaclient): backport respect DisableTssBlockScan in Bitcoin observer #4598
skosito wants to merge 1 commit into
release/zetaclient/v37from
respect-disable-tss-block-scan-in-btc-observer-v37

Conversation

@skosito
Copy link
Copy Markdown
Member

@skosito skosito commented May 20, 2026

original PR #4597

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Note

Medium Risk
Behavior changes to conditionally suppress Bitcoin inbound detection and voting; a mis-set DisableTssBlockScan could cause missed deposits, though it is gated behind an explicit chain parameter flag.

Overview
Respects DisableTssBlockScan in the Bitcoin observer. When this chain parameter is enabled, ObserveInbound now returns early and performs no block-range inbound scanning.

Inbound tracker processing (observeInboundTrackers) is also short-circuited under the same flag (with additional sampled logging), preventing votes on tracker-referenced deposits. Unit tests were added to ensure both paths return without attempting any Bitcoin RPC calls.

Reviewed by Cursor Bugbot for commit 92a7597. Configure here.

Greptile Summary

This PR adds a DisableTssBlockScan guard to the Bitcoin observer's inbound scanning path, mirroring the check that already exists in the EVM observer. Since Bitcoin has no smart-contract-based inbounds — all deposits go directly to the TSS address — the flag correctly short-circuits the entire inbound observation loop rather than just part of it.

  • inbound.go: Early return after updateLastBlock when DisableTssBlockScan is set, so the chain-tip pointer stays fresh but block scanning stops.
  • inbound_tracker.go: Same guard added to observeInboundTrackers, preventing both external and internal tracker votes from being processed.
  • inbound_test.go: Two focused unit tests verify the early-return paths without requiring any RPC mock setup for the scan operations.

Confidence Score: 5/5

The change is a narrow, additive guard; it cannot break existing scan paths and has direct test coverage.

Both changed functions gain a clear early-return guarded by the existing chain parameter, with no mutation to downstream logic. The updateLastBlock call is preserved before the guard in ObserveInbound, keeping chain-tip tracking alive even when scanning is disabled, which is the correct trade-off for a clean resume once the flag is cleared. Tests confirm no RPC calls are made when the flag is set.

No files require special attention.

Important Files Changed

Filename Overview
zetaclient/chains/bitcoin/observer/inbound.go Adds DisableTssBlockScan early-return after updateLastBlock; placement is correct and consistent with keeping chain-tip tracking alive.
zetaclient/chains/bitcoin/observer/inbound_tracker.go Adds DisableTssBlockScan guard to observeInboundTrackers, correctly skipping both external and internal tracker voting with structured logging.
zetaclient/chains/bitcoin/observer/inbound_test.go Two new tests cover the early-return behaviour for ObserveInbound and observeInboundTrackers; GetBlockCount is safely handled by the existing Maybe() mock in newTestSuite.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ObserveInbound called] --> B[updateLastBlock]
    B --> C{DisableTssBlockScan?}
    C -- Yes --> D[log sampled info & return nil]
    C -- No --> E[GetScanRangeInboundSafe]
    E --> F[observeInboundInBlockRange SAFE]
    F --> G[SaveLastBlockScanned]
    G --> H[GetScanRangeInboundFast]
    H --> I[observeInboundInBlockRange FAST]
    I --> J[return nil]

    K[ProcessInboundTrackers / ProcessInternalTrackers] --> L[observeInboundTrackers]
    L --> M{DisableTssBlockScan?}
    M -- Yes --> N[log sampled info & return nil]
    M -- No --> O[truncate trackers at MaxInboundTrackersPerScan]
    O --> P[CheckReceiptAndPostVoteForBtcTxHash per tracker]
    P --> Q[return nil]
Loading

Reviews (1): Last reviewed commit: "fix(zetaclient): respect DisableTssBlock..." | Re-trigger Greptile

* fix(zetaclient): respect DisableTssBlockScan in Bitcoin observer

* same fix in inbound tracker

* log

* changelog
@skosito skosito requested a review from a team as a code owner May 20, 2026 01:36
@skosito skosito added the no-changelog Skip changelog CI check label May 20, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0f40128c-7a04-4940-b8e2-5dffcae92d19

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch respect-disable-tss-block-scan-in-btc-observer-v37

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skosito skosito changed the title fix(zetaclient): respect DisableTssBlockScan in Bitcoin observer fix(zetaclient): backport respect DisableTssBlockScan in Bitcoin observer May 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Skip changelog CI check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants