From 8f017ede64964b4fb584df8874ca729fb90f8bff Mon Sep 17 00:00:00 2001 From: mrekucci Date: Tue, 22 Oct 2024 20:46:04 +0700 Subject: [PATCH] feat: use l1 mock --- .github/workflows/infrastructure.yml | 3 --- bridge/standard/bridge-v1/cmd/emulator/main.go | 3 ++- infrastructure/nomad/cluster.sh | 2 +- .../playbooks/templates/jobs/mev-commit-oracle.nomad.j2 | 2 +- .../nomad/playbooks/templates/jobs/mock-l1.nomad.j2 | 6 +++++- infrastructure/nomad/playbooks/variables/profiles.yml | 9 +++++---- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/infrastructure.yml b/.github/workflows/infrastructure.yml index 757220a72..9f57f761d 100644 --- a/.github/workflows/infrastructure.yml +++ b/.github/workflows/infrastructure.yml @@ -73,7 +73,6 @@ jobs: CLUSTER_PROFILE_FLAG=$([ "${IS_MANUAL_DEPLOYMENT}" == "true" ] && echo "--profile ${{ github.event.inputs.profile }}" || echo "--profile ci") CLUSTER_LOGS_FLAG=$([ "${{ github.event.inputs.logs }}" == "false" ] && echo "--no-logs-collection" || echo "") CLUSTER_DATADOG_KEY_FLAG=$([ "${IS_MANUAL_DEPLOYMENT}" == "true" ] && echo "--datadog-key ${{ secrets.DATADOG_API_KEY }}" || echo "") - CLUSTER_L1_RPC_URL_FLAG="--l1-rpc-urls ${{ secrets.L1_RPC_URL }}" CLUSTER_OTEL_COLLECTOR_ENDPOINT_URL_FLAG=$([ "${{ github.event.inputs.tracing }}" == "true" ] && echo "--otel-collector-endpoint-url grpc://${TARGET_MACHINE_IP}:4317" || echo "") CLUSTER_DEBUG_FLAG=$([ "${{ github.event.inputs.debug }}" == "true" ] && echo "--debug" || echo "") @@ -84,7 +83,6 @@ jobs: echo "CLUSTER_PROFILE_FLAG=${CLUSTER_PROFILE_FLAG}" >> ${GITHUB_ENV} echo "CLUSTER_LOGS_FLAG=${CLUSTER_LOGS_FLAG}" >> ${GITHUB_ENV} echo "CLUSTER_DATADOG_KEY_FLAG=${CLUSTER_DATADOG_KEY_FLAG}" >> ${GITHUB_ENV} - echo "CLUSTER_L1_RPC_URL_FLAG=${CLUSTER_L1_RPC_URL_FLAG}" >> ${GITHUB_ENV} echo "CLUSTER_OTEL_COLLECTOR_ENDPOINT_URL_FLAG=${CLUSTER_OTEL_COLLECTOR_ENDPOINT_URL_FLAG}" >> ${GITHUB_ENV} echo "CLUSTER_DEBUG_FLAG=${CLUSTER_DEBUG_FLAG}" >> ${GITHUB_ENV} @@ -215,7 +213,6 @@ jobs: ${CLUSTER_PROFILE_FLAG} \ ${CLUSTER_LOGS_FLAG} \ ${CLUSTER_DATADOG_KEY_FLAG} \ - ${CLUSTER_L1_RPC_URL_FLAG} \ ${CLUSTER_OTEL_COLLECTOR_ENDPOINT_URL_FLAG} \ ${CLUSTER_DEBUG_FLAG} END_TIME="$(date +%s)" diff --git a/bridge/standard/bridge-v1/cmd/emulator/main.go b/bridge/standard/bridge-v1/cmd/emulator/main.go index 4271f68f5..7b8b46e73 100644 --- a/bridge/standard/bridge-v1/cmd/emulator/main.go +++ b/bridge/standard/bridge-v1/cmd/emulator/main.go @@ -9,6 +9,7 @@ import ( "net/http" "os" "os/signal" + "path" "slices" "strings" "syscall" @@ -160,7 +161,7 @@ func main() { if len(parts) != 2 { return fmt.Errorf("invalid keystore-path-password format: %s", kp) } - keySigner, err := keysigner.NewKeystoreSigner(parts[0], parts[1]) + keySigner, err := keysigner.NewKeystoreSigner(path.Dir(parts[0]), parts[1]) if err != nil { return fmt.Errorf("failed creating key signer: %w", err) } diff --git a/infrastructure/nomad/cluster.sh b/infrastructure/nomad/cluster.sh index 5d620fcc4..f5d69ce0f 100755 --- a/infrastructure/nomad/cluster.sh +++ b/infrastructure/nomad/cluster.sh @@ -14,7 +14,7 @@ deploy_version="HEAD" environment_name="devenv" profile_name="devnet" datadog_key="" -l1_rpc_urls="" +l1_rpc_urls="mock" otel_collector_endpoint_url="" genesis_file_url="" geth_bootnode_url="" diff --git a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-oracle.nomad.j2 b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-oracle.nomad.j2 index 0cb0763db..fbc6a193f 100644 --- a/infrastructure/nomad/playbooks/templates/jobs/mev-commit-oracle.nomad.j2 +++ b/infrastructure/nomad/playbooks/templates/jobs/mev-commit-oracle.nomad.j2 @@ -305,7 +305,7 @@ job "{{ job.name }}" { export MEV_ORACLE_PG_PASSWORD="${POSTGRES_PASSWORD}" export MEV_ORACLE_PG_DBNAME="${POSTGRES_DB}" - if ! timeout 5m bash -c 'until pg_isready -h ${MEV_ORACLE_PG_HOST} -p ${MEV_ORACLE_PG_PORT} -U ${MEV_ORACLE_PG_USER} -d ${MEV_ORACLE_PG_DBNAME}; do sleep 1; done'; then + if ! timeout 5m bash -c 'until pg_isready -h ${MEV_ORACLE_PG_HOST} -p ${MEV_ORACLE_PG_PORT} -U ${MEV_ORACLE_PG_USER} -d ${MEV_ORACLE_PG_DBNAME}; do sleep 2; done'; then echo "Waiting for PostgreSQL to start..." sleep 3 fi diff --git a/infrastructure/nomad/playbooks/templates/jobs/mock-l1.nomad.j2 b/infrastructure/nomad/playbooks/templates/jobs/mock-l1.nomad.j2 index eb708cf66..57b46beab 100644 --- a/infrastructure/nomad/playbooks/templates/jobs/mock-l1.nomad.j2 +++ b/infrastructure/nomad/playbooks/templates/jobs/mock-l1.nomad.j2 @@ -77,7 +77,11 @@ job "{{ job.name }}" { # Mutate genesis file to only have a single alloc to contract deployer ${GETH_BIN} --dev dumpgenesis > local/default_genesis.json - jq -s '.[0].alloc = .[1].alloc | .[0]' local/default_genesis.json local/genesis_{{ version }}.json > local/genesis.json + jq -s ' + .[0].alloc = .[1].alloc + | .[0].config.chainId = .[1].config.chainId + | .[0] + ' local/default_genesis.json local/genesis_{{ version }}.json > local/genesis.json ${GETH_BIN} --datadir local/data init local/genesis.json exec ${GETH_BIN} \ diff --git a/infrastructure/nomad/playbooks/variables/profiles.yml b/infrastructure/nomad/playbooks/variables/profiles.yml index acbca7705..815bc98ef 100644 --- a/infrastructure/nomad/playbooks/variables/profiles.yml +++ b/infrastructure/nomad/playbooks/variables/profiles.yml @@ -1,4 +1,5 @@ datacenter: "dc1" +resolved_l1_rpc_urls: "{{ ('http://' ~ ansible_facts['default_ipv4']['address'] ~ ':9545') if l1_rpc_urls == 'mock' else l1_rpc_urls }}" artifacts: bidder_emulator: &bidder_emulator_artifact @@ -504,7 +505,7 @@ jobs: - metrics: to: 8080 env: - l1_rpc_url: "{{ l1_rpc_urls.split(',')[0] }}" + l1_rpc_url: "{{ resolved_l1_rpc_urls.split(',')[0] }}" otel_collector_endpoint_url: "{{ otel_collector_endpoint_url }}" mev_commit_bidder_emulator_nodes: &mev_commit_bidder_emulator_nodes_job @@ -521,7 +522,7 @@ jobs: - metrics: to: 8080 env: - l1_rpc_url: "{{ l1_rpc_urls.split(',')[0] }}" + l1_rpc_url: "{{ resolved_l1_rpc_urls.split(',')[0] }}" mev_commit_oracle: &mev_commit_oracle_job name: mev-commit-oracle @@ -546,7 +547,7 @@ jobs: metrics: to: 8080 env: - l1_rpc_urls: "{{ l1_rpc_urls }}" + l1_rpc_urls: "{{ resolved_l1_rpc_urls }}" mev_commit_bridge: &mev_commit_bridge_job name: mev-commit-bridge @@ -559,7 +560,7 @@ jobs: to: 8080 env: l1_chain_id: "{{ environments[env].chain_id }}" - l1_rpc_url: "{{ l1_rpc_urls.split(',')[0] }}" + l1_rpc_url: "{{ resolved_l1_rpc_urls.split(',')[0] }}" mev_commit_faucet: &mev_commit_faucet_job name: mev-commit-faucet