-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Labels
Description
- 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
- As part of this issue, let's replace DefaultCriteria usage with a method like NewDefaultCriteria()