-
Notifications
You must be signed in to change notification settings - Fork 372
feat(crypto): CRP-2665 make ic-cdk optional and support wasm+js env in ic-validator-ingress-message #3369
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
feat(crypto): CRP-2665 make ic-cdk optional and support wasm+js env in ic-validator-ingress-message #3369
Conversation
|
Thanks @fspreiss, LGTM! I was wondering though if you see an easy way to test this in js. |
Unfortunately not, no. Not sure what the most minimal way for getting a WASM+JS environment is in a Rust test. Do you have an idea? The original issue report has a minimal example to reproduce the error, but it relies on a full-fledged cargo project and on running Would it maybe be sufficient to just ensure that |
|
It seems At the first glance, it looks like there will be some (but not too many) modifications needed in the tests. Not sure if this should be a separate PR then. But my personal preference would be to have tests in this PR if that's not too much work.
This seems to me like the minimum we should have. But making sure that the returned time is actually in some meaningful range seems better. |
|
@altkdf, I believe we can do exactly what we need with Bazel's rust_wasm_bindgen_test, which is an extension to rules_rust. The rules_rust version we currently use is too old I believe (it doesn't have this extension yet). I talked to the developers who initially asked for this feature, and they said "Yes! Its working great with our cloudflare worker!", so I suggest to merge this as is and add the tests once we have the respective support in Bazel: for that I created CRP-2756. |
…ngress-message-js-wasm
Adapts
ic-validator-ingress-messageto support Javascript WASM environments for Cargo builds via a new featurejs, and also makesic-cdkoptional, but still keepsic-cdkenabled by default, to keep backwards compatibility.Both
cargo build -p ic-validator-ingress-message --target=wasm32-unknown-unknown --no-default-features --features=jsandcargo build -p ic-validator-ingress-message --target=wasm32-unknown-unknown --features=jssucceed.
Note that
cargo build -p ic-validator-ingress-message --target=wasm32-unknown-unknownfails becausegetrandomis not supported for wasm*-unknown-unknown targets. Canisters that want to use ic-validator-ingress-message have to manually fix this, for example by using ouric-crypto-getrandom-for-wasmcrate. There is alsoic-validator-ingress-message-test-canisterto test the usage ofic-validator-ingress-messagefrom a canister.