@@ -18,6 +18,7 @@ import {
1818import type { RuntimeModule } from "../runtime/RuntimeModule.js" ;
1919
2020import { MethodParameterEncoder } from "./MethodParameterEncoder" ;
21+ import { Runtime } from "../runtime/Runtime" ;
2122
2223const errors = {
2324 runtimeNotProvided : ( name : string ) =>
@@ -70,6 +71,7 @@ export function toEventsHash(
7071
7172export type WrappedMethod = ( ...args : ArgumentTypes ) => MethodPublicOutput ;
7273export type AsyncWrappedMethod = (
74+ publicInput : undefined ,
7375 ...args : ArgumentTypes
7476) => Promise < { publicOutput : MethodPublicOutput } > ;
7577
@@ -86,6 +88,12 @@ export function toWrappedMethod(
8688 ) ;
8789
8890 const wrappedMethod : AsyncWrappedMethod = async (
91+ /**
92+ * Here, we ignore the publicInput, because o1js internally always populates
93+ * the public input as undefined if a method doesn't use it.
94+ * Therefore, the args array starts at position 1 of the args given by o1js
95+ */
96+ _publicInput ,
8997 ...args
9098 ) : Promise < { publicOutput : MethodPublicOutput } > => {
9199 await Reflect . apply ( moduleMethod , this , args ) ;
@@ -237,19 +245,6 @@ function runtimeMethodInternal(options: {
237245 ) {
238246 const constructorName = this . name ! ;
239247
240- /**
241- * If its a top level method call, wrap it into a wrapped method,
242- * since it'll be turned into a real/mock prover in provableMethod().
243- *
244- * Otherwise provableMethod() will just call the originalMethod provided
245- * if method is not called at the top level.
246- */
247- const simulatedWrappedMethod = Reflect . apply ( toWrappedMethod , this , [
248- methodName ,
249- simulatedMethod ,
250- options ,
251- ] ) ;
252-
253248 /**
254249 * Before the prover runs, make sure it is operating on the correct
255250 * RuntimeMethodExecutionContext state, meaning it enters and exits
@@ -259,8 +254,6 @@ function runtimeMethodInternal(options: {
259254 executionContext . beforeMethod ( constructorName , methodName , args ) ;
260255 const innerProver = toProver (
261256 combineMethodName ( constructorName , methodName ) ,
262- simulatedWrappedMethod ,
263- false ,
264257 this . appChain ! . areProofsEnabled ,
265258 ...args
266259 ) . bind ( this ) ;
0 commit comments