-
Notifications
You must be signed in to change notification settings - Fork 15
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
Time side-effect in wasm32-unknown-unknown target #18
Comments
@appcypher I would like to reproduce your issue before we discuss how to proceed. Can you clarify: by non-wasi do you mean |
Yes I mean |
Please take a look at our CI: https://github.com/ucan-wg/rs-ucan/runs/6739585727?check_suite_focus=true#step:7:70 We run automated tests in Chrome to verify browser-targeted Edit: I want to note that we may not be properly covering the code path you are hitting in our tests, so it's definitely still possible that there is a bug. Also, @appcypher you should take a look at the work @fabricedesre is doing right now #17 - you two are probably doing the same thing at the same time ;D |
Oh, and also while I have your attention @appcypher : would you be willing to add your use case as a comment on #19 ? |
This code panics #![cfg(test)]
use ucan::ucan::Ucan;
use wasm_bindgen_test::wasm_bindgen_test;
#[wasm_bindgen_test]
fn fail() {
let token = "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsInVjdiI6IjAuOC4xIn0.eyJpc3MiOiJkaWQ6a2V5Ono2TWtrODliQzNKclZxS2llNzFZRWNjNU0xU01WeHVDZ054NnpMWjhTWUpzeEFMaSIsImF1ZCI6ImRpZDprZXk6ejZNa2ZmRFpDa0NUV3JlZzg4NjhmRzFGR0ZvZ2NKajVYNlBZOTNwUGNXRG45Ym9iIiwiZXhwIjoxNjYxNDUwODk5LCJuYmYiOm51bGwsIm5uYyI6bnVsbCwiYXR0IjpbXSwiZmN0IjpbXSwicHJmIjpbXX0.liZl14IKOyc1eQluPJ39U4AoZLN_Ma9WKp9Vr1ak2VLFcglbZeIJmnEuuyWDRdo-81mv79cZ1tygaPwJrIKfCQ";
let ucan = Ucan::try_from_token_string(token).unwrap();
ucan.is_too_early(); // This panics because it calls `now()`.
} Here is the repo for repro. |
Weird, I have no problem with it in my wasm-api branch, testing with commit 50b614e |
@fabricedesre That's because ucan crate, in a subtle way, assumes that all
https://github.com/sebcrozet/instant/blob/master/src/wasm.rs#L183-L191 So it works in your case because you have |
@appcypher thank you for the test case. Can you share a few more details about how you plan to use the |
For non-wasi
wasm32
build ofrs-ucan
, this liners-ucan/ucan/src/time.rs
Line 7 in 5d80833
resolves to this branch of code that panics at runtime.
https://github.com/rust-lang/rust/blob/4d45b0745ab227feb9000bc15713ade4b99241ea/library/std/src/sys/unsupported/time.rs#L12-L14
Is it possible to have a version that has time passed from the interface down to where it is needed?
Any other solution?
The text was updated successfully, but these errors were encountered: