rm unused code (#5623)

This commit is contained in:
tersec 2023-11-25 12:09:18 +00:00 committed by GitHub
parent 5aa595fbc6
commit 115ffa70eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 68 deletions

View File

@ -251,9 +251,6 @@ proc addHeadBlockWithParent*(
parent = shortLog(parent), checkedParent = shortLog(checkedParent)
return err(VerifierError.MissingParent)
template blck(): untyped = signedBlock.message # shortcuts without copy
template blockRoot(): untyped = signedBlock.root
# The block is resolved, now it's time to validate it to ensure that the
# blocks we add to the database are clean for the given state
let startTick = Moment.now()

View File

@ -82,34 +82,6 @@ proc existingCurrentSyncCommitteeForPeriod(
doAssert strictVerification notin dag.updateFlags
syncCommittee
template syncCommitteeRoot(state: ForkyHashedBeaconState): Eth2Digest =
## Compute a root to uniquely identify `current_sync_committee` and
## `next_sync_committee`.
withEth2Hash:
h.update state.data.current_sync_committee.hash_tree_root().data
h.update state.data.next_sync_committee.hash_tree_root().data
proc syncCommitteeRootForPeriod(
dag: ChainDAGRef,
tmpState: var ForkedHashedBeaconState,
period: SyncCommitteePeriod): Opt[Eth2Digest] =
## Compute a root to uniquely identify `current_sync_committee` and
## `next_sync_committee` for a given sync committee period.
## For non-finalized periods, follow the chain as selected by fork choice.
let lowSlot = max(dag.tail.slot, dag.cfg.ALTAIR_FORK_EPOCH.start_slot)
if period < lowSlot.sync_committee_period:
return err()
let
periodStartSlot = period.start_slot
syncCommitteeSlot = max(periodStartSlot, lowSlot)
bsi = ? dag.getExistingBlockIdAtSlot(syncCommitteeSlot)
dag.withUpdatedExistingState(tmpState, bsi) do:
withState(updatedState):
when consensusFork >= ConsensusFork.Altair:
ok forkyState.syncCommitteeRoot
else: raiseAssert "Unreachable"
do: err()
proc initLightClientDataStore*(
config: LightClientDataConfig,
cfg: RuntimeConfig,

View File

@ -114,8 +114,6 @@ proc expectBlock*(self: var ConsensusManager, expectedSlot: Slot): Future[bool]
return fut
func `$`(h: BlockHash): string = $h.asEth2Digest
func shouldSyncOptimistically*(
optimisticSlot, dagSlot, wallSlot: Slot): bool =
## Determine whether an optimistic execution block hash should be reported

View File

@ -787,7 +787,7 @@ proc processBlock(
let
wallTime = self.getBeaconTime()
(afterGenesis, wallSlot) = wallTime.toSlot()
(afterGenesis, _) = wallTime.toSlot()
if not afterGenesis:
error "Processing block before genesis, clock turned back?"

View File

@ -280,7 +280,7 @@ proc processBlobSidecar*(
let
wallTime = self.getCurrentBeaconTime()
(afterGenesis, wallSlot) = wallTime.toSlot()
(_, wallSlot) = wallTime.toSlot()
logScope:
blob = shortLog(blobSidecar)
@ -302,8 +302,6 @@ proc processBlobSidecar*(
debug "Blob validated, putting in blob quarantine"
self.blobQuarantine[].put(newClone(blobSidecar))
var skippedBlocks = false
let block_root = hash_tree_root(block_header)
if (let o = self.quarantine[].popBlobless(block_root); o.isSome):
let blobless = o.unsafeGet()

View File

@ -41,40 +41,41 @@ type
raises: [].}
# silly chronicles, colors is a compile-time property
proc stripAnsi(v: string): string =
var
res = newStringOfCap(v.len)
i: int
when defaultChroniclesStream.outputs.type.arity == 2:
func stripAnsi(v: string): string =
var
res = newStringOfCap(v.len)
i: int
while i < v.len:
let c = v[i]
if c == '\x1b':
var
x = i + 1
found = false
while i < v.len:
let c = v[i]
if c == '\x1b':
var
x = i + 1
found = false
while x < v.len: # look for [..m
let c2 = v[x]
if x == i + 1:
if c2 != '[':
break
else:
if c2 in {'0'..'9'} + {';'}:
discard # keep looking
elif c2 == 'm':
i = x + 1
found = true
break
while x < v.len: # look for [..m
let c2 = v[x]
if x == i + 1:
if c2 != '[':
break
else:
break
inc x
if c2 in {'0'..'9'} + {';'}:
discard # keep looking
elif c2 == 'm':
i = x + 1
found = true
break
else:
break
inc x
if found: # skip adding c
continue
res.add c
inc i
if found: # skip adding c
continue
res.add c
inc i
res
res
proc updateLogLevel*(logLevel: string) {.raises: [ValueError].} =
# Updates log levels (without clearing old ones)

View File

@ -28,8 +28,7 @@ proc addMapping*(store: var DynamicFeeRecipientsStore,
validator: ValidatorIndex,
feeRecipient: Eth1Address,
currentEpoch: Epoch) =
var
found, updated = false
var updated = false
store.mappings.withValue(validator, entry) do:
updated = not (entry[].recipient == feeRecipient)
entry[] = Entry(recipient: feeRecipient, addedAt: currentEpoch)