Skip to content

Commit

Permalink
fix regression in proposals sync (#4986)
Browse files Browse the repository at this point in the history
on sync path activeset is downloaded together with proposals so that not updated nodes can download data.
however starting at specific layer (in systests in all layers) we only sign empty activeset, so after downloading proposals it should not pass this validation.
  • Loading branch information
dshulyak committed Sep 8, 2023
1 parent 3092724 commit 55a193d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ See [RELEASE](./RELEASE.md) for workflow instructions.
* [#4965](https://github.com/spacemeshos/go-spacemesh/pull/4965) Updates to PoST:
* Prevent errors when shutting down the node that can result in a crash
* `postdata_metadata.json` is now updated atomically to prevent corruption of the file.
* [#4956](https://github.com/spacemeshos/go-spacemesh/pull/4956) Active set is will not be gossipped in every proposal.
Active set usually contains list of atxs that targets current epoch. As the number of atxs grows this object grows as well.

## v1.1.4

Expand Down
11 changes: 9 additions & 2 deletions proposals/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,19 @@ func (h *Handler) handleProposal(ctx context.Context, expHash types.Hash32, peer
latency := receivedTime.Sub(h.clock.LayerToTime(p.Layer))
metrics.ReportMessageLatency(pubsub.ProposalProtocol, pubsub.ProposalProtocol, latency)

set := p.ActiveSet
// on sync path activeset is downloaded together with proposal
// but starting at layer AllowEmptyActiveSet proposals are signed without activeset
if p.Layer >= h.cfg.AllowEmptyActiveSet {
p.ActiveSet = nil
}
if !h.edVerifier.Verify(signing.PROPOSAL, p.SmesherID, p.SignedBytes(), p.Signature) {
badSigBallot.Inc()
badSigProposal.Inc()
return fmt.Errorf("failed to verify proposal signature")
}
p.ActiveSet = set
if !h.edVerifier.Verify(signing.BALLOT, p.Ballot.SmesherID, p.Ballot.SignedBytes(), p.Ballot.Signature) {
badSigProposal.Inc()
badSigBallot.Inc()
return fmt.Errorf("failed to verify ballot signature")
}

Expand Down

0 comments on commit 55a193d

Please sign in to comment.