From dbbdbea7da4fa88b53dfded7f26a49fb91c2f5e9 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 10 Oct 2021 13:35:06 +0200 Subject: [PATCH 1/3] Hotfix: Revert a nim-web3 change that interferes with Eth1 deposit syncing --- beacon_chain/eth1/eth1_monitor.nim | 34 +----------------------------- vendor/nim-web3 | 2 +- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/beacon_chain/eth1/eth1_monitor.nim b/beacon_chain/eth1/eth1_monitor.nim index 5eb2c1a42..ca673f543 100644 --- a/beacon_chain/eth1/eth1_monitor.nim +++ b/beacon_chain/eth1/eth1_monitor.nim @@ -12,7 +12,7 @@ import typetraits, uri, json], # Nimble packages: chronos, json, metrics, chronicles/timings, - web3, web3/ethtypes as web3Types, web3/ethhexstrings, web3/engine_api, + web3, web3/ethtypes as web3Types, web3/ethhexstrings, eth/common/eth_types, eth/async_utils, stew/byteutils, # Local modules: @@ -403,38 +403,6 @@ proc getBlockByNumber*(p: Web3DataProviderRef, except ValueError as exc: raiseAssert exc.msg # Never fails p.web3.provider.eth_getBlockByNumber(hexNumber, false) -proc preparePayload*(p: Web3DataProviderRef, - parentHash: Eth2Digest, - timestamp: uint64, - randomData: array[32, byte], - feeRecipient: Eth1Address): Future[PreparePayloadResponse] = - p.web3.provider.engine_preparePayload(PayloadAttributes( - parentHash: parentHash.asBlockHash, - timestamp: Quantity timestamp, - random: FixedBytes[32] randomData, - feeRecipient: feeRecipient)) - -proc getPayload*(p: Web3DataProviderRef, - payloadId: Quantity): Future[engine_api.ExecutionPayload] = - p.web3.provider.engine_getPayload(payloadId) - -proc executePayload*(p: Web3DataProviderRef, - payload: engine_api.ExecutionPayload): Future[ExecutePayloadResponse] = - p.web3.provider.engine_executePayload(payload) - -proc consensusValidated*(p: Web3DataProviderRef, - blockHash: BlockHash, - status: BlockValidationStatus): Future[JsonNode] = - p.web3.provider.engine_consensusValidated(BlockValidationResult( - blockHash: blockHash, - status: $status)) - -proc forkchoiceUpdated*(p: Web3DataProviderRef, - headBlock, finalizedBlock: Eth2Digest): Future[JsonNode] = - p.web3.provider.engine_forkchoiceUpdated(ForkChoiceUpdate( - headBlockHash: headBlock.asBlockHash, - finalizedBlockHash: finalizedBlock.asBlockHash)) - template readJsonField(j: JsonNode, fieldName: string, ValueType: type): untyped = var res: ValueType fromJson(j[fieldName], fieldName, res) diff --git a/vendor/nim-web3 b/vendor/nim-web3 index 9a23474af..97e05aea6 160000 --- a/vendor/nim-web3 +++ b/vendor/nim-web3 @@ -1 +1 @@ -Subproject commit 9a23474afb7e2a14798ec0bf0e69e96cd5895e55 +Subproject commit 97e05aea6573d2630e318e7777a54d95db6ec40e From d918b7bc030c3007ec7b9e7bff4ab7ec41a87666 Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Thu, 7 Oct 2021 23:08:12 +0200 Subject: [PATCH 2/3] update defaultRuntimeConfig for v1.1.1 (#2958) This synchronizes defaultRuntimeConfig with v1.1.1 of the spec. - Introduces `TERMINAL_TOTAL_DIFFICULTY` and `TERMINAL_BLOCK_HASH`. - Sets `ALTAIR_FORK_EPOCH` in `mainnet` preset. --- beacon_chain/spec/presets.nim | 43 +++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/beacon_chain/spec/presets.nim b/beacon_chain/spec/presets.nim index cf7e01535..ee9c56344 100644 --- a/beacon_chain/spec/presets.nim +++ b/beacon_chain/spec/presets.nim @@ -9,8 +9,7 @@ import std/[macros, strutils, parseutils, tables], - stew/endians2, - web3/[ethtypes] + stew/endians2, stint, web3/[ethtypes] export toBytesBE @@ -30,10 +29,14 @@ type Eth1Address* = ethtypes.Address RuntimeConfig* = object - ## https://github.com/ethereum/eth2.0-specs/tree/v1.1.0-alpha.8/configs + ## https://github.com/ethereum/consensus-specs/tree/v1.1.1/configs PRESET_BASE*: string + # Transition + TERMINAL_TOTAL_DIFFICULTY*: UInt256 + TERMINAL_BLOCK_HASH*: BlockHash + # Genesis MIN_GENESIS_ACTIVE_VALIDATOR_COUNT*: uint64 MIN_GENESIS_TIME*: uint64 @@ -144,10 +147,6 @@ const "CONFIG_NAME", - # Merge-related settings that are already part of the mainnet config: - "TERMINAL_TOTAL_DIFFICULTY", - "TERMINAL_BLOCK_HASH", - "TRANSITION_TOTAL_DIFFICULTY", # Name that appears in some altair alphas, obsolete, remove when no more testnets ] @@ -158,11 +157,20 @@ when const_preset == "mainnet": # TODO Move this to RuntimeConfig const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 12 - # https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.8/configs/mainnet.yaml + # https://github.com/ethereum/consensus-specs/blob/v1.1.1/configs/mainnet.yaml # TODO Read these from yaml file const defaultRuntimeConfig* = RuntimeConfig( PRESET_BASE: "mainnet", + # Transition + # --------------------------------------------------------------- + # TBD, 2**256-2**10 is a placeholder + TERMINAL_TOTAL_DIFFICULTY: + u256"115792089237316195423570985008687907853269984665640564039457584007913129638912", + # By default, don't use this param + TERMINAL_BLOCK_HASH: BlockHash.fromHex( + "0x0000000000000000000000000000000000000000000000000000000000000000"), + # Genesis # --------------------------------------------------------------- # `2**14` (= 16,384) @@ -183,7 +191,7 @@ when const_preset == "mainnet": # Altair ALTAIR_FORK_VERSION: Version [byte 0x01, 0x00, 0x00, 0x00], - ALTAIR_FORK_EPOCH: FAR_FUTURE_EPOCH, + ALTAIR_FORK_EPOCH: Epoch(74240), # Oct 27, 2021, 10:56:23am UTC # Merge MERGE_FORK_VERSION: Version [byte 0x02, 0x00, 0x00, 0x00], MERGE_FORK_EPOCH: Epoch(uint64.high), @@ -237,13 +245,22 @@ elif const_preset == "minimal": const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 6 - # https://github.com/ethereum/consensus-specs/blob/v1.1.0-alpha.8/configs/minimal.yaml + # https://github.com/ethereum/consensus-specs/blob/v1.1.1/configs/minimal.yaml const defaultRuntimeConfig* = RuntimeConfig( # Minimal config # Extends the minimal preset PRESET_BASE: "minimal", + # Transition + # --------------------------------------------------------------- + # TBD, 2**256-2**10 is a placeholder + TERMINAL_TOTAL_DIFFICULTY: + u256"115792089237316195423570985008687907853269984665640564039457584007913129638912", + # By default, don't use this param + TERMINAL_BLOCK_HASH: BlockHash.fromHex( + "0x0000000000000000000000000000000000000000000000000000000000000000"), + # Genesis # --------------------------------------------------------------- # [customized] @@ -367,6 +384,12 @@ template parse(T: type string, input: string): T = template parse(T: type Eth1Address, input: string): T = Eth1Address.fromHex(input) +template parse(T: type BlockHash, input: string): T = + BlockHash.fromHex(input) + +template parse(T: type UInt256, input: string): T = + parse(input, UInt256, 10) + proc readRuntimeConfig*( path: string): (RuntimeConfig, seq[string]) {. raises: [IOError, PresetFileError, PresetIncompatibleError, Defect].} = From 592e4928a117eba6cdd76cac248be3009d3b41c3 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 10 Oct 2021 14:09:36 +0200 Subject: [PATCH 3/3] Version v1.5.1 --- CHANGELOG.md | 8 ++++++++ beacon_chain/version.nim | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07828f1da..27db3fdec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +2021-10-04 v1.5.1 +================= + +Nimbus `v1.5.1` is a `high-urgency` release for all users who have already upgraded to `v1.5.0`. It fixes a deposit contract syncing issue manifesting as the warning message "Eth1 chain not synced". Under specific circumstances, such a failure to sync the Eth1 chain may result in missed Eth2 block proposals, so affected users are advised to upgrade as soon as possible. + +For anyone still running Nimbus v1.4.x or earlier, migrating to v1.5.1 continues to be a `medium-urgency` but *mandatory* upgrade that must be installed **before October 27th**. + + 2021-10-04 v1.5.0 ================= diff --git a/beacon_chain/version.nim b/beacon_chain/version.nim index d60b2886e..41c684132 100644 --- a/beacon_chain/version.nim +++ b/beacon_chain/version.nim @@ -15,7 +15,7 @@ when not defined(nimscript): const versionMajor* = 1 versionMinor* = 5 - versionBuild* = 0 + versionBuild* = 1 versionBlob* = "stateofus" # Single word - ends up in the default graffitti