Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to generate blsToExecutionChange for testnet validators. #167

Merged
merged 10 commits into from
Apr 20, 2023

Conversation

jimmygchen
Copy link
Member

@jimmygchen jimmygchen commented Apr 12, 2023

Add script to generate blsToExecutionChange for testnet validators to make withdrawal testing easier on local testnet. The script does the following:

  • Set up the parameters required for generating blsToExecutionChange using staking-deposit-cli
  • Runs staking-deposit-cli using docker and outputs the json to a local directory.
  • Update local testnet to latest version to support Capella (copied from a Lighthouse branch)

To use this script, lighthouse and lcli needs to be built using this Lighthouse PR, so that we could use a given mnemonic to set up the genesis validators. See steps below.

Steps to test:

  1. Check out the branch from sigp/lighthouse#3808 and build lighthouse and lcli: make && make install-lcli
  2. Pull latest changes on this PR
  3. Start testnet ./start_local_testnet.sh genesis.json (make sure geth & bootnode are installed and available on PATH)
  4. Generate a blsToExecutionChange json:
# generate for validator index 0 & 1
./generate_bls_to_execution_change.sh 0 0,1 <eth1_address>
  1. Submit the blsToExecutionChange json to beacon node:
curl -X 'POST' \\n  'http://localhost:8001/eth/v1/beacon/pool/bls_to_execution_changes' \\n  -H 'accept: */*' \\n  -H 'Content-Type: application/json' \\n  --data "@bls_to_execution_changes/bls_to_execution_change-<your_file_name>.json"
  1. Wait until Capella fork (about 1 minute) and the BLS change messages are processed. If you're interested, look for this message in the beacon_node_<n>.log, but it should happen pretty quickly if you submitted the message after Capella fork, so feel free to skip checking this:
INFO Processed BLS to execution change
  1. Confirm withdrawal_credentials are updated to 0x01:
curl -X GET "http://localhost:8001/eth/v1/beacon/states/head/validators/0" | jq .
{
  "execution_optimistic": false,
  "finalized": false,
  "data": {
    "index": "0",
    "balance": "32000001170",
    "status": "active_ongoing",
    "validator": {
      "pubkey": "0xa03c8f4fe1baf3b62ee1464778ae7a0bfe2fa3fe5baa454c4bfef35832b2378ecfe202a00cb05a34c2fc4c22bf6eff7c",
      "withdrawal_credentials": "0x01000000000000000000000049011adbcc3bc9c0307bb07f37dda1a1a9c69d2e",
      "effective_balance": "32000000000",
      "slashed": false,
      "activation_eligibility_epoch": "0",
      "activation_epoch": "0",
      "exit_epoch": "18446744073709551615",
      "withdrawable_epoch": "18446744073709551615"
    }
  }
}

NOTE: the local testnet is a copy from the Lighthouse repo, longer term we potentially want to unify them to reduce maintenance burden.

local-testnet/setup.sh Outdated Show resolved Hide resolved
@jimmygchen jimmygchen changed the base branch from stable to unstable April 13, 2023 10:01
@jimmygchen
Copy link
Member Author

@rickimoore I've copied all the latest Capella local testnet changes from @pawan's PR sigp/lighthouse#3807, there are a few important changes for starting up local testnet:

  1. Clone and build geth and bootnode
https://github.com/ethereum/go-ethereum.git
git checkout v1.11.5
make all
  1. Build lighthouse & lcli from this branch
# under the lighthouse directory
git fetch origin pull/3807/head:pr-3807
git checkout pr-3807
make lighthouse && make install-lcli
  1. Start local testnet with this command instead (new genesis.json parameter)
./start_local_testnet.sh genesis.json

The local testnet works, however the generate BLS change script no longer works - I'll check with @pawan on how he's generating the keys. If generating the json file is important to you now, you may want to run local testnet with the older commit.

@jimmygchen
Copy link
Member Author

For reviewer(s), this PR contains all local testnet scripts copied from sigp/lighthouse#3807 - I'm trying to keep it in sync (mostly) to the lighthouse repo keep it maintainable.

The only new change here is this file:
https://github.com/sigp/siren/pull/167/files#diff-8d8da66adb19d899688c9f2b897fca422fcc3355b7945e61e55853185213c4c3

@jimmygchen
Copy link
Member Author

@rickimoore I can confirm blsToExecutionChange now works on the local testnet now! (thanks @pawanjay176)

I've updated the steps in the PR description.

@rickimoore rickimoore self-requested a review April 20, 2023 03:09
Copy link
Member

@rickimoore rickimoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gg

@rickimoore rickimoore merged commit 1042847 into sigp:unstable Apr 20, 2023
@jimmygchen jimmygchen deleted the replace-val-pubkeys-testnet branch April 20, 2023 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants