@@ -9,7 +9,12 @@ import (
 
 // AddressToProverID creates a prover id by padding an address hash to 31 bytes
 func AddressToProverID(addr address.Address) [31]byte {
-	hash := addr.Hash()
+	// this code will no longer WAE when ID's or BLS pub keys are added
+	// as they will break the assumption of addresses all being the same length
+	if addr.Protocol() != address.Actor && addr.Protocol() != address.SECP256K1 {
+		panic("cannot create prover hash from new address protocol")
+	}
+	hash := addr.Payload()
 
 	dlen := 31          // desired length
 	hlen := len(hash)   // hash length
package sectorbuilder

import (
	"bytes"
	"encoding/binary"

	"github.com/filecoin-project/go-filecoin/address"
)

// AddressToProverID creates a prover id by padding an address hash to 31 bytes
func AddressToProverID(addr address.Address) [31]byte {
	hash := addr.Hash()

	dlen := 31          // desired length
	hlen := len(hash)   // hash length
	padl := dlen - hlen // padding length

	var prid [31]byte

	// will copy dlen bytes from hash
	copy(prid[:], hash)

	if padl > 0 {
		copy(prid[hlen:], bytes.Repeat([]byte{0}, padl))
	}

	return prid
}

// SectorIDToBytes creates a prover id by padding an address hash to 31 bytes
func SectorIDToBytes(sectorID uint64) [31]byte {
	slice := make([]byte, 31)
	binary.LittleEndian.PutUint64(slice, sectorID)

	var sectorIDAsBytes [31]byte
	copy(sectorIDAsBytes[:], slice)

	return sectorIDAsBytes
}

BLOCKING: This code does not assume addresses are all the same length (or even the desired length). This panic should be removed. If we do need that assurance, the check should be where we do make that assumption.