Skip to content

Commit

Permalink
Merge branch 'main' into luke/relay-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeHackett12 committed Apr 11, 2023
2 parents b1083cd + c968878 commit 3a883a1
Show file tree
Hide file tree
Showing 107 changed files with 1,940 additions and 747 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/add-issue-to-project.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# This is a basic workflow adding every issue in this repo to the Obol Project Management Board.
name: Add Issue To Project

# Controls when the workflow will run - new issues
on:
issues:
types:
- opened

# This workflow contains a single job called "build"
jobs:
build:
runs-on: ubuntu-latest
# Steps
steps:
- name: Add Issue To Project
uses: actions/[email protected]
with:
# URL of the project to add issues to
project-url: https://github.com/orgs/ObolNetwork/projects/7
# A GitHub personal access token with write access to the project, need org admin's token with repo and project permissions, need to store the token outside the script if public
github-token: ${{ secrets.GH_ORG_ADMIN_SECRET }}
8 changes: 3 additions & 5 deletions .github/workflows/build-push-deploy-promrated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ jobs:
obolnetwork/promrated
ghcr.io/obolnetwork/promrated
tags: |
# Tag "git short sha" on push to branch (main)
type=sha,event=branch,prefix=
# Tag "latest" on all events
# Tag "git short sha" on all git events
type=sha,prefix=
# Tag "latest" on all git events
type=raw,value=latest
# Tag "tag ref" on tag push events
type=ref,event=tag
- name: Login to Github container registry
uses: docker/login-action@v2
with:
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/build-push-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ jobs:
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v1
# Only allow building docker images from trunk (main) or patch (main/v0.X) protected branches.
- name: Check branch
run: |
# Short name for current branch
GIT_BRANCH=${GITHUB_REF#refs/heads/}
[[ $GIT_BRANCH = main* ]] || (echo "Not building image for invalid branch: $GIT_BRANCH" && exit 1)
- name: Define docker image meta data tags
id: meta
uses: docker/metadata-action@v3
Expand All @@ -28,13 +22,13 @@ jobs:
obolnetwork/charon
ghcr.io/obolnetwork/charon
tags: |
# Tag "git short sha" on push to branch (main)
type=sha,event=branch,prefix=
# Tag "git short sha" on all git events
type=sha,prefix=
# Tag "latest" on all events
type=raw,value=latest
# Tag "latest" on git-push-to-branch (main) events
type=raw,value=latest,event=branch
# Tag "tag ref" on tag push events
# Tag "tag ref" on git-tag events
type=ref,event=tag
- name: Login to Github container registry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: [ "main*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: [ "main*" ]
schedule:
- cron: '18 19 * * 6'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
push:
branches:
- main
- main*

permissions:
contents: read
Expand All @@ -16,7 +16,7 @@ jobs:
# Config options can be found in README here: https://github.com/golangci/golangci-lint-action
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@master
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
push:
branches:
- main
- main*

jobs:
govulncheck:
Expand All @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck -v -test ./...
43 changes: 43 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Label PR
on:
pull_request:
types: [ opened, reopened, edited, synchronize ]

jobs:
label_pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Calculate branch label
id: branch-label
run: |
# Short name for current branch. For PRs, use target branch (base ref)
# Reference: https://stackoverflow.com/questions/60300169/how-to-get-branch-name-on-github-action
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH"
LABEL=""
if [[ $GIT_BRANCH = main ]]; then
# Do not label main branch PRs
LABEL="skip"
elif [[ $GIT_BRANCH = main* ]]; then
# Label release branches
LABEL="branch-release"
else
# Label all other branches as invalid
LABEL="branch-invalid"
fi
echo "label=$LABEL" >> $GITHUB_OUTPUT
- uses: actions/github-script@v6
if: steps.branch-label.outputs.label != 'skip'
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["${{steps.branch-label.outputs.label}}"]
})
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
push:
branches:
- main
- main*
jobs:
pre-commit:
runs-on: ubuntu-latest
Expand All @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-python@v2
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- uses: pre-commit/[email protected]

