Skip to content

Commit

Permalink
contracts/ens: revert bmt to keccak256 (#19323)
Browse files Browse the repository at this point in the history
* contracts/ens: revert bmt to keccak256

* contracts/ens: fix keccak256 hash code comment
  • Loading branch information
acud authored and zelig committed Mar 27, 2019
1 parent 7fb8969 commit 67fc037
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions contracts/ens/cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const (
nsIpfs = 0xe3
nsSwarm = 0xe4

swarmTypecode = 0xfa //swarm manifest, see https://github.com/multiformats/multicodec/blob/master/table.csv
swarmHashtype = 0xd6 // BMT, see https://github.com/multiformats/multicodec/blob/master/table.csv
swarmTypecode = 0xfa // swarm manifest, see https://github.com/multiformats/multicodec/blob/master/table.csv
swarmHashtype = 0x1b // keccak256, see https://github.com/multiformats/multicodec/blob/master/table.csv

hashLength = 32
)
Expand Down Expand Up @@ -106,7 +106,7 @@ func EncodeSwarmHash(hash common.Hash) ([]byte, error) {
nsSwarm, //swarm namespace
cidv1, // CIDv1
swarmTypecode, // swarm hash
swarmHashtype, // swarm bmt hash
swarmHashtype, // keccak256 hash
hashLength, //hash length. 32 bytes
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/ens/cid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ func TestManualCidDecode(t *testing.T) {
}{
{
name: "values correct, should not fail",
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x20},
headerBytes: []byte{0xe4, 0x01, 0xfa, 0x1b, 0x20},
wantErr: false,
},
{
name: "cid version wrong, should fail",
headerBytes: []byte{0xe4, 0x00, 0xfa, 0xd6, 0x20},
headerBytes: []byte{0xe4, 0x00, 0xfa, 0x1b, 0x20},
wantErr: true,
},
{
name: "hash length wrong, should fail",
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x1f},
headerBytes: []byte{0xe4, 0x01, 0xfa, 0x1b, 0x1f},
wantErr: true,
},
{
Expand Down

0 comments on commit 67fc037

Please sign in to comment.