Skip to content

Commit

Permalink
fix feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
breathx committed Nov 4, 2024
1 parent c7ca0a0 commit 3bebf4d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ethexe/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ log.workspace = true
parity-scale-codec.workspace = true
hex.workspace = true
ethexe-common.workspace = true
ethexe-runtime-common.workspace = true
ethexe-runtime-common = { workspace = true, features = ["std"] }
sp-core = { workspace = true, features = ["serde"] }
gear-core = { workspace = true, features = ["std"] }
serde.workspace = true
serde = { workspace = true, features = ["std"] }
13 changes: 10 additions & 3 deletions ethexe/runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ ethexe-common.workspace = true

gear-lazy-pages-common.workspace = true
core-processor.workspace = true
gear-core = { workspace = true, features = ["std"] }
gear-core.workspace = true
gprimitives.workspace = true
gsys.workspace = true
gear-core-errors.workspace = true

anyhow.workspace = true
parity-scale-codec.workspace = true
log.workspace = true
serde.workspace = true
serde = { workspace = true, features = ["derive"], optional = true }

[features]
default = ["std"]
std = ["anyhow/std", "core-processor/std", "log/std"]
std = [
"anyhow/std",
"core-processor/std",
"gear-core/std",
"gprimitives/serde",
"log/std",
"serde/std",
]
19 changes: 12 additions & 7 deletions ethexe/runtime/common/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ use gear_core_errors::ReplyCode;
use gprimitives::{ActorId, CodeId, MessageId, H256};
use gsys::BlockNumber;
use parity_scale_codec::{Decode, Encode};
use serde::{Deserialize, Serialize};

pub use gear_core::program::ProgramState as InitStatus;

/// 3h validity in mailbox for 12s blocks.
pub const MAILBOX_VALIDITY: u32 = 54_000;

#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct HashAndLen {
pub hash: H256,
pub len: NonZero<u32>,
Expand All @@ -64,7 +64,8 @@ impl From<H256> for HashAndLen {
}
}

#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum MaybeHash {
Hash(HashAndLen),
Empty,
Expand Down Expand Up @@ -102,7 +103,8 @@ impl MaybeHash {
}
}

#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ActiveProgram {
/// Hash of wasm memory pages allocations, see [`Allocations`].
pub allocations_hash: MaybeHash,
Expand All @@ -114,7 +116,8 @@ pub struct ActiveProgram {
pub initialized: bool,
}

#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum Program {
Active(ActiveProgram),
Exited(ProgramId),
Expand All @@ -138,7 +141,8 @@ impl Program {
}

/// ethexe program state.
#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ProgramState {
/// Active, exited or terminated program state.
pub program: Program,
Expand Down Expand Up @@ -193,7 +197,8 @@ impl ProgramState {
}
}

#[derive(Clone, Debug, Encode, Decode, Serialize, Deserialize)]
#[derive(Clone, Debug, Encode, Decode)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct Dispatch {
/// Message id.
pub id: MessageId,
Expand Down

0 comments on commit 3bebf4d

Please sign in to comment.