prysmaticlabs / prysm

Function with cyclomatic complexity higher than threshold GO-R1005
Anti-pattern
Minor
5 days ago8 months old
func handleRPCError has a cyclomatic complexity of 17 with "high" risk
666}
667
668// Handles errors received from the RPC server according to the specification.
669func handleRPCError(err error) error {670	if err == nil {
671		return nil
672	}
func NewPayload has a cyclomatic complexity of 20 with "high" risk
126var ErrEmptyBlockHash = errors.New("Block hash is empty 0x0000...")
127
128// NewPayload calls the engine_newPayloadVX method via JSON-RPC.
129func (s *Service) NewPayload(ctx context.Context, payload interfaces.ExecutionData, versionedHashes []common.Hash, parentBlockRoot *common.Hash) ([]byte, error) {130	ctx, span := trace.StartSpan(ctx, "powchain.engine-api-client.NewPayload")
131	defer span.End()
132	start := time.Now()
func ForkchoiceUpdated has a cyclomatic complexity of 18 with "high" risk
197}
198
199// ForkchoiceUpdated calls the engine_forkchoiceUpdatedV1 method via JSON-RPC.
200func (s *Service) ForkchoiceUpdated(201	ctx context.Context, state *pb.ForkchoiceState, attrs payloadattribute.Attributer,
202) (*pb.PayloadIDBytes, []byte, error) {
203	ctx, span := trace.StartSpan(ctx, "powchain.engine-api-client.ForkchoiceUpdated")
func Validate has a cyclomatic complexity of 16 with "high" risk
 344}
 345
 346// Validate returns an error if key fields in ExecutionPayloadElectraJSON are nil or invalid.
 347func (j *ExecutionPayloadElectraJSON) Validate() error { 348	if j.ParentHash == nil {
 349		return errors.New("missing required field 'parentHash' for ExecutionPayload")
 350	}
func UnmarshalJSON has a cyclomatic complexity of 25 with "high" risk
1166	return nil
1167}
1168
1169func (e *ExecutionPayloadDenebWithValueAndBlobsBundle) UnmarshalJSON(enc []byte) error {1170	dec := GetPayloadV3ResponseJson{}
1171	if err := json.Unmarshal(enc, &dec); err != nil {
1172		return err