-
Notifications
You must be signed in to change notification settings - Fork 20k
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
TransactionByHash failing due to inability to parse txdata.S value #19461
Comments
For a test I commented out the line in checkNumbetText (found in the file json.go) that would fail if there was a leading 0 and at least on the surface level there were no adverse issues and I was able to load the transaction:
|
Hmm, apparently we interpret the signature R, S, V fields are numbers, not as binary blobs. Numbers cannot have leading zeroes. Not sure what the correct representation is, perhaps that should be answered first, then we can decide who's at fault. Ping @fjl |
Thanks for the response. Hopefully some insights soon. At some point I'll be switching to test against Geth instead of Ganache but local development we use Ganache. Note: the version of Ganache this was against was 2.0.0. I'll be trying again against 2.0.1 (which was just released) shortly. |
Quick update: When using Ganache 2.0.1 there is the same issue. I'm still seeing txdata.S values that start with a zero. |
Just wanted to see if there was any update here? |
This is a bug in ganache. Transaction signature values returned through RPC should not contain leading zero. |
Sorry, my bad. I re-checked the RPC docs and R, S values are of type DATA, which means leading zeros are allowed after all. |
We should fix ganache anyway and update the spec. Transaction R, S values are integers everywhere. Parity treats them as integers also. |
Ganache PR: trufflesuite/ganache#432 |
Canonical issue for this is now: #18152 |
I have some ethereum code running in a contract that works fine. The code performs a mint operation of a type of token I created. The contract is currently compiled using geth but the contracts are deployed into Ganache (and I saw the following issue regardless of running against Ganache 2.0.0 and 1.2.2).
Today I updated my golang code to monitor and validate the mint transactions (mainly to see if they were pending) using TransactionByHash. What I found was that this call will periodically fail on some transactions with the message 'json: cannot unmarshal hex number with leading zero digits into Go value of type *hexutil.Big'.
After some extra logging in the go-ethereum code I produced the following output:
What you can see from the above is that the 's' value in the transaction isn't parsing because the 's' value is being unmarshalled as a hexutil.Big which uses 'checkNumberText' BUT that function fails due to the starting 0.
So while my operations are correct and things are minted fine, I have no way to verify the operation isn't pending (so I can potentially resubmit, etc).
System information
Geth version: 1.9.0-unstable (though failed on earlier version as well)
OS & Version: Windows 10 / WSL using Ubuntu 18.04
Expected behaviour
The TransactionByHash should load the otherwise successful transactions.
Actual behaviour
The transaction isn't loading due to a failure (see above)
Steps to reproduce the behaviour
Hard to say without using my code explicitly, but I am easily able to reproduce by attempting to load and check the mint transactions. I programmatically deploy multiple of the contract and then call mint on each. In any grouping of 4 calls I seem to guarantee at least 1 failure.
Backtrace
The text was updated successfully, but these errors were encountered: