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

Fix: staking with incorrect refs – rework getRefferalAddress #600

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alx-khramov
Copy link
Contributor

Description

Resolves SI-1817

Fixes the issue, when it is not possible to stake if some incorrect ref is provided.

Testing notes

The logic of processing the provided ref address looks like this:

  1. if the ref is an Ethereum address (0x...), then the ref is used as is
  2. if the ref starts with 'http[s]://', then the ref is replaced with a fallback address
  3. if the ref ends with 'lido.fi', then the ref is replaced with a fallback address
    It is possible to pass ENS names as a ref. We assume that no one uses 'lido.fi' ENS name, because not all ENS names end with '.eth' and it is technically possible to have 'lido.fi' ENS name.
  4. only in the end, after all other checks, we are trying to get ENS name using the provided ref. Because this request takes some time (5 seconds or so).

Checked with refs:

  • ?ref=blog.lido.fi – no ENS request, ignoring the ref
  • /?ref=https://test – no ENS request, ignoring the ref
  • ?ref=test.com – we have to do a ENS request, because it is a possible ENS name. If the name is not resolved – ignore, return fallback.

Checklist:

  • Checked the changes locally.
  • Created / updated analytics events.
  • Created / updated the technical documentation (README.md / docs / etc.).
  • Affects / requires changes in other services (Matomo / Sentry / CloudFlare / etc.).

Signed-off-by: alx-khramov <alx.khramov@gmail.com>
@alx-khramov alx-khramov self-assigned this Mar 7, 2025
@alx-khramov alx-khramov requested review from a team as code owners March 7, 2025 19:28
@preview-stands
Copy link

preview-stands bot commented Mar 7, 2025

Preview stand status

Deploying...

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.

1 participant