Skip to content

Commit

Permalink
Skip adding our signature when catching up
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hewison-chris authored and Geod24 committed Jul 23, 2021
1 parent 7b05ab7 commit 0fb8ff7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions source/agora/node/FullNode.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 3 additions & 9 deletions source/agora/node/Validator.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0fb8ff7

Please sign in to comment.