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

Expose light client verifier to JavaScript #671

Closed
wants to merge 4 commits into from
Closed

Conversation

romac
Copy link
Member

@romac romac commented Nov 12, 2020

See: #463

Basic prototype that exposes the verifier to JS via wasm-pack/wasm-bindgen.

Rust wrapper: https://github.com/informalsystems/tendermint-rs/blob/romac/wasm-verifier/wasm-client/src/lib.rs
Usage from JS: https://github.com/informalsystems/tendermint-rs/blob/romac/wasm-verifier/wasm-client/app/index.js

To make this work, one currently has to:

  1. Run wasm-pack build from within the wasm-client folder
  2. Move the app directory and run npm start
  3. Open http://localhost:8080/ and look at the console
  4. It should display:
{
  "Ok": {
    "Invalid": {
      "NotWithinTrustPeriod": {
        "expires_at": "1970-01-15T00:00:03Z",
        "now": "2020-10-21T12:40:04.160328400Z"
      }
    }
  }
}
  • 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

@romac romac added light-client Issues/features which involve the light client wasm labels Nov 12, 2020
@romac romac mentioned this pull request Nov 12, 2020
5 tasks
Copy link

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

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

Thank you! Some first thoughts here

@@ -0,0 +1,6 @@
/target

Choose a reason for hiding this comment

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

Regarding the empty file above: As far as I know, .cargo-ok can be deleted.

@@ -0,0 +1,38 @@
[package]
name = "wasm-client"

Choose a reason for hiding this comment

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

Suggestion: rename to something like "js-verifier" or "light-client-js" because wasm-bindgen binds to JS only.

@@ -0,0 +1,176 @@
Apache License

Choose a reason for hiding this comment

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

Should not be needed since there is a LICENSE in the repo root

@@ -0,0 +1,25 @@
Copyright (c) 2018 Romain Ruetschi <romain@informal.systems>

Choose a reason for hiding this comment

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

Should not be needed since there is a LICENSE in the repo root

name = "wasm-client"
version = "0.1.0"
authors = ["Romain Ruetschi <romain@informal.systems>"]
edition = "2018"

Choose a reason for hiding this comment

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

license entry here would be nice

@@ -0,0 +1,5 @@
language: node_js

Choose a reason for hiding this comment

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

I think this file is not needed

@@ -0,0 +1,201 @@
Apache License

Choose a reason for hiding this comment

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

Should not be needed since there is a LICENSE in the repo root

@@ -0,0 +1,25 @@
Copyright (c) [year] [name]

Choose a reason for hiding this comment

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

Should not be needed since there is a LICENSE in the repo root

"rust",
"webpack"
],
"author": "Ashley Williams <ashley666ashley@gmail.com>",

Choose a reason for hiding this comment

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

Suggested change
"author": "Ashley Williams <ashley666ashley@gmail.com>",
"contributors": ["Romain Ruetschi <romain@informal.systems>"],

@cargo-dep-bot
Copy link

cargo-dep-bot bot commented Dec 3, 2020

This PR made the following dependency changes:

Added Packages (Duplicate versions in '()'):
	bumpalo 3.4.0
	console_error_panic_hook 0.1.6
	js-sys 0.3.46
	scoped-tls 1.0.0
	wasm-bindgen 0.2.69
	wasm-bindgen-backend 0.2.69
	wasm-bindgen-futures 0.4.19
	wasm-bindgen-macro 0.2.69
	wasm-bindgen-macro-support 0.2.69
	wasm-bindgen-shared 0.2.69
	wasm-bindgen-test 0.3.19
	wasm-bindgen-test-macro 0.3.19
	wasm-client 0.1.0
	web-sys 0.3.46

@informalsystems informalsystems deleted a comment from codecov-io Dec 3, 2020
@romac romac closed this Mar 31, 2021
@romac romac deleted the romac/wasm-verifier branch March 31, 2021 14:18
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.

2 participants