diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 37ed3e25e..5341e2ad7 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -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 @@ -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 @@ -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 @@ -141,3 +147,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + provenance: false diff --git a/CHANGELOG.md b/CHANGELOG.md index b681c76be..abd1cd666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/op-batcher/Makefile b/op-batcher/Makefile index 24d719c3b..12d0d7135 100644 --- a/op-batcher/Makefile +++ b/op-batcher/Makefile @@ -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 diff --git a/op-bootnode/Makefile b/op-bootnode/Makefile index f9f276e9e..bdc52769e 100644 --- a/op-bootnode/Makefile +++ b/op-bootnode/Makefile @@ -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 diff --git a/op-node/Dockerfile b/op-node/Dockerfile index 5207e2bcf..a0c24f543 100644 --- a/op-node/Dockerfile +++ b/op-node/Dockerfile @@ -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 @@ -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__" diff --git a/op-node/Makefile b/op-node/Makefile index 4c4cb9b3e..8138d3d51 100644 --- a/op-node/Makefile +++ b/op-node/Makefile @@ -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 diff --git a/op-proposer/Makefile b/op-proposer/Makefile index dff47b41d..911ad381b 100644 --- a/op-proposer/Makefile +++ b/op-proposer/Makefile @@ -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 diff --git a/op-service/sources/engine_client.go b/op-service/sources/engine_client.go index 1bac00d8f..9490df78f 100644 --- a/op-service/sources/engine_client.go +++ b/op-service/sources/engine_client.go @@ -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) diff --git a/op-service/sources/l1_client.go b/op-service/sources/l1_client.go index a0576eac3..a1c175e95 100644 --- a/op-service/sources/l1_client.go +++ b/op-service/sources/l1_client.go @@ -5,6 +5,7 @@ import ( "fmt" "strings" "sync" + "sync/atomic" "time" "github.com/ethereum/go-ethereum" @@ -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 @@ -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 @@ -140,6 +145,7 @@ 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 @@ -147,6 +153,7 @@ func (s *L1Client) GoOrUpdatePreFetchReceipts(ctx context.Context, l1Start uint6 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) @@ -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() }