diff --git a/.github/workflows/local-testnet.yml b/.github/workflows/local-testnet.yml index 42293d38a79..9b61921d9ee 100644 --- a/.github/workflows/local-testnet.yml +++ b/.github/workflows/local-testnet.yml @@ -39,12 +39,6 @@ jobs: run: | brew tap ethereum/ethereum brew install ethereum - - name: Install GNU sed & GNU grep - if: matrix.os == 'macos-12' - run: | - brew install gnu-sed grep - echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH - echo "$(brew --prefix)/opt/grep/libexec/gnubin" >> $GITHUB_PATH # https://github.com/actions/cache/blob/main/examples.md#rust---cargo - uses: actions/cache@v4 id: cache-cargo diff --git a/scripts/local_testnet/README.md b/scripts/local_testnet/README.md index 77c9d62c1cd..b3a3479a343 100644 --- a/scripts/local_testnet/README.md +++ b/scripts/local_testnet/README.md @@ -8,8 +8,6 @@ This setup can be useful for testing and development. The scripts require `lcli`, `lighthouse`, `geth`, `bootnode` to be installed on `PATH` (run `echo $PATH` to view all `PATH` directories). -MacOS users need to install GNU `sed` and GNU `grep`, and add them both to `PATH` as well. - The first step is to install Rust and dependencies. Refer to the [Lighthouse Book](https://lighthouse-book.sigmaprime.io/installation-source.html#dependencies) for installation. We will also need [jq](https://jqlang.github.io/jq/), which can be installed with `sudo apt install jq`. Then, we clone the Lighthouse repository: diff --git a/scripts/local_testnet/bootnode.sh b/scripts/local_testnet/bootnode.sh index ca02a24140f..7c917045c84 100755 --- a/scripts/local_testnet/bootnode.sh +++ b/scripts/local_testnet/bootnode.sh @@ -28,7 +28,9 @@ DEBUG_LEVEL=${1:-info} echo "Starting bootnode" -exec lighthouse boot_node \ +exec lighthouse \ + --debug-level $DEBUG_LEVEL \ + boot_node \ --testnet-dir $TESTNET_DIR \ --port $BOOTNODE_PORT \ --listen-address 127.0.0.1 \ diff --git a/scripts/local_testnet/setup_time.sh b/scripts/local_testnet/setup_time.sh index 36f7fc4e997..39551b860b8 100755 --- a/scripts/local_testnet/setup_time.sh +++ b/scripts/local_testnet/setup_time.sh @@ -20,16 +20,21 @@ echo "slot_per_epoch=$SLOT_PER_EPOCH" genesis_file=$1 # Update future hardforks time in the EL genesis file based on the CL genesis time -GENESIS_TIME=$(lcli pretty-ssz --spec $SPEC_PRESET --testnet-dir $TESTNET_DIR BeaconState $TESTNET_DIR/genesis.ssz | jq | grep -Po 'genesis_time": "\K.*\d') -echo $GENESIS_TIME +GENESIS_TIME=$(lcli pretty-ssz --spec $SPEC_PRESET --testnet-dir $TESTNET_DIR BeaconState $TESTNET_DIR/genesis.ssz | jq | sed -n 's/.*genesis_time": "\([0-9]*\).*/\1/p') +echo "GENESIS_TIME: $GENESIS_TIME" + CAPELLA_TIME=$((GENESIS_TIME + (CAPELLA_FORK_EPOCH * $SLOT_PER_EPOCH * SECONDS_PER_SLOT))) -echo $CAPELLA_TIME -sed -i 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' $genesis_file +echo "SHANGHAI_TIME: $CAPELLA_TIME" +sed 's/"shanghaiTime".*$/"shanghaiTime": '"$CAPELLA_TIME"',/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file + CANCUN_TIME=$((GENESIS_TIME + (DENEB_FORK_EPOCH * $SLOT_PER_EPOCH * SECONDS_PER_SLOT))) -echo $CANCUN_TIME -sed -i 's/"cancunTime".*$/"cancunTime": '"$CANCUN_TIME"',/g' $genesis_file -PRAGUE_TIME=$((GENESIS_TIME + (ELECTRA_FORK_EPOCH * $SLOT_PER_EPOCH * SECONDS_PER_SLOT))) -echo $PRAGUE_TIME -sed -i 's/"pragueTime".*$/"pragueTime": '"$PRAGUE_TIME"',/g' $genesis_file -cat $genesis_file +echo "CANCUN_TIME: $CANCUN_TIME" +sed 's/"cancunTime".*$/"cancunTime": '"$CANCUN_TIME"',/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file + +PRAGUE_TIME=$((GENESIS_TIME + (ELECTRA_FORK_EPOCH * $SLOT_PER_EPOCH * SECONDS_PER_SLOT))) +echo "PRAGUE_TIME: $PRAGUE_TIME" +sed 's/"pragueTime".*$/"pragueTime": '"$PRAGUE_TIME"',/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file diff --git a/scripts/local_testnet/start_local_testnet.sh b/scripts/local_testnet/start_local_testnet.sh index 77422095130..b2c3b193cef 100755 --- a/scripts/local_testnet/start_local_testnet.sh +++ b/scripts/local_testnet/start_local_testnet.sh @@ -132,9 +132,14 @@ done sleeping 20 # Reset the `genesis.json` config file fork times. -sed -i 's/"shanghaiTime".*$/"shanghaiTime": 0,/g' $genesis_file -sed -i 's/"cancunTime".*$/"cancunTime": 0,/g' $genesis_file -sed -i 's/"pragueTime".*$/"pragueTime": 0,/g' $genesis_file +sed 's/"shanghaiTime".*$/"shanghaiTime": 0,/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file + +sed 's/"cancunTime".*$/"cancunTime": 0,/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file + +sed 's/"pragueTime".*$/"pragueTime": 0,/g' $genesis_file > "/tmp/genesis.json" +mv "/tmp/genesis.json" $genesis_file for (( bn=1; bn<=$BN_COUNT; bn++ )); do secret=$DATADIR/geth_datadir$bn/geth/jwtsecret