-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
eth.accounts.signTransaction: expected r & s to be treated as quantity, not data #1170
Comments
https://github.com/pipermerriam/web3.py/blob/master/web3/account.py#L181..L182 'r': HexBytes(r, variable_length=True),
's': HexBytes(s, variable_length=True), |
@namuyan that question belongns back on the web3.py repo, not here on the web3.js repo. I'll answer back on the pull request. |
oops! web3.js! sorry! |
Occasionally run into error: Seems related here. My solution:
to
|
Could somebody post a transactions which returns leading zeros |
Please ReopenI'd like to reopen, since the individual values Key, Transaction & Expected SignatureI generated a web3py test with I copied the code below, and converted the 'txn, private_key, expected_raw_tx, tx_hash, r, s, v',
(
(
{
'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
'value': 1000000000,
'gas': 2000000,
'gasPrice': 234567897654321,
'nonce': 0,
'chainId': 1
},
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
'0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428',
'0xd8f64a42b57be0d565f385378db2f6bf324ce14a594afc05de90436e9ce01f60',
'0x9ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9c', # 31.5 bytes
'0x440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428', # 32 bytes
37,
),
(
{
'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
'value': 0,
'gas': 31853,
'gasPrice': 0,
'nonce': 0,
'chainId': 1
},
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
'0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20',
'0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a',
'0x22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd9', # 31 bytes
'0x83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20', # 31 bytes
38,
),
) |
I just merged the issue, not new release was made. Or did you try with the 1.0 branch? |
And btw, this is web3.js not py |
I added a change where we make sure to add a |
Right, but that PR said
Yes, I know. :) I work on web3.py, and a few months ago added some local private key signing code. As part of that, I had to generate tests for this same scenario (
I'm proposing that |
I'll comment there, thanks! |
@malissa and @jellegerbrandy can you please test the 1.0 branch for your issuer again? |
my tests pass. Thanks for merging this! |
I have same problem as you, can you help me how to deal with leading zero in raw-transaction? |
According to the docs, r & s are returned from signTransaction with leading zeros, implying that they are always 32 bytes of binary data. In many other implementations that return r & s (geth, parity, ethereum-keys), they are treated as integers, without leading zeros.
I would expect r & s in web3.eth.accounts.signTransaction to follow the same pattern.
The text was updated successfully, but these errors were encountered: