Merge pull request #1300 from status-im/deactivate-dual-fork-choice

Deactivate dual fork choice
This commit is contained in:
Ștefan Talpalaru 2020-07-11 00:07:53 +02:00 committed by GitHub
commit 86241d7303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 11 deletions

View File

@ -182,8 +182,8 @@ func updateLatestVotes(
if current.isNil or current.slot < attestationSlot:
pool.latestAttestations[pubKey] = blck
# ForkChoice v2
pool.forkChoice_v2.process_attestation(validator, blck.root, target_epoch)
# # ForkChoice v2
# pool.forkChoice_v2.process_attestation(validator, blck.root, target_epoch)
func get_attesting_indices_seq(state: BeaconState,
attestation_data: AttestationData,
@ -636,11 +636,11 @@ proc pruneBefore*(pool: var AttestationPool, finalizedhead: BlockSlot) =
proc selectHead*(pool: var AttestationPool): BlockRef =
let head_v1 = pool.selectHead_v1()
let head_v2 = pool.selectHead_v2()
if head_v1 != head_v2:
error "Fork choice engines in disagreement, using block from v1.",
v1_block = shortlog(head_v1),
v2_block = shortlog(head_v2)
# let head_v2 = pool.selectHead_v2()
#
# if head_v1 != head_v2:
# error "Fork choice engines in disagreement, using block from v1.",
# v1_block = shortlog(head_v1),
# v2_block = shortlog(head_v2)
return head_v1

View File

@ -347,7 +347,8 @@ proc storeBlock(
{.gcsafe.}: # TODO: fork choice and blockpool should sync via messages instead of callbacks
let blck = node.blockPool.addRawBlock(blockRoot, signedBlock) do (validBlock: BlockRef):
# Callback add to fork choice if valid
node.attestationPool.addForkChoice_v2(validBlock)
# node.attestationPool.addForkChoice_v2(validBlock)
discard "TODO: Deactivated"
node.dumpBlock(signedBlock, blck)

View File

@ -70,8 +70,9 @@ proc updateHead*(node: BeaconNode): BlockRef =
node.blockPool.updateHead(newHead)
beacon_head_root.set newHead.root.toGaugeValue
# TODO - deactivated
# Cleanup the fork choice v2 if we have a finalized head
node.attestationPool.pruneBefore(node.blockPool.finalizedHead)
# node.attestationPool.pruneBefore(node.blockPool.finalizedHead)
newHead

View File

@ -228,7 +228,8 @@ proc proposeSignedBlock*(node: BeaconNode,
{.gcsafe.}: # TODO: fork choice and blockpool should sync via messages instead of callbacks
let newBlockRef = node.blockPool.addRawBlock(blockRoot, newBlock) do (validBlock: BlockRef):
# Callback Add to fork choice
node.attestationPool.addForkChoice_v2(validBlock)
# node.attestationPool.addForkChoice_v2(validBlock)
discard "TODO: Deactivated"
if newBlockRef.isErr:
warn "Unable to add proposed block to block pool",