- name: notify failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fetch-depth: 0 # Disable shallow checkout
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- run: go run . --help > cli-reference.txt
- run: go run testutil/genchangelog/main.go
- uses: softprops/action-gh-release@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ on:
pull_request:
push:
branches:
- main
- main*
jobs:
unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -51,7 +51,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/track-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'

- name: "Track PR"
run: go run github.com/obolnetwork/charon/testutil/trackpr
2 changes: 1 addition & 1 deletion .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20.2'
go-version: '1.20.3'

- name: "Verify PR"
run: go run github.com/obolnetwork/charon/testutil/verifypr
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 5m
go: "1.20.2"
go: "1.20.3"
linters-settings:
cyclop:
max-complexity: 15
Expand Down Expand Up @@ -85,7 +85,7 @@ linters-settings:
- "github.com/gogo/protobuf/proto" # Prefer google.golang.org/protobuf
- "github.com/prometheus/client_golang/prometheus/promauto" # Prefer ./app/promauto
staticcheck:
go: "1.20.2"
go: "1.20.3"
checks:
- "all"
- "-SA1019" # Ignoring since github.com/drand/kyber/sign/bls uses Proof Of Possession as does Ethereum.
Expand Down Expand Up @@ -143,6 +143,7 @@ linters:
- interfacer
- ireturn
- lll # Think about adding this (max line length)
- maintidx
- maligned
- musttag
- nonamedreturns
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Container for building Go binary.
FROM golang:1.20.2-bullseye AS builder
FROM golang:1.20.3-bullseye AS builder
# Install dependencies
RUN apt-get update && apt-get install -y build-essential git
# Prep and copy source
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Licensor: Obol Labs, Inc.
Licensed Work: Charon, the Distributed Validator Client
The Licensed Work is © 2022-2023 Obol Labs, Inc.

Additional Use Grant: Any uses listed and defined at
charon-license-grants.obol.eth
Additional Use Grant: The use of the Licensed Work by the Licensee is limited
to one distributed validator on a production network.

Change Date: The earlier of March 1, 2027 or a date specified at
charon-license-date.obol.eth

Change License: GNU General Public License Version 3.0
Change Licence: GNU General Public License Version 3.0

-----------------------------------------------------------------------------

Expand Down
8 changes: 6 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,11 @@ func wireP2P(ctx context.Context, life *lifecycle.Manager, conf Config,
}

// Start libp2p TCP node.
tcpNode, err := p2p.NewTCPNode(ctx, conf.P2P, p2pKey, connGater, false, conf.TestConfig.LibP2POpts...)
opts := []libp2p.Option{p2p.WithBandwidthReporter(peerIDs)}
opts = append(opts, conf.TestConfig.LibP2POpts...)

tcpNode, err := p2p.NewTCPNode(ctx, conf.P2P, p2pKey, connGater,
false, opts...)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -680,7 +684,7 @@ func newETH2Client(ctx context.Context, conf Config, life *lifecycle.Manager,
return nil, errors.New("beacon node endpoints empty")
}

eth2Cl, err := eth2wrap.NewMultiHTTP(ctx, eth2ClientTimeout, conf.BeaconNodeAddrs...)
eth2Cl, err := eth2wrap.NewMultiHTTP(eth2ClientTimeout, conf.BeaconNodeAddrs...)
if err != nil {
return nil, errors.Wrap(err, "new eth2 http client")
}
Expand Down
4 changes: 2 additions & 2 deletions app/eth2wrap/eth2wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ func WithSyntheticDuties(cl Client, pubkeys []eth2p0.BLSPubKey) Client {
}

// NewMultiHTTP returns a new instrumented multi eth2 http client.
func NewMultiHTTP(ctx context.Context, timeout time.Duration, addresses ...string) (Client, error) {
func NewMultiHTTP(timeout time.Duration, addresses ...string) (Client, error) {
var clients []Client
for _, address := range addresses {
address := address // Capture range variable.

cl := newLazy(func() (Client, error) {
cl := newLazy(func(ctx context.Context) (Client, error) {
eth2Svc, err := eth2http.New(ctx,
eth2http.WithLogLevel(zeroLogInfo),
eth2http.WithAddress(address),
Expand Down
Loading

0 comments on commit 3a883a1

Please sign in to comment.