Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix for rh-minimal-parachain #141

Merged
merged 6 commits into from
Apr 18, 2018
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
2 changes: 1 addition & 1 deletion polkadot/parachain/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl ModuleImportResolver for Resolver {
descriptor: &MemoryDescriptor,
) -> Result<MemoryRef, WasmError> {
if field_name == "memory" {
let effective_max = descriptor.maximum().unwrap_or(self.max_memory + 1);
let effective_max = descriptor.maximum().unwrap_or(self.max_memory);
if descriptor.initial() > self.max_memory || effective_max > self.max_memory {
Err(WasmError::Instantiation("Module requested too much memory".to_owned()))
} else {
Expand Down
5 changes: 3 additions & 2 deletions polkadot/parachain/test-chains/basic_add/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ use super::{HeadData, BlockData};

#[lang = "panic_fmt"]
#[no_mangle]
pub extern "C" fn panic_fmt(
pub extern fn panic_fmt(
_args: ::core::fmt::Arguments,
_file: &'static str,
_line: u32
_line: u32,
_col: u32,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't notice there were spaces here. i'll clean it up in the main PR

) -> ! {
use core::intrinsics;
unsafe {
Expand Down
5 changes: 2 additions & 3 deletions polkadot/parachain/test-chains/build_test_chains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ for i in */
do
i=${i%/}
cd $i
cargo build --target=wasm32-unknown-unknown --release --no-default-features
wasm-build --target wasm32-unknown-unknown ./target $i
mv ./target/$i.wasm ../../tests/res/$i.wasm
RUSTFLAGS="-C link-arg=--import-memory" cargo +nightly-2018-03-07 build --target=wasm32-unknown-unknown --release --no-default-features
wasm-gc target/wasm32-unknown-unknown/release/$i.wasm ../../tests/res/$i.wasm
cd ..
done
Binary file modified polkadot/parachain/tests/res/basic_add.wasm
Binary file not shown.