Skip to content

Commit

Permalink
refactor: distribute allocation from single address
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 4, 2024
1 parent 882eeeb commit b24686f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 27 deletions.
9 changes: 9 additions & 0 deletions contracts/scripts/core/DeployCore.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import {BlockTracker} from "../../contracts/core/BlockTracker.sol";
import {console} from "forge-std/console.sol";

contract DeployTestnet is Script {

// Amount of ETH required to fund the Oracle contract.
uint256 public constant ORACLE_FUNDING = 1000 ether;

error FailedToSendETHToOracle(address addr);

function run() external {
require(block.chainid == 17864, "chainID not 17864 (testnet env)");
vm.startBroadcast();
Expand Down Expand Up @@ -102,6 +108,9 @@ contract DeployTestnet is Script {
preconfManager.updateOracleContract(address(oracle));
console.log("_PreconfManagerWithOracle:", address(oracle));

(bool success, ) = payable(oracleKeystoreAddress).call{value: ORACLE_FUNDING}("");
require(success, FailedToSendETHToOracle(oracleKeystoreAddress));

vm.stopBroadcast();
}
}
4 changes: 2 additions & 2 deletions contracts/scripts/standard-bridge/DeployStandardBridge.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {console} from "forge-std/console.sol";

contract BridgeBase is Script {
// Amount of ETH which must be allocated only to the contract deployer on mev-commit chain genesis.
uint256 public constant DEPLOYER_GENESIS_ALLOCATION = type(uint256).max - 10 ether;
uint256 public constant DEPLOYER_GENESIS_ALLOCATION = type(uint256).max - 2000 ether;

// Amount of ETH to initially fund the relayer account on both chains.
uint256 public constant RELAYER_INITIAL_FUNDING = 1 ether;
Expand All @@ -23,7 +23,7 @@ contract BridgeBase is Script {
// AND initially fund the relayer, all on mev-commit chain.
// This amount of ETH must be initially locked in the L1 gateway contract to ensure a 1:1 peg
// between mev-commit chain ETH and L1 ETH.
uint256 public constant MEV_COMMIT_CHAIN_SETUP_COST = 1 ether + RELAYER_INITIAL_FUNDING;
uint256 public constant MEV_COMMIT_CHAIN_SETUP_COST = 10000 ether + RELAYER_INITIAL_FUNDING;

// Amount of ETH required on L1 to initialize the L1 gateway, make transfer calls, and initially fund the relayer on L1.
uint256 public constant L1_SETUP_COST = 1 ether + RELAYER_INITIAL_FUNDING;
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/nomad/playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@
echo "${ALLOC}" | jq --arg address "0x${ADDRESS}" '
. + {
($address): {
"balance": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD4A51000FDA0FFFF"
"balance": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
}
}
'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ job "{{ job.name }}" {
{%- raw %}
XDG_CONFIG_HOME="local/.config"
KEYSTORE_PATH="/local/data-{{ env "NOMAD_ALLOC_INDEX" }}/keystore"
KEYSTORE_FILENAME="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.{% endraw %}{{ job.target.artifacts | selectattr('keystores', 'defined') | map(attribute='keystores') | first | list | first }}{% raw %}_filename }}{{ end }}"
KEYSTORE_PASSWORD="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.{% endraw %}{{ job.target.artifacts | selectattr('keystores', 'defined') | map(attribute='keystores') | first | list | first }}{% raw %}_password }}{{ end }}"
KEYSTORE_FILENAME="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.contract_deployer_keystore_filename }}{{ end }}"
KEYSTORE_PASSWORD="{{ with secret "secret/data/mev-commit" }}{{ .Data.data.contract_deployer_keystore_password }}{{ end }}"
{% endraw %}
EOH
destination = "secrets/.env"
Expand Down Expand Up @@ -68,19 +68,21 @@ job "{{ job.name }}" {
mkdir -p "${KEYSTORE_PATH}" > /dev/null 2>&1
{{- with secret "secret/data/mev-commit" }}
KEYSTORE_FILE="${KEYSTORE_PATH}/${KEYSTORE_FILENAME}"
echo '{{ .Data.data.{% endraw %}{{ job.target.artifacts | selectattr('keystores', 'defined') | map(attribute='keystores') | first | list | first }}{% raw %} }}' > "${KEYSTORE_FILE}"
echo '{{ .Data.data.contract_deployer_keystore }}' > "${KEYSTORE_FILE}"
{{ end }}

{{- range nomadService "{% endraw %}{{ job.target.name }}{% raw %}" }}
{{- if contains "http" .Tags }}
ADDRESS=$(curl -sk https://{{ .Address }}:{{ .Port }}/v1/debug/topology | jq -r '.topology.self["Ethereum Address"]')
{{- end }}
{{- range nomadService "mev-commit-geth-bootnode1" }}
{{- if contains "http" .Tags }}
ADDRESS=$(cat "${KEYSTORE_FILE}" | jq -r '.address')
cast send \
--keystore "${KEYSTORE_FILE}" \
--password "${KEYSTORE_PASSWORD}" \
--priority-gas-price 2000000000 \
--gas-price 5000000000 \
--value 1000ether \
--value 10ether \
--rpc-url http://{{ .Address }}:{{ .Port }} \
"${ADDRESS}"

Expand Down
19 changes: 0 additions & 19 deletions infrastructure/nomad/playbooks/variables/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ jobs:
name: geth_signer_node1_nodekey
- keystores:
geth_signer1_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand Down Expand Up @@ -155,7 +154,6 @@ jobs:
contract_deployer_keystore:
allocation: true
bridge_relayer_keystore:
allocation: true
count: 1
ports:
- http:
Expand Down Expand Up @@ -186,7 +184,6 @@ jobs:
- *p2p_artifact
- keystores:
bootnode1_keystore:
allocation: false
count: 1
ports:
- metrics:
Expand All @@ -213,7 +210,6 @@ jobs:
- *p2p_artifact
- keystores:
provider1_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -240,7 +236,6 @@ jobs:
- *p2p_artifact
- keystores:
provider2_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -266,7 +261,6 @@ jobs:
- *p2p_artifact
- keystores:
provider3_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand Down Expand Up @@ -342,7 +336,6 @@ jobs:
- *p2p_artifact
- keystores:
bidder1_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -368,7 +361,6 @@ jobs:
- *p2p_artifact
- keystores:
bidder2_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -393,7 +385,6 @@ jobs:
- *p2p_artifact
- keystores:
bidder3_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -418,7 +409,6 @@ jobs:
- *p2p_artifact
- keystores:
bidder4_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand All @@ -443,7 +433,6 @@ jobs:
- *p2p_artifact
- keystores:
bidder5_keystore:
allocation: true
count: 1
ports:
- metrics:
Expand Down Expand Up @@ -533,7 +522,6 @@ jobs:
name: oracle_register_provider_api_auth_token
- keystores:
oracle_keystore:
allocation: true
dependencies:
contracts_deployer: *contracts_deployer_job
count: 1
Expand Down Expand Up @@ -571,7 +559,6 @@ jobs:
artifacts:
- keystores:
faucet_keystore:
allocation: true
count: 1
ports:
- http:
Expand Down Expand Up @@ -624,11 +611,8 @@ jobs:
- *l1_transactor_artifact
- keystores:
l1_transactor_account1_keystore:
allocation: true
l1_transactor_account2_keystore:
allocation: true
l1_transactor_account3_keystore:
allocation: true
dependencies:
mock_l1: *mock_l1_job
env:
Expand All @@ -641,11 +625,8 @@ jobs:
- *bridge_v1_artifact
- keystores:
bridge_emulator_account1_keystore:
allocation: true
bridge_emulator_account2_keystore:
allocation: true
bridge_emulator_account3_keystore:
allocation: true
dependencies:
contracts_deployer: *contracts_deployer_job
count: 1
Expand Down

0 comments on commit b24686f

Please sign in to comment.