Giter Site home page Giter Site logo

o1js-bindings's People

Contributors

barriebyron avatar comdex avatar dannywillems avatar ghost-not-in-the-shell avatar jackryanservia avatar l-as avatar martinminkov avatar martinondejka avatar mitschabaude avatar mrmr1993 avatar nholland94 avatar rbonichon avatar rpanic avatar sam-goodwin avatar shimkiv avatar trivo25 avatar volhovm avatar wizicer avatar ymekuria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

o1js-bindings's Issues

Avoid copying arrays

          Yes we could slightly optimize the code, but it comes at the cost that we have to always deal with the index translation by 1. This has led to bugs in the previous code base, so I'd like to keep it simple for now and always to the conversion to/from an ml array as a separate step.

In theory we could use array.unshift(0) at the end to get the same result without copying the array. The only reason I don't do that is because TS doesn't understand it

Originally posted by @mitschabaude in #140 (comment)

Don't use `.unwrap()`

All uses should be replaced by something that reports a useful error.
In many cases the panic should probably be turned into a Result::Err instead and passed back up.
This is especially problematic because panics don't contain any useful debugging information when compiled to WASM.
See rustwasm/wasm-bindgen#1289

Drop `promise` lib?

You don't need it.
A thread pool is needed anyway, you can run the async_kernel scheduler in there too.
You can await on a Deferred.t by using the Promise constructor and calling the resolve function passed in from within the Ivar's handler.
You can implement from_deferred : 'a Deferred.t -> a Promise.t too using this simple trick,
but I'm not sure the library has any point at that point. All you really want is the to_js and of_js functions.

Interdependency between this and monorepo

MinaProtocol/mina depends on this, but this also depends on the monorepo.
Very little is gained from this setup AFAICT compared to having it be part of the monorepo properly rather than as a submodule.
Alternatively you could break the cycle and remove the submodule from the monorepo.

Adjust efficient num workers for Apple M1 Max

I was investigating proving performance on Apple M1 Max, and managed to double the proving speed by adjusting the number of threads/workers used in this config:

'Apple M1 Max': 3,

The associated issue has apparently been fixed in newer chromium (?) and/or nodejs. So i've upgraded to nodejs v21.4.0 and set the num workers to 7, which double my proving speed for 2^16 constraints from ~50s to ~24s.

I'm unsure of all implications this has for the bindings or o1js in general, but its a significant improvement from my sparse testing.

Fix compiling with `separate` jsoo mode

It's much faster, but when I try to use it I get this error with a snarkyjs only modified at parts unrelated to this (AFAICT, might be wrong):

[user@nixos:/work/mina/src/lib/snarkyjs/dist/node]$ node
Welcome to Node.js v19.8.1.
Type ".help" for more information.
> snarkyjs = await import("./snarky.js");
/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:8603
         throw err;
         ^

Error
    at caml_raise_with_string (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:849:63)
    at caml_failwith (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:1326:7)
    at caml_int_of_string (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:6325:29)
    at /work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:802660:24
    at /work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:802666:8
    at Object.<anonymous> (/work/mina/src/lib/snarkyjs/dist/node/_node_bindings/snarky_js_node.bc.cjs:804154:3)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)

Node.js v19.8.1

Move `kimchi` library to Mina repo under `src/lib/crypto`

Summary

In order to get MinaProtocol/mina#14466 working (and more generally o1-labs/o1js#1096), we need to move the kimchi code that generates the WASM dependencies for o1js into the Mina repo. Part of building o1js depends on the OCaml code which the o1js-stub module covers, but an additional part is the Rust code that generates the WASM needed for Kimchi.

Since Mina will be a submodule of o1js, generating the WASM won't be an issue for o1js, however, since the stub code will live in Mina, there is no way to get the WASM dependencies as of right now.

Thus, we should probably move the Kimchi code into the Mina repo and out of the bindings code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.