Fix Withdrawal Credentials (#3517)

This commit is contained in:
Nishant Das
2019-09-18 20:22:34 +05:30
committed by terence tsao
parent 037c01f4d7
commit d9664d3b6b
3 changed files with 6 additions and 4 deletions

View File

@@ -113,6 +113,6 @@ func createDepositData(privKey *bls.SecretKey, pubKey *bls.PublicKey) (*ethpb.De
// withdrawal_credentials[1:] == hash(withdrawal_pubkey)[1:]
// where withdrawal_credentials is of type bytes32.
func withdrawalCredentialsHash(pubKey []byte) []byte {
h := hashutil.HashKeccak256(pubKey)
return append([]byte{blsWithdrawalPrefixByte}, h[0:]...)[:32]
h := hashutil.Hash(pubKey)
return append([]byte{blsWithdrawalPrefixByte}, h[1:]...)[:32]
}

View File

@@ -14,6 +14,7 @@ go_library(
deps = [
"//proto/eth/v1alpha1:go_default_library",
"//shared/bls:go_default_library",
"//shared/hashutil:go_default_library",
"//shared/params:go_default_library",
"@com_github_minio_sha256_simd//:go_default_library",
"@com_github_pborman_uuid//:go_default_library",

View File

@@ -4,6 +4,7 @@ import (
"github.com/prysmaticlabs/go-ssz"
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/hashutil"
"github.com/prysmaticlabs/prysm/shared/params"
)
@@ -47,6 +48,6 @@ func DepositInput(depositKey *Key, withdrawalKey *Key, amountInGwei uint64) (*et
// withdrawal_credentials[1:] == hash(withdrawal_pubkey)[1:]
// where withdrawal_credentials is of type bytes32.
func withdrawalCredentialsHash(withdrawalKey *Key) []byte {
h := Keccak256(withdrawalKey.PublicKey.Marshal())
return append([]byte{params.BeaconConfig().BLSWithdrawalPrefixByte}, h[0:]...)[:32]
h := hashutil.Hash(withdrawalKey.PublicKey.Marshal())
return append([]byte{params.BeaconConfig().BLSWithdrawalPrefixByte}, h[1:]...)[:32]
}