Deactivate dual fork choice

This commit is contained in:
Mamy André-Ratsimbazafy 2020-07-10 18:47:48 +02:00
parent 87928e0069
commit 344175d1a2
No known key found for this signature in database
GPG Key ID: 7B88AD1FE79492E1
4 changed files with 14 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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