Skip to content

test: DEFI-2100: Migrate disable-api-if-not-fully-synced-flag e2e test to PocketIC - #537

Draft
mbjorkqvist wants to merge 1 commit into
masterfrom
mathias/DEFI-2100-disable-api-pocketic
Draft

test: DEFI-2100: Migrate disable-api-if-not-fully-synced-flag e2e test to PocketIC#537
mbjorkqvist wants to merge 1 commit into
masterfrom
mathias/DEFI-2100-disable-api-pocketic

Conversation

@mbjorkqvist

Copy link
Copy Markdown
Contributor

Continues the DEFI-2100 migration of e2e tests off dfx and onto PocketIC.

Replaces the dfx-based disable-api-if-not-fully-synced-flag.sh script with a Rust integration test driven by PocketIC. The test reuses the existing source canister — which serves 2 full blocks plus 3 next block headers, leaving the canister permanently not-fully-synced — and asserts both directions of the disable_api_if_not_fully_synced flag:

  • with the flag enabled, every bitcoin_* API call (update and query) traps with "Canister state is not fully synced.";
  • with the flag disabled, the same calls succeed and return real data.

CI changes: folds the test into the e2e-scenario matrix (building the source canister wasm), drops the standalone dfx job and its gate check, and excludes the crate from the workspace cargo test run since it needs the prebuilt bitcoin canister wasm. Adds a query_raw helper to the shared e2e harness, mirroring update_raw.

🤖 Generated with Claude Code

…t to PocketIC

Replaces the dfx-based disable-api-if-not-fully-synced-flag.sh e2e test with
a Rust integration test driven by PocketIC, continuing the DEFI-2100 migration
of e2e tests off dfx.

The test reuses the existing source canister (which serves 2 full blocks plus
3 next block headers, leaving the canister permanently not-fully-synced) and
asserts both directions of the flag: with disable_api_if_not_fully_synced
enabled every bitcoin_* API call traps with "Canister state is not fully
synced.", and with it disabled the same calls succeed and return real data.

Folds the test into the e2e-scenario CI matrix (building the source canister
wasm), drops the standalone dfx job, and excludes the crate from the workspace
cargo test run since it needs the prebuilt bitcoin canister wasm. Adds a
query_raw helper to the shared e2e harness, mirroring update_raw.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

canbench 🏋 (dir: .) 19dae02 2026-06-17 15:07:52 UTC

./canbench_results.yml is up to date
📦 canbench_results_benchmark.csv available in artifacts

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

Benchmark: insert_300_blocks
  total:
    instructions: 441.23 M (no change)
    heap_increase: 9 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate (scope):
    calls: 300 (no change)
    instructions: 368.90 M (no change)
    heap_increase: 1 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block (scope):
    calls: 300 (no change)
    instructions: 18.32 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/check_merkle_root (scope):
    calls: 300 (no change)
    instructions: 8.00 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/ensure_unique_transactions (scope):
    calls: 300 (no change)
    instructions: 8.48 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_header (scope):
    calls: 300 (no change)
    instructions: 349.46 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: get_metrics
  total:
    instructions: 3.36 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_headers
  total:
    instructions: 2.84 B (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_header (scope):
    calls: 100 (no change)
    instructions: 2.81 B (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_headers_multiple_times
  total:
    instructions: 10.30 B (no change)
    heap_increase: 7 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_header (scope):
    calls: 1000 (no change)
    instructions: 8.99 B (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_with_10k_transactions
  total:
    instructions: 1.40 B (no change)
    heap_increase: 74 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate (scope):
    calls: 1 (no change)
    instructions: 149.72 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block (scope):
    calls: 1 (no change)
    instructions: 149.61 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/check_merkle_root (scope):
    calls: 1 (no change)
    instructions: 70.70 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/ensure_unique_transactions (scope):
    calls: 1 (no change)
    instructions: 78.91 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_header (scope):
    calls: 1 (no change)
    instructions: 102.87 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_with_1k_transactions
  total:
    instructions: 116.14 M (no change)
    heap_increase: 7 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate (scope):
    calls: 1 (no change)
    instructions: 15.15 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block (scope):
    calls: 1 (no change)
    instructions: 15.04 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/check_merkle_root (scope):
    calls: 1 (no change)
    instructions: 7.12 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_block/ensure_unique_transactions (scope):
    calls: 1 (no change)
    instructions: 7.92 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  validate_header (scope):
    calls: 1 (no change)
    instructions: 102.87 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: pre_upgrade_with_many_unstable_blocks
  total:
    instructions: 3.38 B (no change)
    heap_increase: 1538 pages (no change)
    stable_memory_increase: 1024 pages (no change)

  serialize_blocktree_flatten (scope):
    calls: 1 (no change)
    instructions: 229.67 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

  serialize_blocktree_serialize_seq (scope):
    calls: 1 (no change)
    instructions: 36.57 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: get_blockchain_info_single_chain
  total:
    instructions: 345.64 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: get_blockchain_info_with_forks
  total:
    instructions: 374.77 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: get_blockchain_info_many_branches
  total:
    instructions: 827.63 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_balance_baseline
  total:
    instructions: 6.19 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_balance_stress
  total:
    instructions: 254.31 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_utxos_baseline
  total:
    instructions: 7.81 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_utxos_stress
  total:
    instructions: 4.69 B (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_current_fee_percentiles
  total:
    instructions: 44.14 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_block_headers_baseline
  total:
    instructions: 366.46 K (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: bitcoin_get_block_headers_stress
  total:
    instructions: 2.57 M (no change)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Summary:
  instructions:
    status:   No significant changes 👍
    counts:   [total 17 | regressed 0 | improved 0 | new 0 | unchanged 17]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

  heap_increase:
    status:   No significant changes 👍
    counts:   [total 17 | regressed 0 | improved 0 | new 0 | unchanged 17]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

  stable_memory_increase:
    status:   No significant changes 👍
    counts:   [total 17 | regressed 0 | improved 0 | new 0 | unchanged 17]
    change:   [max 0 | p75 0 | median 0 | p25 0 | min 0]
    change %: [max 0.00% | p75 0.00% | median 0.00% | p25 0.00% | min 0.00%]

---------------------------------------------------
CSV results saved to canbench_results.csv

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