Skip to content

Gbi 2845/discovery contract implementation#356

Merged
Luisfc68 merged 27 commits intolbc-splitfrom
GBI-2845/discovery-contract-implementation
Sep 17, 2025
Merged

Gbi 2845/discovery contract implementation#356
Luisfc68 merged 27 commits intolbc-splitfrom
GBI-2845/discovery-contract-implementation

Conversation

@Hakob23
Copy link
Copy Markdown
Collaborator

@Hakob23 Hakob23 commented Aug 27, 2025

What

  • Add Discovery contract
  • Add unit tests and docs

Why

To finalize with the implementation of the split contracts

Task
https://rsklabs.atlassian.net/browse/GBI-2845

Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment on lines +9 to +22
function callRegister(
address discovery,
string calldata name,
string calldata apiBaseUrl,
bool status,
Flyover.ProviderType providerType
) external payable {
IFlyoverDiscovery(discovery).register{value: msg.value}(
name,
apiBaseUrl,
status,
providerType
);
}
Comment thread contracts/test/RegisterCaller.sol Dismissed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 27, 2025

Dependency Review

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

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment thread contracts/FlyoverDiscovery.sol Fixed
Copy link
Copy Markdown
Collaborator

@Luisfc68 Luisfc68 left a comment

Choose a reason for hiding this comment

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

Mostly looks good, there are a couple things to change:

  • Move some parts to CollateralManagement
  • Send the money received in register to CollateralManagement

Also, we might want to add a way for the different parties to verify which are the addresses of the other contracts, we can discuss later if this is the proper contract to do so or not

Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol
Comment thread contracts/FlyoverDiscovery.sol Outdated

if (providerType > type(Flyover.ProviderType).max) revert InvalidProviderType(providerType);

if (_resignationBlockNum[providerAddress] != 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this condition and the ones below should change since the minCollateral doesn't go on discovery, you can check here for reference https://github.com/rsksmart/liquidity-bridge-contract/blob/lbc-split/contracts/split/FlyoverDiscovery.sol#L138

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have removed minCollateral check and for the AlreadyRegistered condition, I think we could simply use _collateralManagement.isRegistered function instead of what is done in the PoC.

Comment thread contracts/FlyoverDiscovery.sol
Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

Slither found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@Hakob23 Hakob23 closed this Sep 1, 2025
@Hakob23 Hakob23 reopened this Sep 1, 2025
Hakob23 and others added 17 commits September 1, 2025 16:54
Co-authored-by: Luisfc68 <60527258+Luisfc68@users.noreply.github.com>
Co-authored-by: Luisfc68 <60527258+Luisfc68@users.noreply.github.com>
… for liquidity providers and sending assets to collateral contract
@Hakob23 Hakob23 force-pushed the GBI-2845/discovery-contract-implementation branch from 9b08981 to c017180 Compare September 1, 2025 12:55
Comment thread contracts/FlyoverDiscovery.sol Fixed
Comment on lines +171 to +173
function _shouldBeListed(Flyover.LiquidityProvider storage lp) private view returns(bool){
return _collateralManagement.isRegistered(lp.providerType, lp.providerAddress) && lp.status;
}

Check notice

Code scanning / Slither

Calls inside a loop Low

FlyoverDiscovery._shouldBeListed(Flyover.LiquidityProvider) has external calls inside a loop: _collateralManagement.isRegistered(lp.providerType,lp.providerAddress) && lp.status
Calls stack containing the loop:
FlyoverDiscovery.getProviders()
Comment thread contracts/interfaces/IFlyoverDiscovery.sol Outdated
Comment thread contracts/FlyoverDiscovery.sol Outdated
status: status,
providerType: providerType
});
_addCollateral(providerType, msg.sender, msg.value);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you should emit Register before, because _addCollateral has an external call inside

Comment thread contracts/FlyoverDiscovery.sol
/// @notice Lists LPs that should be visible to users
/// @dev A provider is listed if it has sufficient collateral for at least one side and `status` is true
/// @return providersToReturn Array of LP records to display
function getProviders() external view returns (Flyover.LiquidityProvider[] memory) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I maintain this comment from the previous review

Comment thread contracts/FlyoverDiscovery.sol Outdated
Comment thread contracts/split/FlyoverDiscovery.sol Outdated
Comment thread test/discovery/fixtures.ts Outdated
Comment thread test/discovery/operational.test.ts
Comment thread test/discovery/resign.test.ts Outdated
Comment thread test/discovery/resign.test.ts Outdated
Hakob23 and others added 3 commits September 2, 2025 17:36
@Hakob23 Hakob23 requested a review from Luisfc68 September 2, 2025 22:52
Copy link
Copy Markdown
Collaborator

@Luisfc68 Luisfc68 left a comment

Choose a reason for hiding this comment

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

besides the isOperational comment the rest seems to be ok

Comment thread contracts/FlyoverDiscovery.sol Outdated
…d more operational checks for liquidity providers
@Hakob23 Hakob23 requested a review from Luisfc68 September 8, 2025 14:59
@Luisfc68 Luisfc68 merged commit 96d6855 into lbc-split Sep 17, 2025
5 checks passed
@Luisfc68 Luisfc68 deleted the GBI-2845/discovery-contract-implementation branch September 17, 2025 14:51
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