Skip to content

fix(marketplace): add input validation guards to list_asset - #54

Merged
vestor-dev merged 2 commits into
CortexRail:mainfrom
MissHarah:fix/list-asset-input-validation
Jul 25, 2026
Merged

fix(marketplace): add input validation guards to list_asset#54
vestor-dev merged 2 commits into
CortexRail:mainfrom
MissHarah:fix/list-asset-input-validation

Conversation

@MissHarah

Copy link
Copy Markdown
Contributor

List_asset accepted any price, name, or description without checking them. This PR adds four guards before any storage is touched: price must be greater than zero (InvalidPrice), name must be 1–200 bytes (InvalidMetadata), description must be 1–2000 bytes (InvalidMetadata), and the total listing count must not exceed MAX_ASSETS of 10,000 (AssetLimitReached). The return type changes from u64 to Result<u64, MarketplaceError>. 11 boundary tests are added covering exact-limit and one-over-limit cases for every guard.
Closes #19

@vestor-dev vestor-dev left a comment

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.

pls delete the cargo.lock file @MissHarah

@vestor-dev

Copy link
Copy Markdown
Collaborator

@MissHarah any update ??

@vestor-dev vestor-dev left a comment

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.

lgtm

@vestor-dev
vestor-dev merged commit ab27c32 into CortexRail:main Jul 25, 2026
1 check failed
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.

Add input validation to list_asset contract function

2 participants