`gnosis-chain` -> `gnosis` (#3577)

* `gnosis-chain` -> `gnosis`

Use same name as LH/Teku throughout

* fixes #3504
* fixes large stack temporary that can cause crashes during genesis
detection
This commit is contained in:
Jacek Sieka 2022-04-08 22:11:37 +02:00 committed by GitHub
parent d450681b15
commit d1a8daec7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 20 deletions

View File

@ -403,13 +403,13 @@ clean-prater:
# TODO The constants overrides below should not be necessary if we restore
# the support for compiling with custom const presets.
# See the prepared preset file in media/gnosis-chain/preset.yaml
# See the prepared preset file in media/gnosis/preset.yaml
#
# The `-d:gnosisChainBinary` override can be removed if the web3 library
# gains support for multiple "Chain Profiles" that consist of a set of
# consensus object (such as blocks and transactions) that are specific
# to the chain.
gnosis-chain-build: | build deps
gnosis-build gnosis-chain-build: | build deps
+ echo -e $(BUILD_MSG) "build/nimbus_beacon_node_gnosis" && \
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
nimbus_beacon_node_gnosis \
@ -424,18 +424,39 @@ gnosis-chain-build: | build deps
&& \
echo -e $(BUILD_END_MSG) "build/nimbus_beacon_node_gnosis"
gnosis-chain: | gnosis-chain-build
gnosis: | gnosis-build
$(call CONNECT_TO_NETWORK,gnosis,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
ifneq ($(LOG_LEVEL), TRACE)
gnosis-dev:
+ "$(MAKE)" --no-print-directory LOG_LEVEL=TRACE $@
else
gnosis-dev: | gnosis-build
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,gnosis,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
endif
gnosis-dev-deposit: | gnosis-build deposit_contract
$(call MAKE_DEPOSIT,gnosis,$(GNOSIS_WEB3_URLS))
clean-gnosis:
$(call CLEAN_NETWORK,gnosis)
# v22.3 names
gnosis-chain: | gnosis-build
echo `gnosis-chain` is deprecated, use `gnosis` after migrating data folder
$(call CONNECT_TO_NETWORK,gnosis-chain,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
ifneq ($(LOG_LEVEL), TRACE)
gnosis-chain-dev:
+ "$(MAKE)" --no-print-directory LOG_LEVEL=TRACE $@
else
gnosis-chain-dev: | gnosis-chain-build
gnosis-chain-dev: | gnosis-build
echo `gnosis-chain-dev` is deprecated, use `gnosis-dev` instead
$(call CONNECT_TO_NETWORK_IN_DEV_MODE,gnosis-chain,nimbus_beacon_node_gnosis,$(GNOSIS_WEB3_URLS))
endif
gnosis-chain-dev-deposit: | gnosis-chain-build deposit_contract
gnosis-chain-dev-deposit: | gnosis-build deposit_contract
echo `gnosis-chain-dev-deposit` is deprecated, use `gnosis-chain-dev-deposit` instead
$(call MAKE_DEPOSIT,gnosis-chain,$(GNOSIS_WEB3_URLS))
clean-gnosis-chain:

View File

@ -1120,4 +1120,4 @@ proc loadEth2Network*(config: BeaconNodeConf): Eth2NetworkMetadata {.raises: [De
quit 1
else:
checkNetworkParameterUse config.eth2Network
gnosisChainMetadata
gnosisMetadata

View File

@ -259,17 +259,21 @@ when not defined(gnosisChainBinary):
else:
const
gnosisChainMetadata* = loadCompileTimeNetworkMetadata(
currentSourcePath.parentDir.replace('\\', '/') & "/../../media/gnosis-chain")
gnosisMetadata* = loadCompileTimeNetworkMetadata(
currentSourcePath.parentDir.replace('\\', '/') & "/../../media/gnosis")
proc checkNetworkParameterUse*(eth2Network: Option[string]) =
if eth2Network.isSome and eth2Network.get != "gnosis-chain":
fatal "The only supported value for the --network parameter is 'gnosis-chain'"
# Support `gnosis-chain` as network name which was used in v22.3
if eth2Network.isSome and eth2Network.get notin ["gnosis", "gnosis-chain"]:
fatal "The only supported value for the --network parameter is 'gnosis'"
quit 1
if eth2Network.isSome and eth2Network.get == "gnosis-chain":
warn "`--network:gnosis-chain` is deprecated, use `--network:gnosis` instead"
proc getRuntimeConfig*(eth2Network: Option[string]): RuntimeConfig {.raises: [Defect, IOError].} =
checkNetworkParameterUse eth2Network
gnosisChainMetadata.cfg
gnosisMetadata.cfg
proc extractGenesisValidatorRootFromSnapshot*(
snapshot: string): Eth2Digest {.raises: [Defect, IOError, SszError].} =

View File

@ -467,9 +467,12 @@ proc init*(T: type BeaconNode,
eth1Monitor.loadPersistedDeposits()
let phase0Genesis = waitFor eth1Monitor.waitGenesis()
genesisState = newClone ForkedHashedBeaconState.init(
phase0.HashedBeaconState(data: phase0Genesis[],
root: hash_tree_root(phase0Genesis[])))
genesisState = (ref ForkedHashedBeaconState)(
kind: BeaconStateFork.Phase0,
phase0Data:
(ref phase0.HashedBeaconState)(
data: phase0Genesis[],
root: hash_tree_root(phase0Genesis[]))[])
if bnStatus == BeaconNodeStatus.Stopping:
return nil

View File

@ -172,12 +172,13 @@ template toFork*[T: bellatrix.BeaconState | bellatrix.HashedBeaconState](
t: type T): BeaconStateFork =
BeaconStateFork.Bellatrix
template init*(T: type ForkedHashedBeaconState, data: phase0.HashedBeaconState): T =
T(kind: BeaconStateFork.Phase0, phase0Data: data)
template init*(T: type ForkedHashedBeaconState, data: altair.HashedBeaconState): T =
T(kind: BeaconStateFork.Altair, altairData: data)
template init*(T: type ForkedHashedBeaconState, data: bellatrix.HashedBeaconState): T =
T(kind: BeaconStateFork.Bellatrix, bellatrixData: data)
# TODO these cause stack overflows due to large temporaries getting allocated
# template init*(T: type ForkedHashedBeaconState, data: phase0.HashedBeaconState): T =
# T(kind: BeaconStateFork.Phase0, phase0Data: data)
# template init*(T: type ForkedHashedBeaconState, data: altair.HashedBeaconState): T =
# T(kind: BeaconStateFork.Altair, altairData: data)
# template init*(T: type ForkedHashedBeaconState, data: bellatrix.HashedBeaconState): T =
# T(kind: BeaconStateFork.Bellatrix, bellatrixData: data)
template init*(T: type ForkedBeaconBlock, blck: phase0.BeaconBlock): T =
T(kind: BeaconBlockFork.Phase0, phase0Data: blck)