Skip to content

Commit

Permalink
Merge branch 'master' into gligneul/program-gas-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gligneul authored Oct 2, 2024
2 parents cb3b584 + 7a3d6e6 commit c9430a9
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/arbitrator-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ jobs:
- name: Install go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x

- name: Install custom go-ethereum
run: |
cd /tmp
git clone --branch v1.13.8 --depth 1 https://github.com/ethereum/go-ethereum.git
git clone --branch v1.14.11 --depth 1 https://github.com/ethereum/go-ethereum.git
cd go-ethereum
# Enable KZG point evaluation precompile early
sed -i 's#var PrecompiledContractsBerlin = map\[common.Address\]PrecompiledContract{#\0 common.BytesToAddress([]byte{0x0a}): \&kzgPointEvaluation{},#g' core/vm/contracts.go
go build -o /usr/local/bin/geth ./cmd/geth
- name: Setup nodejs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Install go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x

- name: Install wasm-ld
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Install go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
go-version: 1.23.x

- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ COPY --from=wasm-libs-builder /workspace/ /

FROM wasm-base AS wasm-bin-builder
# pinned go version
RUN curl -L https://golang.org/dl/go1.21.10.linux-`dpkg --print-architecture`.tar.gz | tar -C /usr/local -xzf -
RUN curl -L https://golang.org/dl/go1.23.1.linux-`dpkg --print-architecture`.tar.gz | tar -C /usr/local -xzf -
COPY ./Makefile ./go.mod ./go.sum ./
COPY ./arbcompress ./arbcompress
COPY ./arbos ./arbos
Expand Down Expand Up @@ -220,7 +220,7 @@ RUN ./download-machine.sh consensus-v30 0xb0de9cb89e4d944ae6023a3b62276e54804c24
RUN ./download-machine.sh consensus-v31 0x260f5fa5c3176a856893642e149cf128b5a8de9f828afec8d11184415dd8dc69
RUN ./download-machine.sh consensus-v32 0x184884e1eb9fefdc158f6c8ac912bb183bf3cf83f0090317e0bc4ac5860baa39

FROM golang:1.21.10-bookworm AS node-builder
FROM golang:1.23.1-bookworm AS node-builder
WORKDIR /workspace
ARG version=""
ARG datetime=""
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/offchainlabs/nitro

go 1.21
go 1.23

replace github.com/VictoriaMetrics/fastcache => ./fastcache

Expand Down Expand Up @@ -94,7 +94,6 @@ require (
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gammazero/deque v0.2.1 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
Expand Down
34 changes: 32 additions & 2 deletions staker/rollup_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
package staker

import (
"bytes"
"context"
"encoding/binary"
"errors"
"fmt"
"math/big"
"strings"
"sync/atomic"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/util/headerreader"
Expand Down Expand Up @@ -51,6 +54,7 @@ type RollupWatcher struct {
client RollupWatcherL1Interface
baseCallOpts bind.CallOpts
unSupportedL3Method atomic.Bool
supportedL3Method atomic.Bool
}

type RollupWatcherL1Interface interface {
Expand Down Expand Up @@ -79,15 +83,41 @@ func (r *RollupWatcher) getCallOpts(ctx context.Context) *bind.CallOpts {
return &opts
}

const noNodeErr string = "NO_NODE"

func looksLikeNoNodeError(err error) bool {
if err == nil {
return false
}
if strings.Contains(err.Error(), noNodeErr) {
return true
}
var errWithData rpc.DataError
ok := errors.As(err, &errWithData)
if !ok {
return false
}
dataString, ok := errWithData.ErrorData().(string)
if !ok {
return false
}
data := common.FromHex(dataString)
return bytes.Contains(data, []byte(noNodeErr))
}

func (r *RollupWatcher) getNodeCreationBlock(ctx context.Context, nodeNum uint64) (*big.Int, error) {
callOpts := r.getCallOpts(ctx)
if !r.unSupportedL3Method.Load() {
createdAtBlock, err := r.GetNodeCreationBlockForLogLookup(callOpts, nodeNum)
if err == nil {
r.supportedL3Method.Store(true)
return createdAtBlock, nil
}
log.Trace("failed to call getNodeCreationBlockForLogLookup, falling back on node CreatedAtBlock field", "err", err)
if headerreader.ExecutionRevertedRegexp.MatchString(err.Error()) {
if headerreader.ExecutionRevertedRegexp.MatchString(err.Error()) && !looksLikeNoNodeError(err) {
if r.supportedL3Method.Load() {
return nil, fmt.Errorf("getNodeCreationBlockForLogLookup failed despite previously succeeding: %w", err)
}
log.Info("getNodeCreationBlockForLogLookup does not seem to exist, falling back on node CreatedAtBlock field", "err", err)
r.unSupportedL3Method.Store(true)
} else {
return nil, err
Expand Down

0 comments on commit c9430a9

Please sign in to comment.