Skip to content

Split preparations#348

Merged
Luisfc68 merged 5 commits intolbc-splitfrom
split-preparations
Aug 5, 2025
Merged

Split preparations#348
Luisfc68 merged 5 commits intolbc-splitfrom
split-preparations

Conversation

@Luisfc68
Copy link
Copy Markdown
Collaborator

@Luisfc68 Luisfc68 commented Jul 28, 2025

What

  • Update solhint version and configuration
  • Fix the lint issues found by the new linter version
  • Organize repository structure

Why

After doing some PoCs with the gas consumption of the discovery part of the protocol, we need to prepare the repo to start receiving the actual implementation of the split. This includes organizing the current contract files into a clear repository structure and update the linter so the new contributions can be consistent between them.

Important

The new directory structure is the following:
.
└── contracts/
├── interfaces/
├── legacy/
├── libraries/
├── test-contracts/
├── split/
├── Contract1
├── Contract2
├── ...
└── ContractN
where the directories will be used in the following way:

  • interfaces: this will contain the interface of each one of the contracts, this directory is very important as the contracts will interact between them using interfaces and the off-chain components will generate their bindings from this interfaces too.
  • legacy: this contains the files of the non-split LBC version, once the new version is validated and confirmed this dir can be removed.
  • libraries: this will only contain libraries so we can keep them separated from the contracts.
  • test-contracts: smart contracts used for unit and integration tests.
  • split: files that are being used for the sprint but are not yet part of the final version. E.g. the files we used for the Discovery gas measurements. This dir should disappear at the end of the split implementation too.
  • contracts: the main contracts of the protocol (PegIn, PegOut, Discovery, CollateralManagement)

Not included in this PR

  • NatSpec documentation, as it will be provided with the implementation of each one of the contracts
  • Readme update with the directory structure, as we need to create a separate task for the overall documentation of the repo

Task

https://rsklabs.atlassian.net/browse/GBI-2842

event ProviderUpdate(address indexed providerAddress, string name, string url);

Bridge public bridge;
IBridge public bridge;

Check warning

Code scanning / Slither

State variables that could be declared constant Warning


// solhint-disable comprehensive-interface
contract PegOutPayer {
LiquidityBridgeContractV2 public immutable LBC;

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning test

Variable PegOutPayer.LBC is not in mixedCase
// solhint-disable comprehensive-interface
contract PegOutPayer {
LiquidityBridgeContractV2 public immutable LBC;
address public immutable OWNER;

Check warning

Code scanning / Slither

Conformance to Solidity naming conventions Warning test

Variable PegOutPayer.OWNER is not in mixedCase
Comment on lines +38 to +50
function withdraw(uint256 amount) external {
if (msg.sender != OWNER) {
revert NotOwner(msg.sender);
}
if (address(this).balance < amount){
revert InsufficientBalance(address(this).balance, amount);
}
emit Withdraw(OWNER, amount);
(bool sent, bytes memory cause) = payable(OWNER).call{value: amount}("");
if (!sent) {
revert SendError(cause);
}
}

Check warning

Code scanning / Slither

Low-level calls Warning test

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 28, 2025

Dependency Review

The following issues were found:

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses.
  • ⚠️ 1 packages with OpenSSF Scorecard issues.

View full job summary

@Luisfc68 Luisfc68 marked this pull request as ready for review July 28, 2025 15:31
Copy link
Copy Markdown
Collaborator

@alexjavabraz alexjavabraz left a comment

Choose a reason for hiding this comment

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

LGTM

@Hakob23
Copy link
Copy Markdown
Collaborator

Hakob23 commented Aug 5, 2025

NIT: We could also rename the file names of the interfaces to follow the IName.sol convention. Otherwise, LGTM!

@Luisfc68 Luisfc68 merged commit 83b1eb7 into lbc-split Aug 5, 2025
4 checks passed
@Luisfc68 Luisfc68 deleted the split-preparations branch August 5, 2025 18:45
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