remove most std/options imports (#4778)

This commit is contained in:
tersec 2023-03-31 20:46:47 +00:00 committed by GitHub
parent 9131ebac81
commit c31fbc3977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 24 additions and 24 deletions

View File

@ -9,7 +9,7 @@
import
# Standard library
std/[options, sets, tables, hashes],
std/[sets, tables, hashes],
# Status libraries
chronicles,
# Internals
@ -25,7 +25,7 @@ from ../spec/datatypes/deneb import TrustedSignedBeaconBlock
from "."/vanity_logs/vanity_logs import VanityLogs
export
options, sets, tables, hashes, helpers, beacon_chain_db, era_db, block_dag,
sets, tables, hashes, helpers, beacon_chain_db, era_db, block_dag,
block_pools_types_light_client, validator_monitor, VanityLogs
# ChainDAG and types related to forming a DAG of blocks, keeping track of their

View File

@ -8,8 +8,7 @@
{.push raises: [].}
import
std/[deques, options, strformat, strutils, sequtils, tables,
typetraits, uri, json],
std/[deques, strformat, strutils, sequtils, tables, typetraits, uri, json],
# Nimble packages:
chronos, metrics, chronicles/timings, stint/endians2,
json_rpc/[client, errors],

View File

@ -7,7 +7,7 @@
{.push raises: [].}
import std/[options, heapqueue, tables, strutils, sequtils, algorithm]
import std/[heapqueue, tables, strutils, sequtils, algorithm]
import stew/[results, base10], chronos, chronicles
import
../spec/datatypes/[phase0, altair],

View File

@ -8,7 +8,7 @@
{.push raises: [].}
import
std/[options, tables, sets, macros],
std/[tables, sets, macros],
chronicles, chronos, snappy, snappy/codec,
libp2p/switch,
../spec/datatypes/[phase0, altair, bellatrix, capella, deneb],

View File

@ -7,7 +7,7 @@
{.push raises: [].}
import std/[options, heapqueue, tables, strutils, sequtils, math]
import std/[heapqueue, tables, strutils, sequtils, math]
import stew/[results, base10], chronos, chronicles
import
../spec/datatypes/[base, phase0, altair],

View File

@ -272,7 +272,7 @@ proc routeSyncCommitteeMessages*(
Future[seq[SendResult]] {.async.} =
return withState(router[].dag.headState):
when consensusFork >= ConsensusFork.Altair:
var statuses = newSeq[Option[SendResult]](len(msgs))
var statuses = newSeq[Opt[SendResult]](len(msgs))
let
curPeriod = sync_committee_period(forkyState.data.slot)
@ -291,10 +291,11 @@ proc routeSyncCommitteeMessages*(
elif msgPeriod == nextPeriod:
resNxt[msg.validator_index] = index
else:
statuses[index] =
some(SendResult.err("Message's slot out of state's head range"))
statuses[index] = Opt.some(
SendResult.err("Message's slot out of state's head range"))
else:
statuses[index] = some(SendResult.err("Incorrect validator's index"))
statuses[index] = Opt.some(
SendResult.err("Incorrect validator's index"))
if (len(resCur) == 0) and (len(resNxt) == 0):
return statuses.mapIt(it.get())
(resCur, resNxt)
@ -327,14 +328,14 @@ proc routeSyncCommitteeMessages*(
if future.done():
let fres = future.read()
if fres.isErr():
statuses[indices[index]] = some(SendResult.err(fres.error()))
statuses[indices[index]] = Opt.some(SendResult.err(fres.error()))
else:
statuses[indices[index]] = some(SendResult.ok())
statuses[indices[index]] = Opt.some(SendResult.ok())
elif future.failed() or future.cancelled():
let exc = future.readError()
debug "Unexpected failure while sending committee message",
message = msgs[indices[index]], error = $exc.msg
statuses[indices[index]] = some(SendResult.err(
statuses[indices[index]] = Opt.some(SendResult.err(
"Unexpected failure while sending committee message"))
var res: seq[SendResult]

View File

@ -10,7 +10,7 @@
# and attesting when they're supposed to.
import
std/[strformat, options, sequtils, tables],
std/[strformat, sequtils, tables],
chronicles,
confutils,
stew/io2,

View File

@ -7,7 +7,7 @@
import
# Standard library
std/[options, strformat, tables],
std/[strformat, tables],
# Status libraries
stew/[results, endians2],
# Internals
@ -15,7 +15,7 @@ import
../../beacon_chain/spec/helpers,
../../beacon_chain/fork_choice/[fork_choice, fork_choice_types]
export results, base, helpers, fork_choice, fork_choice_types, tables, options
export results, base, helpers, fork_choice, fork_choice_types, tables
func fakeHash*(index: SomeInteger): Eth2Digest =
## Create fake hashes

View File

@ -9,7 +9,7 @@
import
chronos,
std/[options, sequtils],
std/sequtils,
unittest2,
eth/keys, taskpools,
../beacon_chain/[conf, beacon_clock],

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Copyright (c) 2021-2023 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -8,7 +8,6 @@
{.used.}
import
std/options,
stew/results, presto/client,
testutils/unittests, chronicles,
../beacon_chain/spec/eth2_apis/[eth2_rest_serialization, rest_types],

View File

@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Copyright (c) 2018-2023 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
@ -8,7 +8,7 @@
{.used.}
import
options, sequtils,
std/sequtils,
unittest2,
./testutil, ./testdbutil, ./teststateutil,
../beacon_chain/spec/datatypes/bellatrix,

View File

@ -6,7 +6,6 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
std/[options, random],
chronicles,
eth/keys,
stew/endians2,
@ -15,6 +14,9 @@ import
../beacon_chain/spec/[
beaconstate, helpers, keystore, signatures, state_transition, validator]
# TODO remove this dependency
from std/random import rand
from eth/common/eth_types import EMPTY_ROOT_HASH
from eth/common/eth_types_rlp import rlpHash
from eth/eip1559 import EIP1559_INITIAL_BASE_FEE

View File

@ -9,7 +9,6 @@
import
chronicles,
std/options,
./mocking/mock_deposits,
./helpers/math_helpers,
../beacon_chain/spec/[