mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 04:24:05 +00:00
remove unused beacon chain spec and test code
This commit is contained in:
parent
5d3c995d42
commit
707fcd99cb
@ -764,9 +764,6 @@ func `[]`*[T](a: var seq[T], b: ValidatorIndex): var T =
|
||||
func `[]`*[T](a: seq[T], b: ValidatorIndex): auto =
|
||||
a[b.int]
|
||||
|
||||
func `[]=`*[T](a: var seq[T], b: ValidatorIndex, c: T) =
|
||||
a[b.int] = c
|
||||
|
||||
# `ValidatorIndex` Nim integration
|
||||
proc `==`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
||||
proc `<`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# beacon_chain
|
||||
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2021 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).
|
||||
@ -66,12 +66,6 @@ func eth2digest*(v: openArray[byte]): Eth2Digest {.noInit.} =
|
||||
ctx.update(v)
|
||||
ctx.finish()
|
||||
|
||||
when BLS_BACKEND == BLST:
|
||||
func update*(ctx: var BLST_SHA256_CTX; digest: Eth2Digest) =
|
||||
ctx.update digest.data
|
||||
func update*(ctx: var sha256; digest: Eth2Digest) =
|
||||
ctx.update digest.data
|
||||
|
||||
template withEth2Hash*(body: untyped): Eth2Digest =
|
||||
## This little helper will init the hash function and return the sliced
|
||||
## hash:
|
||||
|
@ -15,9 +15,9 @@ import
|
||||
chronicles,
|
||||
# Specs
|
||||
../../beacon_chain/spec/[datatypes, beaconstate, helpers, validator, crypto,
|
||||
signatures, state_transition, presets],
|
||||
signatures, presets],
|
||||
# Internals
|
||||
../../beacon_chain/[ssz, extras],
|
||||
../../beacon_chain/ssz,
|
||||
# Mocking procs
|
||||
./mock_blocks,
|
||||
./mock_validator_keys
|
||||
@ -113,29 +113,3 @@ proc mockAttestation*(
|
||||
state: BeaconState,
|
||||
slot: Slot): Attestation =
|
||||
mockAttestationImpl(state, slot)
|
||||
|
||||
func fillAggregateAttestation*(state: BeaconState, attestation: var Attestation) =
|
||||
var cache = StateCache()
|
||||
let beacon_committee = get_beacon_committee(
|
||||
state,
|
||||
attestation.data.slot,
|
||||
attestation.data.index.CommitteeIndex,
|
||||
cache
|
||||
)
|
||||
for i in 0 ..< beacon_committee.len:
|
||||
attestation.aggregation_bits[i] = true
|
||||
|
||||
proc add*(state: var HashedBeaconState, attestation: Attestation, slot: Slot) =
|
||||
var
|
||||
signedBlock = mockBlockForNextSlot(state.data)
|
||||
cache = StateCache()
|
||||
signedBlock.message.slot = slot
|
||||
signedBlock.message.body.attestations.add attestation
|
||||
doAssert process_slots(state, slot, cache)
|
||||
signMockBlock(state.data, signedBlock)
|
||||
|
||||
let success = state_transition(
|
||||
defaultRuntimePreset, state, signedBlock, cache,
|
||||
flags = {skipStateRootValidation}, noRollback)
|
||||
|
||||
doAssert success
|
||||
|
@ -21,15 +21,6 @@ func preset*(): string =
|
||||
" [Preset: " & const_preset & ']'
|
||||
|
||||
# For state_sim
|
||||
template withTimer*(stats: var RunningStat, body: untyped) =
|
||||
let start = getMonoTime()
|
||||
|
||||
block:
|
||||
body
|
||||
|
||||
let stop = getMonoTime()
|
||||
stats.push (stop - start).inMicroseconds.float / 1000000.0
|
||||
|
||||
template withTimer*(duration: var float, body: untyped) =
|
||||
let start = getMonoTime()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user