-
Notifications
You must be signed in to change notification settings - Fork 589
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
Added support for eip-1191 #339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be a different address field as mentioned here: #305 (comment)
otherwise this can break upstream projects.
@ligi thanks for your answer, I thought that you asked me to not modified the token json file. So I need more clarification about the solution that you prefer:
Are you agreed with this? |
yes
yes
yes |
13d2cd7
to
63162cc
Compare
@ligi I did the changes that we have talked about. Please check them. Thanks! |
!address.hasValidERC55Checksum() | ||
address_eip1191 != null && !(address_eip1191.isValid()) -> throw InvalidAddress(address) | ||
|
||
(!address.hasValidERC55Checksum() && address_eip1191 == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also throw an error when the address_eip1191 is non null. We need to make sure that the address field is always valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did because we need the name of the file has the checksum following the eip1191 when it is appropriate. This allow us to have a better integration with Ledger and Trezor wallets for the different tokens that are in RSK.
Maybe something that we can do is this:
- if
address_eip1191
is empty or null, it will be validated using erc55 rules theaddress
field. (as it is working today) - if
address_eip1191
has a value, it will be validate with erc1191 rules and also theaddress
field. So basically the two fields has to be the same.
Another option is to modify the file name validation and allow to check the file name by address_eip1191
if it is appropriate.
Let me know what are your thought about this. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately this will not work - we cannot break the guarantees that the address field brings.
To have better TREZOR integration you need to change it on the TREZOR side - meaning there the check if the address_eip1191 field is there and if it is use it instead of the address field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's do what you have suggested. I will do the modifications and update the PR.
Just this one point - otherwise the PR looks good to me |
63162cc
to
ca10dce
Compare
there are currently failing tests after this change - can you have a look? All tests need to pass before I can merge |
Yes, sure I will review. |
ca10dce
to
868b437
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me the tests still fail - even with a clean:
✗ ~/g/e/tokens (pr/339 *$) ./gradlew clean test 23:25:01
> Task :test FAILED
TheTokenChecker > shouldPassForValidTokenEip1191 FAILED
java.lang.IllegalStateException at TheTokenChecker.kt:117
TheTokenChecker > shouldFailForInvalidChecksumEip1191 FAILED
java.lang.Exception at ExpectException.java:28
Caused by: java.lang.IllegalStateException at TheTokenChecker.kt:117
15 tests completed, 2 failed
I remember that I had the same issue. I fixed it removing the build and .gradle folder. I think this because kethereum version was updated and now it is used new functions. |
64465b4
to
e4c864c
Compare
I cloned again my repo and did
|
I guess you ran these tests on a non case sensitive OS ..-) |
fee26cf
to
1dc1712
Compare
1dc1712
to
684e11c
Compare
@ligi I could fix the issue :) |
It was implemented EIP-1191. By default for every network it will be used EIP-55.
It was necessary to update the version of Kethereum to support this PR. Also it was fixed chainId of RSK Network.
This PR is related to #305.
Please @ligi let me know what you think about these changes.