Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Make libcontract compile to wasm
  • Loading branch information
pepyakin committed Sep 10, 2018
commit 1340836ac2f9ce96f47251fbdda27a69cf681498
1 change: 1 addition & 0 deletions substrate/runtime-std/with_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub use std::ops;
pub use std::ptr;
pub use std::rc;
pub use std::slice;
pub use std::string;
pub use std::vec;
pub use std::result;

Expand Down
1 change: 1 addition & 0 deletions substrate/runtime-std/without_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern crate pwasm_alloc;
pub use alloc::boxed;
pub use alloc::rc;
pub use alloc::vec;
pub use alloc::string;
pub use core::borrow;
pub use core::cell;
pub use core::clone;
Expand Down
2 changes: 2 additions & 0 deletions substrate/runtime/contract/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

//! Build the contract module part of the genesis block storage.

#![cfg(feature = "std")]

use {Trait, ContractFee, CallBaseFee, CreateBaseFee, GasPrice, MaxDepth, BlockGasLimit};

use runtime_primitives;
Expand Down
5 changes: 4 additions & 1 deletion substrate/runtime/contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extern crate substrate_codec as codec;
extern crate substrate_runtime_io as runtime_io;
extern crate substrate_runtime_sandbox as sandbox;

#[cfg_attr(feature = "std", macro_use)]
#[macro_use]
extern crate substrate_runtime_std as rstd;

extern crate substrate_runtime_balances as balances;
Expand All @@ -90,16 +90,19 @@ mod double_map;
mod exec;
mod vm;
mod gas;

mod genesis_config;

#[cfg(test)]
mod tests;

#[cfg(feature = "std")]
pub use genesis_config::GenesisConfig;
use exec::ExecutionContext;
use account_db::{AccountDb, OverlayAccountDb};
use double_map::StorageDoubleMap;

use rstd::prelude::*;
use codec::Codec;
use runtime_primitives::traits::{As, SimpleArithmetic, OnFinalise};
use runtime_support::dispatch::Result;
Expand Down
2 changes: 1 addition & 1 deletion substrate/runtime/contract/src/vm/env_def/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ macro_rules! define_env {

$(
env.funcs.insert(
stringify!( $name ).to_string(),
stringify!( $name ).into(),
HostFunction::new(
gen_signature!( ( $( $params ),* ) $( -> $returns )* ),
{
Expand Down
2 changes: 2 additions & 0 deletions substrate/runtime/contract/src/vm/env_def/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use super::{BalanceOf, CallReceipt, CreateReceipt, Ext, GasMeterResult, Runtime};
use codec::Decode;
use parity_wasm::elements::{FunctionType, ValueType};
use rstd::prelude::*;
use rstd::string::String;
use rstd::collections::btree_map::BTreeMap;
use runtime_primitives::traits::As;
use sandbox::{self, TypedValue};
Expand Down
1 change: 1 addition & 0 deletions substrate/runtime/contract/src/vm/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use super::env_def::HostFunctionSet;
use super::{Config, Error, Ext};
use rstd::prelude::*;
use parity_wasm::elements::{self, External, MemoryType, Type};
use pwasm_utils;
use pwasm_utils::rules;
Expand Down