use-ink / contracts-ui

Web application for deploying wasm smart contracts on Substrate chains that include the FRAME contracts pallet
https://contracts-ui.substrate.io/
GNU General Public License v3.0
61 stars 44 forks source link

contracts-ui should not inspect the code contained in a contracts bundle #507

Closed athei closed 7 months ago

athei commented 11 months ago

I am currently working on supporting RISC-V contracts (as opposed to wasm). I can produce a contract bundle that contains RISC-V instead of wasm code and feed that into contracts UI. I am connected to a dev node that can run RISC-V contracts on pallet-contracts.

I get past the dry-run but when I submit the instantatiation the screen is white and there is an error on the console "Error: No WASM code provided".

Expected behaviour: The UI does not inspect, touch or care about the code. It just passes it along as data to the node.

Behaviour I am seeing: The UI errors out because it determines that the code is not wasm.

statictype commented 11 months ago

I removed the pre-instantiation WASM checks a while ago, but didn't have a RISC-V contract to test further. The error you encountered is not thrown by the UI but polkadot.js (see this line here) so for RISC-V contracts to work, we need to update the pjs api.

peetzweg commented 7 months ago

As contracts-ui is built ontop of @polkadot/api-contract we are a bit limited to what we can and cannot do. It is still checked but it now allows for these two different ELF headers.

https://github.com/polkadot-js/common/blob/f55e88c1167b243f6e2ce961e75d3e99ed3e78bc/packages/util/src/is/riscv.ts#L7-L11