Check if wasm was built by container exit code and state instead of local mountpoint (#570)

* Check if the serai wasm was built successfully by verifying the build container's status code and state, instead of checking the volume mountpoint locally

* Use a log statement for which wasm is used

* Minor typo fix

---------

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
rlking
2024-05-26 02:33:23 +02:00
committed by GitHub
parent 1d2beb3ee4
commit cd69f3b9d6
4 changed files with 13 additions and 14 deletions

View File

@@ -18,9 +18,12 @@ fn account_from_name(name: &'static str) -> PublicKey {
fn wasm_binary() -> Vec<u8> {
// TODO: Accept a config of runtime path
if let Ok(binary) = std::fs::read("/runtime/serai.wasm") {
const WASM_PATH: &str = "/runtime/serai.wasm";
if let Ok(binary) = std::fs::read(WASM_PATH) {
log::info!("using {WASM_PATH}");
return binary;
}
log::info!("using built-in wasm");
WASM_BINARY.ok_or("compiled in wasm not available").unwrap().to_vec()
}