diff --git a/infrastructure/docker/Dockerfile.bidderemulator b/infrastructure/docker/Dockerfile.bidderemulator new file mode 100644 index 000000000..e01396237 --- /dev/null +++ b/infrastructure/docker/Dockerfile.bidderemulator @@ -0,0 +1,22 @@ +FROM golang:1.23.0-alpine AS builder + +WORKDIR /app + +COPY p2p/go.mod p2p/go.sum /app/p2p/ +COPY x/go.mod x/go.sum /app/x/ +COPY contracts-abi/go.mod contracts-abi/go.sum /app/contracts-abi/ + +RUN cd /app/p2p && go mod download +RUN cd /app/x && go mod download +RUN cd /app/contracts-abi && go mod download + +COPY . . + +RUN go build -o /app/bidder-emulator ./p2p/integrationtest/real-bidder + +FROM alpine:3.10 + +COPY --from=builder /app/bidder-emulator /usr/local/bin/bidder-emulator +COPY --from=builder /app/p2p/integrationtest/real-bidder/entrypoint.sh entrypoint.sh + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/infrastructure/docker/Dockerfile.l1transactor b/infrastructure/docker/Dockerfile.l1transactor new file mode 100644 index 000000000..6097474af --- /dev/null +++ b/infrastructure/docker/Dockerfile.l1transactor @@ -0,0 +1,25 @@ +FROM golang:1.23.0-alpine AS builder + +WORKDIR /app + +COPY tools/go.mod tools/go.sum /app/tools/ +COPY p2p/go.mod p2p/go.sum /app/p2p/ +COPY x/go.mod x/go.sum /app/x/ +COPY contracts-abi/go.mod contracts-abi/go.sum /app/contracts-abi/ +COPY bridge/standard/go.mod bridge/standard/go.sum /app/bridge/standard/ + +RUN cd /app/tools && go mod download +RUN cd /app/x && go mod download +RUN cd /app/contracts-abi && go mod download +RUN cd /app/p2p && go mod download +RUN cd /app/bridge/standard && go mod download + +COPY . . + +RUN go build -o /app/l1-transactor ./tools/l1-transaction-emulator + +FROM alpine:3.10 + +COPY --from=builder /app/l1-transactor /usr/local/bin/l1-transactor + +ENTRYPOINT ["l1-transactor"] diff --git a/infrastructure/docker/Dockerfile.provideremulator b/infrastructure/docker/Dockerfile.provideremulator new file mode 100644 index 000000000..5ff3e86f7 --- /dev/null +++ b/infrastructure/docker/Dockerfile.provideremulator @@ -0,0 +1,22 @@ +FROM golang:1.23.0-alpine AS builder + +WORKDIR /app + +COPY p2p/go.mod p2p/go.sum /app/p2p/ +COPY x/go.mod x/go.sum /app/x/ +COPY contracts-abi/go.mod contracts-abi/go.sum /app/contracts-abi/ + +RUN cd /app/p2p && go mod download +RUN cd /app/x && go mod download +RUN cd /app/contracts-abi && go mod download + +COPY . . + +RUN go build -o /app/provider-emulator ./p2p/integrationtest/provider + +FROM alpine:3.10 + +COPY --from=builder /app/provider-emulator /usr/local/bin/provider-emulator +COPY --from=builder /app/p2p/integrationtest/provider/entrypoint.sh entrypoint.sh + +ENTRYPOINT ["./entrypoint.sh"] diff --git a/infrastructure/docker/Dockerfile.relayemulator b/infrastructure/docker/Dockerfile.relayemulator new file mode 100644 index 000000000..4f096e6bd --- /dev/null +++ b/infrastructure/docker/Dockerfile.relayemulator @@ -0,0 +1,25 @@ +FROM golang:1.23.0-alpine AS builder + +WORKDIR /app + +COPY tools/go.mod tools/go.sum /app/tools/ +COPY p2p/go.mod p2p/go.sum /app/p2p/ +COPY x/go.mod x/go.sum /app/x/ +COPY contracts-abi/go.mod contracts-abi/go.sum /app/contracts-abi/ +COPY bridge/standard/go.mod bridge/standard/go.sum /app/bridge/standard/ + +RUN cd /app/tools && go mod download +RUN cd /app/x && go mod download +RUN cd /app/contracts-abi && go mod download +RUN cd /app/bridge/standard && go mod download +RUN cd /app/p2p && go mod download + +COPY . . + +RUN go build -o /app/relay-emulator ./tools/relay-emulator + +FROM alpine:3.10 + +COPY --from=builder /app/relay-emulator /usr/local/bin/relay-emulator + +ENTRYPOINT ["relay-emulator"] diff --git a/p2p/integrationtest/provider/entrypoint.sh b/p2p/integrationtest/provider/entrypoint.sh new file mode 100755 index 000000000..c5b0a1b98 --- /dev/null +++ b/p2p/integrationtest/provider/entrypoint.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +EMULATOR_LOG_LEVEL=${EMULATOR_LOG_LEVEL:-"debug"} +EMULATOR_LOG_FMT=${EMULATOR_LOG_FMT:-"json"} + +flags="-log-level $EMULATOR_LOG_LEVEL -log-fmt $EMULATOR_LOG_FMT" + +if [ -n "$EMULATOR_LOG_TAGS" ]; then + flags="$flags -log-tags $EMULATOR_LOG_TAGS" +fi + +if [ -n "$EMULATOR_IP_RPC_PORT" ]; then + flags="$flags -server-addr $EMULATOR_IP_RPC_PORT" +fi + +if [ -n "$EMULATOR_METRICS_PORT" ]; then + flags="$flags -http-port $EMULATOR_METRICS_PORT" +fi + +if [ -n "$EMULATOR_RELAY_URL" ]; then + flags="$flags -relay $EMULATOR_RELAY_URL" +fi + +if [ -n "$EMULATOR_ERROR_PROBABILITY" ]; then + flags="$flags -error-probability $EMULATOR_ERROR_PROBABILITY" +fi + +if [ -n "$EMULATOR_OTEL_COLLECTOR_ENDPOINT_URL" ]; then + flags="$flags -otel-collector-endpoint-url $EMULATOR_OTEL_COLLECTOR_ENDPOINT_URL" +fi + +provider-emulator $flags diff --git a/p2p/integrationtest/provider/main.go b/p2p/integrationtest/provider/main.go index 5d36d5ce6..53226bc67 100644 --- a/p2p/integrationtest/provider/main.go +++ b/p2p/integrationtest/provider/main.go @@ -32,6 +32,7 @@ const ( logTagsFlagName = "log-tags" httpPortFlagName = "http-port" errorProbabilityFlagName = "error-probability" + relayFlagName = "relay" ) var ( @@ -71,7 +72,7 @@ var ( "The probability of returning an error when sending a bid response", ) relay = flag.String( - "relay", + relayFlagName, "", "Relay address", ) diff --git a/p2p/integrationtest/real-bidder/entrypoint.sh b/p2p/integrationtest/real-bidder/entrypoint.sh new file mode 100755 index 000000000..013522169 --- /dev/null +++ b/p2p/integrationtest/real-bidder/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +EMULATOR_LOG_LEVEL=${EMULATOR_LOG_LEVEL:-"debug"} +EMULATOR_LOG_FMT=${EMULATOR_LOG_FMT:-"json"} +EMULATOR_BID_WORKERS=${EMULATOR_BID_WORKERS:-"1"} + +flags="-log-level $EMULATOR_LOG_LEVEL -log-fmt $EMULATOR_LOG_FMT -bid-workers $EMULATOR_BID_WORKERS" + +if [ -n "$EMULATOR_LOG_TAGS" ]; then + flags="$flags -log-tags $EMULATOR_LOG_TAGS" +fi + +if [ -n "$EMULATOR_IP_RPC_PORT" ]; then + flags="$flags -server-addr $EMULATOR_IP_RPC_PORT" +fi + +if [ -n "$EMULATOR_METRICS_PORT" ]; then + flags="$flags -http-port $EMULATOR_METRICS_PORT" +fi + +if [ -n "$EMULATOR_OTEL_COLLECTOR_ENDPOINT_URL" ]; then + flags="$flags -otel-collector-endpoint-url $EMULATOR_OTEL_COLLECTOR_ENDPOINT_URL" +fi + +if [ -n "$EMULATOR_L1_RPC_URL" ]; then + flags="$flags -rpc-addr $EMULATOR_L1_RPC_URL" +fi + +bidder-emulator $flags diff --git a/p2p/integrationtest/real-bidder/main.go b/p2p/integrationtest/real-bidder/main.go index 1c4ec4c22..2bc784853 100644 --- a/p2p/integrationtest/real-bidder/main.go +++ b/p2p/integrationtest/real-bidder/main.go @@ -38,7 +38,7 @@ var ( ) rpcAddr = flag.String( "rpc-addr", - "localhost:13524", + "localhost:8545", "The server address in the format of host:port", ) logLevel = flag.String(