Skip to content

Commit

Permalink
Merge branch 'master' into gsobol-symbiotic-step1
Browse files Browse the repository at this point in the history
  • Loading branch information
grishasobol committed Nov 8, 2024
2 parents 8b651e8 + 2006b3d commit 5bf4106
Show file tree
Hide file tree
Showing 87 changed files with 2,886 additions and 2,036 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
98 changes: 90 additions & 8 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",
]
6 changes: 6 additions & 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 Expand Up @@ -89,6 +90,11 @@ impl<T, E: Default, const N: usize> TryFrom<Vec<T>> for LimitedVec<T, E, N> {
}

impl<T: Clone + Default, E: Default, const N: usize> LimitedVec<T, E, N> {
/// Constructs a new, empty `LimitedVec<T>`.
pub const fn new() -> Self {
Self(Vec::new(), PhantomData)
}

/// Tries to create new limited vector of length `len`
/// with default initialized elements.
pub fn try_new_default(len: usize) -> Result<Self, E> {
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 @@ -144,6 +144,7 @@ impl ContextOutcome {

/// 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 {
outgoing: BTreeMap<u32, Option<Payload>>,
reply: Option<Payload>,
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
Loading

0 comments on commit 5bf4106

Please sign in to comment.