Skip to content
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

Add tendermint-light-client-js crate #812

Merged
merged 17 commits into from
Mar 9, 2021

Conversation

thanethomson
Copy link
Member

@thanethomson thanethomson commented Feb 13, 2021

Closes #463

The vast majority of this PR was taken from #671 with very few changes (thanks @romac for breaking ground there!). I basically added a UI to allow for quick/easy tweaking of the inputs , and will be looking at defining a custom data structure to provide a result back to JavaScript as opposed to serializing Rust's Result type (TBD).

EDIT: I'll leave the verify function parameters and return types as-is for now. We can always look at finding better ways of expressing the types in later versions.

📖 Example README

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md

Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
@thanethomson thanethomson added light-client Issues/features which involve the light client wasm labels Feb 13, 2021
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
@webmaster128
Copy link

to provide a result back to JavaScript as opposed to serializing Rust's Result type

Result can be used with wasm-bindgen. See https://rustwasm.github.io/docs/wasm-bindgen/reference/types/result.html. I never used it though.

@thanethomson
Copy link
Member Author

Result can be used with wasm-bindgen. See https://rustwasm.github.io/docs/wasm-bindgen/reference/types/result.html. I never used it though.

I'm quite happy to leave it as-is, if that works for you @webmaster128. The result comes through as per the example in the README. It's just a little weird with all the different naming conventions, but it works 😁

@thanethomson thanethomson marked this pull request as ready for review February 16, 2021 19:46
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me! Great job @thanethomson!

The one things we may still want to doo, is add a unit test which calls the exported verify function with some JsValues.

Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
@thanethomson thanethomson requested a review from romac March 3, 2021 02:21
@thanethomson
Copy link
Member Author

The one things we may still want to doo, is add a unit test which calls the exported verify function with some JsValues.

Cool! @romac I've now added two basic tests of the verify method which are now tested in CI too against Chrome and Firefox.

Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Could you also please fix the warnings in light-client-js/src/utils.rs with an #[allow(dead_code)] on set_panic_hook?

Signed-off-by: Thane Thomson <connect@thanethomson.com>
Signed-off-by: Thane Thomson <connect@thanethomson.com>
@thanethomson
Copy link
Member Author

Great stuff! Could you also please fix the warnings in light-client-js/src/utils.rs with an #[allow(dead_code)] on set_panic_hook?

Done 😁

@thanethomson thanethomson requested a review from romac March 5, 2021 14:02
@thanethomson thanethomson merged commit ebc3ac9 into master Mar 9, 2021
@thanethomson thanethomson deleted the thane/463-wasm-light-client branch March 9, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
light-client Issues/features which involve the light client wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

light-client: wasm compilation
3 participants