Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add initial github action #160

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.20'
# Setup environment
- run: make install
# Do the linting
- run: make lint
17 changes: 17 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.20'
- run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ all: clean lint test build
.PHONY: lint
lint:
@echo ">>> Performing golang code linting.."
golangci-lint run --config=.golangci-lint.yml
golangci-lint run --config=.golangci.yml

.PHONY: test
test:
Expand Down
2 changes: 1 addition & 1 deletion pkg/air/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (p *Mul) Equate(other Expr) Expr { return &Sub{Args: []Expr{p, other}} }
// Constant represents a constant value within an expression.
type Constant struct{ Value *fr.Element }

// NewConstant construct an AIR expression representing a given constant.
// NewConst construct an AIR expression representing a given constant.
func NewConst(val *fr.Element) Expr {
return &Constant{val}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/air/gadgets/normalisation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"github.com/consensys/go-corset/pkg/table"
)

// Norm constructs an expression representing the normalised value of e. That is,
// an expression which is 0 when e is 0, and 1 when e is non-zero. This is done
// by introducing a synthetic column to hold the (pseudo) mutliplicative inverse
// of e.
// Normalise constructs an expression representing the normalised value of e.
// That is, an expression which is 0 when e is 0, and 1 when e is non-zero.
// This is done by introducing a synthetic column to hold the (pseudo)
// mutliplicative inverse of e.
func Normalise(e air.Expr, tbl *air.Schema) air.Expr {
// Construct pseudo multiplicative inverse of e.
ie := ApplyPseudoInverseGadget(e, tbl)
Expand Down
1 change: 1 addition & 0 deletions pkg/table/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (c *DataColumn[T]) Accepts(tr Trace) error {
return nil
}

//nolint:revive
func (c *DataColumn[T]) String() string {
if c.Type.AsField() != nil {
return fmt.Sprintf("(column %s)", c.Name)
Expand Down
6 changes: 6 additions & 0 deletions pkg/table/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func (p ZeroTest[E]) TestAt(row int, tr Trace) bool {
return val == nil || val.IsZero()
}

// String generates a human-readble string.
//
//nolint:revive
func (p ZeroTest[E]) String() string {
return fmt.Sprintf("%s", any(p.Expr))
}
Expand Down Expand Up @@ -130,6 +133,9 @@ func HoldsLocally[T Testable](k int, handle string, constraint T, tr Trace) erro
return nil
}

// String generates a human-readble string.
//
//nolint:revive
func (p *RowConstraint[T]) String() string {
if p.Domain == nil {
return fmt.Sprintf("(vanish %s %s)", p.Handle, any(p.Constraint))
Expand Down