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

failed test for value = 0 #11

Merged
merged 1 commit into from
Jun 13, 2018
Merged

failed test for value = 0 #11

merged 1 commit into from
Jun 13, 2018

Conversation

olegabr
Copy link
Contributor

@olegabr olegabr commented Jun 5, 2018

This PR intensionally failing tests

I'm trying to call contract methods and get this error in return:

Failed to sendRawTransaction: RuntimeException: rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).Amount

I've tryed a lot of variants with your tests code. The only one that fails is when value is zero. It is typically the case when contract methods are called.

I've used ethereumjs-tx nodejs lib to independently calculate the signed transaction hex.

@sc0Vu
Copy link
Member

sc0Vu commented Jun 10, 2018

After trace this issue, found that the length and zero limit in ethereum transaction.
The value was transformed into empty buffer because of the limit, the hashed rlp encode were different.

Two different rlp encoded transaction data:

JS:
e4098504a817c800825208943535353535353535353535353535353535353535 80 80018080

PHP
e4098504a817c800825208943535353535353535353535353535353535353535 00 80018080

I think the best way to fix this is adding the two limit in library.
I'll merge this pr after finish the two limit.

Right now, you can get the correct signing data if value is empty string (0x80).
Thanks!

@sc0Vu sc0Vu mentioned this pull request Jun 11, 2018
3 tasks
@codecov-io
Copy link

Codecov Report

Merging #11 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #11      +/-   ##
============================================
- Coverage     86.61%   86.56%   -0.05%     
- Complexity       56       67      +11     
============================================
  Files             1        1              
  Lines           127      134       +7     
============================================
+ Hits            110      116       +6     
- Misses           17       18       +1
Impacted Files Coverage Δ Complexity Δ
src/Transaction.php 86.56% <0%> (-0.05%) 67% <0%> (+11%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e1d214...74034ba. Read the comment docs.

@sc0Vu sc0Vu merged commit 21fcb51 into web3p:master Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants