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

Remove redundant code #3288

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions node/bft/src/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,6 @@ impl<N: Network> Primary<N> {
}
// Retrieve the committee lookback for the round.
let committee_lookback = self_.ledger.get_committee_lookback_for_round(proposal.round())?;
// Retrieve the address of the validator.
let Some(signer) = self_.gateway.resolver().get_address(peer_ip) else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe this code is redundant. The previous check above:

        if self.gateway.resolver().get_address(peer_ip).map_or(true, |address| address != signer) {
            // Proceed to disconnect the validator.
            self.gateway.disconnect(peer_ip);
            bail!("Malicious peer - batch signature is from a different validator ({signer})");
        }

Returns true if there was no signer associated with a connected peer ip. Removing this check means that we would now allow validators to process the signatures for non-connected validators.

In theory, could alter the above check, but I believe the double-lookup is cheap enough to not warrant any changes.

bail!("Signature is from a disconnected validator");
};
// Add the signature to the batch.
proposal.add_signature(signer, signature, &committee_lookback)?;
info!("Received a batch signature for round {} from '{peer_ip}'", proposal.round());
Expand Down