Skip to content

fix(tholos): prevent initialize front-running via atomic constructor - #163

Closed
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-158
Closed

fix(tholos): prevent initialize front-running via atomic constructor#163
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-158

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary of Changes

Fixes #158 by adding an atomic __constructor to Tholos (v1) mirroring TholosV2::__constructor.

Key Improvements

  • Atomic Deployment & Initialization: Added Tholos::__constructor which executes Self::initialize synchronously during contract instantiation.
  • Front-Running Prevention: Eliminates the window where an uninitialized contract could be front-run by a third-party caller attempting to initialize with malicious parameters or take administrative control.
  • Preserved Idempotency Guard: Secondary attempts to invoke initialize after deployment fail with Error::AlreadyInitialized.
  • Comprehensive Unit and Property Tests: Updated test suite to instantiate contracts via constructor and added explicit verification that subsequent initialize calls fail.

Verification

  • cargo test -p tholos: 70/70 tests passing (including fuzzed proptests).
  • cargo test -p tholos-v2: 107/107 tests passing.
  • cargo clippy -p tholos --all-targets -- -D warnings: Clean.
  • cargo fmt --check: Clean.

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

@collinsezedike

Copy link
Copy Markdown
Collaborator

@s6pa1rta3n-lab Closing. #158 has no assignee. Comment on the issue and wait to be assigned before opening a PR.

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.

[Bug] initialize is front-runnable in tholos v1

2 participants