Skip to content

Commit

Permalink
fix coordinator unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Nov 15, 2024
1 parent 0d0902c commit a953414
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions coordinator/test/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func setupCoordinator(t *testing.T, proversPerSession uint8, coordinatorURL stri
LowVersionCircuit: &config.CircuitConfig{
ParamsPath: "",
AssetsPath: "",
ForkName: "homestead",
ForkName: "darwin",
MinProverVersion: "v4.2.0",
},
HighVersionCircuit: &config.CircuitConfig{
ParamsPath: "",
AssetsPath: "",
ForkName: "bernoulli",
ForkName: "darwinV2",
MinProverVersion: "v4.3.0",
},
},
Expand All @@ -109,12 +109,16 @@ func setupCoordinator(t *testing.T, proversPerSession uint8, coordinatorURL stri
}

var chainConf params.ChainConfig
chainConf.LondonBlock = big.NewInt(0)
chainConf.BernoulliBlock = big.NewInt(0)
chainConf.CurieBlock = big.NewInt(0)
for _, forkName := range forks {
switch forkName {
case "bernoulli":
chainConf.BernoulliBlock = big.NewInt(100)
case "homestead":
chainConf.HomesteadBlock = big.NewInt(0)
case "darwinV2":
chainConf.DarwinTime = new(uint64)
chainConf.DarwinV2Time = new(uint64)
case "darwin":
chainConf.DarwinTime = new(uint64)
}
}

Expand Down Expand Up @@ -197,7 +201,7 @@ func TestApis(t *testing.T) {
func testHandshake(t *testing.T) {
// Setup coordinator and http server.
coordinatorURL := randomURL()
proofCollector, httpHandler := setupCoordinator(t, 1, coordinatorURL, []string{"homestead"})
proofCollector, httpHandler := setupCoordinator(t, 1, coordinatorURL, []string{"darwinV2"})
defer func() {
proofCollector.Stop()
assert.NoError(t, httpHandler.Shutdown(context.Background()))
Expand All @@ -210,7 +214,7 @@ func testHandshake(t *testing.T) {
func testFailedHandshake(t *testing.T) {
// Setup coordinator and http server.
coordinatorURL := randomURL()
proofCollector, httpHandler := setupCoordinator(t, 1, coordinatorURL, []string{"homestead"})
proofCollector, httpHandler := setupCoordinator(t, 1, coordinatorURL, []string{"darwinV2"})
defer func() {
proofCollector.Stop()
}()
Expand All @@ -228,7 +232,7 @@ func testFailedHandshake(t *testing.T) {

func testGetTaskBlocked(t *testing.T) {
coordinatorURL := randomURL()
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"homestead"})
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"darwinV2"})
defer func() {
collector.Stop()
assert.NoError(t, httpHandler.Shutdown(context.Background()))
Expand Down Expand Up @@ -272,7 +276,7 @@ func testGetTaskBlocked(t *testing.T) {

func testOutdatedProverVersion(t *testing.T) {
coordinatorURL := randomURL()
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"homestead"})
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"darwinV2"})
defer func() {
collector.Stop()
assert.NoError(t, httpHandler.Shutdown(context.Background()))
Expand All @@ -299,7 +303,7 @@ func testOutdatedProverVersion(t *testing.T) {

func testValidProof(t *testing.T) {
coordinatorURL := randomURL()
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"homestead"})
collector, httpHandler := setupCoordinator(t, 3, coordinatorURL, []string{"darwinV2"})
defer func() {
collector.Stop()
assert.NoError(t, httpHandler.Shutdown(context.Background()))
Expand Down

0 comments on commit a953414

Please sign in to comment.