Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve crosslink on devnet #4669

Closed
wants to merge 3 commits into from
Closed

Improve crosslink on devnet #4669

wants to merge 3 commits into from

Conversation

Frozen
Copy link
Contributor

@Frozen Frozen commented May 15, 2024

Improved crosslink signing

@Frozen Frozen force-pushed the fix/crosslink-loop branch 2 times, most recently from 72b2c6b to db9fe4b Compare May 15, 2024 23:28
@Frozen Frozen changed the title Fix/crosslink loop Fix for devnet crosslink. May 16, 2024
go func() {
for {
<-time.After(10 * time.Second)
go currentNode.BroadcastCrossLinkFromShardsToBeacon()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BroadcastCrossLinkFromShardsToBeacon happens only on a new block insertion. There is infinity view change, no new blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not always the case that we are in an infinite view change. Under normal conditions (i.e., no view change), could there be any race conditions here, or what happens if we broadcasting a crosslink twice?

Question is why would a shard need to broadcast a crosslink when it is not producing block?

Copy link
Contributor Author

@Frozen Frozen May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if we broadcasting a crosslink twice

crosslink broadcasted by leader and 1% of validators. It's duplicated by design.

why would a shard need to broadcast a crosslink when it is not producing block

Because shard 0 broadcasts struct CrosslinkHeartbeat with field LatestContinuousBlockNum. It knows about last blocks received by crosslink, but crosslink should be sent first. Actually, that is the second issue, where we can't verify CrosslinkHeartbeat message, because no key in committee, which is solved here

so, there is circular dependency, no heartbeat because no crosslinks, but no crosslinks because no heartbeat.

utils.Logger().Error().Err(err).Msg("[BroadcastCrossLinkSignal] failed to get committee")
continue
}
privToSing := getPrivToSign(node.Consensus.GetPrivateKeys(), comm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we make sure to use the leader private key to sign instead of any private key available on the node?

q := createVoters(comm)
for _, priv := range privs {
_, found := q[priv.Pub.Bytes]
if found { // if key is in committee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depending on the use case of getPrivToSign, there might be instances where we need the leader key instead of any keys currently elected in the committee

@sophoah sophoah changed the title Fix for devnet crosslink. Improve crosslink on devnet May 20, 2024
@Frozen Frozen closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants