eth.rb icon indicating copy to clipboard operation
eth.rb copied to clipboard

Add ENS resolve support

Open dansimpson opened this issue 3 years ago • 1 comments

This does work to resolve common ENS names to a given address (I'm using it), with the caveat that the name normalization isn't to spec... so it will not work with some edge case names.

Opening this PR per request.

dansimpson avatar Sep 27 '22 15:09 dansimpson

Codecov Report

Merging #150 (e11c27e) into main (6e1a491) will increase coverage by 0.00%. The diff coverage is 100.00%.

:exclamation: Current head e11c27e differs from pull request most recent head 7baf4a5. Consider uploading reports for the commit 7baf4a5 to get more accurate results

@@           Coverage Diff            @@
##             main     #150    +/-   ##
========================================
  Coverage   99.74%   99.75%            
========================================
  Files          67       70     +3     
  Lines        3899     4028   +129     
========================================
+ Hits         3889     4018   +129     
  Misses         10       10            
Impacted Files Coverage Δ
lib/eth.rb 100.00% <100.00%> (ø)
lib/eth/ens/resolver.rb 100.00% <100.00%> (ø)
spec/eth/ens/resolver_spec.rb 100.00% <100.00%> (ø)
lib/eth/chain.rb 100.00% <0.00%> (ø)
lib/eth/client.rb 100.00% <0.00%> (ø)
spec/eth/tx_spec.rb 100.00% <0.00%> (ø)
lib/eth/signature.rb 100.00% <0.00%> (ø)
spec/eth/chain_spec.rb 100.00% <0.00%> (ø)
spec/eth/client_spec.rb 100.00% <0.00%> (ø)
spec/eth/signature_spec.rb 100.00% <0.00%> (ø)
... and 4 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov-commenter avatar Sep 27 '22 15:09 codecov-commenter

Had a few general Ruby comments, but really glad you did this. I let myself get stuck on the encoding, and you made the wise decision to get this out there even though it may not work in all use cases. Good call and thank you!

Yeah, I had to fight myself with the encoding piece. Perfect is the enemy of good.

dansimpson avatar Oct 02 '22 21:10 dansimpson

I'll adjust some things based on feedback @mculp tomorrow.

dansimpson avatar Oct 02 '22 22:10 dansimpson

@q9f I was able to make CI happy, two of the tests I had to mark as pending due to: 1) Lack of a library to handle the full extent of text processing required for ENS, and 2) No existing way to test live chains, or to do a full deploy of ENS contracts locally, write to them, etc. If there is an infura/alchemy key in CI secrets, then resolving a known ENS address on mainnet would work... with the small caveat that when that changes the test will need to be updated.

dansimpson avatar Nov 18 '22 03:11 dansimpson

Thank you. I can add an infura key to the pipelines in future.

q9f avatar Nov 21 '22 11:11 q9f