Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into refactor-publisher…
Browse files Browse the repository at this point in the history
…-wip
  • Loading branch information
fasmat committed Aug 8, 2024
2 parents 0175bc9 + ef93b78 commit 36d48c7
Show file tree
Hide file tree
Showing 37 changed files with 860 additions and 424 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ See [RELEASE](./RELEASE.md) for workflow instructions.

### Upgrade information

The command line flag `--scan-malfeasant-atxs` has been removed. All malfeasant ATXs before 1.6.0 have been marked as
such and the node will continue to scan new ATXs for their validity.

### Highlights

### Features
Expand Down Expand Up @@ -699,6 +702,7 @@ and permanent ineligibility for rewards.

* [#5494](https://github.com/spacemeshos/go-spacemesh/pull/5494)
Make routing discovery more configurable and less spammy by default.

* [#5511](https://github.com/spacemeshos/go-spacemesh/pull/5511)
Fix dialing peers on their private IPs, which was causing "portscan" complaints.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ the build folder you need to ensure that you have the gpu setup dynamic library
binary. The simplest way to do this is just copy the library file to be in the
same directory as the go-spacemesh binary. Alternatively you can modify your
system's library search paths (e.g. LD_LIBRARY_PATH) to ensure that the
library is found._
library is found.

go-spacemesh is p2p software which is designed to form a decentralized network by connecting to other instances of
go-spacemesh running on remote computers.
Expand Down
26 changes: 25 additions & 1 deletion activation/activation_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package activation
import (
"errors"
"fmt"
"strings"
)

var (
Expand All @@ -21,8 +22,31 @@ type PoetSvcUnstableError struct {
source error
}

func (e *PoetSvcUnstableError) Error() string {
func (e PoetSvcUnstableError) Error() string {
return fmt.Sprintf("poet service is unstable: %s (%v)", e.msg, e.source)
}

func (e *PoetSvcUnstableError) Unwrap() error { return e.source }

type PoetRegistrationMismatchError struct {
registrations []string
configuredPoets []string
}

func (e PoetRegistrationMismatchError) Error() string {
var sb strings.Builder
sb.WriteString("builder: none of configured poets matches the existing registrations.\n")
sb.WriteString("registrations:\n")
for _, r := range e.registrations {
sb.WriteString("\t")
sb.WriteString(r)
sb.WriteString("\n")
}
sb.WriteString("\nconfigured poets:\n")
for _, p := range e.configuredPoets {
sb.WriteString("\t")
sb.WriteString(p)
sb.WriteString("\n")
}
return sb.String()
}
2 changes: 1 addition & 1 deletion activation/e2e/atx_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func Test_MarryAndMerge(t *testing.T) {
GracePeriod: epoch / 4,
}

client := ae2e.NewTestPoetClient(2)
client := ae2e.NewTestPoetClient(2, poetCfg)
poetSvc := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

clock, err := timesync.NewClock(
Expand Down
2 changes: 1 addition & 1 deletion activation/e2e/builds_atx_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestBuilder_SwitchesToBuildV2(t *testing.T) {
require.NoError(t, err)
t.Cleanup(clock.Close)

client := ae2e.NewTestPoetClient(1)
client := ae2e.NewTestPoetClient(1, poetCfg)
poetClient := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

localDB := localsql.InMemory()
Expand Down
2 changes: 1 addition & 1 deletion activation/e2e/checkpoint_merged_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func Test_CheckpointAfterMerge(t *testing.T) {
GracePeriod: epoch / 4,
}

client := ae2e.NewTestPoetClient(2)
client := ae2e.NewTestPoetClient(2, poetCfg)
poetSvc := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

clock, err := timesync.NewClock(
Expand Down
2 changes: 1 addition & 1 deletion activation/e2e/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestCheckpoint_PublishingSoloATXs(t *testing.T) {
CycleGap: 3 * epoch / 4,
GracePeriod: epoch / 4,
}
client := ae2e.NewTestPoetClient(1)
client := ae2e.NewTestPoetClient(1, poetCfg)
poetService := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

// ensure that genesis aligns with layer timings
Expand Down
4 changes: 2 additions & 2 deletions activation/e2e/nipost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestNIPostBuilderWithClients(t *testing.T) {
err = nipost.AddPost(localDb, sig.NodeID(), *fullPost(post, info, shared.ZeroChallenge))
require.NoError(t, err)

client := ae2e.NewTestPoetClient(1)
client := ae2e.NewTestPoetClient(1, poetCfg)
poetService := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

localDB := localsql.InMemory()
Expand Down Expand Up @@ -272,7 +272,7 @@ func Test_NIPostBuilderWithMultipleClients(t *testing.T) {
}

poetDb := activation.NewPoetDb(db, logger.Named("poetDb"))
client := ae2e.NewTestPoetClient(len(signers))
client := ae2e.NewTestPoetClient(len(signers), poetCfg)
poetService := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

mclock := activation.NewMocklayerClock(ctrl)
Expand Down
20 changes: 14 additions & 6 deletions activation/e2e/poet_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"net/url"
"strconv"
"sync"
"time"
Expand All @@ -20,15 +19,17 @@ import (
)

type TestPoet struct {
mu sync.Mutex
round int
mu sync.Mutex
round int
poetCfg activation.PoetConfig

expectedMembers int
registrations chan []byte
}

func NewTestPoetClient(expectedMembers int) *TestPoet {
func NewTestPoetClient(expectedMembers int, poetCfg activation.PoetConfig) *TestPoet {
return &TestPoet{
poetCfg: poetCfg,
expectedMembers: expectedMembers,
registrations: make(chan []byte, expectedMembers),
}
Expand Down Expand Up @@ -66,8 +67,15 @@ func (p *TestPoet) Submit(
return &types.PoetRound{ID: strconv.Itoa(round), End: time.Now()}, nil
}

func (p *TestPoet) CertifierInfo(ctx context.Context) (*url.URL, []byte, error) {
return nil, nil, errors.New("not supported")
func (p *TestPoet) CertifierInfo(ctx context.Context) (*types.CertifierInfo, error) {
return nil, errors.New("CertifierInfo: not supported")
}

func (p *TestPoet) Info(ctx context.Context) (*types.PoetInfo, error) {
return &types.PoetInfo{
PhaseShift: p.poetCfg.PhaseShift,
CycleGap: p.poetCfg.CycleGap,
}, nil
}

// Build a proof.
Expand Down
8 changes: 4 additions & 4 deletions activation/e2e/poet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ func TestCertifierInfo(t *testing.T) {
)
require.NoError(t, err)

url, pubkey, err := client.CertifierInfo(context.Background())
certInfo, err := client.CertifierInfo(context.Background())
r.NoError(err)
r.Equal("http://localhost:8080", url.String())
r.Equal([]byte("pubkey"), pubkey)
r.Equal("http://localhost:8080", certInfo.Url.String())
r.Equal([]byte("pubkey"), certInfo.Pubkey)
}

func TestNoCertifierInfo(t *testing.T) {
Expand Down Expand Up @@ -291,6 +291,6 @@ func TestNoCertifierInfo(t *testing.T) {
)
require.NoError(t, err)

_, _, err = client.CertifierInfo(context.Background())
_, err = client.CertifierInfo(context.Background())
r.ErrorContains(err, "poet doesn't support certificates")
}
2 changes: 1 addition & 1 deletion activation/e2e/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestValidator_Validate(t *testing.T) {
}

poetDb := activation.NewPoetDb(sql.InMemory(), logger.Named("poetDb"))
client := ae2e.NewTestPoetClient(1)
client := ae2e.NewTestPoetClient(1, poetCfg)
poetService := activation.NewPoetServiceWithClient(poetDb, client, poetCfg, logger)

mclock := activation.NewMocklayerClock(ctrl)
Expand Down
2 changes: 1 addition & 1 deletion activation/malfeasance.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (mh *MalfeasanceHandler) Validate(ctx context.Context, data wire.ProofData)
msg1.InnerMsg.MsgHash != msg2.InnerMsg.MsgHash {
return msg1.SmesherID, nil
}
mh.logger.Warn("received invalid atx malfeasance proof",
mh.logger.Debug("received invalid atx malfeasance proof",
log.ZContext(ctx),
zap.Stringer("first_smesher", msg1.SmesherID),
zap.Object("first_proof", &msg1.InnerMsg),
Expand Down
Loading

0 comments on commit 36d48c7

Please sign in to comment.