Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Serpent/Solidity function naming mismatch - ABI name contains ()'s #4122

Closed
cseberino opened this issue Jan 10, 2017 · 4 comments
Closed

Serpent/Solidity function naming mismatch - ABI name contains ()'s #4122

cseberino opened this issue Jan 10, 2017 · 4 comments
Assignees
Labels
F2-bug 🐞 The client fails to follow expected behavior.

Comments

@cseberino
Copy link

cseberino commented Jan 10, 2017

TL;DR ---- Allow function names with no arguments to have "()" after the name in the ABI

After much grief I figured out why a simple Serpent function that has no params and just
returns a string wouldn't run correctly in Parity.

Here is the ABI Serpent emits...

[{"constant": false, "type": "function", "name": "get_confirmation()", "outputs": [{"type": "bytes", "name": "out"}], "inputs": []}]

I noticed web UI queries on watched contracts keep returning 0x0 (instead of correct return value/string) unless you remove the parens from the function name. In other words, this nonstandard hack is needed for Parity.....

[{"constant": false, "type": "function", "name": "get_confirmation", "outputs": [{"type": "bytes", "name": "out"}], "inputs": []}]

Hope that helps

@jacogr
Copy link
Contributor

jacogr commented Jan 10, 2017

Solidity returns the name without any parens. (So there is a mismatch between the Solidty/Serpent outputs here.)

Are you making the calla via the UI when you get the wrong value? (UI definitely doesn't strip the extra ()'s, ABI parsing should be adapted to conform to the difference in inputs)

@cseberino
Copy link
Author

Yes I'm doing the call with a "watched contract" via the web UI.

Regardless of whether Serpent or Solidity is following the ABI spec correctly, is it legit
to just make Parity parse out "()" for functions with no args!??

I'm writing a paper on how awesome Parity is for Serpent and I'd like to avoid having
to have a footnote on this if possible if it can be added to repo soon.

@jacogr jacogr added F2-bug 🐞 The client fails to follow expected behavior. M7-ui labels Jan 10, 2017
@jacogr jacogr changed the title Parity not following ABI spec exactly for functions with no parameters!?! Serpent/Solidity function naming mismatch - ABI name contains ()'s Jan 10, 2017
@tomusdrw
Copy link
Collaborator

tomusdrw commented Jan 11, 2017

According to https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#json seems that name should contain only function name, not the whole signature, we can parse out \(.*\), but maybe it's worth discussing with Serpent devs too?

name the name of the function (only present for function types);

Web3 is either assuming that it's a signature or constructs the signature:
https://github.com/ethereum/web3.js/blob/develop/lib/utils/utils.js#L191

@jacogr
Copy link
Contributor

jacogr commented Jan 11, 2017

Yes, as "specified" it seems to be the name only.

However, I looked at another well-used decoder, they do have the () parse-ignore work-around in-place as well, so it is definitely something that does happen depending on compiler type and version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior.
Projects
None yet
Development

No branches or pull requests

3 participants