Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value of largeRequestsTimeout is set via --large-requests-timeout parameter when starting nimbus_beacon_node in trustedNodeSync mode. #6781

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions beacon_chain/conf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,11 @@ type
defaultValue: false
name: "with-deposit-snapshot" .}: bool

largeRequestsTimeout* {.
desc: "Timeout for large requests (in seconds)"
defaultValue: 120
name: "large-requests-timeout" .}: int

ValidatorClientConf* = object
configFile* {.
desc: "Loads the configuration from a TOML file"
Expand Down
4 changes: 4 additions & 0 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ proc doRunTrustedNodeSync(
backfill: bool,
reindex: bool,
downloadDepositSnapshot: bool,
largeRequestsTimeout: int,
genesisState: ref ForkedHashedBeaconState) {.async.} =
let syncTarget =
if stateId.isSome:
Expand Down Expand Up @@ -139,6 +140,7 @@ proc doRunTrustedNodeSync(
backfill,
reindex,
downloadDepositSnapshot,
largeRequestsTimeout,
genesisState)

func getVanityLogs(stdoutKind: StdoutLogKind): VanityLogs =
Expand Down Expand Up @@ -791,6 +793,7 @@ proc init*(T: type BeaconNode,
backfill = false,
reindex = false,
downloadDepositSnapshot = false,
config.largeRequestsTimeout,
genesisState)

if config.finalizedCheckpointBlock.isSome:
Expand Down Expand Up @@ -2560,6 +2563,7 @@ proc handleStartUpCmd(config: var BeaconNodeConf) {.raises: [CatchableError].} =
config.backfillBlocks,
config.reindex,
config.downloadDepositSnapshot,
config.largeRequestsTimeout,
genesisState)
db.close()

Expand Down
9 changes: 5 additions & 4 deletions beacon_chain/trusted_node_sync.nim
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import
from presto import RestDecodingError

const
largeRequestsTimeout = 120.seconds # Downloading large items such as states.
smallRequestsTimeout = 30.seconds # Downloading smaller items such as blocks and deposit snapshots.
# largeRequestsTimeout # Downloading large items such as states. The value is set via the --large-requests-timeout parameter.

proc fetchDepositSnapshot(
client: RestClientRef
Expand Down Expand Up @@ -78,13 +78,14 @@ proc doTrustedNodeSync*(
backfill: bool,
reindex: bool,
downloadDepositSnapshot: bool,
largeRequestsTimeout: int,
genesisState: ref ForkedHashedBeaconState = nil) {.async.} =
logScope:
restUrl
syncTarget

notice "Starting trusted node sync",
databaseDir, backfill, reindex
databaseDir, backfill, reindex, largeRequestsTimeout

var
client = createNewRestClient(restUrl).valueOr:
Expand Down Expand Up @@ -145,7 +146,7 @@ proc doTrustedNodeSync*(
try:
awaitWithTimeout(
client.getStateV2(StateIdent.init(StateIdentType.Genesis), cfg),
largeRequestsTimeout):
largeRequestsTimeout.seconds):
info "Attempt to download genesis state timed out"
# https://github.com/nim-lang/Nim/issues/22180
(ref ForkedHashedBeaconState)(nil)
Expand Down Expand Up @@ -336,7 +337,7 @@ proc doTrustedNodeSync*(
StateIdent.init(tmp.slot.epoch().start_slot)
else:
tmp
awaitWithTimeout(client.getStateV2(id, cfg), largeRequestsTimeout):
awaitWithTimeout(client.getStateV2(id, cfg), largeRequestsTimeout.seconds):
error "Attempt to download checkpoint state timed out"
quit 1
except CatchableError as exc:
Expand Down
Loading