Skip to content

Commit

Permalink
Merge pull request #246 from bnb-chain/develop
Browse files Browse the repository at this point in the history
prepare for v0.5.1
  • Loading branch information
owen-reorg committed Sep 26, 2024
2 parents 2f232a8 + f278007 commit 4748aa3
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
provenance: false

push-op-batcher:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -75,6 +77,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
provenance: false

push-op-proposer:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -108,6 +112,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
provenance: false

push-op-bootnode:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -141,3 +147,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
provenance: false
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## v0.5.1

This is a minor release and upgrading is optional.

### What's Changed
* fix(ci): support building arm64 architecture by @welkin22 in https://github.com/bnb-chain/opbnb/pull/239
* fix(op-node): l1 client chan stuck when closed in ELSync mode by @welkin22 in https://github.com/bnb-chain/opbnb/pull/241
* fix: add sync status when newpayload API meet the specific error by @krish-nr in https://github.com/bnb-chain/opbnb/pull/240

### Docker Images

- ghcr.io/bnb-chain/op-node:v0.5.1
- ghcr.io/bnb-chain/op-batcher:v0.5.1
- ghcr.io/bnb-chain/op-proposer:v0.5.1

**Full Changelog**: https://github.com/bnb-chain/opbnb/compare/v0.5.0...v0.5.1

## v0.5.0

This release includes code merging from the upstream version v1.7.7 along with several fixs and improvements.
Expand Down
6 changes: 6 additions & 0 deletions op-batcher/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ ifeq ($(shell uname),Darwin)
endif

op-batcher:
ifeq ($(TARGETARCH),arm64)
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar zxf aarch64-linux-musl-cross.tgz
export PATH=$$PATH:/app/op-batcher/aarch64-linux-musl-cross/bin/ && env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CC=aarch64-linux-musl-gcc CGO_ENABLED=1 go build -v $(LDFLAGS) -o ./bin/op-batcher ./cmd
else
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-batcher ./cmd
endif

clean:
rm bin/op-batcher
Expand Down
6 changes: 6 additions & 0 deletions op-bootnode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

op-bootnode:
ifeq ($(TARGETARCH),arm64)
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar zxf aarch64-linux-musl-cross.tgz
export PATH=$$PATH:/app/op-bootnode/aarch64-linux-musl-cross/bin/ && env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CC=aarch64-linux-musl-gcc CGO_ENABLED=1 go build -v $(LDFLAGS) -o ./bin/op-bootnode ./cmd
else
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-bootnode ./cmd
endif

clean:
rm -f bin/op-bootnode
Expand Down
6 changes: 3 additions & 3 deletions op-node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM --platform=$BUILDPLATFORM golang:1.21.5-alpine3.18 as builder

ARG VERSION=v0.0.0

RUN apk add --no-cache build-base libc-dev
RUN apk add --no-cache build-base libc-dev wget
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash

# build op-node with the shared go.mod & go.sum files
Expand All @@ -17,10 +17,10 @@ COPY ./go.sum /app/go.sum
COPY ./.git /app/.git

WORKDIR /app/op-node

RUN go mod download

ARG TARGETOS TARGETARCH
ARG TARGETOS
ARG TARGETARCH

ENV CGO_CFLAGS="-O -D__BLST_PORTABLE__"
ENV CGO_CFLAGS_ALLOW="-O -D__BLST_PORTABLE__"
Expand Down
6 changes: 6 additions & 0 deletions op-node/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ ifeq ($(shell uname),Darwin)
endif

op-node:
ifeq ($(TARGETARCH),arm64)
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar zxf aarch64-linux-musl-cross.tgz
export PATH=$$PATH:/app/op-node/aarch64-linux-musl-cross/bin/ && env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CC=aarch64-linux-musl-gcc CGO_ENABLED=1 go build -v $(LDFLAGS) -o ./bin/op-node ./cmd/main.go
else
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-node ./cmd/main.go
endif

