Skip to content

Conversation

ian-shim
Copy link
Contributor

Why are these changes needed?

If it auto registers the socket with missing ports, it can render the node unreachable.

Checks

  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ian-shim ian-shim marked this pull request as ready for review February 14, 2025 05:03
pschork
pschork previously approved these changes Feb 14, 2025
node/node.go Outdated
@@ -349,14 +349,35 @@ func (n *Node) Start(ctx context.Context) error {

n.CurrentSocket = socket
// Start the Node IP updater only if the PUBLIC_IP_PROVIDER is greater than 0.
if n.Config.PubIPCheckInterval > 0 {
if n.Config.PubIPCheckInterval > 0 && n.allPortsConfigured() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure the feature is disabled if its only running v1 and missing v2 ports for example

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the condition is if v2Enabled {...} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would cover most of the cases and is probably fine. Checking the ports is the closest condition we can check here imo, for example, this allows the feature if node is only running v1 but does have the v2 ports configured.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why v1 should disable this feature again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its possible to run the node in v1-only mode without defining v2 ports.

The other concern is chance of split brain problem when running 2 nodes in isolation mode on 2 separate hosts (potentially in different subnets/AZs) the .env port configs could diverge and/or the egress IP could be different - then both nodes start flip flopping with different socket updates.

So the idea is to only enable IP discovery updates when the node is in v1-and-v2 runtime mode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the condition is if v2Enabled {...} ?

if n.Config.v1Enabled && n.Config.v2Enabled {...}

Copy link
Contributor

@jianoaix jianoaix Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its possible to run the node in v1-only mode without defining v2 ports.

This sounds different than "node is only running v1 but does have the v2 ports"

The other concern is chance of split brain problem when running 2 nodes in isolation mode on 2 separate hosts (potentially in different subnets/AZs) the .env port configs could diverge and/or the egress IP could be different - then both nodes start flip flopping with different socket updates.

So the idea is to only enable IP discovery updates when the node is in v1-and-v2 runtime mode

Even it's running v1 and v2 together, they can still run two machines that both have v1 and v2 running, v1-and-v2 mode doesn't seem safe as well

jianoaix
jianoaix previously approved these changes Feb 14, 2025
@ian-shim ian-shim dismissed stale reviews from jianoaix and pschork via ab73efa February 14, 2025 23:07
@ian-shim ian-shim merged commit a0001a3 into Layr-Labs:master Feb 14, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants