harmony-one / harmony

The core protocol of harmony
https://harmony.one
GNU Lesser General Public License v3.0
1.46k stars 286 forks source link

Crosslink heartbeat verify through current committee #4673

Closed Frozen closed 2 months ago

Frozen commented 2 months ago

Crosslink heartbeat verify through current committee

Frozen commented 2 months ago

https://github.com/harmony-one/harmony/pull/4673/files#diff-53cafc20d348cad861dbaad811b8e24eed9320f4382536da667b166aa641eb6eR71

sophoah commented 2 months ago

PR Explanation: In current dev shard 0 node are signing the crosslink heartbeat with the current leader private key, however upon processing the heartbeat shard 1 is verifying the public key by using the epoch number in the heartbeat hb.epoch(). In normal situation it usually works fine since hb.epoch() and cur.epoch() will be the same or more or less 1 epoch difference. However, in cases where the crosslink wasn't processed for a long time, the leader in hb.epoch() may not have been elected. It will be especially true in the future with external leader rotation when external validator can be kick out from committee due to low signature rate.

This PR is takes the assumption that the heartbeat has to be processed as soon as they are sent, and making sure it is sent by a valid/elected validator should be enough for now

sophoah commented 2 months ago

@Frozen can you review the conflict and @GheisMohammadi comment