|
| 1 | +# Ethereum Package |
| 2 | + |
| 3 | +> [!WARNING] |
| 4 | +> [Kurtosis](https://github.com/kurtosis-tech/kurtosis) must be installed. |
| 5 | +
|
| 6 | +## Usage and Setup |
| 7 | + |
| 8 | +To start a local network run: |
| 9 | + |
| 10 | +```bash |
| 11 | +make ethereum_package_start |
| 12 | +``` |
| 13 | + |
| 14 | +To see the status of the network run: |
| 15 | + |
| 16 | +```bash |
| 17 | +make ethereum_package_inspect |
| 18 | +``` |
| 19 | + |
| 20 | +This will show you all the containers running and their respective ports. The most interesting ones are prometheus, grafana and el_forkmon, they will provide you with metrics to see the gasPrice, gasUsed, txPerBlock, and others that will be in our interest to create chaos on the network. |
| 21 | + |
| 22 | +To stop the network run the following: |
| 23 | + |
| 24 | +```bash |
| 25 | +make ethereum_package_rm |
| 26 | +``` |
| 27 | + |
| 28 | +To start the batcher run: |
| 29 | + |
| 30 | +```bash |
| 31 | +make batcher_start_ethereum_package |
| 32 | +``` |
| 33 | + |
| 34 | +To start the aggregator run: |
| 35 | + |
| 36 | +```bash |
| 37 | +make aggregator_start_ethereum_package |
| 38 | +``` |
| 39 | + |
| 40 | +To start an operator run: |
| 41 | + |
| 42 | +```bash |
| 43 | +make operator_register_start_ethereum_package |
| 44 | +``` |
| 45 | + |
| 46 | +If you want to deploy more operators, you must duplicate the config-operator-1-ethereum-package.yaml and change the private and bls keys and the address. |
| 47 | + |
| 48 | +To start Telemetry and the Explorer, run the usual commands: |
| 49 | + |
| 50 | +```bash |
| 51 | +make telemetry_full_start |
| 52 | +make run_explorer |
| 53 | +``` |
| 54 | + |
| 55 | +To spam transactions install spamoor: |
| 56 | +```bash |
| 57 | +make install_spamoor |
| 58 | +``` |
| 59 | + |
| 60 | +and run the following make targets: |
| 61 | + |
| 62 | +```bash |
| 63 | +make spamoor_send_transactions \\ |
| 64 | + COUNT=<TOTAL_TX_TO_EXECUTE> \\ |
| 65 | + TX_PER_BLOCK=<LIMIT_OF_TXS_TO_SEND_PER_BLOCK> \\ |
| 66 | + TX_CONSUME_GAS=<HOW_MUCH_GAS_TO_USE_PER_TX> \\ |
| 67 | + NUM_WALLETS=<NUMBER_OF_WALLETS_FROM_WHICH_TO_SEND_TXS> \\ |
| 68 | + TIP_FEE=<TIP_FEE_IN_GWEI> |
| 69 | +``` |
| 70 | + |
| 71 | +For Example: |
| 72 | +```bash |
| 73 | +make spamoor_send_transactions COUNT=1000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=50 NUM_WALLETS=100 TIP_FEE=2 |
| 74 | +``` |
| 75 | + |
| 76 | +## Network status |
| 77 | + |
| 78 | +You can check the network status using Grafana and el_forkmon explorer. |
| 79 | +Run `make ethereum_package_inspect` to see the exposed ports for the enabled services. You can check for example the Grafana panels under `Dashboards -> Ethereum Metrics Exporter Overview` which provides useful information about the network. |
| 80 | + |
| 81 | +## Changing Network Params |
| 82 | + |
| 83 | +To adjust network params you have to modify `network_params.yaml`. |
| 84 | + |
| 85 | +> [!NOTE] |
| 86 | +> We are using a hardcoded input to deploy Eigen and Aligned contracts using the output from anvil. |
| 87 | +
|
| 88 | +## How to make transactions compete and see bumping in the Aggregator and Batcher logs |
| 89 | + |
| 90 | +To increment the gas price and make transactions compete with aligned transactions we need to: |
| 91 | + |
| 92 | +1. **Exceed the block `gasLimit` (30 million):** This is achieved by ensuring the total gas consumed per block is greater than `30,000,000`. Calculate it as: `TX_CONSUME_GAS * TX_PER_BLOCK` |
| 93 | +2. **Raise the `tipFee` slightly above the current gas price:** For instance, if the current `gasPrice` is `20 GWEI`, you can generate spam transactions with: |
| 94 | + |
| 95 | +```bash |
| 96 | +make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=22 |
| 97 | +``` |
| 98 | + |
| 99 | +- Notes: |
| 100 | + - A transaction consuming `150000` of gas would be similar to a bridge swap. |
| 101 | + - We pass `2` gwei more to the `tipFee` that should be enough if not, you can increase it. |
| 102 | + |
| 103 | +3. **Monitor Gas Price Updates:** After a few blocks, the `gasPrice` will adjust. The aligned batcher and aggregator will fetch the updated `gasPrice` and start competing in the mempool with their adjusted bump. |
| 104 | +4. **Repeat as Needed:** Re-run the same command with the updated `TIP_FEE` to maintain competition: |
| 105 | + |
| 106 | +```bash |
| 107 | +make spamoor_send_transactions COUNT=1000000000 TX_CONSUME_GAS=150000 TX_PER_BLOCK=210 NUM_WALLETS=1000 TIP_FEE=<new_tip_fee> |
| 108 | +``` |
| 109 | + |
| 110 | +## How to update preloaded contracts |
| 111 | + |
| 112 | +1. First, deploy the new contracts in Anvil: |
| 113 | + |
| 114 | +```bash |
| 115 | +make anvil_deploy_aligned_contracts |
| 116 | +``` |
| 117 | + |
| 118 | +That will generate the state output in `contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json` |
| 119 | + |
| 120 | +2. Filter the contracts' state: |
| 121 | + |
| 122 | +```bash |
| 123 | +jq '.accounts | to_entries | map(select(.value.code != "0x")) | from_entries' contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json > contracts.json |
| 124 | +``` |
| 125 | + |
| 126 | +3. Open the `network_params.yaml` file and replace the `additional_preloaded_contracts` section with the content of `contracts.json`. |
0 commit comments