feat: add testnet presets and no-bootstrap option (#1438)

This commit is contained in:
Giuliano Mega 2026-05-29 11:19:39 -03:00 committed by GitHub
parent ebb1ae2599
commit 3e0e143270
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 2 deletions

View File

@ -187,6 +187,14 @@ type
name: "bootstrap-node" name: "bootstrap-node"
.}: seq[SignedPeerRecord] .}: seq[SignedPeerRecord]
noBootstrapNode* {.
desc:
"Pass this switch to not bootstrap the node at all. This " &
"is typically only useful if you are creating a new Logos Storage " & "network.",
name: "no-bootstrap-node",
defaultValue: false
.}: bool
network* {. network* {.
desc: "The network to connect to. Options are: \n" & NetworkPresetsDescription, desc: "The network to connect to. Options are: \n" & NetworkPresetsDescription,
name: "network", name: "network",

View File

@ -53,6 +53,30 @@ proc `bootstrapNodes`*(self: NetworkPreset): seq[SignedPeerRecord] =
result.add(parse(SignedPeerRecord, record).tryGet()) result.add(parse(SignedPeerRecord, record).tryGet())
const NetworkPresets* = [ const NetworkPresets* = [
NetworkPreset.init(
"logos.test",
"Logos testnet",
@[
"spr:CiUIAhIhA6rD-Sa1mJqHOoYMk8yad7B4BYDEI_toNwb1z0cYIRu6EgIDARpJCicAJQgCEiEDqsP5JrWYmoc6hgyT" &
"zJp3sHgFgMQj-2g3BvXPRxghG7oQwoe70AYaCwoJBEDhQ42RAiOCGgsKCQRA4UONkQIjgipHMEUCIQCulmrBDKTTxL" &
"8uBQYtEfp3_n3qDZFbO8lZ8mfIWHrRBAIgNXpVlWD1VlXzbGuJ4t7u8b7ymm3AYwm6-KjUvH6NfKU",
"spr:CiUIAhIhAsFwlXD-3VpX-Pa3taM15wdL3DS75l_dpVCIFhdaIKYREgIDARpJCicAJQgCEiECwXCVcP7dWlf49re1" &
"ozXnB0vcNLvmX92lUIgWF1ogphEQ4Ym70AYaCwoJBI5d6vqRAiOCGgsKCQSOXer6kQIjgipGMEQCIGaofSX23DDUcW" &
"EMElHtlaFbLAsM0YgrMB4UwOIqPMb8AiB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Y2JEOyZ1FMdOzN6aZbAWo83AyjCrR-n0sietE1624",
],
),
NetworkPreset.init( NetworkPreset.init(
"logos.dev", "logos.dev",
"Logos devnet", "Logos devnet",

View File

@ -217,8 +217,18 @@ proc new*(
path = providersPath, err = discoveryStoreRes.error.msg path = providersPath, err = discoveryStoreRes.error.msg
let bootstrapNodes = let bootstrapNodes =
if config.bootstrapNodes.len > 0: if config.noBootstrapNode:
info "Overriding network preset using custom bootstrap nodes", # Sanity checks that the user isn't doing anything funny.
if config.bootstrapNodes.len > 0:
error "Cannot specify bootstrap nodes when using no-bootstrap flag"
raise newException(
ValueError, "Cannot specify bootstrap nodes when using no-bootstrap flag"
)
warn "Node has been marked with --no-bootstrap-node and will NOT be bootstrapped"
seq[SignedPeerRecord](@[])
elif config.bootstrapNodes.len > 0:
warn "Overriding network preset using custom bootstrap nodes",
nodes = config.bootstrapNodes nodes = config.bootstrapNodes
config.bootstrapNodes config.bootstrapNodes
else: else: