8000 Move the taproot module to crate root by tcharding · Pull Request #1373 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Move the taproot module to crate root #1373

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

Merged
merged 2 commits into from
Nov 30, 2022

Conversation

tcharding
Copy link
Member
@tcharding tcharding commented Nov 7, 2022

We are trying to flatten the util module. The taproot module can live in the crate root. If/when we create a crypto module/crate we may wish to pull some stuff out of this module but for now moving it gets us closer to removing util without making the directory structure any worse.

CC sanket1729, I did this after reviewing the taproot module during work on #1260 and your review comment.

@tcharding tcharding mentioned this pull request Nov 8, 2022
apoelstra
apoelstra previously approved these changes Nov 12, 2022
Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK bbad1af96248a55c7a88fc2a5e59b5ed211fb4ed

Kixunil
Kixunil previously approved these changes Nov 16, 2022
Copy link
Collaborator
@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK bbad1af96248a55c7a88fc2a5e59b5ed211fb4ed

@Kixunil Kixunil added the trivial Obvious, easy and quick to review (few lines or doc-only...) label Nov 8000 16, 2022
@tcharding
Copy link
Member Author

\me whispers excitedly merge merge merge merge merge

@apoelstra
Copy link
Member

@tcharding sorry, this needs a rebase!

error[E0432]: unresolved import `crate::util::taproot`
  --> bitcoin/src/blockdata/witness.rs:19:18
   |
19 | use crate::util::taproot::TAPROOT_ANNEX_PREFIX;
   |                  ^^^^^^^ could not find `taproot` in `util`

It looks like #1381 caused a conflict :(

@tcharding tcharding dismissed stale reviews from Kixunil and apoelstra via b6eed32 November 17, 2022 20:33
@tcharding tcharding force-pushed the 11-08-move-taproot-module branch from bbad1af to b6eed32 Compare November 17, 2022 20:33
@tcharding
Copy link
Member Author

Rebased! Felt so good to see psbt in bitcoin/src/ for some reason :)

@tcharding tcharding force-pushed the 11-08-move-taproot-module branch from b6eed32 to 676f9c2 Compare November 17, 2022 23:16
apoelstra
apoelstra previously approved these changes Nov 17, 2022
Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 676f9c2bb5cf8d6ac5c2d9651ec4543de9495a19

@tcharding
Copy link
Member Author

Rebased, no other changes.

apoelstra
apoelstra previously approved these changes Nov 22, 2022
Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 43091087e214c0e5c8827ff0892a8d01e799aee9

@tcharding
Copy link
Member Author

No changes since you last ack'ed @Kixunil, here is the range diff command for you to verify what I say, can I get another ack please git range-diff bbad1af...@

Kixunil
Kixunil previously approved these changes Nov 29, 2022
Copy link
Collaborator
@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 43091087e214c0e5c8827ff0892a8d01e799aee9

We are trying to flatten the `util` module. The `taproot` module can
live in the crate root. If/when we create a `crypto` module/crate we may
wish to pull some stuff out of this module but for now moving it gets us
closer to removing `util` without making the directory structure any
worse.

Includes adding rustfmt attributes to skip formatting of macros.
Run `cargo +nightly fmt` and commit changes to the `taproot` module.

No manual changes, only those introduced by `rustfmt`.
@tcharding tcharding dismissed stale reviews from Kixunil and apoelstra via dce88b0 November 30, 2022 01:05
@tcharding tcharding force-pushed the 11-08-move-taproot-module branch from 4309108 to dce88b0 Compare November 30, 2022 01:05
@tcharding
Copy link
Member Author

Rebased and added rustfmt::skip attributes to the sha256t_hash_newtype! macro calls. Added an additional patch that does the formatting. I hope I haven't just made re-acking this painful ...

Copy link
Collaborator
@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK dce88b0

if let Some(Some(node)) = self.branch.pop() {
Ok(TaprootSpendInfo::from_node_info(secp, internal_key, node))
} else {
unreachable!("Size checked above. Builder guarantees the last element is Some")
}
}
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I may be paranoid but this style seems to ask for heartbleed-style vulnerability.

Copy link
Member

Choose a reason for hiding this comment

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

Heh, I agree it feels a bit treacherous, but Rust will at least require you put something (not just whitespace) before any following lines of code, so you can't be easily fooled into mistaking which block it belongs to.

Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK dce88b0

@apoelstra apoelstra merged commit cde120b into rust-bitcoin:master Nov 30, 2022
@tcharding tcharding deleted the 11-08-move-taproot-module branch November 30, 2022 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trivial Obvious, easy and quick to review (few lines or doc-only...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0