func ParseBlockLayerKind(s string) (torus.BlockLayerKind, error) {
	smalls := strings.ToLower(s)
	switch smalls {
	case "base":
		return Base, nil
	case "crc":
		return CRC, nil
	case "rep", "r":
		return Replication, nil
	default:
		return torus.BlockLayerKind(-1), fmt.Errorf("no such block layer type: %s", s)
	}
}
func UnmarshalFromProto(layers []*models.BlockLayer, store torus.BlockStore) (torus.Blockset, error) {
	l := len(layers)
	var layer blockset
	if l == 0 {
		return nil, errors.New("No layers to unmarshal")
	}
	for i := l - 1; i >= 0; i-- {
		m := layers[i]
		// Options must be stored by the blockset when serialized
		newl, err := createBlockset(torus.BlockLayer{Kind: torus.BlockLayerKind(m.Type), Options: ""}, store, layer)
		if err != nil {
			return nil, err
		}
		err = newl.Unmarshal(m.Content)
		if err != nil {
			return nil, err
		}
		layer = newl
	}
	return layer, nil
}