ethereum / remix-project

Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
https://remix-ide.readthedocs.io
MIT License
2.41k stars 916 forks source link

Remix does not support function type parameter #3887

Open drafish opened 1 year ago

drafish commented 1 year ago

image

If I input a function type parameter, it will throw an error -- invalid type.

https://docs.soliditylang.org/en/v0.8.19/types.html#function-types

If external function types are used outside of the context of Solidity, they are treated as the function type, which encodes the address followed by the function identifier together in a single bytes24 type.

According to solidity docs, we can just deal with it as bytes24 type.

But it's not some thing remix should do. Remix use ethers.js to encode and decode parameters. So if ethers.js can support function type, Remix will support too.

I'v already fixed this issue in brochain ide through patch-package. Check the image below. image

I will submit a pr for ethers.js. After ethers.js merge my pr, and release a new version, remix can fix this issue by updating ethers.js

And I have another question. Check the link below. What's this for? https://github.com/ethereum/remix-project/blob/master/libs/remix-lib/src/execution/eventsDecoder.ts#L65-L70

These code seems like unnecessary, it's never be executed before until I fixed the function type issue, and it throw an error. Check the image below. image

I suppose I can submit a pr to remove these code.

But I really don't understand why it throw an error. I understand I can't assign to a constant. But if the constant is an object, I should be able to assign the property.

drafish commented 1 year ago

https://github.com/ethers-io/ethers.js/issues/389

@ajsantander submitted an issue in 2019, and it's still open. It's easy to fix. I don't know why they not fix it yet.

Anyway, I will submit a pr for ethers.js, and hope they will accept.

There maybe a problem for remix to catch up the update of ethers.js. The last version of ethers.js is v6.6.2, and remix is still using v5.7.2. I will ask if they can release v5.7.3.