Skip to content

Commit

Permalink
Merge branch 'master' into ap/tmp-store
Browse files Browse the repository at this point in the history
  • Loading branch information
playX18 authored Nov 7, 2024
2 parents b55d533 + d43076a commit 3ad5dc3
Show file tree
Hide file tree
Showing 71 changed files with 1,476 additions and 790 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/crates-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: llvm-tools
components: llvm-tools, rust-src

- name: "Publish packages (simulate)"
if: ${{ !inputs.publish }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
tags: ${{ needs.prepare.outputs.image_name }}

- name: SSH into VM
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
env:
NEW_IMAGE: ${{ needs.prepare.outputs.image_name }}
with:
Expand Down
89 changes: 85 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ ethexe-rpc = { path = "ethexe/rpc", default-features = false }
ethexe-common = { path = "ethexe/common" }

# Common executor between `sandbox-host` and `lazy-pages-fuzzer`
sandbox-wasmi = { package = "wasmi", git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", features = [
"virtual_memory",
] }
wasmi = { package = "wasmi", version = "0.38"}

# Substrate deps
binary-merkle-tree = { version = "4.0.0-dev", git = "https://github.com/gear-tech/polkadot-sdk.git", branch = "gear-v1.4.0", default-features = false }
Expand Down Expand Up @@ -503,6 +501,7 @@ demo-wat = { path = "examples/wat" }
#
# TODO: remove these dependencies (from this file?) or add more docs.

atomic_enum = "0.3.0"
cfg-if = "1.0.0" # gear-lazy-pages
cargo-http-registry = "0.1.6" # crates-io
errno = "0.3" # gear-lazy-pages
Expand Down
8 changes: 7 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ numerated = { workspace = true, features = ["mock"] }
[features]
default = []
strict = []
std = ["serde/std", "dep:impl-serde", "wasmparser/std", "gear-core-errors/serde"]
std = [
"serde/std",
"dep:impl-serde",
"wasmparser/std",
"gear-core-errors/serde",
"gprimitives/serde",
]
1 change: 1 addition & 0 deletions core/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use scale_info::{
/// `E` is overflow error type.
/// `N` is max len which a vector can have.
#[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct LimitedVec<T, E, const N: usize>(Vec<T>, PhantomData<E>);

/// Formatter for [`LimitedVec`] will print to precision of 8 by default, to print the whole data, use `{:+}`.
Expand Down
3 changes: 3 additions & 0 deletions core/src/message/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ impl Message {
TypeInfo,
derive_more::From,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum MessageDetails {
/// Reply details.
Reply(ReplyDetails),
Expand Down Expand Up @@ -228,6 +229,7 @@ impl MessageDetails {
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ReplyDetails {
/// Message id, this message replies on.
to: MessageId,
Expand Down Expand Up @@ -261,6 +263,7 @@ impl ReplyDetails {
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct SignalDetails {
/// Message id, which issues signal.
to: MessageId,
Expand Down
1 change: 1 addition & 0 deletions core/src/message/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ pub struct TmpStore {

/// Store of previous message execution context.
#[derive(Clone, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ContextStore {
initialized: BTreeSet<ProgramId>,
reservation_nonce: ReservationNonce,
Expand Down
2 changes: 2 additions & 0 deletions core/src/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const _: () = assert!(MAX_PAYLOAD_SIZE <= u32::MAX as usize);
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct PayloadSizeError;

impl From<PayloadSizeError> for &str {
Expand Down Expand Up @@ -113,6 +114,7 @@ pub enum MessageWaitedType {
#[derive(
Copy, Clone, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum DispatchKind {
/// Initialization.
Init,
Expand Down
1 change: 1 addition & 0 deletions core/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl<const SIZE: u32> PartialOrd<PagesAmount<SIZE>> for Page<SIZE> {
Default,
derive_more::Into,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct Page<const SIZE: u32>(u32);

impl<const SIZE: u32> Page<SIZE> {
Expand Down
1 change: 1 addition & 0 deletions core/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub enum ProgramState {

/// Struct defines infix of memory pages storage.
#[derive(Clone, Copy, Debug, Default, Decode, Encode, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct MemoryInfix(u32);

impl MemoryInfix {
Expand Down
1 change: 1 addition & 0 deletions core/src/reservation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use scale_info::{
#[derive(
Clone, Copy, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct ReservationNonce(u64);

impl From<&InnerNonce> for ReservationNonce {
Expand Down
4 changes: 2 additions & 2 deletions docker/runtime-fuzzer/scripts/fuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ function start_container_post {
--workdir /gear/utils/runtime-fuzzer \
--name ${CONTAINER_NAME_GEAR} ${IMAGE} \
-c "cargo install cargo-binutils && \
rustup component add llvm-tools-preview && \
rustup component add --toolchain nightly llvm-tools-preview && \
rustup component add llvm-tools && \
rustup component add --toolchain nightly llvm-tools && \
cargo fuzz coverage --release --sanitizer=none main /corpus/main -- \
-rss_limit_mb=8192 -max_len=450000 -len_control=0 && \
cargo cov -- show target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \
Expand Down
3 changes: 2 additions & 1 deletion ethexe/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub use gprimitives;

use gprimitives::ActorId;
use parity_scale_codec::{Decode, Encode};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Encode, Decode)]
pub enum BlockEvent {
Expand Down Expand Up @@ -61,7 +62,7 @@ impl From<wvara::Event> for BlockEvent {
}
}

#[derive(Clone, Debug, Encode, Decode)]
#[derive(Clone, Debug, Encode, Decode, Serialize, Deserialize)]
pub enum BlockRequestEvent {
Router(router::RequestEvent),
Mirror {
Expand Down
3 changes: 2 additions & 1 deletion ethexe/common/src/mirror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use alloc::vec::Vec;
use gear_core::message::ReplyCode;
use gprimitives::{ActorId, MessageId, H256};
use parity_scale_codec::{Decode, Encode};
use serde::{Deserialize, Serialize};

/* Events section */

Expand Down Expand Up @@ -104,7 +105,7 @@ impl Event {
}
}

#[derive(Clone, Debug, Encode, Decode)]
#[derive(Clone, Debug, Encode, Decode, Serialize, Deserialize)]
pub enum RequestEvent {
ExecutableBalanceTopUpRequested {
value: u128,
Expand Down
3 changes: 2 additions & 1 deletion ethexe/common/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use alloc::vec::Vec;
use gear_core::message::{Message, ReplyDetails};
use gprimitives::{ActorId, CodeId, MessageId, H256};
use parity_scale_codec::{Decode, Encode};
use serde::{Deserialize, Serialize};

/* Storage related structures */

Expand Down Expand Up @@ -142,7 +143,7 @@ impl Event {
}
}

#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq)]
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, Serialize, Deserialize)]
pub enum RequestEvent {
BaseWeightChanged {
base_weight: u64,
Expand Down
Loading

0 comments on commit 3ad5dc3

Please sign in to comment.