prysm-pulse/fuzz/ssz_encoder_attestations_fuzz.go
2021-07-21 21:34:07 +00:00

28 lines
606 B
Go

package fuzz
import (
"bytes"
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/params"
)
var buf = new(bytes.Buffer)
// SszEncoderAttestationFuzz runs network encode/decode for attestations.
func SszEncoderAttestationFuzz(b []byte) {
params.UseMainnetConfig()
buf.Reset()
input := &ethpb.Attestation{}
e := encoder.SszNetworkEncoder{}
if err := e.DecodeGossip(b, input); err != nil {
_ = err
return
}
if _, err := e.EncodeGossip(buf, input); err != nil {
_ = err
return
}
}