aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElad <theman@elad.im>2019-03-27 21:07:03 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2019-03-27 21:07:03 +0800
commit67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3 (patch)
treeb8ede7e00e01ce2a24d8977156dd480a245632c8
parent7fb89697fd248879a0fd1ac0b925b91b3dda0e22 (diff)
downloadgo-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar.gz
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar.bz2
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar.lz
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar.xz
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.tar.zst
go-tangerine-67fc0377e13416d9a1f8ea32e7d1b0ca89374bf3.zip
contracts/ens: revert bmt to keccak256 (#19323)
* contracts/ens: revert bmt to keccak256 * contracts/ens: fix keccak256 hash code comment
-rw-r--r--contracts/ens/cid.go6
-rw-r--r--contracts/ens/cid_test.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/contracts/ens/cid.go b/contracts/ens/cid.go
index fae9bfd0a..673e8203e 100644
--- a/contracts/ens/cid.go
+++ b/contracts/ens/cid.go
@@ -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
)
@@ -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
}
diff --git a/contracts/ens/cid_test.go b/contracts/ens/cid_test.go
index f2f188084..7d0e67851 100644
--- a/contracts/ens/cid_test.go
+++ b/contracts/ens/cid_test.go
@@ -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,
},
{