-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement head block age monitoring
- Loading branch information
1 parent
df12a58
commit 26ecaac
Showing
18 changed files
with
716 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
/bin/* | ||
!/bin/.gitkeep | ||
/cmd/__debug_* | ||
dist | ||
|
||
# ide | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package config | ||
|
||
import "errors" | ||
|
||
func flatten(errs []error) error { | ||
next := 0 | ||
for _, err := range errs { | ||
if err != nil { | ||
errs[next] = err | ||
next++ | ||
} | ||
} | ||
errs = errs[:next] | ||
|
||
switch len(errs) { | ||
default: | ||
return errors.Join(errs...) | ||
case 1: | ||
return errs[0] | ||
case 0: | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
"time" | ||
) | ||
|
||
type HealthcheckGeth struct { | ||
BaseURL string `yaml:"base_url"` | ||
BaseURL string `yaml:"base_url"` | ||
BlockAgeThreshold time.Duration `yaml:"-"` | ||
} | ||
|
||
func (c *HealthcheckGeth) Preprocess() error { | ||
if c.BaseURL != "" { | ||
if _, err := url.Parse(c.BaseURL); err != nil { | ||
return fmt.Errorf("invalid geth base url: %w", | ||
err, | ||
) | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
"time" | ||
) | ||
|
||
type HealthcheckLighthouse struct { | ||
BaseURL string `yaml:"base_url"` | ||
BaseURL string `yaml:"base_url"` | ||
BlockAgeThreshold time.Duration `yaml:"-"` | ||
} | ||
|
||
func (c *HealthcheckLighthouse) Preprocess() error { | ||
if c.BaseURL != "" { | ||
if _, err := url.Parse(c.BaseURL); err != nil { | ||
return fmt.Errorf("invalid lighthouse base url: %w", | ||
err, | ||
) | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
"time" | ||
) | ||
|
||
type HealthcheckOpNode struct { | ||
BaseURL string `yaml:"base_url"` | ||
ConfirmationDistance uint64 `yaml:"confirmation_distance"` | ||
BaseURL string `yaml:"base_url"` | ||
BlockAgeThreshold time.Duration `yaml:"-"` | ||
ConfirmationDistance uint64 `yaml:"confirmation_distance"` | ||
} | ||
|
||
func (c *HealthcheckOpNode) Preprocess() error { | ||
if c.BaseURL != "" { | ||
if _, err := url.Parse(c.BaseURL); err != nil { | ||
return fmt.Errorf("invalid op-node base url: %w", | ||
err, | ||
) | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
"time" | ||
) | ||
|
||
type HealthcheckReth struct { | ||
BaseURL string `yaml:"base_url"` | ||
BaseURL string `yaml:"base_url"` | ||
BlockAgeThreshold time.Duration `yaml:"-"` | ||
} | ||
|
||
func (c *HealthcheckReth) Preprocess() error { | ||
if c.BaseURL != "" { | ||
if _, err := url.Parse(c.BaseURL); err != nil { | ||
return fmt.Errorf("invalid reth base url: %w", | ||
err, | ||
) | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.