Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm unused code #5623

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions beacon_chain/consensus_object_pools/block_clearance.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions beacon_chain/consensus_object_pools/consensus_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/gossip_processing/block_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
Expand Down
4 changes: 1 addition & 3 deletions beacon_chain/gossip_processing/eth2_processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ proc processBlobSidecar*(

let
wallTime = self.getCurrentBeaconTime()
(afterGenesis, wallSlot) = wallTime.toSlot()
(_, wallSlot) = wallTime.toSlot()

logScope:
blob = shortLog(blobSidecar)
Expand All @@ -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()
Expand Down
67 changes: 34 additions & 33 deletions beacon_chain/nimbus_binary_common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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

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
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 x < v.len: # look for [..m
let c2 = v[x]
if x == i + 1:
if c2 != '[':
break
else:
break
inc x

if found: # skip adding c
continue
res.add c
inc i

res
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

res

proc updateLogLevel*(logLevel: string) {.raises: [ValueError].} =
# Updates log levels (without clearing old ones)
Expand Down
3 changes: 1 addition & 2 deletions beacon_chain/spec/eth2_apis/dynamic_fee_recipients.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading