mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-22 12:30:08 +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 =
|
func `[]`*[T](a: seq[T], b: ValidatorIndex): auto =
|
||||||
a[b.int]
|
a[b.int]
|
||||||
|
|
||||||
func `[]=`*[T](a: var seq[T], b: ValidatorIndex, c: T) =
|
|
||||||
a[b.int] = c
|
|
||||||
|
|
||||||
# `ValidatorIndex` Nim integration
|
# `ValidatorIndex` Nim integration
|
||||||
proc `==`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
proc `==`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
||||||
proc `<`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
proc `<`*(x, y: ValidatorIndex) : bool {.borrow, noSideEffect.}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2018-2020 Status Research & Development GmbH
|
# Copyright (c) 2018-2021 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).
|
||||||
@ -66,12 +66,6 @@ func eth2digest*(v: openArray[byte]): Eth2Digest {.noInit.} =
|
|||||||
ctx.update(v)
|
ctx.update(v)
|
||||||
ctx.finish()
|
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 =
|
template withEth2Hash*(body: untyped): Eth2Digest =
|
||||||
## This little helper will init the hash function and return the sliced
|
## This little helper will init the hash function and return the sliced
|
||||||
## hash:
|
## hash:
|
||||||
|
@ -15,9 +15,9 @@ import
|
|||||||
chronicles,
|
chronicles,
|
||||||
# Specs
|
# Specs
|
||||||
../../beacon_chain/spec/[datatypes, beaconstate, helpers, validator, crypto,
|
../../beacon_chain/spec/[datatypes, beaconstate, helpers, validator, crypto,
|
||||||
signatures, state_transition, presets],
|
signatures, presets],
|
||||||
# Internals
|
# Internals
|
||||||
../../beacon_chain/[ssz, extras],
|
../../beacon_chain/ssz,
|
||||||
# Mocking procs
|
# Mocking procs
|
||||||
./mock_blocks,
|
./mock_blocks,
|
||||||
./mock_validator_keys
|
./mock_validator_keys
|
||||||
@ -113,29 +113,3 @@ proc mockAttestation*(
|
|||||||
state: BeaconState,
|
state: BeaconState,
|
||||||
slot: Slot): Attestation =
|
slot: Slot): Attestation =
|
||||||
mockAttestationImpl(state, slot)
|
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 & ']'
|
" [Preset: " & const_preset & ']'
|
||||||
|
|
||||||
# For state_sim
|
# 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) =
|
template withTimer*(duration: var float, body: untyped) =
|
||||||
let start = getMonoTime()
|
let start = getMonoTime()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user