Skip to content

Commit

Permalink
Merge pull request #292 from Consensys/integration/export-all-needed-…
Browse files Browse the repository at this point in the history
…fields

Integration: exports the fields needed by the prover for integration
  • Loading branch information
DavePearce authored Sep 5, 2024
2 parents 88102b5 + 5d5b937 commit 7b5d9c1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/schema/constraint/permutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ func (p *PermutationConstraint) String() string {
return fmt.Sprintf("(permutation (%s) (%s))", targets, sources)
}

// Targets returns the indices of the columns composing the "left" table of the
// permutation.
func (p *PermutationConstraint) Targets() []uint {
return p.targets
}

// Sources returns the indices of the columns composing the "right" table of the
// permutation.
func (p *PermutationConstraint) Sources() []uint {
return p.sources
}

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

// Column returns the index of the column subjected to the constraint.
func (p *RangeConstraint) Column() uint {
return p.column
}

// Bound returns the range boundary of the constraint.
//
// Note: the bound is returned in the form of a uint because this is simpler
// 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 7b5d9c1

Please sign in to comment.