Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function signature doesn't get verified #263

Closed
bbenligiray opened this issue Nov 23, 2021 · 5 comments
Closed

Function signature doesn't get verified #263

bbenligiray opened this issue Nov 23, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@bbenligiray
Copy link
Member

bbenligiray commented Nov 23, 2021

The dashboard doesn't verify function signatures and allows proposals with invalid function signatures to be created (https://api3.eth.link/#/history/secondary-13)

There is no utility function for verifying signatures in ethers v5, but there is a workaround, see ethers-io/ethers.js#1101 (Edit: we already implement the workaround)

@Siegrift
Copy link
Collaborator

Some validation is done by https://github.com/api3dao/api3-dao-dashboard/blob/main/src/logic/proposals/encoding/encoding.ts#L80 and it does catch some bugs (e.g. unit instead of uint https://github.com/api3dao/api3-dao-dashboard/blob/main/cypress/integration/new-proposal.spec.ts#L29)

unfortunately it doesn't validate spaces properly...

@Siegrift Siegrift added the bug Something isn't working label Nov 24, 2021
@bbenligiray
Copy link
Member Author

How does that work? When I run ethers.utils.FunctionFragment.from("transfer(address, unit256)") on https://playground.ethers.org/ it doesn't throw.

@bbenligiray bbenligiray added enhancement New feature or request and removed bug Something isn't working labels Nov 24, 2021
@Siegrift
Copy link
Collaborator

You're right - that catches only basic validation errors like '' (empty string) value.
More validation is performed by encoding the parameters which catches the unit256 mistake - but that does not involve the function fragment anymore...

@bbenligiray
Copy link
Member Author

You're right, and that's essentially the workaround they propose in the ethers.js issue. I'm still keeping this issue open in case a function signature verification function gets implemented in ethers v6 that can catch things like (address,uint256)transfer (though I doubt it)

@bbenligiray
Copy link
Member Author

We now do a decent bit of validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants