Skip to content

Commit

Permalink
Remove PoET round 4 work around (#5139)
Browse files Browse the repository at this point in the history
## Motivation
Closes #5030 

## Changes
- remove mitigation for PoET round 4
- mitigation code itself is not removed in case we need it in the future

## Test Plan
- n/a

## TODO
<!-- This section should be removed when all items are complete -->
- [x] Explain motivation or link existing issue(s)
- [x] Test changes and document test plan
- [x] Update documentation as needed
- [x] Update [changelog](../CHANGELOG.md) as needed
  • Loading branch information
fasmat committed Oct 10, 2023
1 parent 46fb639 commit 7b64e64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
18 changes: 5 additions & 13 deletions activation/nipost.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,11 @@ func membersContainChallenge(members []types.Member, challenge types.Hash32) (ui
return 0, fmt.Errorf("challenge is not a member of the proof")
}

func (nb *NIPostBuilder) addPoETMitigation(ctx context.Context, from, to string, pubEpoch types.EpochID) error {
// addPoETMitigation adds a mitigation if one of the PoETs crashed and was restored with the member list of a different PoET.
// for an example see: https://github.com/spacemeshos/go-spacemesh/pull/5031

//lint:ignore U1000 we keep this method in case we need it for a future mitigation
func (nb *NIPostBuilder) addPoETMitigation(ctx context.Context, from, to string, pubEpoch types.EpochID) error { //nolint:unused
clientTo, ok := nb.poetProvers[to]
if !ok {
// Target PoET is not in the list, no action necessary
Expand Down Expand Up @@ -489,18 +493,6 @@ func (nb *NIPostBuilder) addPoETMitigation(ctx context.Context, from, to string,
}

func (nb *NIPostBuilder) getBestProof(ctx context.Context, challenge types.Hash32, publishEpoch types.EpochID) (types.PoetProofRef, *types.MerkleProof, error) {
switch publishEpoch {
case 5:
// PoET 112 came online after the registration window for round 4 ended, so no node could submit to it
// 112 was initialized with the PoET 110 DB, so all successful submissions to 110 should be able to be fetched from there as well
// TODO(mafa): remove after next PoET round; https://github.com/spacemeshos/go-spacemesh/issues/5030
err := nb.addPoETMitigation(ctx, "https://poet-110.spacemesh.network", "https://poet-112.spacemesh.network", 5)
if err != nil {
nb.log.With().Error("pub epoch 5 mitigation: failed to add PoET 112 to state for pub epoch 5", log.Err(err))
}
default:
}

type poetProof struct {
poet *types.PoetProofMessage
membership *types.MerkleProof
Expand Down
10 changes: 2 additions & 8 deletions activation/nipost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ func TestConstructingMerkleProof(t *testing.T) {
})
}

func TestNIPostBuilder_Mainnet_PoetRound3_Workaround(t *testing.T) {
func TestNIPostBuilder_Mainnet_Poet_Workaround(t *testing.T) {
t.Parallel()

tt := []struct {
Expand All @@ -1163,13 +1163,7 @@ func TestNIPostBuilder_Mainnet_PoetRound3_Workaround(t *testing.T) {
to string
epoch types.EpochID
}{
{
// TODO(mafa): remove after epoch 5 end; https://github.com/spacemeshos/go-spacemesh/issues/5030
name: "epoch 5: PoET 112 restore with PoET 110",
from: "https://poet-110.spacemesh.network",
to: "https://poet-112.spacemesh.network",
epoch: 5,
},
// no mitigation needed at the moment
}

for _, tc := range tt {
Expand Down

0 comments on commit 7b64e64

Please sign in to comment.