-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Javascript API: invalid params on contract creation #6531
Comments
What do you suggest? |
All hex-encoded fields (bytes, uint) are required to be prefixed with IIRC the requirements are relaxed when running with |
@tomusdrw fair enough, it does make more sense to prefix with @5chdn I suggest some form of special treatment is given to this kind of encoding error, in the JS API level. The JS API is higher level and already performs type conversion when convenient, so I wouldn't find it unreasonable for it to be more relaxed with the |
@asmello Yeah, imho the web3 library should add the prefixes if needed, since it's handling those conversions for other types. The RPC is as strict as possible to prevent some undefined behaviour and we prefer to keep it this way. |
@tomusdrw thanks, I didn't know about Actually, now that you mention it, the JS API is not mentioned anywhere in the docs except in the Basic Usage page, and that one just points to the Ethereum docs. Which means I've probably just been using the vanilla I suppose it's still relevant to highlight the strict behavior in the JSONRPC docs, or point to |
I'm running:
This last line fails with a JSON invalid params error. This is because the parser expects data's byte string to be prefixed with '0x', which doesn't apply to solc's bytecode. This wouldn't be considered a bug, except this requirement is not made clear by the documentation and other implementations of the same API relax it.
The text was updated successfully, but these errors were encountered: