Skip to content

Commit

Permalink
*: cherry pick commits (#2696)
Browse files Browse the repository at this point in the history
CHERRY-PICKED PRs

* Update timeout for publishing lock to 30s: #2685
* Fix synthetic proposal errors when a block for a slot is not found: #2693
* Bump go version to 1.21.4 to fix govulncheck builds: #2694

category: bug 
ticket: none
  • Loading branch information
xenowits authored Nov 9, 2023
1 parent 3b701cb commit ddf4d0a
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# Config options can be found in README here: https://github.com/golangci/golangci-lint-action
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck -show=stacks -test ./...
2 changes: 1 addition & 1 deletion .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- uses: actions/cache@v3
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-python@v2
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- 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@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- 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 @@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- 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@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- uses: actions/cache@v3
with:
path: |
Expand All @@ -78,7 +78,7 @@ jobs:
- uses: docker/setup-buildx-action@v2 # For compose to build images
- uses: actions/setup-go@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'
- uses: actions/cache@v3
with:
path: |
Expand Down
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@v4
with:
go-version: '1.21.3'
go-version: '1.21.4'

- name: "Verify PR"
run: go run github.com/obolnetwork/charon/testutil/verifypr
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 5m
go: "1.21.3"
go: "1.21.4"
linters-settings:
cyclop:
max-complexity: 15
Expand Down Expand Up @@ -99,7 +99,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.21.3"
go: "1.21.4"
checks:
- "all"
- "-SA1019" # Ignoring since github.com/drand/kyber/sign/bls uses Proof Of Possession as does Ethereum.
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.21.3-bullseye AS builder
FROM golang:1.21.4-bullseye AS builder
# Install dependencies
RUN apt-get update && apt-get install -y build-essential git
# Prep and copy source
Expand Down
11 changes: 8 additions & 3 deletions app/eth2wrap/synthproposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"crypto/sha256"
"encoding/binary"
"fmt"
"net/http"
"sync"

eth2client "github.com/attestantio/go-eth2-client"
Expand Down Expand Up @@ -141,16 +142,20 @@ func (h *synthWrapper) BlindedProposal(ctx context.Context, opts *eth2api.Blinde
func (h *synthWrapper) syntheticProposal(ctx context.Context, slot eth2p0.Slot, vIdx eth2p0.ValidatorIndex) (*eth2api.VersionedProposal, error) {
var signedBlock *eth2spec.VersionedSignedBeaconBlock

// Work our way back from previous slot to find a proposal to base the synthetic proposal on.
// Work our way back from previous slot to find a block to base the synthetic proposal on.
for prev := slot - 1; prev > 0; prev-- {
opts := &eth2api.SignedBeaconBlockOpts{
Block: fmt.Sprint(prev),
}
signed, err := h.Client.SignedBeaconBlock(ctx, opts)
if err != nil {
if apiErr := new(eth2api.Error); errors.As(err, apiErr) { // Continue if block is not found in the given slot.
if apiErr.StatusCode == http.StatusNotFound {
continue
}
}

return nil, err
} else if signed == nil { // go-eth2-client returns nil if proposal is not found.
continue
}

signedBlock = signed.Data
Expand Down
5 changes: 3 additions & 2 deletions app/obolapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ func (c Client) url() *url.URL {
return baseURL
}

// PublishLock posts the lockfile to obol-api.
// PublishLock posts the lockfile to obol-api. It has a 30s timeout.
func (c Client) PublishLock(ctx context.Context, lock cluster.Lock) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
// TODO(xenowits): Reduce the timeout once the obol-api is optimised for publishing large lock files.
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()

addr := c.url()
Expand Down
2 changes: 1 addition & 1 deletion testutil/compose/static/lighthouse/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ done
echo "Starting lighthouse validator client for ${NODE}"
exec lighthouse validator \
--testnet-dir "/tmp/testnet" \
--beacon-node "http://${NODE}:3600" \
--beacon-nodes "http://${NODE}:3600" \
--suggested-fee-recipient "0x0000000000000000000000000000000000000000"
2 changes: 1 addition & 1 deletion testutil/promrated/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3-alpine AS builder
FROM golang:1.21.4-alpine AS builder

# Install dependencies
RUN apk add --no-cache build-base git
Expand Down

0 comments on commit ddf4d0a

Please sign in to comment.