Skip to content

feat: validate contract initialization state#42

Open
Kkkakania wants to merge 1 commit into
AnonVote:mainfrom
Kkkakania:feat/init-validation
Open

feat: validate contract initialization state#42
Kkkakania wants to merge 1 commit into
AnonVote:mainfrom
Kkkakania:feat/init-validation

Conversation

@Kkkakania

Copy link
Copy Markdown

Fixes #34.

Summary

  • add a verify_initialized helper that checks the required admin storage slot
  • call initialization validation before each write operation mutates state
  • add unit coverage for initialized and uninitialized contract validation

Notes

The issue mentions ContractError::NotInitialized, but this contract currently uses
panic strings for all error paths. This keeps the existing style and uses
not initialized for failed initialization validation.

Testing

  • Baseline cargo test before changes -> 4 tests passed
  • TDD red check first: cargo test failed because verify_initialized did not exist
  • cargo fmt -- --check
  • cargo test
  • git diff --check

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 Contract Initialization State Validation

1 participant