Skip to content

Commit

Permalink
Merge pull request #123 from KenshiTech/feature/cz
Browse files Browse the repository at this point in the history
Feature/cz
  • Loading branch information
pouya-eghbali authored Apr 9, 2024
2 parents eb09c80 + d916b62 commit 2b2dae6
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 34 deletions.
8 changes: 8 additions & 0 deletions .cz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
commitizen:
major_version_zero: true
name: cz_gitmoji
tag_format: v$version
update_changelog_on_bump: true
version: 0.11.21
version_scheme: semver
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ docker/pgadmin
node_trace.*
internal/bin
conf.*.private
.idea
.idea
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-added-large-files
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: forbid-submodules
- id: mixed-line-ending

- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-fmt
- id: go-mod-tidy
- id: go-imports
- id: golangci-lint-repo-mod

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint

- repo: https://github.com/commitizen-tools/commitizen
rev: v3.21.3
hooks:
- id: commitizen
additional_dependencies:
- "cz-conventional-gitmoji"
- id: commitizen-branch
additional_dependencies:
- "cz-conventional-gitmoji"
stages: [push]

- repo: https://github.com/ljnsn/cz-conventional-gitmoji
rev: v0.2.4
hooks:
- id: conventional-gitmoji
18 changes: 18 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends: relaxed

yaml-files:
- '*.yaml'
- '*.yaml.template'
- '*.yml'
- '.yamllint'

