bitcoin-canister icon indicating copy to clipboard operation
bitcoin-canister copied to clipboard

chore: Upgrade bitcoin to version 0.32.2

Open ninegua opened this issue 1 year ago • 5 comments

Upgrade bitcoin library to version 0.32.2. Notable changes are:

  • A number of types now use new type instead of primitive types like u32.
  • U256 is no longer exported from bitcoin, and instead primitive-types::U256 is used when it is needed.
  • Because of changes to Address type, we have to use assume_checked when it is needed.
  • Dependency on getrandom (due to secp256k1 dependency) now requires custom flag to be used.
  • Some other miscellaneous type and name changes.

ninegua avatar Jul 10 '24 13:07 ninegua

canbench 🏋 (dir: .)

Significant performance change 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: 567.85 M (1.08%) (change within noise threshold)
    heap_increase: 7 pages (regressed by 16.67%)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: get_metrics
  total:
    instructions: 93.35 M (regressed by 7.30%)
    heap_increase: 0 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_headers
  total:
    instructions: 3.91 B (0.44%) (change within noise threshold)
    heap_increase: 1 pages (improved by 50.00%)
    stable_memory_increase: 0 pages (no change)

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

Benchmark: insert_block_headers_multiple_times
  total:
    instructions: 13.98 B (0.56%) (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.80 B (-0.25%) (change within noise threshold)
    heap_increase: 4097 pages (no change)
    stable_memory_increase: 1792 pages (no change)

  serialize_blocktree (scope):
    instructions: 2.37 B (-0.64%) (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.37 B (-0.64%) (change within noise threshold)
    heap_increase: 2048 pages (no change)
    stable_memory_increase: 0 pages (no change)

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

github-actions[bot] avatar Jul 11 '24 23:07 github-actions[bot]

As I mentioned on Slack, I'm not sure why we're doing this upgrade. AFAICT it's bringing risk with no particular gain.

ielashi avatar Jul 17 '24 11:07 ielashi

As I mentioned on Slack, I'm not sure why we're doing this upgrade. AFAICT it's bringing risk with no particular gain.

Yes, perfectly understood. I made the PR just in case it may become useful in the future should an upgrade is needed. In general, library maintainers could bring bug fixes, enhancements or new features, so we probably don't want to be left behind for too long. The rust library for bitcoin has a changelog that may be useful.

ninegua avatar Jul 19 '24 20:07 ninegua

As I mentioned on Slack, I'm not sure why we're doing this upgrade. AFAICT it's bringing risk with no particular gain.

Yes, perfectly understood. I made the PR just in case it may become useful in the future should an upgrade is needed. In general, library maintainers could bring bug fixes, enhancements or new features, so we probably don't want to be left behind for too long. The rust library for bitcoin has a changelog that may be useful.

I see, thanks @ninegua! In that case, would it make sense to mark it as a draft, and the team can take a closer look whenever they have the bandwidth to test this upgrade? I don't the team has the resources to do this soon.

ielashi avatar Jul 22 '24 13:07 ielashi

thanks @ninegua , the NET will definitely benefit from this upgrade

rumenov avatar Sep 23 '24 11:09 rumenov

FYI: #349 upgraded bitcoin crate to 0.32.4.

maksymar avatar Dec 16 '24 20:12 maksymar