Skip to content

Conversation

@tcharding
Copy link
Member

@tcharding tcharding commented Nov 5, 2025

This is an experimental PR, not a merge candidate.

The aim is to see if Claude can do the upgrade without too much intervention, or what intervention is likely required. If we can work this out other downstream projects can do the same - WIN.

Two patches, the first does the upgrade but leaves tests failing. The second fixes the tests. Both are raw, ie no changes from me. And I have yet to review closely [0] because I want to do so in public (also the script tagging changes are at my knowledge boundary at best).

Process used

  1. I pointed Claude at the online docs for v0.32.7 and a directory with WIP: Release tracking PR: bitcoin 0.33.0-rc.0 rust-bitcoin#5169 checkout out. I prompted it to make a CLAUDE.md file (committed), props to @tnull for the idea.
  2. Next I prompted it to do the upgrade, periodically checking the changes and squashing into a single patch.
  3. Next I prompted it to fix the tests.
  4. I managed the patches manually with jj.

(I thing, IIRC, at some stage I told it not to bother with rustdocs fixes.)

Lessons

As usual, in my experience, this was painful still but not as painful as doing it manually (which I and @mpbagot have both tried a few times). I maxed by session limit 3 times [1]. On top of that I it took me 5 days in total to do this because the bot kept stopping and asking if I wanted it to fix the remaining errors / tests even when I repeatedly said variations of 'fix all the errors" (yes by the end there were a bunch of f and c words in there too).

Questions

  • Can I be better at promting, almost certainly. Suggestions welcomed please.
  • Can we improve the CLAUDE.md file so that:
    • Its a set and forget operation.
    • It does build errors separately from build warnings

Next steps

  • Review and critique this
  • Try again in corepc using the CLAUDE.md file we come up with

I'm not exactly sure how to continue with CI fails. I definitely don't want to start from scratch because Claude is so slow at the task.

[0] I'm not sure when I'll get to it since 5 days of this has already bored me of the task
[1] I'm on the $20 a month plan.

FYI claude left the repo with a broken build. I fixed the build as a
separate patch for reasons listed below.

First I got claude to create a CLAUDE.md file. Then I pointed it at:

- A local `rust-bitcoin` directory on the release tracking branch
    rust-bitcoin/rust-bitcoin#5169
- The docs online for `bitcoin v0.32.7`
- The `rust-miniscript` repo

And asked it to do the upgrade. It took me three goes over the weekend
to do this, hitting session limits twice.

I am pushing the raw changes Claude made so:

- I can review them in public
- We can learn how good/bad Claude is for doing upgrades
@tcharding
Copy link
Member Author

cc @LLFourn because he got me started on Claude.

@apoelstra
Copy link
Member

Whew. I wonder if we can update secp256k1 first.

@tcharding
Copy link
Member Author

ooo, that's a nice idea. I'm keen for Saturday morning miniscript so I"ll let Claude spin on a new go from scratch just updating secp, have a cup of tea, and review this PR for giggles.

@tcharding
Copy link
Member Author

I didn't end up exploring the upgrade-secp-first-route. I started but stopped, now I think more I'd like to try:

  1. patch miniscript to use scep directly instead of the bitcoin re-export
  2. upgrade secp to 0.30
  3. upgrade secp to 0.31

This would mean this PR becomes void, I personally do not want to run claude again to do the upgrade because it took me 5 days and was boring as hell. Still looking for another way to progress. FTR I spent a fair bit of time reviewing this and still didn't get all the way through but here is what I found:

# Notes for upgrading to bitcoin 0.33.0-beta.0

The non-trivial things are:

- script tagging
- secp context removal

Kind of trivial things:

- input/output -> inputs/outputs
- secp Into<Message> thing, causes addition/removal of `*` and `&`
- from_ apis have changed to more idiomatic names
- Default removed
- txout.value -> txout.amount


Things now disallowed on purpose:

- The hashes wrapper types cannot hash arbitrary data so there is a
  bunch of casting required.

## Thing to improve the CLAUDE.md file with

- Only fix build errors not warnings (eg don't fix warnings about
  deprecated function calls).
- Use `Amount::from_sat_u32` instead of `Amount::from_sat().unwrap()`

## Things claude did well

- using `_` to rename secp context function paramater instead of removing it
- Worked out which associated consts to use instead of `default`

### Script tagging questions

- Do we want to favour one script type over the others in test code?
- Basically anything that does not have a local varibale name of
  function name that hints at the type needs checking by Andrew (or
  Tobin needs to upgrade his bitcoin script knowledge - or both).

- Is script code a `ScriptPubKey` some other type?

## Bitcoin API questions

- Does the `XOnlyPublicKey` API have holes in it?
- Are we happy with users having to reach into `bitcoin::script` to
  get the new script types.
  
## Things I did not look too closely at - assuming they are correct

- error type changes
  
# TMP

Reviewed upto interpreter/mod.rs

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