AztecProtocol / aztec-2.0

C++ elliptic curve library
134 stars 37 forks source link

hummus package not working #60

Closed fosgate29 closed 2 years ago

fosgate29 commented 2 years ago

After building and running the server, it complains it can't find barretenber.wasm file. I built barretenber package and got the barretenber.wasm but I couldn't find the correct folder to add it so hummus PoC works.

fosgate29 commented 2 years ago

I was able to build. I am using node 14.17.0

1) I copied all files from barretenberg.js folder to barretenberg/hummus/node_modules and renamed it to barretenberg-es.

2) Updated file index.js in hummus/node_modules/barretenberg-es/dest-es/wasm/index.js to have this structure:

wasi_snapshot_preview1: {
                fd_close: () => { },
                fd_read: () => { },
                fd_write: () => { },
                fd_seek: () => { },
                fd_fdstat_get: () => { },
                fd_fdstat_set_flags: () => { },
                proc_exit: () => { },
                path_open: () => { },
                path_filestat_get: () => { },
                environ_sizes_get: () => { },
                environ_get: () => { },
                random_get: (arr, length) => {
                    const heap = new Uint8Array(this.memory.buffer);
                    for (let i = arr; i < arr + length; ++i) {
                        heap[i] = Math.floor(Math.random() * 256);
                    }
                },
            },

After those changes, it builds and runs the example. but after clicking "The Button", I have this error message: Uncaught (in promise) TypeError: wasm.exports(...)[name] is not a function when trying to call this function from WASM file: create_note__init_verification_key.

I cannot find create_note__init_verification_key from barretenberg library.

fosgate29 commented 2 years ago

It has a new version and hummus package doesn't exist anymore