From 4b374d9f049e9d03128b81e00269afded742d0f5 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 15 May 2024 21:35:41 +0200 Subject: [PATCH] feat: updated infra privacy to support privacy set up (#56) * fix: updating infra for privacy * fix: deleted secrets * fix: added raw * fix: updated nomad * fix: fixed job env * fix: fixing oracle nomad job * fix: updated order * fix: updated infra * fix: deleted comment for datadog logs * fix: fixes after merge * chore: get rid of contracts hardcode --- contracts-abi/config/testnet.go | 10 ++-- infrastructure/nomad/deploy.yml | 56 +++++++++---------- .../nomad/mev-commit-emulator.nomad.j2 | 12 +--- .../nomad/mev-commit-funder.nomad.j2 | 2 +- .../nomad/mev-commit-oracle.nomad.j2 | 22 +++++++- .../nomad/templates/nomad/mev-commit.nomad.j2 | 3 + infrastructure/nomad/vars.yml | 43 ++++++-------- 7 files changed, 75 insertions(+), 73 deletions(-) diff --git a/contracts-abi/config/testnet.go b/contracts-abi/config/testnet.go index 553abeb3e..eb74d2c07 100644 --- a/contracts-abi/config/testnet.go +++ b/contracts-abi/config/testnet.go @@ -9,9 +9,9 @@ type Contracts struct { } var TestnetContracts = Contracts{ - BidderRegistry: "0xded9029fC3789ED393D62686c0c0f9dfA92aA2f6", - ProviderRegistry: "0xFA19327bDBf2632aAB7C77e61DC69DbC872d5AC1", - PreconfCommitmentStore: "0x1F8989fAd5f0538D794Fd9fa15d50942F305f367", - Oracle: "0x1cB85eC90320Ef25FB4F991E41392f518980e53a", - BlockTracker: "0xCB4AA84C916BB891cBF43320e0c97C3d4329Cec7", + BidderRegistry: "0x1E218818D409E0f00dfeBE8A960F7585d4fDff70", + ProviderRegistry: "0x0332388390d9df01cA3d26269f2B1Fc314deD9c0", + PreconfCommitmentStore: "0x2Aff805aBdF1Fe79AfcF8B3a9B4B45ECcD6b6D6e", + Oracle: "0x77A4FE615de28fdf0bF68D9B9ba773A32b5C7630", + BlockTracker: "0x042744D8cF66d8455350D43F9e09CA73b5C0CB94", } diff --git a/infrastructure/nomad/deploy.yml b/infrastructure/nomad/deploy.yml index c9aeff9b2..1bfd57fed 100644 --- a/infrastructure/nomad/deploy.yml +++ b/infrastructure/nomad/deploy.yml @@ -8,33 +8,33 @@ profiles: devnet: job_names: - - 'datadog-agent-logs-collector' - - 'mev-commit-geth-bootnode1' - - 'mev-commit-geth-signer-node1' - - 'mev-commit-geth-member-node' - - 'deploy-contracts' - - 'mev-commit-bootnode1' - - 'mev-commit-provider-node1' - - 'mev-commit-provider-node1-funder' - - 'mev-commit-bidder-node1' - - 'mev-commit-bidder-node1-funder' - - 'mev-commit-provider-emulator-node1' - - 'mev-commit-bidder-emulator-node1' - - 'mev-commit-oracle' - - 'datadog-agent-metrics-collector' + - "datadog-agent-logs-collector" + - "mev-commit-geth-bootnode1" + - "mev-commit-geth-signer-node1" + - "mev-commit-geth-member-node" + - "deploy-contracts" + - "mev-commit-bootnode1" + - "mev-commit-provider-node1" + - "mev-commit-provider-node1-funder" + - "mev-commit-oracle" + - "mev-commit-bidder-node1" + - "mev-commit-bidder-node1-funder" + - "mev-commit-provider-emulator-node1" + - "mev-commit-bidder-emulator-node1" + - "datadog-agent-metrics-collector" testnet: job_names: - - 'datadog-agent-logs-collector' - - 'mev-commit-geth-bootnode1' - - 'mev-commit-geth-signer-node1' - - 'mev-commit-geth-member-node' - - 'deploy-contracts' - - 'mev-commit-bootnode1' - - 'mev-commit-provider-node1' - - 'mev-commit-provider-node1-funder' - - 'mev-commit-provider-emulator-node1' - - 'mev-commit-oracle' - - 'datadog-agent-metrics-collector' + - "datadog-agent-logs-collector" + - "mev-commit-geth-bootnode1" + - "mev-commit-geth-signer-node1" + - "mev-commit-geth-member-node" + - "deploy-contracts" + - "mev-commit-bootnode1" + - "mev-commit-provider-node1" + - "mev-commit-provider-node1-funder" + - "mev-commit-provider-emulator-node1" + - "mev-commit-oracle" + - "datadog-agent-metrics-collector" vars_prompt: - name: version @@ -99,7 +99,7 @@ ansible.builtin.file: path: "{{ ansible_env.HOME }}/{{ env }}" state: directory - mode: '0744' + mode: "0744" recurse: yes - name: Build | Nomad artifacts @@ -120,7 +120,7 @@ loop: - infrastructure/tools/keystore-generator - p2p/integrationtest/provider - - p2p/integrationtest/bidder + - p2p/integrationtest/real-bidder - bridge/standard/bridge-v1 - external/geth - contracts @@ -174,7 +174,7 @@ - name: Deploy | Nomad jobs ansible.builtin.shell: | nomad run {{ ansible_env.HOME }}/{{ env }}/{{ job.name }}.nomad - [ "{{ job.name }}" = "deploy-contracts" ] && sleep 180 || true + [ "{{ job.name }}" = "deploy-contracts" ] && sleep 240 || true args: executable: bash loop: "{{ jobs }}" diff --git a/infrastructure/nomad/templates/nomad/mev-commit-emulator.nomad.j2 b/infrastructure/nomad/templates/nomad/mev-commit-emulator.nomad.j2 index e5da81e9f..de5279628 100644 --- a/infrastructure/nomad/templates/nomad/mev-commit-emulator.nomad.j2 +++ b/infrastructure/nomad/templates/nomad/mev-commit-emulator.nomad.j2 @@ -57,13 +57,7 @@ job "{{ job.name }}" { {{- end }} {% endraw %} {% if job.target_type == 'bidder' %} - {%- raw %} - {{ range nomadService "mev-commit-geth-bootnode1" }} - {{- if contains "http" .Tags }} - EMULATOR_SETTLEMENT_RPC_ENDPOINT="http://{{ .Address }}:{{ .Port }}" - {{ end }} - {{ end }} - {% endraw %} + EMULATOR_L1_RPC_URL="{{ job.env['l1_rpc_url'] }}" {% endif %} EOH destination = "secrets/.env" @@ -86,10 +80,8 @@ job "{{ job.name }}" { ${EMULATOR_BINARY} \ -server-addr "${EMULATOR_IP_PORT}" \ {% if job.target_type == 'bidder' %} - -rpc-addr "${EMULATOR_SETTLEMENT_RPC_ENDPOINT}" \ + -rpc-addr "${EMULATOR_L1_RPC_URL}" \ {% endif %} - -log-tags "${EMULATOR_LOG_TAGS}" \ - -log-fmt "${EMULATOR_LOG_FMT}" EOH destination = "local/run.sh" perms = "0755" diff --git a/infrastructure/nomad/templates/nomad/mev-commit-funder.nomad.j2 b/infrastructure/nomad/templates/nomad/mev-commit-funder.nomad.j2 index 9729d2aa6..51be14c68 100644 --- a/infrastructure/nomad/templates/nomad/mev-commit-funder.nomad.j2 +++ b/infrastructure/nomad/templates/nomad/mev-commit-funder.nomad.j2 @@ -53,7 +53,7 @@ job "{{ job.name }}" { local/cast send \ --rpc-url http://{{ .Address }}:{{ .Port }} \ --private-key 0x7c9bf0f015874594d321c1c01ada3166c3509bbd91f76f9e4d7380c2df269c55 ${ETHEREUM_ADDRESS} \ - --value 100ether + --value 1000ether {{- end }} {{- end }} {% endraw %} diff --git a/infrastructure/nomad/templates/nomad/mev-commit-oracle.nomad.j2 b/infrastructure/nomad/templates/nomad/mev-commit-oracle.nomad.j2 index 84555be09..13bc48dbe 100644 --- a/infrastructure/nomad/templates/nomad/mev-commit-oracle.nomad.j2 +++ b/infrastructure/nomad/templates/nomad/mev-commit-oracle.nomad.j2 @@ -134,11 +134,12 @@ job "{{ job.name }}" { else 'service:' + job.name + '-{{ env "NOMAD_ALLOC_INDEX" }}' }}" MEV_ORACLE_LOG_LEVEL="{{ job.env.get('log-level', 'info') }}" - MEV_ORACLE_LAGGERD_MODE="{{ job.env.get('laggerd-mode', '64') }}" + MEV_ORACLE_LAGGERD_MODE="{{ job.env.get('laggerd-mode', '20') }}" MEV_ORACLE_L1_RPC_URL="{{ job.env['l1_rpc_url'] }}" {%- raw %} - MEV_ORACLE_KEYSTORE_PATH="/local/data-{{env "NOMAD_ALLOC_INDEX"}}/keystore" - MEV_ORACLE_KEYSTORE_PASSWORD="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.oracle_keystore_password }}{{ end }}" + # MEV_ORACLE_KEYSTORE_PATH="/local/data-{{env "NOMAD_ALLOC_INDEX"}}/keystore" + # MEV_ORACLE_KEYSTORE_PASSWORD="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.oracle_keystore_password }}{{ end }}" + MEV_ORACLE_PRIV_KEY_FILE = "/local/data-{{env "NOMAD_ALLOC_INDEX"}}/priv-key" {{- range nomadService "mev-commit-oracle" }} {{- if contains "http" .Tags }} MEV_ORACLE_HTTP_PORT="{{ .Port }}" @@ -148,6 +149,9 @@ job "{{ job.name }}" { {{- if contains "http" .Tags }} MEV_ORACLE_SETTLEMENT_RPC_URL="http://{{ .Address }}:{{ .Port }}" {{- end }} + {{- if contains "ws" .Tags }} + MEV_ORACLE_SETTLEMENT_WS_RPC_ENDPOINT="ws://{{ .Address}}:{{ .Port }}" + {{- end }} {{- end }} {{- range nomadService "{% endraw %}{{ job.name }}{% raw %}" }} {{- if contains "db" .Tags }} @@ -167,6 +171,15 @@ job "{{ job.name }}" { template { data = <<-EOH #!/usr/bin/env bash + {%- raw %} + {{- range nomadService "mev-commit-provider-node1" }} + {{ if contains "http" .Tags }} + TOPOLOGY=$(curl https://{{ .Address}}:{{ .Port }}/topology) + PROVIDER_ETHEREUM_ADDRESS=$(echo ${TOPOLOGY} | jq -r '.self["Ethereum Address"]') + export MEV_ORACLE_OVERRIDE_WINNERS=${PROVIDER_ETHEREUM_ADDRESS} + {{ end }} + {{- end }} + {% endraw %} {%- raw %} {{- range nomadService "datadog-agent-logs-collector" }} @@ -185,6 +198,9 @@ job "{{ job.name }}" { fi mkdir -p $(dirname "${MEV_ORACLE_PRIV_KEY_FILE}") > /dev/null 2>&1 + {%- raw %} + echo {{ with secret "secret/data/mev-commit" }}{{ .Data.data.oracle_private_key }}{{ end }} > ${MEV_ORACLE_PRIV_KEY_FILE} + {% endraw %} chmod +x local/mev-commit-oracle local/mev-commit-oracle start EOH diff --git a/infrastructure/nomad/templates/nomad/mev-commit.nomad.j2 b/infrastructure/nomad/templates/nomad/mev-commit.nomad.j2 index 2b9abf54a..30ce395a0 100644 --- a/infrastructure/nomad/templates/nomad/mev-commit.nomad.j2 +++ b/infrastructure/nomad/templates/nomad/mev-commit.nomad.j2 @@ -65,6 +65,9 @@ job "{{ job.name }}" { {{- if contains "http" .Tags }} MEV_COMMIT_SETTLEMENT_RPC_ENDPOINT="http://{{ .Address }}:{{ .Port }}" {{- end }} + {{- if contains "ws" .Tags }} + MEV_COMMIT_SETTLEMENT_WS_RPC_ENDPOINT="ws://{{ .Address}}:{{ .Port }}" + {{- end }} {{- end }} {% endraw %} MEV_COMMIT_PEER_TYPE="{{ job.env['type'] }}" diff --git a/infrastructure/nomad/vars.yml b/infrastructure/nomad/vars.yml index 0c82bb3c4..27cdc0306 100644 --- a/infrastructure/nomad/vars.yml +++ b/infrastructure/nomad/vars.yml @@ -26,6 +26,9 @@ jobs: http: static: 8545 to: 8545 + ws: + static: 8546 + to: 8546 p2p: to: 30301 env: @@ -49,21 +52,6 @@ jobs: sync_mode: snap block_address: "0xd9cd8E5DE6d55f796D980B818D350C0746C25b97" - - name: mev-commit-geth-signer-node2 - template: mev-commit-geth.nomad.j2 - count: 1 - ports: - - metrics: - to: 6060 - p2p: - to: 30311 - env: - ip: 0.0.0.0 - net_restrict: 0.0.0.0/0 - type: signer - sync_mode: snap - block_address: "0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4" - - name: mev-commit-geth-member-node template: mev-commit-geth.nomad.j2 count: 1 @@ -137,6 +125,19 @@ jobs: target_type: provider target_name: mev-commit-provider-node1 + - name: mev-commit-oracle + template: mev-commit-oracle.nomad.j2 + count: 1 + ports: + - db: + static: 5432 + to: 5432 + http: + static: 8080 + to: 8080 + env: + l1_rpc_url: https://ethereum-holesky-rpc.publicnode.com + - name: mev-commit-bidder-node1 template: mev-commit.nomad.j2 count: 1 @@ -181,18 +182,8 @@ jobs: ports: - metrics: to: 8080 - - - name: mev-commit-oracle - template: mev-commit-oracle.nomad.j2 - count: 1 - ports: - - db: - static: 5432 - to: 5432 - http: - to: 8080 env: - l1_rpc_url: https://rpc.sepolia.org + l1_rpc_url: https://ethereum-holesky-rpc.publicnode.com - name: mev-commit-bridge template: mev-commit-bridge.nomad.j2