From 344175d1a240427a61fa7550ab7381cb8e92ebac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Fri, 10 Jul 2020 18:47:48 +0200 Subject: [PATCH] Deactivate dual fork choice --- beacon_chain/attestation_pool.nim | 16 ++++++++-------- beacon_chain/beacon_node.nim | 3 ++- beacon_chain/beacon_node_common.nim | 3 ++- beacon_chain/validator_duties.nim | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/beacon_chain/attestation_pool.nim b/beacon_chain/attestation_pool.nim index cd37de36b..102e50f24 100644 --- a/beacon_chain/attestation_pool.nim +++ b/beacon_chain/attestation_pool.nim @@ -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 diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index e86648403..6ad1184b1 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -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) diff --git a/beacon_chain/beacon_node_common.nim b/beacon_chain/beacon_node_common.nim index fb38dc3d8..8fd0f2a06 100644 --- a/beacon_chain/beacon_node_common.nim +++ b/beacon_chain/beacon_node_common.nim @@ -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 diff --git a/beacon_chain/validator_duties.nim b/beacon_chain/validator_duties.nim index e7f95e60e..438d1a6e4 100644 --- a/beacon_chain/validator_duties.nim +++ b/beacon_chain/validator_duties.nim @@ -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",