Skip to content

Commit

Permalink
build!: bump holochain_serialized_bytes to v0.0.54 (#107)
Browse files Browse the repository at this point in the history
* build: bump holochain_serialized_bytes to v0.0.54

* build: update nix flake

* ci: update github actions

* ci: fix rustup installation

* update all occurrences

* style: fix clippies

* ci: debug term

* debug term

* build: update wasmer

* test: partial benches

* test: re-enable all working benches

* debug term

* test: reduce instance bench sample size

* ci: remove debug term
  • Loading branch information
jost-s committed Apr 24, 2024
1 parent 1ec2ba6 commit 826d6a9
Show file tree
Hide file tree
Showing 18 changed files with 400 additions and 451 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
os: ["ubuntu-latest", "macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v26
- name: Setup cachix
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: wasm32-unknown-unknown
targets: wasm32-unknown-unknown
- run: cargo test -- --nocapture
- run: cargo test --manifest-path test/Cargo.toml -- --nocapture
- run: cd test && cargo bench
6 changes: 3 additions & 3 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name = "holochain_wasmer_common"
description = "commons for both host and guest"
license = "Apache-2.0"
version = "0.0.92"
authors = [ "thedavidmeister", "thedavidmeister@gmail.com" ]
authors = ["thedavidmeister", "thedavidmeister@gmail.com"]
edition = "2021"

[dependencies]
holochain_serialized_bytes = "=0.0.53"
holochain_serialized_bytes = "=0.0.54"
serde = "1"
thiserror = "1"
serde_bytes = "0.11"
Expand All @@ -18,4 +18,4 @@ default = []
error_as_host = []

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wasmer = "=4.2.4"
wasmer = "=4.2.8"
12 changes: 2 additions & 10 deletions crates/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,11 @@ pub type DoubleUSize = u64;
pub type DoubleUSize = u128;

pub fn merge_u64(a: u64, b: u64) -> Result<u128, WasmError> {
Ok(
(u128::try_from(a).map_err(|_| wasm_error!(WasmErrorInner::PointerMap))?
<< (std::mem::size_of::<u64>() * 8))
| u128::try_from(b).map_err(|_| wasm_error!(WasmErrorInner::PointerMap))?,
)
Ok((u128::from(a) << (std::mem::size_of::<u64>() * 8)) | u128::from(b))
}

pub fn merge_u32(a: u32, b: u32) -> Result<u64, WasmError> {
Ok(
(u64::try_from(a).map_err(|_| wasm_error!(WasmErrorInner::PointerMap))?
<< (std::mem::size_of::<u32>() * 8))
| u64::try_from(b).map_err(|_| wasm_error!(WasmErrorInner::PointerMap))?,
)
Ok((u64::from(a) << (std::mem::size_of::<u32>() * 8)) | u64::from(b))
}

/// Given 2x `u32`, return a `DoubleUSize` merged.
Expand Down
6 changes: 3 additions & 3 deletions crates/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name = "holochain_wasmer_guest"
description = "wasm guest code"
license = "Apache-2.0"
version = "0.0.92"
authors = [ "thedavidmeister", "thedavidmeister@gmail.com" ]
authors = ["thedavidmeister", "thedavidmeister@gmail.com"]
edition = "2021"

[workspace]

[lib]
name = "holochain_wasmer_guest"
crate-type = [ "cdylib", "rlib" ]
crate-type = ["cdylib", "rlib"]
path = "src/guest.rs"

[dependencies]
holochain_serialized_bytes = { version = "=0.0.53", features = [] }
holochain_serialized_bytes = { version = "=0.0.54", features = [] }
holochain_wasmer_common = { version = "=0.0.92", path = "../common" }
serde = "1"
tracing = "0.1"
Expand Down
12 changes: 6 additions & 6 deletions crates/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "holochain_wasmer_host"
description = "wasm host code"
license = "Apache-2.0"
version = "0.0.92"
authors = [ "thedavidmeister", "thedavidmeister@gmail.com" ]
authors = ["thedavidmeister", "thedavidmeister@gmail.com"]
edition = "2021"

[dependencies]
wasmer = "=4.2.4"
wasmer-middlewares = "=4.2.4"
wasmer = "=4.2.8"
wasmer-middlewares = "=4.2.8"
holochain_wasmer_common = { version = "=0.0.92", path = "../common" }
holochain_serialized_bytes = "=0.0.53"
holochain_serialized_bytes = "=0.0.54"
serde = "1"
tracing = "0.1"
parking_lot = "0.12"
Expand All @@ -21,10 +21,10 @@ hex = "0.4"

[lib]
name = "holochain_wasmer_host"
crate-type = [ "cdylib", "rlib" ]
crate-type = ["cdylib", "rlib"]
path = "src/host.rs"

[features]
default = ["error_as_host"]
debug_memory = []
error_as_host = ["holochain_wasmer_common/error_as_host"]
error_as_host = ["holochain_wasmer_common/error_as_host"]
4 changes: 2 additions & 2 deletions crates/host/src/guest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ where
.map_err(|e| wasm_error!(WasmErrorInner::CallError(e.to_string())))?
.call(store_mut, &[guest_input_length_value.clone()])
.map_err(|e| wasm_error!(WasmErrorInner::CallError(e.to_string())))?
.get(0)
.first()
{
Some(Value::I32(guest_input_ptr)) => (
(*guest_input_ptr)
Expand Down Expand Up @@ -194,7 +194,7 @@ where
store_mut,
&[guest_input_ptr_value, guest_input_length_value],
) {
Ok(v) => match v.get(0) {
Ok(v) => match v.first() {
Some(Value::I64(i)) => {
let u: GuestPtrLen = (*i)
.try_into()
Expand Down
2 changes: 1 addition & 1 deletion crates/host/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
use tracing::info;
use wasmer::sys::BaseTunables;
use wasmer::wasmparser;
use wasmer::BaseTunables;
use wasmer::CompileError;
use wasmer::CompilerConfig;
use wasmer::CpuFeature;
Expand Down
6 changes: 3 additions & 3 deletions crates/host/src/plru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
//!
//! ✔ Production-quality

#![cfg_attr(features = "no_std", no_std)]
#![cfg_attr(feature = "no_std", no_std)]
#![warn(missing_docs)]

extern crate core;
Expand All @@ -105,7 +105,7 @@ pub type DynamicCache = Cache<Box<[AtomicU64]>>;
/// Create a heap allocated cache of a fixed (but dynamic) number of cache lines.
///
/// Ideally, 64 should divide `len` to optimize space efficiency.
#[cfg(not(features = "no_std"))]
#[cfg(not(feature = "no_std"))]
pub fn create(lines: usize) -> DynamicCache {
// Unfortunately, `AtomicU64` doesn't implement `Clone`, so we cannot use the `vec![]` macro.
// We need to manually construct our vector.
Expand Down Expand Up @@ -312,7 +312,7 @@ impl<B: AsRef<[AtomicU64]>> fmt::Debug for Cache<B> {
#[cfg(test)]
mod tests {
#[test]
#[cfg(not(features = "no_std"))]
#[cfg(not(feature = "no_std"))]
fn create() {
assert_eq!(super::create(10).len(), 64);
assert_eq!(super::create(64).len(), 64);
Expand Down

0 comments on commit 826d6a9

Please sign in to comment.