Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Cannot build simple Parity Ethereum contract #128

Closed
geigerzaehler opened this issue Aug 29, 2019 · 0 comments · Fixed by #129
Closed

Cannot build simple Parity Ethereum contract #128

geigerzaehler opened this issue Aug 29, 2019 · 0 comments · Fixed by #129

Comments

@geigerzaehler
Copy link
Contributor

I’m using the most recent version 0.9 of wasm-build to build the following contract.

#![no_std]
use pwasm_std;

#[no_mangle]
pub fn call() {}

#[no_mangle]
pub fn deploy() {}

The build script is

export RUSTFLAGS="-C panic=abort -C lto=yes -C opt-level=z -C link-args=-zstack-size=65536"
cargo build --target wasm32-unknown-unknown
wasm-build --target=wasm32-unknown-unknown ./target my_contract

This results in the error

Build error: Packing failed due to module structure error: No exported `deploy` symbol. Sure used correct libraries for building contracts?

If I add the --skipt-optimization flag I get

./target/my_contract.wasm:0000089: error: redefinition of export "call"

This problem was also raised in openethereum/pwasm-tutorial#48

geigerzaehler pushed a commit to oscoin/wasm-utils that referenced this issue Aug 29, 2019
When optimizing the constructor module for a PWasm contract the "deploy" symbol is preserved instead of the "call"
symbol. Before this change `build` would error for PWasm contracts because `pack_instance` would not find the "deploy"
symbol in the optimized contract.

Fixes paritytech#128
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant