apply holesky fix form 23.9.1 release
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
7ecc1096e3
commit
48363b7a34
|
@ -321,8 +321,8 @@ elif const_preset == "mainnet":
|
||||||
vendorDir & "/holesky/custom_config_data",
|
vendorDir & "/holesky/custom_config_data",
|
||||||
some holesky,
|
some holesky,
|
||||||
downloadGenesisFrom = some DownloadInfo(
|
downloadGenesisFrom = some DownloadInfo(
|
||||||
url: "https://github.com/status-im/nimbus-eth2/releases/download/v23.9.0/holesky-genesis.ssz.sz",
|
url: "https://github.com/status-im/nimbus-eth2/releases/download/v23.9.1/holesky-genesis.ssz.sz",
|
||||||
digest: Eth2Digest.fromHex "0x76631cd0b9ddc5b2c766b496e23f16759ce1181446a4efb40e5540cd15b78a07"))
|
digest: Eth2Digest.fromHex "0x0ea3f6f9515823b59c863454675fefcd1d8b4f2dbe454db166206a41fda060a0"))
|
||||||
|
|
||||||
sepoliaMetadata = loadCompileTimeNetworkMetadata(
|
sepoliaMetadata = loadCompileTimeNetworkMetadata(
|
||||||
vendorDir & "/sepolia/bepolia",
|
vendorDir & "/sepolia/bepolia",
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import
|
import
|
||||||
std/uri,
|
std/uri,
|
||||||
stew/io2, chronos, chronos/apps/http/httpclient, snappy,
|
stew/io2, chronos, chronos/apps/http/httpclient, snappy,
|
||||||
../spec/digest
|
../spec/[digest, forks], ../spec/datatypes/base
|
||||||
|
|
||||||
import network_metadata
|
import network_metadata
|
||||||
export network_metadata
|
export network_metadata
|
||||||
|
@ -29,15 +29,16 @@ proc downloadFile(url: Uri): Future[seq[byte]] {.async.} =
|
||||||
msg: "Unexpected status code " & $response[0] & " when fetching " & $url,
|
msg: "Unexpected status code " & $response[0] & " when fetching " & $url,
|
||||||
status: response[0])
|
status: response[0])
|
||||||
|
|
||||||
proc fetchBytes*(metadata: GenesisMetadata,
|
proc fetchGenesisBytes*(
|
||||||
genesisStateUrlOverride = none(Uri)): Future[seq[byte]] {.async.} =
|
metadata: Eth2NetworkMetadata,
|
||||||
case metadata.kind
|
genesisStateUrlOverride = none(Uri)): Future[seq[byte]] {.async.} =
|
||||||
|
case metadata.genesis.kind
|
||||||
of NoGenesis:
|
of NoGenesis:
|
||||||
raiseAssert "fetchBytes should be called only when metadata.hasGenesis is true"
|
raiseAssert "fetchGenesisBytes should be called only when metadata.hasGenesis is true"
|
||||||
of BakedIn:
|
of BakedIn:
|
||||||
result = @(metadata.bakedBytes)
|
result = @(metadata.genesis.bakedBytes)
|
||||||
of BakedInUrl:
|
of BakedInUrl:
|
||||||
result = await downloadFile(genesisStateUrlOverride.get(parseUri metadata.url))
|
result = await downloadFile(genesisStateUrlOverride.get(parseUri metadata.genesis.url))
|
||||||
# Under the built-in default URL, we serve a snappy-encoded BeaconState in order
|
# Under the built-in default URL, we serve a snappy-encoded BeaconState in order
|
||||||
# to reduce the size of the downloaded file with roughly 50% (this precise ratio
|
# to reduce the size of the downloaded file with roughly 50% (this precise ratio
|
||||||
# depends on the number of validator recors). The user is still free to provide
|
# depends on the number of validator recors). The user is still free to provide
|
||||||
|
@ -54,11 +55,13 @@ proc fetchBytes*(metadata: GenesisMetadata,
|
||||||
# HTTP servers.
|
# HTTP servers.
|
||||||
if result.isSnappyFramedStream:
|
if result.isSnappyFramedStream:
|
||||||
result = decodeFramed(result)
|
result = decodeFramed(result)
|
||||||
if eth2digest(result) != metadata.digest:
|
let state = newClone(readSszForkedHashedBeaconState(metadata.cfg, result))
|
||||||
raise (ref DigestMismatchError)(
|
withState(state[]):
|
||||||
msg: "The downloaded genesis state cannot be verified (checksum mismatch)")
|
if forkyState.root != metadata.genesis.digest:
|
||||||
|
raise (ref DigestMismatchError)(
|
||||||
|
msg: "The downloaded genesis state cannot be verified (checksum mismatch)")
|
||||||
of UserSuppliedFile:
|
of UserSuppliedFile:
|
||||||
result = readAllBytes(metadata.path).tryGet()
|
result = readAllBytes(metadata.genesis.path).tryGet()
|
||||||
|
|
||||||
proc sourceDesc*(metadata: GenesisMetadata): string =
|
proc sourceDesc*(metadata: GenesisMetadata): string =
|
||||||
case metadata.kind
|
case metadata.kind
|
||||||
|
@ -75,5 +78,5 @@ when isMainModule:
|
||||||
let holeskyMetadata = getMetadataForNetwork("holesky")
|
let holeskyMetadata = getMetadataForNetwork("holesky")
|
||||||
io2.writeFile(
|
io2.writeFile(
|
||||||
"holesky-genesis.ssz",
|
"holesky-genesis.ssz",
|
||||||
waitFor holeskyMetadata.genesis.fetchBytes()
|
waitFor holeskyMetadata.fetchGenesisBytes()
|
||||||
).expect("success")
|
).expect("success")
|
||||||
|
|
|
@ -564,7 +564,7 @@ proc init*(T: type BeaconNode,
|
||||||
if metadata.genesis.kind == BakedInUrl:
|
if metadata.genesis.kind == BakedInUrl:
|
||||||
info "Obtaining genesis state",
|
info "Obtaining genesis state",
|
||||||
sourceUrl = $config.genesisStateUrl.get(parseUri metadata.genesis.url)
|
sourceUrl = $config.genesisStateUrl.get(parseUri metadata.genesis.url)
|
||||||
await metadata.genesis.fetchBytes(config.genesisStateUrl)
|
await metadata.fetchGenesisBytes(config.genesisStateUrl)
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
error "Failed to obtain genesis state",
|
error "Failed to obtain genesis state",
|
||||||
source = metadata.genesis.sourceDesc,
|
source = metadata.genesis.sourceDesc,
|
||||||
|
@ -2083,7 +2083,7 @@ proc handleStartUpCmd(config: var BeaconNodeConf) {.raises: [CatchableError].} =
|
||||||
stateId: "finalized")
|
stateId: "finalized")
|
||||||
genesis =
|
genesis =
|
||||||
if network.hasGenesis:
|
if network.hasGenesis:
|
||||||
let genesisBytes = try: waitFor network.genesis.fetchBytes()
|
let genesisBytes = try: waitFor network.fetchGenesisBytes()
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
error "Failed to obtain genesis state",
|
error "Failed to obtain genesis state",
|
||||||
source = network.genesis.sourceDesc,
|
source = network.genesis.sourceDesc,
|
||||||
|
|
|
@ -63,7 +63,7 @@ programMain:
|
||||||
template cfg(): auto = metadata.cfg
|
template cfg(): auto = metadata.cfg
|
||||||
|
|
||||||
let
|
let
|
||||||
genesisBytes = try: waitFor metadata.genesis.fetchBytes()
|
genesisBytes = try: waitFor metadata.fetchGenesisBytes()
|
||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
error "Failed to obtain genesis state",
|
error "Failed to obtain genesis state",
|
||||||
source = metadata.genesis.sourceDesc,
|
source = metadata.genesis.sourceDesc,
|
||||||
|
|
|
@ -18,7 +18,7 @@ const
|
||||||
|
|
||||||
versionMajor* = 23
|
versionMajor* = 23
|
||||||
versionMinor* = 9
|
versionMinor* = 9
|
||||||
versionBuild* = 0
|
versionBuild* = 1
|
||||||
|
|
||||||
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
|
versionBlob* = "stateofus" # Single word - ends up in the default graffiti
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f1ad227a2511ea26f5d043fad15d9431fd681941
|
Subproject commit ea39b9006210848e13f28d92e12a30548cecd41d
|
Loading…
Reference in New Issue