Skip to content

Commit

Permalink
sdk: Add final touches for WASM support (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serial-ATA authored Sep 18, 2024
1 parent 857e317 commit 8999c51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ jobs:
- name: Test each feature
run: cargo hack test --each-feature --exclude-features wasm --package=${{ matrix.package }}

# TODO
# - name: Test wasm build
# run: cargo hack build --target wasm32-unknown-unknown --package=${{ matrix.package }} --no-default-features --features wasm --ignore-unknown-features
- name: Test wasm build
run: cargo hack build --target wasm32-unknown-unknown --package=${{ matrix.package }} --no-default-features --features wasm --ignore-unknown-features

linting:
timeout-minutes: 120
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/benchmark/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl Runtime for TokioRuntime {

/// A benchmarking harness.
#[derive(Debug)]
#[allow(dead_code)]
pub struct Bencher<R> {
/// The runtime to use for running benchmarks.
runtime: R,
Expand Down Expand Up @@ -109,6 +110,7 @@ impl<R: Runtime> Bencher<R> {
/// let summary = bencher.stop("my_benchmark", 0);
/// println!("{}", summary);
/// ```
#[cfg(feature = "std")] // TODO: Benchmark execution time for WASM?
pub fn stop<N: ToString>(&self, name: N, job_id: u8) -> BenchmarkSummary {
let pid = sysinfo::get_current_pid().expect("Failed to get current process ID");
let s = sysinfo::System::new_all();
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
extern crate alloc;

/// Benchmark Module
#[cfg(feature = "std")]
#[cfg(any(feature = "std", feature = "wasm"))]
pub mod benchmark;
/// Blockchain clients
#[cfg(any(feature = "std", feature = "wasm"))]
Expand All @@ -33,15 +33,15 @@ pub mod metrics;
#[cfg(any(feature = "std", feature = "wasm"))]
pub mod mutex_ext;
/// Network Module
#[cfg(feature = "std")]
#[cfg(feature = "std")] // TODO: Eventually open this up to WASM
pub mod network;
/// Prometheus metrics configuration
#[cfg(any(feature = "std", feature = "wasm"))]
pub mod prometheus;
/// Randomness generation module
pub mod random;
/// Gadget Runner Module
#[cfg(feature = "std")]
#[cfg(feature = "std")] // TODO: Eventually open this up to WASM
pub mod run;
/// Slashing and quality of service utilities
pub mod slashing;
Expand Down

0 comments on commit 8999c51

Please sign in to comment.