-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Built-in customizable deposit WASM #160
Conversation
let session_binaries_dir = env::var("PATH_TO_SESSION_BINARIES") | ||
.expect("PATH_TO_SESSION_BINARIES environment variable is not set"); | ||
|
||
// Get the output directory set by Cargo. | ||
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set"); | ||
let source_path = Path::new(&session_binaries_dir).join("deposit-session-optimized.wasm"); | ||
let dest_path = Path::new(&out_dir).join("deposit-session-optimized.wasm"); | ||
|
||
// Copy the file from the source to the destination | ||
fs::copy(&source_path, dest_path).expect("Failed to copy WASM file"); | ||
|
||
// Print out a message to re-run this script if the source file changes. | ||
println!("cargo:rerun-if-changed={}", source_path.display()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: This works, but I am not clear why we need to copy the wasm into OUT_DIR
. Why not just include_bytes
from PATH_TO_SESSION_BINARIES directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include_bytes!(env!("PATH_TO_SESSION_BINARIES"))
would work too. However, I would like to extend build script to automatically discover and optimize WASMs (similar to this) so PATH_TO_SESSION_BINARIES
can be avoided.
The whole project works great in Nix, but being able to just cargo build
without bunch of extra env setup would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
Fixes #159 by:
PATH_TO_SESSION_BINARIES