remove most std/options imports (#4778)
This commit is contained in:
parent
9131ebac81
commit
c31fbc3977
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
# Standard library
|
# Standard library
|
||||||
std/[options, sets, tables, hashes],
|
std/[sets, tables, hashes],
|
||||||
# Status libraries
|
# Status libraries
|
||||||
chronicles,
|
chronicles,
|
||||||
# Internals
|
# Internals
|
||||||
|
@ -25,7 +25,7 @@ from ../spec/datatypes/deneb import TrustedSignedBeaconBlock
|
||||||
from "."/vanity_logs/vanity_logs import VanityLogs
|
from "."/vanity_logs/vanity_logs import VanityLogs
|
||||||
|
|
||||||
export
|
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
|
block_pools_types_light_client, validator_monitor, VanityLogs
|
||||||
|
|
||||||
# ChainDAG and types related to forming a DAG of blocks, keeping track of their
|
# ChainDAG and types related to forming a DAG of blocks, keeping track of their
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[deques, options, strformat, strutils, sequtils, tables,
|
std/[deques, strformat, strutils, sequtils, tables, typetraits, uri, json],
|
||||||
typetraits, uri, json],
|
|
||||||
# Nimble packages:
|
# Nimble packages:
|
||||||
chronos, metrics, chronicles/timings, stint/endians2,
|
chronos, metrics, chronicles/timings, stint/endians2,
|
||||||
json_rpc/[client, errors],
|
json_rpc/[client, errors],
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import std/[options, heapqueue, tables, strutils, sequtils, algorithm]
|
import std/[heapqueue, tables, strutils, sequtils, algorithm]
|
||||||
import stew/[results, base10], chronos, chronicles
|
import stew/[results, base10], chronos, chronicles
|
||||||
import
|
import
|
||||||
../spec/datatypes/[phase0, altair],
|
../spec/datatypes/[phase0, altair],
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, tables, sets, macros],
|
std/[tables, sets, macros],
|
||||||
chronicles, chronos, snappy, snappy/codec,
|
chronicles, chronos, snappy, snappy/codec,
|
||||||
libp2p/switch,
|
libp2p/switch,
|
||||||
../spec/datatypes/[phase0, altair, bellatrix, capella, deneb],
|
../spec/datatypes/[phase0, altair, bellatrix, capella, deneb],
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import std/[options, heapqueue, tables, strutils, sequtils, math]
|
import std/[heapqueue, tables, strutils, sequtils, math]
|
||||||
import stew/[results, base10], chronos, chronicles
|
import stew/[results, base10], chronos, chronicles
|
||||||
import
|
import
|
||||||
../spec/datatypes/[base, phase0, altair],
|
../spec/datatypes/[base, phase0, altair],
|
||||||
|
|
|
@ -272,7 +272,7 @@ proc routeSyncCommitteeMessages*(
|
||||||
Future[seq[SendResult]] {.async.} =
|
Future[seq[SendResult]] {.async.} =
|
||||||
return withState(router[].dag.headState):
|
return withState(router[].dag.headState):
|
||||||
when consensusFork >= ConsensusFork.Altair:
|
when consensusFork >= ConsensusFork.Altair:
|
||||||
var statuses = newSeq[Option[SendResult]](len(msgs))
|
var statuses = newSeq[Opt[SendResult]](len(msgs))
|
||||||
|
|
||||||
let
|
let
|
||||||
curPeriod = sync_committee_period(forkyState.data.slot)
|
curPeriod = sync_committee_period(forkyState.data.slot)
|
||||||
|
@ -291,10 +291,11 @@ proc routeSyncCommitteeMessages*(
|
||||||
elif msgPeriod == nextPeriod:
|
elif msgPeriod == nextPeriod:
|
||||||
resNxt[msg.validator_index] = index
|
resNxt[msg.validator_index] = index
|
||||||
else:
|
else:
|
||||||
statuses[index] =
|
statuses[index] = Opt.some(
|
||||||
some(SendResult.err("Message's slot out of state's head range"))
|
SendResult.err("Message's slot out of state's head range"))
|
||||||
else:
|
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):
|
if (len(resCur) == 0) and (len(resNxt) == 0):
|
||||||
return statuses.mapIt(it.get())
|
return statuses.mapIt(it.get())
|
||||||
(resCur, resNxt)
|
(resCur, resNxt)
|
||||||
|
@ -327,14 +328,14 @@ proc routeSyncCommitteeMessages*(
|
||||||
if future.done():
|
if future.done():
|
||||||
let fres = future.read()
|
let fres = future.read()
|
||||||
if fres.isErr():
|
if fres.isErr():
|
||||||
statuses[indices[index]] = some(SendResult.err(fres.error()))
|
statuses[indices[index]] = Opt.some(SendResult.err(fres.error()))
|
||||||
else:
|
else:
|
||||||
statuses[indices[index]] = some(SendResult.ok())
|
statuses[indices[index]] = Opt.some(SendResult.ok())
|
||||||
elif future.failed() or future.cancelled():
|
elif future.failed() or future.cancelled():
|
||||||
let exc = future.readError()
|
let exc = future.readError()
|
||||||
debug "Unexpected failure while sending committee message",
|
debug "Unexpected failure while sending committee message",
|
||||||
message = msgs[indices[index]], error = $exc.msg
|
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"))
|
"Unexpected failure while sending committee message"))
|
||||||
|
|
||||||
var res: seq[SendResult]
|
var res: seq[SendResult]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# and attesting when they're supposed to.
|
# and attesting when they're supposed to.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[strformat, options, sequtils, tables],
|
std/[strformat, sequtils, tables],
|
||||||
chronicles,
|
chronicles,
|
||||||
confutils,
|
confutils,
|
||||||
stew/io2,
|
stew/io2,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
# Standard library
|
# Standard library
|
||||||
std/[options, strformat, tables],
|
std/[strformat, tables],
|
||||||
# Status libraries
|
# Status libraries
|
||||||
stew/[results, endians2],
|
stew/[results, endians2],
|
||||||
# Internals
|
# Internals
|
||||||
|
@ -15,7 +15,7 @@ import
|
||||||
../../beacon_chain/spec/helpers,
|
../../beacon_chain/spec/helpers,
|
||||||
../../beacon_chain/fork_choice/[fork_choice, fork_choice_types]
|
../../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 =
|
func fakeHash*(index: SomeInteger): Eth2Digest =
|
||||||
## Create fake hashes
|
## Create fake hashes
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
chronos,
|
chronos,
|
||||||
std/[options, sequtils],
|
std/sequtils,
|
||||||
unittest2,
|
unittest2,
|
||||||
eth/keys, taskpools,
|
eth/keys, taskpools,
|
||||||
../beacon_chain/[conf, beacon_clock],
|
../beacon_chain/[conf, beacon_clock],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2021-2022 Status Research & Development GmbH
|
# Copyright (c) 2021-2023 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -8,7 +8,6 @@
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/options,
|
|
||||||
stew/results, presto/client,
|
stew/results, presto/client,
|
||||||
testutils/unittests, chronicles,
|
testutils/unittests, chronicles,
|
||||||
../beacon_chain/spec/eth2_apis/[eth2_rest_serialization, rest_types],
|
../beacon_chain/spec/eth2_apis/[eth2_rest_serialization, rest_types],
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * 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).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
options, sequtils,
|
std/sequtils,
|
||||||
unittest2,
|
unittest2,
|
||||||
./testutil, ./testdbutil, ./teststateutil,
|
./testutil, ./testdbutil, ./teststateutil,
|
||||||
../beacon_chain/spec/datatypes/bellatrix,
|
../beacon_chain/spec/datatypes/bellatrix,
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, random],
|
|
||||||
chronicles,
|
chronicles,
|
||||||
eth/keys,
|
eth/keys,
|
||||||
stew/endians2,
|
stew/endians2,
|
||||||
|
@ -15,6 +14,9 @@ import
|
||||||
../beacon_chain/spec/[
|
../beacon_chain/spec/[
|
||||||
beaconstate, helpers, keystore, signatures, state_transition, validator]
|
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 import EMPTY_ROOT_HASH
|
||||||
from eth/common/eth_types_rlp import rlpHash
|
from eth/common/eth_types_rlp import rlpHash
|
||||||
from eth/eip1559 import EIP1559_INITIAL_BASE_FEE
|
from eth/eip1559 import EIP1559_INITIAL_BASE_FEE
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
import
|
import
|
||||||
chronicles,
|
chronicles,
|
||||||
std/options,
|
|
||||||
./mocking/mock_deposits,
|
./mocking/mock_deposits,
|
||||||
./helpers/math_helpers,
|
./helpers/math_helpers,
|
||||||
../beacon_chain/spec/[
|
../beacon_chain/spec/[
|
||||||
|
|
Loading…
Reference in New Issue