func BlockBodyFromProto(body *pb.BlockBody) (*BlockBody, error) {
	atts := make([]Attestation, len(body.Attestations))
	casperSlashings := make([]CasperSlashing, len(body.CasperSlashings))
	proposerSlashings := make([]ProposerSlashing, len(body.ProposerSlashings))
	deposits := make([]Deposit, len(body.Deposits))
	exits := make([]Exit, len(body.Exits))
	votes := make([]AggregatedVote, len(body.Votes))

	for i := range atts {
		a, err := AttestationFromProto(body.Attestations[i])
		if err != nil {
			return nil, err
		}
		atts[i] = *a
	}

	for i := range casperSlashings {
		cs, err := CasperSlashingFromProto(body.CasperSlashings[i])
		if err != nil {
			return nil, err
		}
		casperSlashings[i] = *cs
	}

	for i := range proposerSlashings {
		ps, err := ProposerSlashingFromProto(body.ProposerSlashings[i])
		if err != nil {
			return nil, err
		}
		proposerSlashings[i] = *ps
	}

	for i := range deposits {
		ds, err := DepositFromProto(body.Deposits[i])
		if err != nil {
			return nil, err
		}
		deposits[i] = *ds
	}

	for i := range exits {
		ex, err := ExitFromProto(body.Exits[i])
		if err != nil {
			return nil, err
		}
		exits[i] = *ex
	}

	for i := range votes {
		v, err := AggregatedVoteFromProto(body.Votes[i])
		if err != nil {
			return nil, err
		}
		votes[i] = *v
	}

	return &BlockBody{
		Attestations:      atts,
		CasperSlashings:   casperSlashings,
		ProposerSlashings: proposerSlashings,
		Deposits:          deposits,
		Exits:             exits,
		Votes:             votes,
	}, nil
}
// BlockBodyFromProto converts a protobuf representation of a block body to a block body.
BlockBodyFromProto converts a protobuf representation of a block body to a block body.
// BlockBodyFromProto converts a protobuf representation of a block body to a block body .
func BlockBodyFromProto(body *pb.BlockBody) (*BlockBody, error) {
	atts := make([]Attestation, len(body.Attestations))
	casperSlashings := make([]CasperSlashing, len(body.CasperSlashings))
	proposerSlashings := make([]ProposerSlashing, len(body.ProposerSlashings))
	deposits := make([]Deposit, len(body.Deposits))
	exits := make([]Exit, len(body.Exits))
	votes := make([]AggregatedVote, len(body.Votes))
	for i := range atts {
		a, err := AttestationFromProto(body.Attestations[i])
		if err != nil {
			return nil, err
		}
		atts[i] = *a
	}
	for i := range casperSlashings {
		cs, err := CasperSlashingFromProto(body.CasperSlashings[i])
		if err != nil {
			return nil, err
		}
		casperSlashings[i] = *cs
	}
	for i := range proposerSlashings {
		ps, err := ProposerSlashingFromProto(body.ProposerSlashings[i])
		if err != nil {
			return nil, err
		}
		proposerSlashings[i] = *ps
	}
	for i := range deposits {
		ds, err := DepositFromProto(body.Deposits[i])
		if err != nil {
			return nil, err
		}
		deposits[i] = *ds
	}
	for i := range exits {
		ex, err := ExitFromProto(body.Exits[i])
		if err != nil {
			return nil, err
		}
		exits[i] = *ex
	}
	for i := range votes {
		v, err := AggregatedVoteFromProto(body.Votes[i])
		if err != nil {
			return nil, err
		}
		votes[i] = *v
	}
	return &BlockBody{
		Attestations:      atts,
		CasperSlashings:   casperSlashings,
		ProposerSlashings: proposerSlashings,
		Deposits:          deposits,
		Exits:             exits,
		Votes:             votes,
	}, nil
}
func BlockBodyFromProto ( body * pb . BlockBody ) ( * BlockBody , error ) { atts := make ( [ ] Attestation , len ( body . Attestations ) ) casperSlashings := make ( [ ] CasperSlashing , len ( body . CasperSlashings ) ) proposerSlashings := make ( [ ] ProposerSlashing , len ( body . ProposerSlashings ) ) deposits := make ( [ ] Deposit , len ( body . Deposits ) ) exits := make ( [ ] Exit , len ( body . Exits ) ) votes := make ( [ ] AggregatedVote , len ( body . Votes ) ) for i := range atts { a , err := AttestationFromProto ( body . Attestations [ i ] ) if err != nil { return nil , err } atts [ i ] = * a } for i := range casperSlashings { cs , err := CasperSlashingFromProto ( body . CasperSlashings [ i ] ) if err != nil { return nil , err } casperSlashings [ i ] = * cs } for i := range proposerSlashings { ps , err := ProposerSlashingFromProto ( body . ProposerSlashings [ i ] ) if err != nil { return nil , err } proposerSlashings [ i ] = * ps } for i := range deposits { ds , err := DepositFromProto ( body . Deposits [ i ] ) if err != nil { return nil , err } deposits [ i ] = * ds } for i := range exits { ex , err := ExitFromProto ( body . Exits [ i ] ) if err != nil { return nil , err } exits [ i ] = * ex } for i := range votes { v , err := AggregatedVoteFromProto ( body . Votes [ i ] ) if err != nil { return nil , err } votes [ i ] = * v } return & BlockBody { Attestations : atts , CasperSlashings : casperSlashings , ProposerSlashings : proposerSlashings , Deposits : deposits , Exits : exits , Votes : votes , } , nil }
BlockBodyFromProto converts a protobuf representation of a block body to a block body.
BlockBodyFromProto converts a protobuf representation of a block body to a block body .