Skip to content

Commit

Permalink
revert unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ConvallariaMaj committed Jul 17, 2024
1 parent 4d067c6 commit fcd2ab1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 39 deletions.
11 changes: 2 additions & 9 deletions activation/activation_multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,7 @@ func TestRegossip(t *testing.T) {
}

func Test_Builder_Multi_InitialPost(t *testing.T) {
tab := newTestBuilder(t, 5, WithPoetConfig(
PoetConfig{
PhaseShift: layerDuration * 4,
}))
tab := newTestBuilder(t, 5, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))

var eg errgroup.Group
for _, sig := range tab.signers {
Expand Down Expand Up @@ -274,11 +271,7 @@ func Test_Builder_Multi_InitialPost(t *testing.T) {

func Test_Builder_Multi_HappyPath(t *testing.T) {
layerDuration := 2 * time.Second
tab := newTestBuilder(t, 3, WithPoetConfig(
PoetConfig{
PhaseShift: layerDuration * 4,
CycleGap: layerDuration,
}))
tab := newTestBuilder(t, 3, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4, CycleGap: layerDuration}))

// step 1: build initial posts
initialPostChan := make(chan struct{})
Expand Down
17 changes: 6 additions & 11 deletions activation/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,7 @@ func TestBuilder_StopSmeshing_failsWhenNotStarted(t *testing.T) {
}

func TestBuilder_PublishActivationTx_HappyFlow(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(
PoetConfig{
PhaseShift: layerDuration,
}))
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration}))
sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -383,9 +380,7 @@ func TestBuilder_PublishActivationTx_HappyFlow(t *testing.T) {
// failing with ErrATXChallengeExpired.
func TestBuilder_Loop_WaitsOnStaleChallenge(t *testing.T) {
// Arrange
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{
PhaseShift: layerDuration * 4,
}))
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
sig := maps.Values(tab.signers)[0]

// current layer is too late to be able to build a nipost on time
Expand Down Expand Up @@ -434,9 +429,7 @@ func TestBuilder_Loop_WaitsOnStaleChallenge(t *testing.T) {
}

func TestBuilder_PublishActivationTx_FaultyNet(t *testing.T) {
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{
PhaseShift: layerDuration * 4,
}))
tab := newTestBuilder(t, 1, WithPoetConfig(PoetConfig{PhaseShift: layerDuration * 4}))
sig := maps.Values(tab.signers)[0]

posEpoch := postGenesisEpoch
Expand Down Expand Up @@ -508,7 +501,9 @@ func TestBuilder_PublishActivationTx_FaultyNet(t *testing.T) {
}

func TestBuilder_PublishActivationTx_UsesExistingChallengeOnLatePublish(t *testing.T) {
poetCfg := PoetConfig{PhaseShift: layerDuration * 4}
poetCfg := PoetConfig{
PhaseShift: layerDuration * 4,
}
tab := newTestBuilder(t, 1, WithPoetConfig(poetCfg))
sig := maps.Values(tab.signers)[0]

Expand Down
6 changes: 3 additions & 3 deletions activation/e2e/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ func Test_BuilderWithMultipleClients(t *testing.T) {
epoch := layerDuration * layersPerEpoch
genesis := time.Now().Add(layerDuration).Round(layerDuration)
poetCfg := activation.PoetConfig{
RequestTimeout: epoch / 5,
RequestRetryDelay: epoch / 50,
MaxRequestRetries: 10,
PhaseShift: epoch,
CycleGap: 3 * epoch / 4,
GracePeriod: epoch / 4,
RequestTimeout: epoch / 5,
RequestRetryDelay: epoch / 50,
MaxRequestRetries: 10,
}

scrypt := testPostSetupOpts(t).Scrypt
Expand Down
27 changes: 12 additions & 15 deletions activation/poet_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,20 @@ func Test_HTTPPoetClient_ParsesURL(t *testing.T) {

t.Run("add http if missing", func(t *testing.T) {
t.Parallel()
client, err := NewHTTPPoetClient(types.PoetServer{Address: "bla"},
PoetConfig{
PhaseShift: cfg.PhaseShift,
CycleGap: cfg.CycleGap,
})
client, err := NewHTTPPoetClient(types.PoetServer{Address: "bla"}, PoetConfig{
PhaseShift: cfg.PhaseShift,
CycleGap: cfg.CycleGap,
})
require.NoError(t, err)
require.Equal(t, "http://bla", client.baseURL.String())
})

t.Run("do not change scheme if present", func(t *testing.T) {
t.Parallel()
client, err := NewHTTPPoetClient(types.PoetServer{Address: "https://bla"},
PoetConfig{
PhaseShift: cfg.PhaseShift,
CycleGap: cfg.CycleGap,
})
client, err := NewHTTPPoetClient(types.PoetServer{Address: "https://bla"}, PoetConfig{
PhaseShift: cfg.PhaseShift,
CycleGap: cfg.CycleGap,
})
require.NoError(t, err)
require.Equal(t, "https://bla", client.baseURL.String())
})
Expand Down Expand Up @@ -115,11 +113,10 @@ func Test_HTTPPoetClient_Address_Mainnet(t *testing.T) {

for _, url := range poETServers {
t.Run(url, func(t *testing.T) {
client, err := NewHTTPPoetClient(types.PoetServer{Address: url},
PoetConfig{
PhaseShift: poetCfg.PhaseShift,
CycleGap: poetCfg.CycleGap,
})
client, err := NewHTTPPoetClient(types.PoetServer{Address: url}, PoetConfig{
PhaseShift: poetCfg.PhaseShift,
CycleGap: poetCfg.CycleGap,
})
require.NoError(t, err)
require.Equal(t, url, client.Address())
})
Expand Down
2 changes: 1 addition & 1 deletion config/presets/fastnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func fastnet() config.Config {
conf.POET.GracePeriod = 10 * time.Second
conf.POET.CycleGap = 30 * time.Second
conf.POET.PhaseShift = 30 * time.Second
conf.POET.PositioningATXSelectionTimeout = 25 * time.Minute
conf.POET.PositioningATXSelectionTimeout = 25 * time.Second
// RequestTimeout = RequestRetryDelay * 2 * MaxRequestRetries*(MaxRequestRetries+1)/2
conf.POET.RequestTimeout = 12 * time.Second
conf.POET.RequestRetryDelay = 1 * time.Second
Expand Down

0 comments on commit fcd2ab1

Please sign in to comment.