Skip to content

Commit

Permalink
Merge branch 'master' into das-batch-store-chunking
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-Wilson authored Jun 4, 2024
2 parents 2aaf914 + 2423bd8 commit 4146eff
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ FROM scratch as wasm-libs-export
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.7.linux-`dpkg --print-architecture`.tar.gz | tar -C /usr/local -xzf -
# pinned go version
RUN curl -L https://golang.org/dl/go1.21.10.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 @@ -206,7 +206,7 @@ COPY ./scripts/download-machine.sh .
#RUN ./download-machine.sh consensus-v20 0x8b104a2e80ac6165dc58b9048de12f301d70b02a0ab51396c22b4b4b802a16a4
RUN ./download-machine.sh consensus-v30-rc.2 0xb0de9cb89e4d944ae6023a3b62276e54804c242fd8c4c2d8e6cc4450f5fa8b1b

FROM golang:1.21-bookworm as node-builder
FROM golang:1.21.10-bookworm as node-builder
WORKDIR /workspace
ARG version=""
ARG datetime=""
Expand Down
2 changes: 1 addition & 1 deletion execution/gethexec/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var DefaultSequencerConfig = SequencerConfig{
NonceFailureCacheExpiry: time.Second,
ExpectedSurplusSoftThreshold: "default",
ExpectedSurplusHardThreshold: "default",
EnableProfiling: true,
EnableProfiling: false,
}

var TestSequencerConfig = SequencerConfig{
Expand Down
2 changes: 1 addition & 1 deletion util/arbmath/math.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func SaturatingUSub[T Unsigned](a, b T) T {
return a - b
}

// SaturatingMul multiply two integers without over/underflow
// SaturatingUMul multiply two integers without over/underflow
func SaturatingUMul[T Unsigned](a, b T) T {
product := a * b
if b != 0 && product/b != a {
Expand Down
5 changes: 5 additions & 0 deletions validator/client/validation_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ func (c *ExecutionClient) LatestWasmModuleRoot() containers.PromiseInterface[com

func (c *ExecutionClient) WriteToFile(input *validator.ValidationInput, expOut validator.GoGlobalState, moduleRoot common.Hash) containers.PromiseInterface[struct{}] {
jsonInput := server_api.ValidationInputToJson(input)
if err := jsonInput.WriteToFile(); err != nil {
return stopwaiter.LaunchPromiseThread[struct{}](c, func(ctx context.Context) (struct{}, error) {
return struct{}{}, err
})
}
return stopwaiter.LaunchPromiseThread[struct{}](c, func(ctx context.Context) (struct{}, error) {
err := c.client.CallContext(ctx, nil, server_api.Namespace+"_writeToFile", jsonInput, expOut, moduleRoot)
return struct{}{}, err
Expand Down
13 changes: 13 additions & 0 deletions validator/server_api/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package server_api

import (
"encoding/base64"
"encoding/json"
"fmt"
"os"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
Expand Down Expand Up @@ -64,6 +66,17 @@ type InputJSON struct {
DebugChain bool
}

func (i *InputJSON) WriteToFile() error {
contents, err := json.MarshalIndent(i, "", " ")
if err != nil {
return err
}
if err = os.WriteFile(fmt.Sprintf("block_inputs_%d.json", i.Id), contents, 0600); err != nil {
return err
}
return nil
}

type UserWasmJson struct {
Module string
Asm string
Expand Down
6 changes: 3 additions & 3 deletions validator/valnode/redis/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (s *ValidationServer) Start(ctx_in context.Context) {
}
select {
case <-ctx.Done():
log.Info("Context done", "error", ctx.Err().Error())
log.Info("Context done while checking redis stream existance", "error", ctx.Err().Error())
return
case <-time.After(time.Millisecond * 100):
}
Expand All @@ -79,7 +79,7 @@ func (s *ValidationServer) Start(ctx_in context.Context) {
s.StopWaiter.LaunchThread(func(ctx context.Context) {
select {
case <-ctx.Done():
log.Info("Context done", "error", ctx.Err().Error())
log.Info("Context done while waiting a redis stream to be ready", "error", ctx.Err().Error())
return
case <-ready: // Wait until the stream exists and start consuming iteratively.
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func (s *ValidationServer) Start(ctx_in context.Context) {
case <-time.After(s.streamTimeout):
log.Error("Waiting for redis streams timed out")
case <-ctx.Done():
log.Info(("Context expired, failed to start"))
log.Info("Context done while waiting redis streams to be ready, failed to start")
return
}
}
Expand Down
30 changes: 30 additions & 0 deletions validator/valnode/redis/consumer_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package redis

import (
"context"
"testing"
"time"

"github.com/ethereum/go-ethereum/log"
"github.com/offchainlabs/nitro/util/redisutil"
"github.com/offchainlabs/nitro/util/testhelpers"
)

func TestTimeout(t *testing.T) {
handler := testhelpers.InitTestLog(t, log.LevelInfo)
ctx, cancel := context.WithCancel(context.Background())
redisURL := redisutil.CreateTestRedis(ctx, t)
TestValidationServerConfig.RedisURL = redisURL
TestValidationServerConfig.ModuleRoots = []string{"0x123"}
TestValidationServerConfig.StreamTimeout = 100 * time.Millisecond
vs, err := NewValidationServer(&TestValidationServerConfig, nil)
if err != nil {
t.Fatalf("NewValidationSever() unexpected error: %v", err)
}
vs.Start(ctx)
time.Sleep(time.Second)
if !handler.WasLogged("Waiting for redis streams timed out") {
t.Error("Expected message about stream time-outs was not logged")
}
cancel()
}
2 changes: 1 addition & 1 deletion wsbroadcastserver/clientconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (cc *ClientConnection) Receive(ctx context.Context, timeout time.Duration)
return msg, op, err
}

// readRequests reads json-rpc request from connection.
// readRequest reads json-rpc request from connection.
func (cc *ClientConnection) readRequest(ctx context.Context, timeout time.Duration) ([]byte, ws.OpCode, error) {
cc.ioMutex.Lock()
defer cc.ioMutex.Unlock()
Expand Down

0 comments on commit 4146eff

Please sign in to comment.