diff --git a/contracts/scripts/core/DeployCore.s.sol b/contracts/scripts/core/DeployCore.s.sol index c66200aee..6675fecdd 100644 --- a/contracts/scripts/core/DeployCore.s.sol +++ b/contracts/scripts/core/DeployCore.s.sol @@ -17,7 +17,7 @@ import {console} from "forge-std/console.sol"; contract DeployTestnet is Script { // Amount of ETH to initially fund the oracle account on L1 chain. - uint256 public constant ORACLE_INITIAL_FUNDING = 1 ether; + uint256 public constant ORACLE_INITIAL_FUNDING = 0.5 ether; uint256 public constant PERCENT_MULTIPLIER = 1e16; error FailedToSendETHToOracle(address addr); diff --git a/contracts/scripts/standard-bridge/DeployStandardBridge.s.sol b/contracts/scripts/standard-bridge/DeployStandardBridge.s.sol index 80ec71037..94ad5dd1e 100644 --- a/contracts/scripts/standard-bridge/DeployStandardBridge.s.sol +++ b/contracts/scripts/standard-bridge/DeployStandardBridge.s.sol @@ -13,23 +13,34 @@ import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {console} from "forge-std/console.sol"; contract BridgeBase is Script { + // Amount of ETH to initially fund the relayer account on the mev-commit chain. + // This should be high enough to cover the cost of enqueuing transactions as + // long as the relayer account is a zero-fee account. + uint256 public constant RELAYER_INITIAL_FUNDING_MEV_COMMIT_CHAIN = 0.03 ether; + + // Amount of ETH to initially fund the oracle account on the mev-commit chain. + // This should be high enough to cover the cost of enqueuing transactions as + // long as the oracle account is a zero-fee account. + uint256 public constant ORACLE_INITIAL_FUNDING_MEV_COMMIT_CHAIN = 0.5 ether; + // 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 - 500 ether; - // Amount of ETH to initially fund the relayer account on both chains. - uint256 public constant RELAYER_INITIAL_FUNDING = 1 ether; + // Amount of ETH which must be present in the deployer account after core contract deployment. The funds + // for the Oracle are already transferred. + uint256 public constant DEPLOYER_INITIAL_BALANCE = DEPLOYER_GENESIS_ALLOCATION - ORACLE_INITIAL_FUNDING_MEV_COMMIT_CHAIN; - // Amount of ETH to initially fund the oracle account on L1 chain. - uint256 public constant ORACLE_INITIAL_FUNDING = 1 ether; + // Amount of ETH to initially fund the relayer account on L1. + uint256 public constant RELAYER_INITIAL_FUNDING_L1 = 1 ether; // Amount of ETH required by the contract deployer to initialize all bridge and core contract state, // 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 + ORACLE_INITIAL_FUNDING; + uint256 public constant MEV_COMMIT_CHAIN_SETUP_COST = 0.01 ether + ORACLE_INITIAL_FUNDING_MEV_COMMIT_CHAIN + RELAYER_INITIAL_FUNDING_MEV_COMMIT_CHAIN; // 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; + uint256 public constant L1_SETUP_COST = 0.01 ether + RELAYER_INITIAL_FUNDING_L1; error RelayerAddressNotSet(address addr); error L1FinalizationFeeNotSet(uint256 fee); @@ -63,8 +74,8 @@ contract DeploySettlementGateway is BridgeBase { address relayerAddr = _getRelayerAddress(); uint256 l1FinalizationFee = _getL1FinalizationFee(); - require(address(msg.sender).balance >= DEPLOYER_GENESIS_ALLOCATION, - DeployerMustHaveGenesisAllocation(address(msg.sender).balance, DEPLOYER_GENESIS_ALLOCATION)); + require(address(msg.sender).balance >= DEPLOYER_INITIAL_BALANCE, + DeployerMustHaveGenesisAllocation(address(msg.sender).balance, DEPLOYER_INITIAL_BALANCE)); address allocatorProxy = Upgrades.deployUUPSProxy( "Allocator.sol", @@ -90,7 +101,7 @@ contract DeploySettlementGateway is BridgeBase { allocator.addToWhitelist(address(settlementGateway)); - (success, ) = payable(relayerAddr).call{value: RELAYER_INITIAL_FUNDING}(""); + (success, ) = payable(relayerAddr).call{value: RELAYER_INITIAL_FUNDING_MEV_COMMIT_CHAIN}(""); require(success, FailedToSendETHToRelayer(relayerAddr)); vm.stopBroadcast(); @@ -127,7 +138,7 @@ contract DeployL1Gateway is BridgeBase { (bool success, ) = payable(address(l1Gateway)).call{value: MEV_COMMIT_CHAIN_SETUP_COST}(""); require(success, FailedToFundL1Gateway(address(l1Gateway))); - (success, ) = payable(relayerAddr).call{value: RELAYER_INITIAL_FUNDING}(""); + (success, ) = payable(relayerAddr).call{value: RELAYER_INITIAL_FUNDING_L1}(""); require(success, FailedToSendETHToRelayer(relayerAddr)); vm.stopBroadcast(); diff --git a/infrastructure/nomad/playbooks/deploy.yml b/infrastructure/nomad/playbooks/deploy.yml index 3240c727f..5e46c4ebe 100644 --- a/infrastructure/nomad/playbooks/deploy.yml +++ b/infrastructure/nomad/playbooks/deploy.yml @@ -479,7 +479,11 @@ echo "${ALLOC}" | jq --arg address "0x${ADDRESS}" ' . + { ($address): { + {% if profile == 'mainnet' %} + "balance": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE4E51B291D10AFFFFF" + {% else %} "balance": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD4A51000FDA0FFFF" + {% endif %} } } ' diff --git a/tools/relay-emulator/main.go b/tools/relay-emulator/main.go index 30c87d5d9..8aab88d92 100644 --- a/tools/relay-emulator/main.go +++ b/tools/relay-emulator/main.go @@ -164,6 +164,11 @@ func main() { return } + if len(registeredKeys) == 0 { + http.Error(w, "No registered keys", http.StatusInternalServerError) + return + } + idx := int(blockNumber) % len(registeredKeys) registeredLock.RLock() key := registeredKeys[idx]