-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
635d475
Allow to provide custom deposit WASM path to CLI.
koxu1996 7098d87
Use hardcoded env to provide built-in session code.
koxu1996 6529992
Fix clippy error.
koxu1996 7578877
Merge branch 'main' into feature/built-in-customizable-deposit
koxu1996 4e79725
Merge branch 'main' into feature/built-in-customizable-deposit
koxu1996 0c95fd3
Merge branch 'main' into feature/built-in-customizable-deposit
koxu1996 66e9ca6
Merge branch 'main' into feature/built-in-customizable-deposit
koxu1996 a0b2229
Merge branch 'main' into feature/built-in-customizable-deposit
koxu1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use std::env; | ||
use std::fs; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
// Path | ||
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()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 justinclude_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) soPATH_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