second-state / SOLL

SOLL is a new compiler for generate Ewasm from solidity and yul. See a demo here: https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
https://www.secondstate.io/
377 stars 23 forks source link

Uniswap V2 bugs (WasmEdge Revert) #121

Open eee4017 opened 3 years ago

eee4017 commented 3 years ago
  1. Wasm section size too small When copying deploy bytecode, WasmEdge will revert due to OOB https://github.com/second-state/uniswap-v2-core/blob/vincent/upgrade_to_solc_0.8.6/contracts/yul/UniswapV2ERC20.yul#L18

This error could be solved by assigning larger memory secion to wasm-ld

wasm-ld --entry main --gc-sections --allow-undefined --export=__heap_base --max-memory=16777216 --initial-memory=16777216 UniswapV2ERC20.o -o UniswapV2ERC20.wasm
  1. keccak256 failed WasmEdge will revert due to OOB. I guess that this is a bug in keccak256 implementation. https://github.com/second-state/uniswap-v2-core/blob/vincent/upgrade_to_solc_0.8.6/contracts/yul/UniswapV2ERC20.yul#L138

The behavior here is strange, since WasmEdge would not stop at the OOB occurs.