Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure Gateway IP Resides in the Same Subnet as Node's IP #2963

Merged

Conversation

Mahmoud-Emad
Copy link
Contributor

@Mahmoud-Emad Mahmoud-Emad commented Jun 12, 2024

Description

The gateway must reside within the same IP range (subnet) as the node's IP address to facilitate proper routing. This ensures that the node can effectively communicate and route its traffic through the designated gateway.

Changes

  • A new validation rule has been added to ensure that the gateway IP address is within the same subnet as the node's IP address. This validation is applied based on the IP version (IPv4 or IPv6).
  • A new validation rule has been added to verify whether the provided IPv4 address is public or private.
  • A new validation rule has been added to verify whether the provided IPv6 address is public or private.

Related Issues

Screenshots

  • image
  • image
  • image
  • image
  • image

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

- Implemented a validation rule ensuring the gateway IP address resides within the same subnet as the node's IP address.

- A new validation rule has been added to verify whether the provided IPv4 address is public or private.
- A new validation rule has been added to verify whether the provided IPv6 address is public or private.
Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

I tried adding invalid data and the validation didn't work.

image

- Updated the 'isPrivateIP' validation rule to validate the prefix len.
- Displayed the error message in an alert on the form.
- Updated the errors that came from the chain to be user-readable message.
@Mahmoud-Emad
Copy link
Contributor Author

I tried adding invalid data and the validation didn't work.

image

There is a validation on the chain that may validate the prefix length. The value '0' you sent is not valid. This scenario is covered.

image

Also, the error message has been updated to be user-readable, and I have logged the actual error from the chain in the console/logger for developer investigations.

image

@Mahmoud-Emad Mahmoud-Emad requested a review from zaelgohary June 12, 2024 12:21
@zaelgohary
Copy link
Contributor

Also, the error message has been updated to be user-readable, and I have logged the actual error from the chain in the console/logger for developer investigations.

image

Do we really need to show the error to the user twice? I think the toast is enough. If the user wants to copy it, he can get it from the logs.

@Mahmoud-Emad
Copy link
Contributor Author

Mahmoud-Emad commented Jun 13, 2024

Also, the error message has been updated to be user-readable, and I have logged the actual error from the chain in the console/logger for developer investigations.
image

Do we really need to show the error to the user twice? I think the toast is enough. If the user wants to copy it, he can get it from the logs.

The toast message stays on the screen for about 5 seconds before disappearing. I included the alert so that users have enough time to read any error messages without feeling rushed.

Consider this scenario: you press "save," and then glance at your phone for a minute. When you look back, you notice that the public configuration wasn't added, and no errors had disappeared. This is the reason for the alert. Either way, I'll remove it now.

- Removed the 'Error Alert'.
- Updated some messages in the validators.
@AhmedHanafy725 AhmedHanafy725 merged commit 1944556 into development_2.6 Jun 19, 2024
3 checks passed
@AhmedHanafy725 AhmedHanafy725 deleted the development_2.6_node_public_config_validations branch June 19, 2024 07:19
@xmonader xmonader added this to the 2.6.0 milestone Sep 24, 2024
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.

5 participants