Skip to content

Commit 7578f2d

Browse files
authored
prover: remove unnecessary wasm exports (#3554)
prover's unnecessary exports add lots of dependencies to user_host which imports it. They are only required for native and not when compiling to wasm.
1 parent 881980e commit 7578f2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arbitrator/prover/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub unsafe extern "C" fn free_rust_bytes(vec: RustBytes) {
124124
}
125125

126126
#[no_mangle]
127+
#[cfg(feature = "native")]
127128
pub unsafe extern "C" fn arbitrator_load_machine(
128129
binary_path: *const c_char,
129130
library_paths: *const *const c_char,
@@ -212,11 +213,13 @@ pub fn str_to_c_string(text: &str) -> *mut libc::c_char {
212213
}
213214

214215
#[no_mangle]
216+
#[cfg(feature = "native")]
215217
pub unsafe extern "C" fn arbitrator_free_machine(mach: *mut Machine) {
216218
drop(Box::from_raw(mach));
217219
}
218220

219221
#[no_mangle]
222+
#[cfg(feature = "native")]
220223
pub unsafe extern "C" fn arbitrator_clone_machine(mach: *mut Machine) -> *mut Machine {
221224
let new_mach = (*mach).clone();
222225
Box::into_raw(Box::new(new_mach))
@@ -255,6 +258,7 @@ pub unsafe extern "C" fn arbitrator_step(
255258
}
256259

257260
#[no_mangle]
261+
#[cfg(feature = "native")]
258262
pub unsafe extern "C" fn arbitrator_add_inbox_message(
259263
mach: *mut Machine,
260264
inbox_identifier: u64,
@@ -274,6 +278,7 @@ pub unsafe extern "C" fn arbitrator_add_inbox_message(
274278

275279
/// Adds a user program to the machine's known set of wasms.
276280
#[no_mangle]
281+
#[cfg(feature = "native")]
277282
pub unsafe extern "C" fn arbitrator_add_user_wasm(
278283
mach: *mut Machine,
279284
module: *const u8,
@@ -312,6 +317,7 @@ pub unsafe extern "C" fn arbitrator_step_until_host_io(
312317
}
313318

314319
#[no_mangle]
320+
#[cfg(feature = "native")]
315321
pub unsafe extern "C" fn arbitrator_serialize_state(
316322
mach: *const Machine,
317323
path: *const c_char,
@@ -330,6 +336,7 @@ pub unsafe extern "C" fn arbitrator_serialize_state(
330336
}
331337

332338
#[no_mangle]
339+
#[cfg(feature = "native")]
333340
pub unsafe extern "C" fn arbitrator_deserialize_and_replace_state(
334341
mach: *mut Machine,
335342
path: *const c_char,
@@ -348,6 +355,7 @@ pub unsafe extern "C" fn arbitrator_deserialize_and_replace_state(
348355
}
349356

350357
#[no_mangle]
358+
#[cfg(feature = "native")]
351359
pub unsafe extern "C" fn arbitrator_get_num_steps(mach: *const Machine) -> u64 {
352360
(*mach).get_steps()
353361
}
@@ -377,16 +385,19 @@ const_assert_eq!(
377385

378386
/// Returns one of ARBITRATOR_MACHINE_STATUS_*
379387
#[no_mangle]
388+
#[cfg(feature = "native")]
380389
pub unsafe extern "C" fn arbitrator_get_status(mach: *const Machine) -> u8 {
381390
(*mach).get_status() as u8
382391
}
383392

384393
#[no_mangle]
394+
#[cfg(feature = "native")]
385395
pub unsafe extern "C" fn arbitrator_global_state(mach: *mut Machine) -> GlobalState {
386396
(*mach).get_global_state()
387397
}
388398

389399
#[no_mangle]
400+
#[cfg(feature = "native")]
390401
pub unsafe extern "C" fn arbitrator_set_global_state(mach: *mut Machine, gs: GlobalState) {
391402
(*mach).set_global_state(gs);
392403
}
@@ -451,16 +462,19 @@ pub unsafe extern "C" fn arbitrator_set_preimage_resolver(
451462
}
452463

453464
#[no_mangle]
465+
#[cfg(feature = "native")]
454466
pub unsafe extern "C" fn arbitrator_set_context(mach: *mut Machine, context: u64) {
455467
(*mach).set_context(context);
456468
}
457469

458470
#[no_mangle]
471+
#[cfg(feature = "native")]
459472
pub unsafe extern "C" fn arbitrator_hash(mach: *mut Machine) -> Bytes32 {
460473
(*mach).hash()
461474
}
462475

463476
#[no_mangle]
477+
#[cfg(feature = "native")]
464478
pub unsafe extern "C" fn arbitrator_module_root(mach: *mut Machine) -> Bytes32 {
465479
(*mach).get_modules_root()
466480
}

0 commit comments

Comments
 (0)