Skip to content

Conversation

GabrielePicco
Copy link
Contributor

@GabrielePicco GabrielePicco commented Nov 25, 2024

Add a canonical way to bring lamports into the validator

Status Type ⚠️ Core Change Issue
Ready Feature No #41

Problem

See #41

Issues

Closes #41

Greptile Summary

This PR adds functionality for managing ephemeral lamports in the validator through PDAs, introducing a canonical way to handle temporary balances with top-up, delegation, and closure operations.

  • Added new EPHEMERAL_BALANCE PDA seed in src/consts.rs for escrow lamports management
  • Implemented three core operations in src/processor/top_up_and_delegate.rs: top-up (fund PDA), delegate (to program), and close (PDA)
  • Modified buffer PDA validation in src/processor/delegate.rs to support uninitialized buffers for lamport-only delegations
  • Added comprehensive test coverage in tests/test_top_up.rs for the full lifecycle of ephemeral balance operations
  • Introduced new instruction types (TopUp, DelegateEphemeralBalance, CloseEphemeralBalance) in src/instruction.rs

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

@GabrielePicco GabrielePicco merged commit c916af9 into main Nov 26, 2024
3 checks passed
@GabrielePicco GabrielePicco deleted the feat/canonical-lamports-delegation branch November 26, 2024 07:52
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.

feat: Add a canonical way to bring lamports into the validator

1 participant