SOLL icon indicating copy to clipboard operation
SOLL copied to clipboard

Uniswap V2 bugs (WasmEdge Revert)

Open eee4017 opened this issue 4 years ago • 0 comments

  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.

eee4017 avatar Sep 23 '21 05:09 eee4017