darwinia-network / darwinia-messages-sol

Darwinia cross-chain messages gateway and protocol for EVM developers 💌
MIT License
29 stars 8 forks source link

Does the return data of precompile need abi.encode? #200

Closed wuminzhe closed 2 years ago

wuminzhe commented 2 years ago

I prefer to remove abi_encode_bytes as it adds an unnecessary encoding and decoding process.

Ok(PrecompileOutput {
    exit_status: ExitSucceed::Returned,
    cost: helper.used_gas(),
    output: abi_encode_bytes(&output.unwrap_or_default()), <---
    logs: Default::default(),
})
boundless-forest commented 2 years ago

It's not entirely correct. If playing with smart contracts with remix, it will do ethabi decode automatically. If we remove it, the code remix shows are wrong.