clean:
rm bin/op-node
Expand Down
6 changes: 6 additions & 0 deletions op-proposer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ LDFLAGSSTRING +=-X main.Version=$(VERSION)
LDFLAGS := -ldflags "$(LDFLAGSSTRING)"

op-proposer:
ifeq ($(TARGETARCH),arm64)
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar zxf aarch64-linux-musl-cross.tgz
export PATH=$$PATH:/app/op-proposer/aarch64-linux-musl-cross/bin/ && env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CC=aarch64-linux-musl-gcc CGO_ENABLED=1 go build -v $(LDFLAGS) -o ./bin/op-proposer ./cmd
else
env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -v $(LDFLAGS) -o ./bin/op-proposer ./cmd
endif

clean:
rm bin/op-proposer
Expand Down
1 change: 1 addition & 0 deletions op-service/sources/engine_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (s *EngineAPIClient) NewPayload(ctx context.Context, payload *eth.Execution
e.Trace("Received payload execution result", "status", result.Status, "latestValidHash", result.LatestValidHash, "message", result.ValidationError)
if err != nil {
if strings.Contains(err.Error(), derive.ErrELSyncTriggerUnexpected.Error()) {
result.Status = eth.ExecutionSyncing
return &result, err
}
e.Error("Payload execution failed", "err", err)
Expand Down
14 changes: 12 additions & 2 deletions op-service/sources/l1_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"strings"
"sync"
"sync/atomic"
"time"

"github.com/ethereum/go-ethereum"
Expand Down Expand Up @@ -62,9 +63,12 @@ type L1Client struct {
l1BlockRefsCache *caching.LRUCache[common.Hash, eth.L1BlockRef]

//ensure pre-fetch receipts only once
preFetchReceiptsOnce sync.Once
preFetchReceiptsOnce sync.Once
isPreFetchReceiptsRunning atomic.Bool
//start block for pre-fetch receipts
preFetchReceiptsStartBlockChan chan uint64
preFetchReceiptsClosedChan chan struct{}

//max concurrent requests
maxConcurrentRequests int
//done chan
Expand All @@ -83,6 +87,7 @@ func NewL1Client(client client.RPC, log log.Logger, metrics caching.Metrics, con
l1BlockRefsCache: caching.NewLRUCache[common.Hash, eth.L1BlockRef](metrics, "blockrefs", config.L1BlockRefsCacheSize),
preFetchReceiptsOnce: sync.Once{},
preFetchReceiptsStartBlockChan: make(chan uint64, 1),
preFetchReceiptsClosedChan: make(chan struct{}),
maxConcurrentRequests: config.MaxConcurrentRequests,
done: make(chan struct{}),
}, nil
Expand Down Expand Up @@ -140,13 +145,15 @@ func (s *L1Client) GoOrUpdatePreFetchReceipts(ctx context.Context, l1Start uint6
s.preFetchReceiptsStartBlockChan <- l1Start
s.preFetchReceiptsOnce.Do(func() {
s.log.Info("pre-fetching receipts start", "startBlock", l1Start)
s.isPreFetchReceiptsRunning.Store(true)
go func() {
var currentL1Block uint64
var parentHash common.Hash
for {
select {
case <-s.done:
s.log.Info("pre-fetching receipts done")
s.preFetchReceiptsClosedChan <- struct{}{}
return
case currentL1Block = <-s.preFetchReceiptsStartBlockChan:
s.log.Debug("pre-fetching receipts currentL1Block changed", "block", currentL1Block)
Expand Down Expand Up @@ -259,6 +266,9 @@ func (s *L1Client) ClearReceiptsCacheBefore(blockNumber uint64) {
}

func (s *L1Client) Close() {
s.done <- struct{}{}
if s.isPreFetchReceiptsRunning.Load() {
close(s.done)
<-s.preFetchReceiptsClosedChan
}
s.EthClient.Close()
}

0 comments on commit 4748aa3

Please sign in to comment.