Comments (11)
Another question is if it should be used in secp256k1
, a crate with general-purpose name. I was thinking that over time we could extract useful concepts from internals
to separate stable crates. This would also resolve some of our issues (e.g. making InputString
public). Having a crate for byte-like newtypes sounds quite appealing to me.
from rust-bitcoin.
Having a crate for byte-like newtypes sounds quite appealing to me.
Agreed, though there's a bit of non-overlapping ad-hoc weirdness in both hashes
and secp256k1
which would want this. (hashes
has the weird byte-reversal stuff and secp256k1
has the "don't Debug-output secrets" stuff).
I've also started to dislike calling macros from one crate to generate code in another crate... the API-breakage issues are so subtle and difficult to detect, on top of macro code being so hard to read.
I wonder though, if we wrote it as a module that lived in its own repo, and we subtreed copies into both crates...then the macros would never be in anything's public API and we wouldn't have to worry so hard about breakage.
from rust-bitcoin.
I think the reversal in hashes
is small and harmless enough that it doesn't really matter and we could solve the secp256k1
thing by having an option to not impl Debug
and Display
(which we might want anyway to reduce dependencies).
the API-breakage issues are so subtle and difficult to detect, on top of macro code being so hard to read.
Yes, they are. But I think they're kinda similar if you do it within a crate. The only workable solutions I can think of are "write it well the first time and then do not touch" and "have all our known dependencies in CI" (AKA crater).
I wonder though, if we wrote it as a module that lived in its own repo, and we subtreed copies into both crates...then the macros would never be in anything's public API and we wouldn't have to worry so hard about breakage.
The only problem this appears to solve is limit the damage of accidental change to the few crates that subtree it. I'm not really convinced that's worth it.
from rust-bitcoin.
Ok, yeah, that all sounds reasonable.
Then as a secondary question, should this really be its own crate or should it be part of hex-conservative
? Because you basically always want byte-slices to be representable as hex.
from rust-bitcoin.
There were requests to not depend on hex-conservative
from hashes
, one of the reasons being that seeing hex-conservative
as base58ck
dependency (just because of the sha256 algo) looks stupid. Therefore it should be a separate crate.
from rust-bitcoin.
Yeah, that's a good point. Though I guess hex-conservative
should be an optional dep of the byte-wrapper crate.
from rust-bitcoin.
Yes, it should.
from rust-bitcoin.
Mad, this is the crate that we should be able to stabalize first!
from rust-bitcoin.
Oh, we can't stabilize it until we stabilize hex or figure out what to do about FromStr
.
We could also just not provide FromStr
at this point, implementing it manually in unstable crates for now (or using a different macro).
from rust-bitcoin.
Oh, we can't stabilize it until we stabilize hex or figure out what to do about
FromStr
.
I believe implementing it later would be a breaking change.
My preference is to just stabilize hex
-- which we haven't touched in months and have no open feature requests for -- but my second preference would be to wrap the hex errors so we can move on.
from rust-bitcoin.
I believe implementing it later would be a breaking change.
Adding it to the macro to work would be but not if we create a new macro instead.
We could also have an attribute to opt-out from it and force its usage at the beginning then remove the restriction.
from rust-bitcoin.
Related Issues (20)
- hashes: We have an undocumented pre-condition on `BLOCK_SIZE` HOT 3
- Change the `std::error::Error` condition to `std` or Rust version >= 1.81 HOT 5
- Definition of absolute locktime is gone again HOT 2
- Consider moving no-std/alloc error stuff from `internals` to a new stable crate HOT 1
- Potential sha256 perf improvements
- Feature Request: Provide xpriv.to_xpub(&secp) API HOT 4
- Move the `Prepare` job into a step HOT 1
- Follow up #3308 (change docs for Wtxid::COINBASE) HOT 5
- Follow up #3310 (allow_unused flag in serde.rs can be dropped) HOT 2
- Consider using `criterion` for benches HOT 2
- Improve `locktime` API HOT 18
- org-wide: Read MSRV from manifest in CI job HOT 1
- Why don't we use matrix for compiler versions in CI? HOT 6
- Tracking issue - MSRV bump post 1.63 HOT 3
- Should we provide constructors for types with public fields HOT 4
- Should types implement `Default` if it is only used in testing? HOT 30
- On deprecation of stuff that is moving to `primitives` HOT 9
- Negative Zero denom should be treated like Zero instead of panic. HOT 17
- Use link for `OutPoint` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-bitcoin.