Skip to content

fix(contracts): reject stakeOnBehalf calls with owner set to self#4893

Open
shuhuiluo wants to merge 1 commit into
towns-protocol:mainfrom
shuhuiluo:fix/stake-on-behalf-self-owner
Open

fix(contracts): reject stakeOnBehalf calls with owner set to self#4893
shuhuiluo wants to merge 1 commit into
towns-protocol:mainfrom
shuhuiluo:fix/stake-on-behalf-self-owner

Conversation

@shuhuiluo

@shuhuiluo shuhuiluo commented Jul 7, 2026

Copy link
Copy Markdown
Contributor
  • stakeOnBehalf let a caller pass owner == address(this), taking the no-token-transfer mainnet-delegation branch in _stake while still minting earning power, letting an attacker farm rewards for free
  • add RewardsDistribution__CannotStakeToSelf and revert on that owner
  • add regression test covering the revert

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

- stakeOnBehalf let a caller pass owner == address(this), taking the
  no-token-transfer mainnet-delegation branch in _stake while still
  minting earning power, letting an attacker farm rewards for free
- add RewardsDistribution__CannotStakeToSelf and revert on that owner
- add regression test covering the revert
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

@shuhuiluo is attempting to deploy a commit to the River Build Team Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant