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

chore: Upgrade bitcoin to version 0.32.2 #314

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ninegua
Copy link
Member

@ninegua ninegua commented Jul 10, 2024

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 ninegua force-pushed the master branch 2 times, most recently from 60731d6 to 4d5bea3 Compare July 10, 2024 22:23
Copy link

github-actions bot commented Jul 11, 2024

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)

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

@ninegua ninegua changed the title Upgrade bitcoin to version 0.32.2 chore: Upgrade bitcoin to version 0.32.2 Jul 16, 2024
@@ -25,7 +25,7 @@ const EXPECTED_PAGE_LENGTH: usize = 72;
/// A Bitcoin transaction's output.
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub struct TxOut {
pub value: u64,
pub value: Amount,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a breaking change. Shall we revert to maintain compatibility?

@ninegua ninegua marked this pull request as ready for review July 16, 2024 19:28
@ninegua ninegua requested a review from a team as a code owner July 16, 2024 19:28
@ielashi
Copy link
Collaborator

ielashi commented Jul 17, 2024

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

@ninegua
Copy link
Member Author

ninegua commented Jul 19, 2024

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.

@ielashi
Copy link
Collaborator

ielashi commented Jul 22, 2024

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.

@ninegua ninegua marked this pull request as draft July 22, 2024 21:24
@rumenov
Copy link
Member

rumenov commented Sep 23, 2024

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

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.

3 participants