Skip to content

feat(#477): add one-shot initialiser guard to initialize() - #550

Merged
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
k2ghostyou:feat/477-initialiser-guard
Jul 29, 2026
Merged

feat(#477): add one-shot initialiser guard to initialize()#550
Kingsman-99 merged 2 commits into
Stellar-split:mainfrom
k2ghostyou:feat/477-initialiser-guard

Conversation

@k2ghostyou

Copy link
Copy Markdown
Contributor

i Add AlreadyInitialised = 33 to ContractError in error.rs

  • Add initialised_key() returning symbol_short!("init_flg") in lib.rs
  • Replace the admin_key existence check with a dedicated Initialised boolean stored under initialised_key() in instance storage
  • Guard panics with "AlreadyInitialised" if the flag is already set, preventing front-run hijacking of the admin address
  • Set the flag atomically at the end of initialize() so the contract is only marked fully initialised after all state has been written
  • Add initialised_key to storage_snapshot.rs and update the JSON baseline

Closes #477

- Add AlreadyInitialised = 33 to ContractError in error.rs
- Add initialised_key() returning symbol_short!("init_flg") in lib.rs
- Replace the admin_key existence check with a dedicated Initialised
  boolean stored under initialised_key() in instance storage
- Guard panics with "AlreadyInitialised" if the flag is already set,
  preventing front-run hijacking of the admin address
- Set the flag atomically at the end of initialize() so the contract is
  only marked fully initialised after all state has been written
- Add initialised_key to storage_snapshot.rs and update the JSON baseline

Closes Stellar-split#477
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@k2ghostyou 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

@Kingsman-99
Kingsman-99 merged commit 181276a into Stellar-split:main Jul 29, 2026
1 of 4 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 29, 2026
6 tasks
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.

Contract Deployment Initialiser Guard

2 participants