Skip to content

Dynamic account sizing for DirectRecipient with VestingSchedule enum#4

Merged
dev-jodee merged 1 commit intomainfrom
dev-jodee/cliff-vesting
Feb 6, 2026
Merged

Dynamic account sizing for DirectRecipient with VestingSchedule enum#4
dev-jodee merged 1 commit intomainfrom
dev-jodee/cliff-vesting

Conversation

@dev-jodee
Copy link
Copy Markdown
Collaborator

Summary

Implements dynamic account sizing for DirectRecipient following the escrow program pattern. Accounts now vary from 116-140 bytes based on VestingSchedule variant instead of fixed 140-byte padding. Adds VestingSchedule::byte_len() method and updates account creation to calculate actual size needed. All integration tests updated and passing.

Key Changes

  • Remove fixed 25-byte schedule padding from DirectRecipient
  • Add VestingSchedule::byte_len() method for runtime size calculation
  • DirectRecipient now stores VestingSchedule enum directly with dynamic serialization
  • Account sizes by variant: Immediate (116), Cliff (124), Linear (132), CliffLinear (140)
  • Update processor to use DirectRecipient::calculate_account_size()

@dev-jodee dev-jodee requested a review from amilz February 6, 2026 17:47
amilz
amilz previously approved these changes Feb 6, 2026
- Remove fixed 25-byte schedule padding, accounts now vary by variant
- Add VestingSchedule::byte_len() method for runtime size calculation
- Replace DirectRecipient flat fields with VestingSchedule enum storage
- Update account creation to use DirectRecipient::calculate_account_size()
- Change account size range from fixed 140 bytes to 116-140 bytes depending on variant:
  - Immediate: 116 bytes
  - Cliff: 124 bytes
  - Linear: 132 bytes
  - CliffLinear: 140 bytes
- Update all integration tests and fixtures for new layout
- Reset DirectRecipient::VERSION from 3 to 1 for consistency
@dev-jodee dev-jodee merged commit 6a969d0 into main Feb 6, 2026
6 checks passed
@dev-jodee dev-jodee deleted the dev-jodee/cliff-vesting branch March 20, 2026 12:19
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.

2 participants