Skip to content

Fix 921 initialisation guard - #940

Open
Peolite001 wants to merge 12 commits into
accesslayerorg:mainfrom
Peolite001:fix-921-initialisation-guard
Open

Peolite001 wants to merge 12 commits into
accesslayerorg:mainfrom
Peolite001:fix-921-initialisation-guard

Conversation

@Peolite001

Copy link
Copy Markdown
Contributor

Closes #921

Summary

  • Adds an init() function to the referral contract to serve as an initialization guard.
  • Implements AlreadyInitialised custom error to ensure initialization can only be called once per instance.
  • Emits a ContractInitialised event upon successful initialization.
  • Exposes a get_initialised() view function to allow for external verification of the contract's initialization state.
  • Adds unit tests to verify proper initialization, double-initialization rejection, and validate emitted events.
  • Closes Add contract initialisation guard to prevent re-initialisation attacks #921.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
    (Note: I am leaving these unchecked for you to run locally or for the CI pipeline to verify, as my local test run was halted by a missing MSVC linker)

Checklist

  • Linked issue or backlog item
  • Added or updated creator-keys unit/integration tests for every changed contract behavior, including failure paths for new or reachable ContractError variants
  • Ran cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace, or explained exactly why a command was not run
  • Reviewed persistent storage changes against docs/storage-key-invariants.md; any storage layout change includes a migration/backward-compatibility note
  • Confirmed event names, topic order, payload field order, and field meanings remain compatible with docs/contract-event-conventions.md, or documented the breaking change and versioning plan
  • Updated docs for any changed public contract interface, read-only method, event schema, storage behavior, fee logic, or deployment workflow
  • Scope stays limited to one contract concern and does not include unrelated formatting, lockfile, generated artifact, or dependency changes

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Peolite001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093

Copy link
Copy Markdown
Member

CI issues bro

@Peolite001

Copy link
Copy Markdown
Contributor Author

CI issues bro

done

1 similar comment
@Peolite001

Copy link
Copy Markdown
Contributor Author

CI issues bro

done

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 initialisation guard to prevent re-initialisation attacks

2 participants