some cleanups and new functionality for Tmr and Value - #374
Open
apoelstra wants to merge 4 commits into
Open
Conversation
We were storing Word::n as a u32 even though it fits into a u8. u8 can be converted to every unsigned integer type without casts, while u32 cannot. So by using u8, we can eliminate casts everywhere.
apoelstra
force-pushed
the
2026-08/cleanups
branch
from
August 4, 2026 15:28
1dbc471 to
b0ea014
Compare
stringhandler
left a comment
Contributor
There was a problem hiding this comment.
ConceptACK.
Seems fine. Added some comments but they are not blocking
|
|
||
| for c in self.0.iter().rev() { | ||
| match c { | ||
| b'1' => stack.push(Tmr::unit()), |
Contributor
There was a problem hiding this comment.
These repeated mappings might be a source of errors in future. Not how to clean it up though.
|
|
||
| #[test] | ||
| fn all_jet_tmrs() { | ||
| for jet in &Core::ALL { |
Contributor
There was a problem hiding this comment.
Core is probably sufficient, but there may be some types in Elements that are not in Core.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ahead of adding "quoting" functionality where we produce Simplicity fragments that compute the CMRs of other Simplicity fragments, constify a few functions, cleanup some others, and add
Valueconstructors from SHA256 contexts.The next PR will use the new bitcoin-hashes release from rust-bitcoin/rust-bitcoin#6646 which will let us do some more cleanups and constification, and then we can start doing "real" changes.