Skip to content

Commit

Permalink
Merge branch 'unstable' into dev/etan/bd-gnosis
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status authored Nov 10, 2023
2 parents d4cbf57 + eb35039 commit a2834f3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2023-11-06 v23.10.1
===================

Nimbus `v23.10.1` is a `low-urgency` hotfix release addressing a peer scoring issue introduced in the `v23.10.0` release. The issue manifests under specific network circumstances as a buildup of gossip topics with a low number of peers. Affected users are advised to upgrade at their earliest convenience.


2023-10-17 v23.10.0
===================

Expand Down
33 changes: 18 additions & 15 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type
# TODO GOSSIP_MAX_SIZE*: uint64
# TODO MAX_REQUEST_BLOCKS*: uint64
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION*: uint64
# TODO MIN_EPOCHS_FOR_BLOCK_REQUESTS*: uint64
MIN_EPOCHS_FOR_BLOCK_REQUESTS*: uint64
# TODO MAX_CHUNK_SIZE*: uint64
# TODO TTFB_TIMEOUT*: uint64
# TODO RESP_TIMEOUT*: uint64
Expand Down Expand Up @@ -240,7 +240,7 @@ when const_preset == "mainnet":
# `2**8` (= 256)
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
# TODO MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
# `10 * 2**20` (=10485760, 10 MiB)
# TODO MAX_CHUNK_SIZE: 10485760,
# 5s
Expand Down Expand Up @@ -385,7 +385,7 @@ elif const_preset == "gnosis":
# `2**8` (= 256)
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
# `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 33024, ~5 months)
# TODO MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 33024,
# `10 * 2**20` (=10485760, 10 MiB)
# TODO MAX_CHUNK_SIZE: 10485760,
# 5s
Expand Down Expand Up @@ -422,7 +422,7 @@ elif const_preset == "minimal":

const SECONDS_PER_SLOT* {.intdefine.}: uint64 = 6

# https://github.com/ethereum/consensus-specs/blob/v1.3.0/configs/minimal.yaml
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/configs/minimal.yaml
const defaultRuntimeConfig* = RuntimeConfig(
# Minimal config

Expand Down Expand Up @@ -527,7 +527,7 @@ elif const_preset == "minimal":
# `2**8` (= 256)
# TODO EPOCHS_PER_SUBNET_SUBSCRIPTION: 256,
# [customized] `MIN_VALIDATOR_WITHDRAWABILITY_DELAY + CHURN_LIMIT_QUOTIENT // 2` (= 272)
# TODO MIN_EPOCHS_FOR_BLOCK_REQUESTS: 272,
MIN_EPOCHS_FOR_BLOCK_REQUESTS: 272,
# `10 * 2**20` (=10485760, 10 MiB)
# TODO MAX_CHUNK_SIZE: 10485760,
# 5s
Expand Down Expand Up @@ -587,7 +587,7 @@ const SLOTS_PER_SYNC_COMMITTEE_PERIOD* =
SLOTS_PER_EPOCH * EPOCHS_PER_SYNC_COMMITTEE_PERIOD

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-alpha.3/specs/phase0/p2p-interface.md#configuration
func MIN_EPOCHS_FOR_BLOCK_REQUESTS*(cfg: RuntimeConfig): uint64 =
func safeMinEpochsForBlockRequests*(cfg: RuntimeConfig): uint64 =
cfg.MIN_VALIDATOR_WITHDRAWABILITY_DELAY + cfg.CHURN_LIMIT_QUOTIENT div 2

func parse(T: type uint64, input: string): T {.raises: [ValueError].} =
Expand Down Expand Up @@ -668,30 +668,33 @@ proc readRuntimeConfig*(

# Certain config keys are baked into the binary at compile-time
# and cannot be overridden via config.
template checkCompatibility(constValue: untyped, name: string): untyped =
template checkCompatibility(
constValue: untyped, name: string, operator: untyped = `==`): untyped =
if values.hasKey(name):
const opDesc = astToStr(operator)
try:
let value = parse(typeof(constValue), values[name])
when constValue is distinct:
if distinctBase(value) != distinctBase(constValue):
if not operator(distinctBase(value), distinctBase(constValue)):
raise (ref PresetFileError)(msg:
"Cannot override config" &
" (compiled: " & name & "=" & $distinctBase(constValue) &
" (required: " & name & opDesc & $distinctBase(constValue) &
" - config: " & name & "=" & values[name] & ")")
else:
if value != constValue:
if not operator(value, constValue):
raise (ref PresetFileError)(msg:
"Cannot override config" &
" (compiled: " & name & "=" & $constValue &
" (required: " & name & opDesc & $constValue &
" - config: " & name & "=" & values[name] & ")")
values.del name
except ValueError:
raise (ref PresetFileError)(msg: "Unable to parse " & name)

template checkCompatibility(constValue: untyped): untyped =
template checkCompatibility(
constValue: untyped, operator: untyped = `==`): untyped =
block:
const name = astToStr(constValue)
checkCompatibility(constValue, name)
checkCompatibility(constValue, name, operator)

checkCompatibility SECONDS_PER_SLOT

Expand Down Expand Up @@ -785,8 +788,8 @@ proc readRuntimeConfig*(
msg: "Config not compatible with binary, compile with -d:const_preset=" & cfg.PRESET_BASE)

# Requires initialized `cfg`
checkCompatibility cfg.MIN_EPOCHS_FOR_BLOCK_REQUESTS,
"MIN_EPOCHS_FOR_BLOCK_REQUESTS"
checkCompatibility cfg.safeMinEpochsForBlockRequests(),
"MIN_EPOCHS_FOR_BLOCK_REQUESTS", `>=`

var unknowns: seq[string]
for name in values.keys:
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/version.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const

versionMajor* = 23
versionMinor* = 10
versionBuild* = 0
versionBuild* = 1

versionBlob* = "stateofus" # Single word - ends up in the default graffiti

Expand Down
18 changes: 14 additions & 4 deletions docs/the_nimbus_book/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,20 @@ theme:
- navigation.top
- content.tabs.link
palette:
scheme: default
primary: orange
accent: amber
- scheme: default
primary: orange
accent: amber
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
primary: black
accent: light blue
toggle:
icon: material/brightness-4
name: Switch to light mode
extra_css:
- stylesheets/extra.css

# Support urls previously used by mdbook
use_directory_urls: false
Expand All @@ -29,7 +40,6 @@ docs_dir: src

markdown_extensions:
- admonition
- meta
- pymdownx.details
- pymdownx.highlight:
anchor_linenums: true
Expand Down
6 changes: 6 additions & 0 deletions docs/the_nimbus_book/src/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[data-md-color-scheme="slate"] {
--md-hue: 180;
--md-default-bg-color: hsla(var(--md-hue), 0%, 0%, 1);
--md-footer-bg-color: hsla(var(--md-hue), 0%, 0%, 1);
--md-footer-bg-color--dark: hsla(var(--md-hue), 0%, 0%, 1);
}
1 change: 1 addition & 0 deletions tests/test_blockchain_dag.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,7 @@ suite "Pruning":
var res = defaultRuntimeConfig
res.MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 4
res.CHURN_LIMIT_QUOTIENT = 1
res.MIN_EPOCHS_FOR_BLOCK_REQUESTS = res.safeMinEpochsForBlockRequests()
doAssert res.MIN_EPOCHS_FOR_BLOCK_REQUESTS == 4
res
db = makeTestDB(SLOTS_PER_EPOCH)
Expand Down

0 comments on commit a2834f3

Please sign in to comment.