Skip to content

Conversation

@jamesob
Copy link
Contributor

@jamesob jamesob commented Mar 9, 2022

Alright alright alright, I know: we hate refactors. We especially hate cosmetic refactors.

Nobody knows better than I that changing broad swaths of code out from under our already-abused collaborators, only to send a cascade of rebase bankruptcies, is annoying at best and sadistic at worst. And for a rename! The indignation!

But just for a second, imagine yourself. Programming bitcoin/bitcoin, on a sandy beach beneath a lapis lazuli sky. You go to type the name of what is probably the most commonly used data structure in the codebase, and you only hit shift once.

What could you do in such a world? You could do anything. The only limit is yourself.


So maybe you like the idea of this patch but really don't want to deal with rebasing. You're in luck!

Here're the commands that will bail you out of rebase bankruptcy:

git rebase -i $(git merge-base HEAD master) \
  -x 'sed -i "s/CChainState/Chainstate/g" $(git ls-files | grep -E ".*\.(py|cpp|h)$") && git commit --amend --no-edit'
# <commit changed?>
git add -u && git rebase --continue

Anyway I'm not sure how serious I am about this, but I figured it was worth proposing. I have decided I am very serious about this.

Maybe we can have nice things every once in a while?

@jamesob jamesob force-pushed the 2022-03-chainstate-rename branch 4 times, most recently from 003d4af to 5977234 Compare March 9, 2022 18:16
@jonatack
Copy link
Member

jonatack commented Mar 9, 2022

Ok, where is @jamesob and what have you done to him.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 11, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25977 (refactor: Replace std::optional<bilingual_str> with util::Result by ryanofsky)
  • #25971 (refactor: Use std::string for thread and index names by stickies-v)
  • #25740 (assumeutxo: background validation completion by jamesob)
  • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
  • #25667 (assumeutxo: snapshot initialization by jamesob)
  • #25665 (refactor: Add util::Result failure values, multiple error and warning messages by ryanofsky)
  • #24230 (indexes: Stop using node internal types and locking cs_main, improve sync logic by ryanofsky)
  • #23599 ([WIP] DRAFT NOMERGE Tidy up RPCTxSerializationFlags by MarcoFalke)
  • #23319 (rpc: Return fee and prevout (utxos) to getrawtransaction by dougEfresh)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@glozow
Copy link
Member

glozow commented Mar 11, 2022

Concept ACK, but need song-and-dance interpretation of the PR description

@jonatack
Copy link
Member

jonatack commented Mar 13, 2022

I'm sort of tepid on whether this is worth doing, but supposing it were, I think I'd prefer ChainState over Chainstate. The reason/question is, are expressions/words like "chain state", "fee rate", and "block hash" each one word or two? For me, and maybe for people not closely familiar since years with Bitcoin development, they are two words--at least originally, which I guess is why there are classes in the codebase like CChainState and CFeeRate. I usually grep case-indifferently anyway, so this wouldn't change anything (if it doesn't break anything). Just one weakly held light opinion.

@jb55
Copy link
Contributor

jb55 commented Mar 13, 2022

ACK 5977234384da1f52475fc8165c52830750bf7d2a

@michaelfolkson
Copy link

I was reading through some of @jonatack's notes and found this old quote from Greg Maxwell:

I reiterate: the background level of refactors, style changes, cleanups, and other related activity is actively repelling multiple long term contributors, myself included. I beg: give it a bit of a rest, we have so many other things that are crying for our attention and our resolve. We should try to find some initiatives that we all feel more excited about, success with them would make it easier to work on other things... but right now a big style change is just not a unifying effort.

I don't have a strong enough opinion to NACK this PR but the above seems to add some historical context behind previous attempts to do renames like this which may be helpful for other reviewers.

@ajtowns
Copy link
Contributor

ajtowns commented Mar 15, 2022

Introducing "Stockholm syndrome: the PR" ? We have ChainstateManager already, so while I agree with @jonatack that it's weird treating "chainstate" as one word, at least this is slightly reducing an inconsistency. Don't really see the benefits outweighing the costs here.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK e2c9115af2db4b5aa1f1d2333946fb22912e500d. Just rebased since last review

@jamesob
Copy link
Contributor Author

jamesob commented Sep 7, 2022

image

@maflcko
Copy link
Member

maflcko commented Sep 8, 2022

I sometimes see myself running into compile errors when typing ChainStateManager, or CChainstate, so I think it makes sense to somehow improve the consistency here. Also, the merge conflicts right now are currently as minimal as they can get.

Any reason why there are two commits and not a single one? A sed ... $(git grep -l CChainState ':(exclude)doc/release-notes*') should be sufficient.

-BEGIN VERIFY SCRIPT-
sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*')
-END VERIFY SCRIPT-

Co-authored-by: MacroFake <[email protected]>
@jamesob jamesob force-pushed the 2022-03-chainstate-rename branch from 30ee3d3 to 00eeb31 Compare September 9, 2022 15:50
@jamesob
Copy link
Contributor Author

jamesob commented Sep 9, 2022

@MarcoFalke thanks! Pushed.

@maflcko
Copy link
Member

maflcko commented Sep 10, 2022

cr ACK 00eeb31

@hebasto
Copy link
Member

hebasto commented Sep 10, 2022

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK 00eeb31

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

ACK 00eeb31, thanks for being the one to propose this

Copy link
Contributor

@w0xlt w0xlt left a comment

Choose a reason for hiding this comment

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

ACK 00eeb31

@jamesob
Copy link
Contributor Author

jamesob commented Sep 12, 2022

RFM?

@glozow glozow merged commit 3a7e0a2 into bitcoin:master Sep 13, 2022
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Sep 13, 2022
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Feb 15, 2023
Summary:
```
-BEGIN VERIFY SCRIPT-
sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*')
arc lint
-END VERIFY SCRIPT-
```
Co-authored-by: MacroFake <[email protected]>

This is a backport of [[bitcoin/bitcoin#24513 | core#24513]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, sdulfari

Reviewed By: #bitcoin_abc, sdulfari

Differential Revision: https://reviews.bitcoinabc.org/D13126
@bitcoin bitcoin locked and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.