Skip to content

Commit 21daaad

Browse files
authored
support special characters in network metadata paths (#6141)
1 parent c9f5908 commit 21daaad

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

beacon_chain/networking/network_metadata.nim

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
{.push raises: [].}
99

1010
import
11-
std/[sequtils, strutils, os],
11+
std/os,
1212
stew/[byteutils, objects], stew/shims/macros, nimcrypto/hash,
1313
web3/[conversions],
1414
web3/primitives as web3types,
1515
chronicles,
1616
eth/common/eth_types_json_serialization,
1717
../spec/[eth2_ssz_serialization, forks]
1818

19+
from std/sequtils import deduplicate, filterIt, mapIt
20+
from std/strutils import
21+
escape, parseBiggestUInt, replace, splitLines, startsWith, strip,
22+
toLowerAscii
23+
1924
# TODO(zah):
2025
# We can compress the embedded states with snappy before embedding them here.
2126

@@ -236,7 +241,7 @@ when const_preset == "gnosis":
236241
chiadoGenesisSize* {.importc: "gnosis_chiado_genesis_size".}: int
237242

238243
# let `.incbin` in assembly file find the binary file through search path
239-
{.passc: "-I" & vendorDir.}
244+
{.passc: "-I" & escape(vendorDir).}
240245
{.compile: "network_metadata_gnosis.S".}
241246

242247
else:
@@ -263,9 +268,6 @@ when const_preset == "gnosis":
263268
checkForkConsistency(network.cfg)
264269

265270
for network in [gnosisMetadata, chiadoMetadata]:
266-
doAssert network.cfg.ALTAIR_FORK_EPOCH < FAR_FUTURE_EPOCH
267-
doAssert network.cfg.BELLATRIX_FORK_EPOCH < FAR_FUTURE_EPOCH
268-
doAssert network.cfg.CAPELLA_FORK_EPOCH < FAR_FUTURE_EPOCH
269271
doAssert network.cfg.DENEB_FORK_EPOCH < FAR_FUTURE_EPOCH
270272
doAssert network.cfg.ELECTRA_FORK_EPOCH == FAR_FUTURE_EPOCH
271273
static: doAssert ConsensusFork.high == ConsensusFork.Deneb
@@ -287,7 +289,7 @@ elif const_preset == "mainnet":
287289
{.pop.}
288290

289291
# let `.incbin` in assembly file find the binary file through search path
290-
{.passc: "-I" & vendorDir.}
292+
{.passc: "-I" & escape(vendorDir).}
291293
{.compile: "network_metadata_mainnet.S".}
292294

293295
else:
@@ -329,9 +331,6 @@ elif const_preset == "mainnet":
329331
checkForkConsistency(network.cfg)
330332

331333
for network in [mainnetMetadata, praterMetadata, sepoliaMetadata, holeskyMetadata]:
332-
doAssert network.cfg.ALTAIR_FORK_EPOCH < FAR_FUTURE_EPOCH
333-
doAssert network.cfg.BELLATRIX_FORK_EPOCH < FAR_FUTURE_EPOCH
334-
doAssert network.cfg.CAPELLA_FORK_EPOCH < FAR_FUTURE_EPOCH
335334
doAssert network.cfg.DENEB_FORK_EPOCH < FAR_FUTURE_EPOCH
336335
doAssert network.cfg.ELECTRA_FORK_EPOCH == FAR_FUTURE_EPOCH
337336
static: doAssert ConsensusFork.high == ConsensusFork.Deneb

env.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/usr/bin/env bash
2+
# beacon_chain
3+
# Copyright (c) 2020-2024 Status Research & Development GmbH
4+
# Licensed and distributed under either of
5+
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
6+
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
7+
# at your option. This file may not be copied, modified, or distributed except according to those terms.
28

39
# We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file
410
# and we fall back to a Zsh-specific special var to also support Zsh.
511
REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})"
6-
ABS_PATH="$(cd ${REL_PATH}; pwd)"
12+
ABS_PATH="$(cd "${REL_PATH}"; pwd)"
713

814
# Activate nvm only when this file is sourced without arguments:
915
if [ -z "$*" ]; then
@@ -32,5 +38,4 @@ if [ -f "${USER_ENV_FILE}" ]; then
3238
set +o allexport
3339
fi
3440

35-
source ${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh
36-
41+
source "${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh"

0 commit comments

Comments
 (0)