-
Notifications
You must be signed in to change notification settings - Fork 344
Use sha3 has for snative addresses for future-proofing #507
Use sha3 has for snative addresses for future-proofing #507
Conversation
0a8fe6c
to
ec741ce
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.
This minimally needs to change; other comments can come later
manager/eris-mint/evm/snative.go
Outdated
// hash of its name | ||
func (contract *SNativeContractDescription) Address() abi.Address { | ||
var address abi.Address | ||
copy(address[:], sha3.Sha3([]byte(contract.Name))[:abi.AddressLength]) |
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.
Ethereum takes the right most 20 bytes of the 256bit Keccak digest; not the first 20 bytes;
see eris-keys here https://github.com/eris-ltd/eris-keys/blob/master/crypto/key.go#L152-L153
or also here http://bitcoin.stackexchange.com/questions/42055/what-is-the-approach-to-calculate-an-ethereum-address-from-a-256-bit-private-key
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.
that's of a public key though, so it's kind of unrelated... We could copy, but I can't see how it will make any difference. The point is just to have a uniform hash over the 20 bytes.
ec741ce
to
4ecc033
Compare
Overall nice improvement |
a7dab6d
to
94f21e7
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.
This works quite nicely. Waiting on last bits to come in, and then should be ready for merge.
Yes, I reviewed it last thing before I left, but forgot to merge. lgtm |
…emplates Use sha3 has for snative addresses for future-proofing
No description provided.