Skip to content

Commit c758c68

Browse files
committed
More frontend changes
1 parent 17c4a1d commit c758c68

File tree

26 files changed

+8582
-106
lines changed

26 files changed

+8582
-106
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ contracts/abi/
1212
benchmark/benchmark
1313

1414
.env
15+
16+
# Node
17+
coverage/
18+
!**/__fixtures__/coverage
19+
node_modules
20+
yarn-debug.log*
21+
yarn-error.log*

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ build-binaries: build-reth build-geth build-rbuilder
5858
build-backend:
5959
cd report/backend && env GO111MODULE=on GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) CGO_ENABLED=0 go build -v $(LDFLAGS) -o ../../bin/base-bench-api cmd/main.go
6060

61+
.PHONY: build-frontend
62+
build-frontend:
63+
cd report && yarn build
64+
6165
.PHONY: run-backend
6266
run-backend:
6367
./bin/base-bench-api --s3-bucket ${BASE_BENCH_API_S3_BUCKET}

benchmark/flags/flags.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ const (
2323
TxFuzzBinFlagName = "tx-fuzz-bin"
2424
ProxyPortFlagName = "proxy-port"
2525
BenchmarkRunIDFlagName = "benchmark-run-id"
26+
MachineTypeFlagName = "machine-type"
27+
MachineProviderFlagName = "machine-provider"
28+
MachineRegionFlagName = "machine-region"
29+
FileSystemFlagName = "file-system"
2630
)
2731

2832
// TxFuzz defaults

configs/examples/snapshot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ benchmarks:
1919
- node_type: reth
2020
# Download an initial reth snapshot that can be copied for each test
2121
command: ./scripts/setup-initial-snapshot.sh --network=sepolia --node-type=reth --destination=/data/snapshots/reth/initial
22+
destination: /data/snapshots/reth/initial
2223
superchain_chain_id: 84532
2324
- node_type: geth
2425
# Download an initial geth snapshot that can be copied for each test
2526
command: ./scripts/setup-initial-snapshot.sh --network=sepolia --node-type=geth --destination=/data/snapshots/geth/initial
27+
destination: /data/snapshots/geth/initial
2628
superchain_chain_id: 84532
2729
variables:
2830
- type: payload

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ require (
1212
github.com/ethereum/go-ethereum v1.16.0
1313
github.com/holiman/uint256 v1.3.2
1414
github.com/pkg/errors v0.9.1
15+
github.com/prometheus/client_model v0.6.2
1516
github.com/prometheus/common v0.62.0
1617
github.com/stretchr/testify v1.10.0
1718
github.com/urfave/cli/v2 v2.27.6
@@ -121,7 +122,6 @@ require (
121122
github.com/pion/transport/v3 v3.0.7 // indirect
122123
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
123124
github.com/prometheus/client_golang v1.22.0 // indirect
124-
github.com/prometheus/client_model v0.6.2 // indirect
125125
github.com/prometheus/procfs v0.15.1 // indirect
126126
github.com/rivo/uniseg v0.4.7 // indirect
127127
github.com/rogpeppe/go-internal v1.13.1 // indirect

report/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,20 @@ node_modules
33
dist
44
.vite
55
.vercel
6+
7+
# Node
8+
coverage/
9+
!**/__fixtures__/coverage
10+
node_modules
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
15+
# Yarn
16+
.yarn/*
17+
!.yarn/patches
18+
!.yarn/releases
19+
!.yarn/plugins
20+
!.yarn/sdks
21+
!.yarn/versions
22+
.pnp.*

report/.yarn/releases/yarn-4.9.4.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

report/.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
enableTelemetry: false
2+
3+
nodeLinker: node-modules
4+
5+
yarnPath: .yarn/releases/yarn-4.9.4.cjs

report/backend/cmd/main.go

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import (
44
"context"
55
"net/http"
66
"os"
7+
"os/signal"
78
"sync/atomic"
9+
"syscall"
810
"time"
911

1012
"benchmark-report-api/internal/config"
@@ -100,7 +102,57 @@ type ServerService struct {
100102

101103
func (s *ServerService) Start(ctx context.Context) error {
102104
s.logger.Info("Server starting", "addr", s.server.Addr)
103-
return s.server.ListenAndServe()
105+
106+
// Create a channel to listen for OS signals (Ctrl+C, SIGTERM)
107+
sigChan := make(chan os.Signal, 1)
108+
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
109+
defer signal.Stop(sigChan) // Clean up signal notification
110+
111+
// Start server in a goroutine
112+
serverErr := make(chan error, 1)
113+
go func() {
114+
if err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
115+
serverErr <- err
116+
}
117+
}()
118+
119+
// Wait for either a signal or server error
120+
select {
121+
case err := <-serverErr:
122+
s.logger.Error("Server failed to start", "error", err)
123+
return err
124+
case sig := <-sigChan:
125+
s.logger.Info("Received shutdown signal", "signal", sig)
126+
127+
// Create a context with timeout for graceful shutdown
128+
shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
129+
defer cancel()
130+
131+
s.logger.Info("Shutting down server gracefully...")
132+
if err := s.server.Shutdown(shutdownCtx); err != nil {
133+
s.logger.Error("Server forced to shutdown", "error", err)
134+
return err
135+
}
136+
137+
s.logger.Info("Server shutdown complete")
138+
s.stopped.Store(true)
139+
return nil
140+
case <-ctx.Done():
141+
s.logger.Info("Context cancelled, shutting down server")
142+
143+
// Create a context with timeout for graceful shutdown
144+
shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
145+
defer cancel()
146+
147+
if err := s.server.Shutdown(shutdownCtx); err != nil {
148+
s.logger.Error("Server forced to shutdown", "error", err)
149+
return err
150+
}
151+
152+
s.logger.Info("Server shutdown complete")
153+
s.stopped.Store(true)
154+
return ctx.Err()
155+
}
104156
}
105157

106158
func (s *ServerService) Stop(ctx context.Context) error {

report/backend/internal/handlers/metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func MetadataHandler(s3Service *services.S3Service, l log.Logger) gin.HandlerFun
2121
return
2222
}
2323

24-
c.Header("Cache-Control", "public, max-age=86400") // 1 day
24+
c.Header("Cache-Control", "public, max-age=43200") // 12 hours
2525
c.JSON(http.StatusOK, metadata)
2626
}
2727
}

0 commit comments

Comments
 (0)