Skip to content

Commit

Permalink
feat: exports fields needed by the prover for integration
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBelling committed Sep 5, 2024
1 parent 88102b5 commit 42eab2b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/schema/constraint/permutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ func (p *PermutationConstraint) String() string {
return fmt.Sprintf("(permutation (%s) (%s))", targets, sources)
}

func (p *PermutationConstraint) Targets() []uint {

Check failure on line 79 in pkg/schema/constraint/permutation.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported method PermutationConstraint.Targets should have comment or be unexported (revive)
return p.targets
}

func (p *PermutationConstraint) Sources() []uint {

Check failure on line 83 in pkg/schema/constraint/permutation.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported method PermutationConstraint.Sources should have comment or be unexported (revive)
return p.sources
}

func sliceColumns(columns []uint, tr trace.Trace) []util.FrArray {
// Allocate return array
cols := make([]util.FrArray, len(columns))
Expand Down
10 changes: 10 additions & 0 deletions pkg/schema/constraint/range.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ func (p *RangeConstraint) Accepts(tr trace.Trace) error {
func (p *RangeConstraint) String() string {
return fmt.Sprintf("(range #%d %s)", p.column, p.bound)
}

func (p *RangeConstraint) Column() uint {

Check failure on line 63 in pkg/schema/constraint/range.go

View workflow job for this annotation

GitHub Actions / lint

exported: exported method RangeConstraint.Column should have comment or be unexported (revive)
return p.column
}

// Note: the bound is returned in the form of a uint because this is simpler

Check failure on line 67 in pkg/schema/constraint/range.go

View workflow job for this annotation

GitHub Actions / lint

exported: comment on exported method RangeConstraint.Bound should be of the form "Bound ..." (revive)
// and more straightforward to understand.
func (p *RangeConstraint) Bound() uint64 {
return p.bound.Uint64()
}
1 change: 1 addition & 0 deletions pkg/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type Assignment interface {
// with an error (or eventually perhaps report a warning).
type Constraint interface {
Accepts(tr.Trace) error
String() string
}

// Evaluable captures something which can be evaluated on a given table row to
Expand Down
6 changes: 6 additions & 0 deletions pkg/trace/array_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ func (p ArrayModule) Name() string {
return p.name
}

// Height returns the height of this module, meaning the number of assigned
// rows.
func (p ArrayModule) Height() uint {
return p.height
}

// ----------------------------------------------------------------------------

// ArrayColumn describes an individual column of data within a trace table.
Expand Down
2 changes: 2 additions & 0 deletions pkg/trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type Trace interface {
Width() uint
// Returns the height of the given context (i.e. module).
Height(Context) uint
// Module returns the list of assigned modules and their respective heights
Modules() util.Iterator[ArrayModule]
}

// Column describes an individual column of data within a trace table.
Expand Down

0 comments on commit 42eab2b

Please sign in to comment.