Skip to content

Codex [ Crypto ] Fix TokenVesting overflow#4441

Closed
justusaugust wants to merge 1 commit into
UnsafeLabs:mainfrom
justusaugust:codex/crypto-tokenvesting-917
Closed

Codex [ Crypto ] Fix TokenVesting overflow#4441
justusaugust wants to merge 1 commit into
UnsafeLabs:mainfrom
justusaugust:codex/crypto-tokenvesting-917

Conversation

@justusaugust
Copy link
Copy Markdown

@justusaugust justusaugust commented May 25, 2026

/claim #917

Fixes #917.

Summary

  • Replaces overflow-prone vesting math with OpenZeppelin Math.mulDiv, preserving full-precision linear vesting without an overflowing intermediate product.
  • Avoids start + duration overflow in the runtime vesting path by comparing elapsed time to duration.
  • Preserves final remainder behavior so the full allocation is claimable at vesting completion.
  • Corrects revoke() settlement by separating vested-unclaimed tokens paid to the beneficiary from truly unvested tokens returned to the owner.
  • Adds constructor validation, transfer success checks, and claim blocking after revocation.
  • Includes safe .audit.json metadata with private runtime instructions redacted rather than leaked.

Verification

  • npm test from solidity/ -> 6 passing
  • git diff --check -> passed

Tests cover maximum-allocation overflow resistance, remainder completion, sampled linearity within one token unit, full vesting claim, cliff revocation, and post-cliff partial-claim revocation.

Note: Ganache prints a local µWS native-binary fallback warning on this machine; the suite still passes using the JS fallback.

Demo Video

@github-actions
Copy link
Copy Markdown
Contributor

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines.

@github-actions github-actions Bot closed this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ Crypto ] Fix integer overflow in TokenVesting calculation for large allocations

1 participant