-
Notifications
You must be signed in to change notification settings - Fork 230
Add custom-fallback
crate feature
#725
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
base: master
Are you sure you want to change the base?
Conversation
This has the same issue as #672: any crate which adds a custom backend for wasm-js (as a convenience to wasm-web users) precludes any user from providing their own custom backend. The only way this is "superior" to the "js" feature of v0.2 is that it moves wasm-js code outside of |
I feel like any further points here would just be re-hashing prior discussions. My preference is still #675 (possibly with a long and very specific feature name and allow override via |
As I wrote here, I believe it's much less likely to happen in practice |
I don't think that matters though:
|
IIRC it does not work in practice. Pulling It's much easier to see which dependency pulls
Theoretically, you are right. But as our history with v0.2 has shown, in practice it does not work well. My aim with this PR (and the |
Regarding consistency, firstly this indicates that there possibly should be a wasm-web target (off topic), and secondly I do not see the consistency as mattering much. We've had far more requests for WASM-web support than Ariel OS. Allowing targets like Ariel to more easily support We could do both #675 and this PR if you like (in which case the custom backend should probably take priority where both are enabled). This would leave |
Unless the dependency itself is causing a problem this doesn't matter? (Obviously there could be Cargo.lock bloat still.)
True, though there shouldn't be many dependencies on I just think the possibility of defaulting to WASM-JS but still allowing custom backends is the best option. Is there a reason this wouldn't work? |
As I wrote above, IIRC simply having This is why I think it's advantageous to not have
I don't think it makes much sense to do both. It looks like we are at an impasse. So I guess @josephlr could act as a tie breaker here. |
I found #176 ( I'm happy enough with the idea of placing the JS impl in |
It shouldn't, if it does that's a bug. Especially if you mark the [features]
wasm_js = ["dep:wasm-bindgen", "dep:js-sys"]
[dependencies]
wasm-bindgen = { version = "0.2.103", optional = true }
js-sys = { version = "0.3.80", optional = true } Now the |
@Pauan |
About that: does anyone know of non-web WASM targets we can actually test against? I think most uses are probably some type of block-chain compute platform, but we need something we can test in our CI runners. It's not really hard to guess why people are happy to assume that WASM-means-web. I don't care enough to argue this further; @newpavlov's preference of moving the wasm-js impl to another crate via a custom backend is good enough. |
# use std to retrieve OS error descriptions | ||
std = [] | ||
|
||
# Use the custom backend on unsupported targets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should say:
# Use the custom backend when getrandom_backend cfg is not set
Concern: security. Currently This change would allow Implication: verifying security of Ultimately since Rust is not strictly memory safe and therefore every crate in the build must be verified, this is not strictly worse than the alternative, though I would still prefer in-crate implementation (#675). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De-approving because I dislike the idea of any crate in the dependency tree being able to supply a custom random source on WASM where the user forgets/doesn't know to configure this.
The best options right now are |
@Pauan those targets already have support. This issue is about |
@dhardy Non-JS usages have generally moved away from EWasm potentially would have used CosmWasm does use Casper uses It's actually quite difficult to find non-JS uses of |
@Pauan that's helpful thanks. My opinion is therefore that we should care less about non-js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should do this. This is a generic functionality, but it really only makes sense in the wasm_js
context. Going with #675 seems better, see my comment: #675 (comment)
It also makes sense for experimental targets (e.g. see the recent PR for Ariel OS). Such targets could use this feature in their respective "sys" crates. Technically, I believe we should view Web WASM as such experimental target, despite its popularity. |
In a very strict technical sense, yes... but it is a very stable target, things are not breaking on a weekly basis (like they used to back when it was bleeding edge). In a practical sense it is stable, well supported, and widely used. The lack of a dedicated |
TODO: update readme, changelog, and CI
cc @daxpedda