Skip to content

[DataAvailability] Make criteria an entity or value object #8343

@illia-malachyn

Description

@illia-malachyn
  1. Currently, the criteria is defined this way:
type Criteria struct {
	// AgreeingExecutorsCount is the number of receipts including the same ExecutionResult
	AgreeingExecutorsCount uint

	// RequiredExecutors is the list of EN node IDs, one of which must have produced the result
	RequiredExecutors flow.IdentifierList

	// ParentExecutionResultID is the ID of the parent execution result.
	// If set, the result's PreviousResultID field must exactly match.
	ParentExecutionResultID flow.Identifier
}

It is not a good decision to expose all the fields of the object that is passed and used in many architectural layers and abstractions. We'd better encapsulate the implementation details and expose the functions that are needed. I'd recommend making criteria either

  • DDD's value object - read only; no behavior.
  • DDD's entity - with behavior (e.g. a func that tells if an executor group matches the criteria); parent execution result can be set via method call
  1. As part of this issue, let's replace DefaultCriteria usage with a method like NewDefaultCriteria()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions