From 0fb8ff70ccc0ce4518b3a9dd65b186d25a642316 Mon Sep 17 00:00:00 2001 From: hewison-chris Date: Fri, 16 Jul 2021 14:25:21 +0900 Subject: [PATCH] Skip adding our signature when catching up We should only sign a single block at a certain height to prevent leaking our private key. It is very difficult for us to know when adding blocks given to us by other nodes if we have in fact already signed a different block at this height. --- source/agora/node/FullNode.d | 3 +-- source/agora/node/Validator.d | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/agora/node/FullNode.d b/source/agora/node/FullNode.d index 20e81f0bb53..2b12bddad57 100644 --- a/source/agora/node/FullNode.d +++ b/source/agora/node/FullNode.d @@ -539,8 +539,7 @@ public class FullNode : API /*************************************************************************** - Function that is overriden in Validator to enable block signing during - periodic catchup. + Add block to ledger and remove expired validators from network whitelist Params: block = block to be added to the Ledger diff --git a/source/agora/node/Validator.d b/source/agora/node/Validator.d index 5ab269c2fb4..65b94288813 100644 --- a/source/agora/node/Validator.d +++ b/source/agora/node/Validator.d @@ -292,7 +292,6 @@ public class Validator : FullNode, API protected override string acceptBlock (const ref Block block) @trusted { import agora.common.BitMask; - import agora.crypto.Schnorr; import std.algorithm; import std.range; import std.format; @@ -327,14 +326,9 @@ public class Validator : FullNode, API } else { - signed_validators[node_validator_index] = true; - this.network.gossipBlockSignature(ValidatorBlockSig(block.header.height, - this.config.validator.key_pair.address, sig.s)); - log.trace("Periodic Catchup: ADD to block signature R: {} and s: {}", - sig.R, sig.s.toString(PrintMode.Clear)); - const signed_block = block.updateSignature( - multiSigCombine([ block.header.signature, sig ]), signed_validators); - this.ledger.updateBlockMultiSig(signed_block.header); + log.warn("This node's signature is not in the block signature. " ~ + "However, we will not sign in case we signed a different block " ~ + "at this height and could reveal our private key."); } return null; }