rm more state_sim remnants (#5334)
This commit is contained in:
parent
a5151bc546
commit
93d82e2892
|
@ -280,7 +280,7 @@ func makeAttestationData*(
|
|||
)
|
||||
)
|
||||
|
||||
func makeAttestationSig*(
|
||||
func makeAttestationSig(
|
||||
fork: Fork, genesis_validators_root: Eth2Digest, data: AttestationData,
|
||||
committee: openArray[ValidatorIndex],
|
||||
bits: CommitteeValidatorsBits): ValidatorSig =
|
||||
|
@ -317,15 +317,11 @@ func makeAttestationData*(
|
|||
makeAttestationData(
|
||||
forkyState.data, slot, committee_index, beacon_block_root)
|
||||
|
||||
func makeAttestation*(
|
||||
func makeAttestation(
|
||||
state: ForkedHashedBeaconState, beacon_block_root: Eth2Digest,
|
||||
committee: seq[ValidatorIndex], slot: Slot, committee_index: CommitteeIndex,
|
||||
validator_index: ValidatorIndex, cache: var StateCache,
|
||||
flags: UpdateFlags = {}): Attestation =
|
||||
# Avoids state_sim silliness; as it's responsible for all validators,
|
||||
# transforming, from monotonic enumerable index -> committee index ->
|
||||
# monotonic enumerable index, is wasteful and slow. Most test callers
|
||||
# want ValidatorIndex, so that's supported too.
|
||||
let
|
||||
index_in_committee = committee.find(validator_index)
|
||||
data = makeAttestationData(state, slot, committee_index, beacon_block_root)
|
||||
|
|
|
@ -6,41 +6,25 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
{.push raises: [].}
|
||||
{.used.}
|
||||
|
||||
import
|
||||
std/[algorithm, strformat, stats, tables, times],
|
||||
testutils/markdown_reports,
|
||||
unittest2,
|
||||
../beacon_chain/spec/presets
|
||||
|
||||
from std/algorithm import SortOrder, sort
|
||||
from std/strformat import `&`
|
||||
from std/tables import OrderedTable, `[]=`, initOrderedTable, mgetOrPut, sort
|
||||
from std/times import Duration, inNanoseconds
|
||||
|
||||
export unittest2
|
||||
|
||||
type
|
||||
TestDuration = tuple[duration: float, label: string]
|
||||
|
||||
func preset*(): string =
|
||||
func preset*(): string {.compileTime.} =
|
||||
" [Preset: " & const_preset & ']'
|
||||
|
||||
# For state_sim
|
||||
template withTimer*(duration: var float, body: untyped) =
|
||||
let start = getMonoTime()
|
||||
|
||||
block:
|
||||
body
|
||||
|
||||
duration = (getMonoTime() - start).inMicroseconds.float / 1000000.0
|
||||
|
||||
# For state_sim
|
||||
template withTimerRet*(stats: var RunningStat, body: untyped): untyped =
|
||||
let start = getMonoTime()
|
||||
let tmp = block:
|
||||
body
|
||||
let stop = getMonoTime()
|
||||
stats.push (stop - start).inMicroseconds.float / 1000000.0
|
||||
|
||||
tmp
|
||||
|
||||
var testTimes: seq[TestDuration]
|
||||
var status = initOrderedTable[string, OrderedTable[string, Status]]()
|
||||
|
||||
|
|
Loading…
Reference in New Issue