Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
args: ["--all-features"]
env:
FREENET_LOG: error
CARGO_TARGET_DIR: ${{ github.workspace }}/target
Expand All @@ -37,7 +34,7 @@ jobs:
- uses: Swatinem/rust-cache@v2

- name: Test - features
run: cargo test --workspace ${{ matrix.args }}
run: cargo test --workspace --features contract,net,testing,trace

build_targets:
name: Build targets
Expand Down
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ freenet-main-contract = []
net = ["dep:tokio", "dep:tokio-tungstenite", "dep:wasm-bindgen", "dep:web-sys", "dep:js-sys", "dep:serde-wasm-bindgen"]
testing = ["dep:arbitrary"]
trace = []
wasmer-tests = []
8 changes: 4 additions & 4 deletions rust/src/client_api/client_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use crate::{

use super::WsApiError;

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ClientError {
kind: Box<ErrorKind>,
}
Expand Down Expand Up @@ -321,7 +321,7 @@ impl ClientRequest<'_> {
matches!(self, Self::Disconnect { .. })
}

pub fn try_decode_fbs(msg: &[u8]) -> Result<ClientRequest, WsApiError> {
pub fn try_decode_fbs(msg: &[u8]) -> Result<ClientRequest<'_>, WsApiError> {
let req = {
match root_as_client_request(msg) {
Ok(client_request) => match client_request.client_request_type() {
Expand Down Expand Up @@ -707,7 +707,7 @@ impl<'a> TryFromFbs<&FbsDelegateRequest<'a>> for DelegateRequest<'a> {
}

/// A response to a previous [`ClientRequest`]
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[non_exhaustive]
pub enum HostResponse<T = WrappedState> {
ContractResponse(#[serde(bound(deserialize = "T: DeserializeOwned"))] ContractResponse<T>),
Expand All @@ -722,7 +722,7 @@ pub enum HostResponse<T = WrappedState> {

type Peer = String;

#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum QueryResponse {
ConnectedPeers { peers: Vec<(Peer, SocketAddr)> },
NetworkDebug(NetworkDebugInfo),
Expand Down
4 changes: 2 additions & 2 deletions rust/src/contract_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,11 +1554,11 @@ pub(crate) mod wasm_interface {
mod test {
use super::*;
use once_cell::sync::Lazy;
use rand::{rngs::SmallRng, Rng, SeedableRng};
use rand::{rng, rngs::SmallRng, Rng, SeedableRng};

static RND_BYTES: Lazy<[u8; 1024]> = Lazy::new(|| {
let mut bytes = [0; 1024];
let mut rng = SmallRng::from_os_rng();
let mut rng = SmallRng::from_rng(&mut rng());
rng.fill(&mut bytes);
bytes
});
Expand Down
4 changes: 2 additions & 2 deletions rust/src/delegate_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ impl Delegate<'_> {
&self.key
}

pub fn code(&self) -> &DelegateCode {
pub fn code(&self) -> &DelegateCode<'_> {
&self.data
}

pub fn code_hash(&self) -> &CodeHash {
&self.data.code_hash
}

pub fn params(&self) -> &Parameters {
pub fn params(&self) -> &Parameters<'_> {
&self.parameters
}

Expand Down
8 changes: 4 additions & 4 deletions rust/src/generated/client_request_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4707,7 +4707,7 @@ pub mod client_request {
/// `root_as_client_request_unchecked`.
pub fn root_as_client_request(
buf: &[u8],
) -> Result<ClientRequest, flatbuffers::InvalidFlatbuffer> {
) -> Result<ClientRequest<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<ClientRequest>(buf)
}
#[inline]
Expand All @@ -4719,7 +4719,7 @@ pub mod client_request {
/// `size_prefixed_root_as_client_request_unchecked`.
pub fn size_prefixed_root_as_client_request(
buf: &[u8],
) -> Result<ClientRequest, flatbuffers::InvalidFlatbuffer> {
) -> Result<ClientRequest<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<ClientRequest>(buf)
}
#[inline]
Expand Down Expand Up @@ -4752,14 +4752,14 @@ pub mod client_request {
/// Assumes, without verification, that a buffer of bytes contains a ClientRequest and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `ClientRequest`.
pub unsafe fn root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest {
pub unsafe fn root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest<'_> {
flatbuffers::root_unchecked::<ClientRequest>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed ClientRequest and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `ClientRequest`.
pub unsafe fn size_prefixed_root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest {
pub unsafe fn size_prefixed_root_as_client_request_unchecked(buf: &[u8]) -> ClientRequest<'_> {
flatbuffers::size_prefixed_root_unchecked::<ClientRequest>(buf)
}
#[inline]
Expand Down
8 changes: 4 additions & 4 deletions rust/src/generated/host_response_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3338,7 +3338,7 @@ pub mod host_response {
/// `root_as_host_response_unchecked`.
pub fn root_as_host_response(
buf: &[u8],
) -> Result<HostResponse, flatbuffers::InvalidFlatbuffer> {
) -> Result<HostResponse<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<HostResponse>(buf)
}
#[inline]
Expand All @@ -3350,7 +3350,7 @@ pub mod host_response {
/// `size_prefixed_root_as_host_response_unchecked`.
pub fn size_prefixed_root_as_host_response(
buf: &[u8],
) -> Result<HostResponse, flatbuffers::InvalidFlatbuffer> {
) -> Result<HostResponse<'_>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<HostResponse>(buf)
}
#[inline]
Expand Down Expand Up @@ -3383,14 +3383,14 @@ pub mod host_response {
/// Assumes, without verification, that a buffer of bytes contains a HostResponse and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid `HostResponse`.
pub unsafe fn root_as_host_response_unchecked(buf: &[u8]) -> HostResponse {
pub unsafe fn root_as_host_response_unchecked(buf: &[u8]) -> HostResponse<'_> {
flatbuffers::root_unchecked::<HostResponse>(buf)
}
#[inline]
/// Assumes, without verification, that a buffer of bytes contains a size prefixed HostResponse and returns it.
/// # Safety
/// Callers must trust the given bytes do indeed contain a valid size prefixed `HostResponse`.
pub unsafe fn size_prefixed_root_as_host_response_unchecked(buf: &[u8]) -> HostResponse {
pub unsafe fn size_prefixed_root_as_host_response_unchecked(buf: &[u8]) -> HostResponse<'_> {
flatbuffers::size_prefixed_root_unchecked::<HostResponse>(buf)
}
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion rust/src/memory/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fn __frnt__initiate_buffer(capacity: u32) -> i64 {
buffer as i64
}

#[cfg(all(test, any(unix, windows)))]
#[cfg(all(test, any(unix, windows), feature = "wasmer-tests"))]
mod test {
use super::*;
use wasmer::{
Expand Down
2 changes: 1 addition & 1 deletion rust/src/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl DelegateContainer {
}
}

pub fn code(&self) -> &DelegateCode {
pub fn code(&self) -> &DelegateCode<'_> {
match self {
Self::Wasm(DelegateWasmAPIVersion::V1(delegate_v1)) => delegate_v1.code(),
}
Expand Down
Loading