Skip to content

Add assertion macro#1688

Open
gloskull wants to merge 3 commits into
QuickLendX:mainfrom
gloskull:add-assertion-macro
Open

Add assertion macro#1688
gloskull wants to merge 3 commits into
QuickLendX:mainfrom
gloskull:add-assertion-macro

Conversation

@gloskull

Copy link
Copy Markdown

Implemented the assert_view_only! macro to prevent accidental state mutation in read-only contexts.

Key changes:

Added assert_view_only! macro in diagnostics.rs.
Implemented StorageManager::with_view_only in storage.rs to wrap execution in a restricted mode.
Integrated the macro into InvoiceStorage, BidStorage, and InvestmentStorage mutating operations.
Protected invariant_self_check and preview_protocol_config using the new view-only context.
Added test_view_only.rs with happy and sad path verification.
Resolved significant pre-existing build issues (duplicate definitions, cycle dependencies, missing imports, non-exhaustive matches) to ensure the contract compiles and passes tests.
Verified that the contract builds for WASM and passes the size budget check.
Closes #1576

@gloskull

Copy link
Copy Markdown
Author

Done with this issue.
Please merge and give and high review.
Please if there are any more tasks, assign them to me, i'd make sure to get them done quickly and submit my PR's in under 5 hours

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 a "view-only" assertion macro

1 participant