Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

contracts, swarm: implement EIP-1577 #1232

Closed
wants to merge 33 commits into from
Closed

contracts, swarm: implement EIP-1577 #1232

wants to merge 33 commits into from

Conversation

acud
Copy link
Member

@acud acud commented Feb 19, 2019

from the issue below:
EIP-1062 has evolved into EIP-1577, which incorporates the use of multiaddr schemes into the resolver contract on ENS.

This allows clients to know from which Dstorage provider to request the content addressed hash directly from the resolver.

See:
https://ethereum-magicians.org/t/eip1577-multiaddr-support-for-ens/1969
status-im/status-mobile#6688
https://eips.ethereum.org/EIPS/eip-1577
ethereum/EIPs#1577

New contract: https://github.com/ensdomains/resolvers/blob/master/contracts/PublicResolver.sol

===============

fixes #940

@acud acud self-assigned this Feb 19, 2019
@adamschmideg adamschmideg added this to the 0.3.12 milestone Feb 21, 2019
contracts/ens/ens.go Outdated Show resolved Hide resolved
@acud acud marked this pull request as ready for review March 15, 2019 04:48
// Note: only CIDv1 is supported
func decodeEIP1577ContentHash(buf []byte) (storageNs, contentType, hashType, hashLength uint64, hash []byte, err error) {
if len(buf) < 10 {
return 0, 0, 0, 0, nil, fmt.Errorf("buffer too short")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no format param, I guess you just need errors.New.

ns_ipfs = 0xe3
ns_swarm = 0xe4

swarm_typecode = 0xfa //swarm manifest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just add a comment linking to the https://github.com/multiformats/multicodec ?

)

// Tests for the decoding of the example ENS
func TestEIPSpecCidDecode(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but tests like this are much more readable when they are in table-driven format, and you have to input and wantXXX (expectations) next to each other. Currently you have to look for consts outside the test and you have to read carefully the test to see what's compared where - otherwise you know that all wantXXX expectations are checked.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool. i copied the consts into the individual tests for readability sake. this specific test cannot go into the table format of the test below since it unit tests a different function. is this what you've meant?

for _, v := range []struct {
name string
headerBytes []byte
fails bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think wantErr is a better name here, but again up to you to decide.

Copy link
Contributor

@nonsense nonsense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a few minor comments, but overall lgtm.

Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor comment about usage of snake_case variable names, maybe they should be converted to camelCase.

@acud
Copy link
Member Author

acud commented Mar 20, 2019

as featured on ethereum/go-ethereum#19285

@acud acud closed this Mar 20, 2019
@frncmx frncmx deleted the eip-1577 branch March 20, 2019 11:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EIP-1577 - implement resolver contract changes
5 participants