ignore:
- k8s/charts/unchained-worker/*
- '*.private/*'
- '*.private.yaml'

rules:
indentation:
spaces: 2

line-length: disable
60 changes: 47 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,86 @@
# Contributing to Unchained

Thank you for your interest in contributing to Unchained! We value your contributions and want to make sure the process is easy and beneficial for everyone involved. Please take a moment to read these guidelines to ensure a smooth contribution process.
Thank you for your interest in contributing to Unchained! We value your
contributions and want to make sure the process is easy and beneficial for
everyone involved. Please take a moment to read these guidelines to ensure a
smooth contribution process.

## Contribution Guidelines

### 1. Contributor License Agreement (CLA)

Before your contributions can be accepted, you must sign a Contributor License Agreement (CLA). This is a simple process that happens when you make your first pull request (PR).
Before your contributions can be accepted, you must sign a Contributor License
Agreement (CLA). This is a simple process that happens when you make your first
pull request (PR).

### 2. Forking and Branching Strategy

- **External Contributors**: Please fork the repository and submit your changes via a pull request from your fork.
- **Internal Contributors**: You should push your branches directly to the main project repository.
- **External Contributors**: Please fork the repository and submit your changes
via a pull request from your fork.
- **Internal Contributors**: You should push your branches directly to the main
project repository.

### 3. Issues and Pull Requests

- **Creating Issues**: Always create a GitHub issue before starting work on a pull request. Search for existing issues to avoid duplicates and check if someone else is already working on it.
- **Naming Branches**: Use semantic and meaningful branch names to make it clear what your contribution entails. Here are some good and bad examples:
- **Creating Issues**: Always create a GitHub issue before starting work on a
pull request. Search for existing issues to avoid duplicates and check if
someone else is already working on it.
- **Naming Branches**: Use semantic and meaningful branch names to make it clear
what your contribution entails. Here are some good and bad examples:

**Good Examples**

- `add-{x}-to-{y}-{issue-number}`
- `fix-{x}-in-{y}-{issue-number}`
- `feature-{xyz}-{issue-number}`
- `test-{xyz}-{issue-number}`

**Bad Examples**

- `bugfix`
- `potatoes`
- `mybranch`
- `johns-first-pr`

### 4. Coding Standards

- **Documentation**: Your code must be well-documented and commented. Aim for clarity and simplicity; your code should be easily understandable without relying solely on comments.
- **Naming Conventions**: Use descriptive and appropriate names for variables, functions, and branches to clearly convey their purpose.
- **Pull Request Details**: Ensure your pull requests and issues clearly describe what you're trying to achieve. This helps reviewers understand your intentions and the impact of your contributions.
- **Documentation**: Your code must be well-documented and commented. Aim for
clarity and simplicity; your code should be easily understandable without
relying solely on comments.
- **Naming Conventions**: Use descriptive and appropriate names for variables,
functions, and branches to clearly convey their purpose.
- **Pull Request Details**: Ensure your pull requests and issues clearly
describe what you're trying to achieve. This helps reviewers understand your
intentions and the impact of your contributions.

### 5. Pull Request Process

- Your PR should always target the `develop` branch.
- If the `develop` branch is updated before your PR is merged, you must rebase your commits to keep the history clean and avoid merge conflicts.
- If the `develop` branch is updated before your PR is merged, you must rebase
your commits to keep the history clean and avoid merge conflicts.

### 6. Commit Messages and Pull Requests

We use commitizen for commit and changelog management. You'll need the following
tools to get started:

- [Pre-commit](https://pre-commit.com/): Used for various pre-commit checks
including commit message lint checks.
- [Commitizen](https://commitizen-tools.github.io): Used for creating commit
messages and maintaining a logfile.
- [Golangci-lint](https://golangci-lint.run/): Used for Golang lint checks.

### 6. Commit Messages
You'll need to run the following command to setup the pre-commit hooks:

Commit messages should be descriptive and meaningful, helping to explain why and what you have done without needing to look at the source code directly. Please avoid using emojis and stick to ASCII readable characters to ensure clarity and compatibility.
```sh
pre-commit install --install-hooks --hook-type commit-msg --hook-type pre-push
```

## Conclusion

Following these guidelines helps us maintain a high standard of quality for our project and makes the contribution process more efficient and effective. We look forward to your contributions and are excited to see what we can achieve together in Unchained!
Following these guidelines helps us maintain a high standard of quality for our
project and makes the contribution process more efficient and effective. We look
forward to your contributions and are excited to see what we can achieve
together in Unchained!

Thank you for contributing!
8 changes: 4 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Additional Use Grant: You are granted the right to use the Licensed Work as-is,
on private networks. The intent is to ensure the Licensed
Work's application remains within its intended network
ecosystem.

You may operate the Licensed Work on private networks
for non-commercial purposes only. Permissible
non-commercial uses include, but are not limited to,
research, personal network use, and academic purposes.
This clause is to facilitate access to the Licensed Work
for non-profit and developmental activities.

Additionally, entities with an annual revenue of less than
100,000 CHF are granted the right to operate the Licensed
Work on private networks for their internal business
Expand All @@ -28,7 +28,7 @@ Additional Use Grant: You are granted the right to use the Licensed Work as-is,
Licensed Work for their growth and innovation, without the
immediate financial burden of acquiring a commercial
license.

Operating the Licensed Work on private networks for
commercial purposes, outside of the aforementioned
exception, is prohibited unless a separate commercial
Expand Down Expand Up @@ -125,4 +125,4 @@ other recipients of the licensed work to be provided by Licensor:

3. To specify a Change Date.

4. Not to modify this License in any other way.
4. Not to modify this License in any other way.
2 changes: 1 addition & 1 deletion conf.standalone.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rpc:
- wss://ethereum.publicnode.com
- https://eth.rpc.blxrbdn.com

- name: arbitrum:
- name: arbitrum
nodes:
- https://arbitrum-one.publicnode.com
- https://arbitrum.llamarpc.com
Expand Down
2 changes: 1 addition & 1 deletion docker/grafana/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ providers:
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards
foldersFromFilesStructure: true
foldersFromFilesStructure: true
1 change: 0 additions & 1 deletion internal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ imports:

fmt:
go fmt ./...

6 changes: 5 additions & 1 deletion internal/cmd/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ var brokerCmd = &cobra.Command{
panic(err)
}

ethereum.InitClientIdentity()
err = ethereum.InitClientIdentity()
if err != nil {
panic(err)
}

bls.InitClientIdentity()

ethRPC := ethereum.New()
Expand Down
6 changes: 5 additions & 1 deletion internal/cmd/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ var consumerCmd = &cobra.Command{
panic(err)
}

ethereum.InitClientIdentity()
err = ethereum.InitClientIdentity()
if err != nil {
panic(err)
}

bls.InitClientIdentity()

ethRPC := ethereum.New()
Expand Down
6 changes: 5 additions & 1 deletion internal/cmd/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ var workerCmd = &cobra.Command{
panic(err)
}

ethereum.InitClientIdentity()
err = ethereum.InitClientIdentity()
if err != nil {
panic(err)
}

bls.InitClientIdentity()

ethRPC := ethereum.New()
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Load(configPath, secretPath string) error {
}

if secretPath == "" {
secretPath = "./secrets.yaml"
secretPath = "./secrets.yaml" // #nosec G101
}

SecretFilePath = secretPath
Expand Down
2 changes: 1 addition & 1 deletion internal/config/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Token struct {
}

type ProofOfStake struct {
Chain string `env:"POS_CHAIN" env-default:"arbitrumSepolia" yaml:"chain"`
Chain string `env:"POS_CHAIN" env-default:"arbitrumSepolia" yaml:"chain"`
Address string `env:"POS_ADDRESS" env-default:"0x965e364987356785b7E89e2Fe7B70f5E5107332d" yaml:"address"`
Base int64 `env:"POS_BASE" env-default:"1" yaml:"base"`
}
Expand Down
1 change: 0 additions & 1 deletion internal/ethereum/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func saveConfig() error {
}

func InitClientIdentity() error {

var privateKey *ecdsa.PrivateKey
var err error
var privateKeyRegenerated bool
Expand Down
2 changes: 1 addition & 1 deletion k8s/charts/unchained-worker/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:
plugins:
uniswap:
rpc:
ethereum:
ethereum:
- https://ethereum.publicnode.com
- https://eth.llamarpc.com
- wss://ethereum.publicnode.com
Expand Down
2 changes: 1 addition & 1 deletion k8s/charts/unchained-worker/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ spec:
- metadata:
name: data
spec:
accessModes:
accessModes:
- ReadWriteOnce
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion k8s/charts/unchained-worker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ podManagementPolicy: "Parallel"
#podManagementPolicy: "OrderedReady"

image:
repository: ghcr.io/kenshitech/unchained
repository: ghcr.io/kenshitech/unchained
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"
Expand Down
9 changes: 6 additions & 3 deletions zk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ module unchained-zk

go 1.21.5

require (
github.com/consensys/gnark v0.9.1
github.com/consensys/gnark-crypto v0.12.2-0.20231013160410-1f65e75b6dfb
github.com/urfave/cli/v2 v2.26.0
)

require (
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark v0.9.1 // indirect
github.com/consensys/gnark-crypto v0.12.2-0.20231013160410-1f65e75b6dfb // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fxamacker/cbor/v2 v2.5.0 // indirect
Expand All @@ -19,7 +23,6 @@ require (
github.com/rs/zerolog v1.30.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/urfave/cli/v2 v2.26.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/crypto v0.12.0 // indirect
Expand Down
17 changes: 16 additions & 1 deletion zk/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE=
github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b h1:h9U78+dx9a4BKdQkBBos92HalKpaGKHrp+3Uo6yTodo=
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
Expand All @@ -32,6 +40,8 @@ github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFV
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c=
github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w=
Expand All @@ -49,14 +59,19 @@ golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
Expand Down

0 comments on commit 2b2dae6

Please sign in to comment.