Skip to content

Conversation

@bleepbloopsify
Copy link
Member

@bleepbloopsify bleepbloopsify commented Oct 27, 2025

reset to native/napi

adds build and package.json dependency injection for native assets

@bleepbloopsify bleepbloopsify requested a review from a team as a code owner October 27, 2025 14:42
@bleepbloopsify bleepbloopsify force-pushed the leon/native-prover-build branch from 9b18de9 to cef9291 Compare October 28, 2025 15:06
@bleepbloopsify bleepbloopsify force-pushed the leon/native-prover-build branch from cef9291 to 1769fde Compare October 28, 2025 15:09
bleepbloopsify and others added 2 commits October 30, 2025 17:20
…neration-functions

feat: proof generation functions (native prover)
Copy link
Member

@querolita querolita left a comment

Choose a reason for hiding this comment

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

Approving already, but please can you solve the question regarding work in progress / local builds? Thanks!


rm -f "${CURRENT_DIRECTORY}/plonk_napi.node"
cp "${ARTIFACT}" "${CURRENT_DIRECTORY}/plonk_napi.node"
napi build \
Copy link
Member

Choose a reason for hiding this comment

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

how clean!

// This file gets auto-included in the generated plonk-napi types to supplement
// external pointer types.

type WasmPastaFpPlonkIndex = {};
Copy link
Member

Choose a reason for hiding this comment

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

This means every time we have any External<T> we need to include a type T = {} here? Just confirming, looks like what you shared with us during this week call.

Copy link
Member

Choose a reason for hiding this comment

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

same question here!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we will probably have to declare the external types on our own

this is a weird quirk of the napi typegen, it doesn't spit out the names of the external types

@@ -0,0 +1,6 @@
{
"napi": {
"binaryName": "plonk_napi",
Copy link
Member

Choose a reason for hiding this comment

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

Actually, this is a TODO: we wanted to rename plonk-wasm into kimchi-wasm, and the same for plonk-napi to kimchi-napi. But let's do that once we have it working to avoid a renaming craziness.

try {
var native = require('@o1js/native-' + process.platform + '-' + process.arch)

function override(functionName) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we prefer a helper here to avoid repeating this pattern over and over again as we have more overrides?

Copy link
Member

Choose a reason for hiding this comment

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

we could do something like

const new = {
  ...wasm,
  ...napi,
};

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed this in the follow-up

var plonk_wasm = (function() {
var wasm = require('./plonk_wasm.js');

function snakeToCamel(name) {
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to delete this already given that napi does this automatically (unlike neon did).

var plonk_wasm = globalThis.plonk_wasm;

// Provides: plonk_napi
var plonk_napi = globalThis.plonk_wasm
Copy link
Member

Choose a reason for hiding this comment

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

oh sure, in web we still will have wasm

// This file gets auto-included in the generated plonk-napi types to supplement
// external pointer types.

type WasmPastaFpPlonkIndex = {};
Copy link
Member

Choose a reason for hiding this comment

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

same question here!

try {
var native = require('@o1js/native-' + process.platform + '-' + process.arch)

function override(functionName) {
Copy link
Member

Choose a reason for hiding this comment

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

we could do something like

const new = {
  ...wasm,
  ...napi,
};

@bleepbloopsify
Copy link
Member Author

#18054

prefer the above PR to this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants