Skip to content

Conversation

@masch
Copy link
Contributor

@masch masch commented Dec 1, 2025

This PR implements the functionality to list registered projects on-chain with pagination support, mirroring the existing DAO pagination pattern but optimized for storage efficiency. This functionality follows the requirements for #331.

Key Changes

  • Contract Interface:

    • Added get_projects(page: u32) to the VersioningTrait to retrieve projects page by page.
  • Storage Optimization:

    • Introduced ProjectKey::ProjectKeys(u32) to store a list of project keys for each page.
    • Refactored the storage approach to save only Vec<Bytes> (keys) per page rather than duplicating project data.
    • get_projects now retrieves the keys for the requested page and fetches the full Project details for each key on demand.
  • Error Handling:

    • Added ContractErrors::NoProjectPageFound to handle out-of-bounds page requests gracefully.
  • Tests:

    • Added tests/test_project_list.rs covering:
      • Pagination logic (verifying correct items per page).
      • Data correctness for retrieved projects.
      • Error handling for invalid page requests.

This implementation ensures efficient storage usage while providing a robust way to traverse all registered projects.

@netlify
Copy link

netlify bot commented Dec 1, 2025

Deploy Preview for tansu canceled.

Name Link
🔨 Latest commit fe4b2e7
🔍 Latest deploy log https://app.netlify.com/projects/tansu/deploys/6935bd5a62ef240008c7d939

@netlify
Copy link

netlify bot commented Dec 1, 2025

Deploy Preview for staging-tansu canceled.

Name Link
🔨 Latest commit fe4b2e7
🔍 Latest deploy log https://app.netlify.com/projects/staging-tansu/deploys/6935bd5ae1fc0d0008eb9dfa

@masch masch marked this pull request as ready for review December 1, 2025 18:29
Copy link
Owner

@tupui tupui left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @masch It's a good start, I left some comments.

@masch masch requested a review from tupui December 2, 2025 20:30
@masch
Copy link
Contributor Author

masch commented Dec 2, 2025

@tupui Great tips! Let me know what do you think.

Copy link
Owner

@tupui tupui left a comment

Choose a reason for hiding this comment

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

ok I think we are really close 😃

@masch masch requested a review from tupui December 5, 2025 02:13
Copy link
Owner

@tupui tupui left a comment

Choose a reason for hiding this comment

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

Thanks again. I will merge once the CI is green. Looking forward to the follow up 😃

@tupui tupui merged commit 35456c7 into tupui:main Dec 7, 2025
13 checks passed
@tupui tupui added enhancement New feature or request soroban Stellar smart contract labels Dec 7, 2025
@tupui tupui linked an issue Dec 7, 2025 that may be closed by this pull request
@masch masch deleted the feature/add-projects-list-method branch December 7, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request soroban Stellar smart contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List all projects

2 participants