Skip to content

feat: FLY-2250 two-step provider registration with admin approval#945

Open
volodymyrzahanych wants to merge 2 commits intov2.6.0from
feature/FLY-2250
Open

feat: FLY-2250 two-step provider registration with admin approval#945
volodymyrzahanych wants to merge 2 commits intov2.6.0from
feature/FLY-2250

Conversation

@volodymyrzahanych
Copy link
Copy Markdown
Collaborator

What

 LPS now adapts to the two-step registration flow introduced in LBC FLY-2245.
 After submitting a registration request, the server waits indefinitely for an
 admin to approve or reject via the discovery contract before starting operations.

Why

Security requirement — only admin-approved LPs can be listed in the discovery contract, preventing unauthorized providers from appearing in the registry.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change
  • Documentation update
  • Refactoring (no functional changes, no api changes)
  • Performance improvement
  • Test updates
  • Security fix
  • Deployment/Infrastructure changes

Affected part of the project

  • Management UI / API
  • PegIn flow
  • PegOut flow
  • Utility scripts
  • Configuration files
  • Metrics and alerting

Related Issues

Jira ticket

How to test

Unit Tests

Run the two packages that contain all registration-related tests:

# Use case layer — 13 tests covering all registration states and transitions
go test ./internal/usecases/liquidity_provider/... -run TestRegistration -v

# Adapter layer — GetRegistrationState (all 5 states, error, invalid address)
#               + all other DiscoveryContract methods
go test ./internal/adapters/dataproviders/rootstock/... -run "TestDiscoveryContractImpl|TestNewDiscoveryContractImpl" -v

Key tests to pay attention to:

Test What it proves
TestRegistrationUseCase_Run_Pending_ThenApproved Restart-during-pending works — no double registration
TestRegistrationUseCase_Run_Pending_ThenRejected Rejection in poll loop propagates correctly
TestRegistrationUseCase_Run_ApprovedOrPending_NoPauseCheck Pause check is skipped for already-progressed states
TestDiscoveryContractImpl_GetRegistrationState All 5 enum values round-trip correctly through ABI encoding

Local Compose Environment

Prerequisites: LBC repo at ~/liquidity-bridge-contract (or set LBC_REPO_PATH), Docker running.

Happy path — approve registration:

cd docker-compose/local
LBC_BRANCH=refactor/FLY-2245 bash lps-env.sh

Expected: LPS submits registration → script detects Pending state → restarts lps01 → approves → LPS comes up healthy at http://localhost:8080/health.

Rejection path:

cd docker-compose/local
LBC_BRANCH=refactor/FLY-2245 LBC_REGISTRATION_DECISION=reject bash lps-env.sh

Expected: LPS submits registration → script calls rejectRegistration → LPS logs "Registration rejected by admin..." and exits with log.Fatal. Container stops.

Fast poll interval for debugging:

LP_REGISTRATION_POLL_INTERVAL_SECONDS=5 LBC_BRANCH=refactor/FLY-2245 bash lps-env.sh

Verify pending-state restart manually:

# While LPS is waiting for approval, in another terminal:
docker compose -f docker-compose.yml -f docker-compose.lps.yml restart lps
# LPS should resume polling (Pending → wait) without re-submitting registration
docker logs lps01 --tail 20

Reviewer Guidelines

This functionality is connected to LBC refactor/FLY-2245

Screenshots (if applicable)

Add screenshots or GIFs to help explain your changes.

Additional Notes

Add any other context about the pull request here.

     LPS now adapts to the two-step registration flow introduced in LBC FLY-2245.
     After submitting a registration request, the server waits indefinitely for an
     admin to approve or reject via the discovery contract before starting operations.
@volodymyrzahanych volodymyrzahanych requested a review from a team as a code owner April 3, 2026 14:17
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA a66495c.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

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