From 1f51331dd39296de3ef31762295131ecf817d984 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 12 Oct 2021 11:37:40 +0000 Subject: [PATCH] use specified execution_payload when constructing blocks; update Geth launch script (#2975) * use specified execution_payload when constructing blocks; update Geth launch script * revert DepositContractState change --- beacon_chain/spec/helpers.nim | 3 ++- beacon_chain/spec/state_transition.nim | 3 ++- scripts/run-catalyst.sh | 25 +++++++++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) mode change 100755 => 100644 scripts/run-catalyst.sh diff --git a/beacon_chain/spec/helpers.nim b/beacon_chain/spec/helpers.nim index 5d3b1da1b..127ad261d 100644 --- a/beacon_chain/spec/helpers.nim +++ b/beacon_chain/spec/helpers.nim @@ -301,7 +301,8 @@ func is_merge_block( state: merge.BeaconState, body: merge.BeaconBlockBody | merge.TrustedBeaconBlockBody | merge.SigVerifiedBeaconBlockBody): bool = - not is_merge_complete(state) and body.execution_payload != ExecutionPayload() + not is_merge_complete(state) and + body.execution_payload != default(merge.ExecutionPayload) # https://github.com/ethereum/consensus-specs/blob/v1.1.0-beta.4/specs/merge/beacon-chain.md#is_execution_enabled func is_execution_enabled*( diff --git a/beacon_chain/spec/state_transition.nim b/beacon_chain/spec/state_transition.nim index 3a4f31cb0..32413a6f7 100644 --- a/beacon_chain/spec/state_transition.nim +++ b/beacon_chain/spec/state_transition.nim @@ -547,7 +547,8 @@ template partialBeaconBlock( deposits: List[Deposit, Limit MAX_DEPOSITS](deposits), voluntary_exits: List[SignedVoluntaryExit, Limit MAX_VOLUNTARY_EXITS](voluntaryExits), - sync_aggregate: sync_aggregate)) + sync_aggregate: sync_aggregate, + execution_payload: executionPayload)) proc makeBeaconBlock*( cfg: RuntimeConfig, diff --git a/scripts/run-catalyst.sh b/scripts/run-catalyst.sh old mode 100755 new mode 100644 index 51d669eb7..3b03148a8 --- a/scripts/run-catalyst.sh +++ b/scripts/run-catalyst.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # set -Eeuo pipefail -# https://notes.ethereum.org/@9AeMAlpyQYaAAyuj47BzRw/rkwW3ceVY +# https://notes.ethereum.org/_UH57VUPRrC-re3ubtmo2w # To increase verbosity: debug.verbosity(4) # MetaMask seed phrase for address with balance is: @@ -11,12 +11,11 @@ GENESISJSON=$(mktemp) GETHDATADIR=$(mktemp -d) echo \{\ - \"config\": \{\ + \"config\": \{\ \"chainId\":1,\ \"homesteadBlock\":0,\ - \"daoForkBlock\":0,\ - \"daoForkSupport\":true,\ \"eip150Block\":0,\ + \"eip150Hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\ \"eip155Block\":0,\ \"eip158Block\":0,\ \"byzantiumBlock\":0,\ @@ -30,13 +29,13 @@ echo \{\ \"period\": 5,\ \"epoch\": 30000\ \},\ - \"terminalTotalDifficulty\":0\ + \"terminalTotalDifficulty\":10\ \},\ \"nonce\":\"0x42\",\ \"timestamp\":\"0x0\",\ \"extraData\":\"0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\ - \"gasLimit\":\"0x989680\",\ - \"difficulty\":\"0x400000000\",\ + \"gasLimit\":\"0x1C9C380\",\ + \"difficulty\":\"0x0\",\ \"mixHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\ \"coinbase\":\"0x0000000000000000000000000000000000000000\",\ \"alloc\":\{\ @@ -46,7 +45,13 @@ echo \{\ \"gasUsed\":\"0x0\",\ \"parentHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\ \"baseFeePerGas\":\"0x7\"\ -\} > ${GENESISJSON} +\} > "${GENESISJSON}" -~/execution_clients/go-ethereum/build/bin/geth --catalyst --http --ws -http.api "engine" --datadir ${GETHDATADIR} init ${GENESISJSON} -~/execution_clients/go-ethereum/build/bin/geth --catalyst --http --ws -http.api "engine" --nodiscover --miner.etherbase 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b --datadir ${GETHDATADIR} console +# Initialize the genesis +~/execution_clients/go-ethereum/build/bin/geth --catalyst --http --ws -http.api "engine" --datadir "${GETHDATADIR}" init "${GENESISJSON}" + +# Import the signing key (press enter twice for empty password) +~/execution_clients/go-ethereum/build/bin/geth --catalyst --http --ws -http.api "engine" --datadir "${GETHDATADIR}" account import <(echo 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8) + +# Start the node (and press enter once to unlock the account) +~/execution_clients/go-ethereum/build/bin/geth --catalyst --http --ws -ws.api "eth,net,engine" --datadir "${GETHDATADIR}" --allow-insecure-unlock --unlock "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" --password "" --nodiscover console