Repository navigation
fix(yield_vault): bind initialize to deployer and creation salt (#8) - #27
Open
dongwei-polyred wants to merge 1 commit into
Open
dongwei-polyred wants to merge 1 commit into
dongwei-polyred wants to merge 1 commit into
Conversation
Close the front-running window on freshly created vaults (issue YieldAnchor#8 option 2): initialize now takes deployer + salt, re-derives the contract address, and requires deployer (and admin when distinct) authorization. Wrong pairs return BadDeployer. Deploy clients/scripts pass and persist the salt; docs replace the unauthenticated caveat. Verified: cargo test -p yield_vault (15), cargo clippy -D warnings, pnpm validation + contract-clients tests. Fixes YieldAnchor#8
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #8 (option 2 — bind deployer)
initializepreviously only required the proposedadminto sign. A front-runner could still name itself as admin on a freshly created vault. This PR binds initialization to the creating account and salt.Changes
initialize(deployer, salt, admin, asset, name, symbol, decimals)re-derives this contract address fromdeployer+salt; mismatch →VaultError::BadDeployer(17)deployer.require_auth(); ifadmin != deployer, alsoadmin.require_auth()scripts/.deploy_salt)docs/deployment/testnet.mdreplace the unauthenticated caveatVerification
BountyHub
https://www.bountyhub.dev/en/bounty/view/7c4339c5-d481-4658-b46c-629023bb05e0
(assignmentType=open — not Exclusive)