Skip to content

feat: set default identity on delegation - #83

Merged
GabrielePicco merged 2 commits into
mainfrom
feat/set-default-identity-on-delegation
Sep 4, 2025
Merged

GabrielePicco merged 2 commits into
mainfrom
feat/set-default-identity-on-delegation

Conversation

@GabrielePicco

@GabrielePicco GabrielePicco commented Sep 4, 2025 •

Copy link
Copy Markdown
Contributor

[Description](feat: set default identity on delegation)

Status Type ⚠️ Core Change Issue
Ready Feature No -

Greptile Summary

Updated On: 2025-09-04 15:42:38 UTC

This PR introduces a default validator identity mechanism for the delegation system. The change adds a new constant DEFAULT_VALIDATOR_IDENTITY in src/consts.rs that specifies a hardcoded validator pubkey (MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57) to serve as a fallback when no validator is explicitly provided during delegation operations.

The implementation modifies the delegation processor in src/processor/delegate.rs to use this default validator identity via args.validator.unwrap_or(DEFAULT_VALIDATOR_IDENTITY) instead of potentially allowing undefined behavior when args.validator is None. This ensures every delegation record has a valid authority field, which is essential for the delegation system's operation.

The change integrates well with the existing codebase architecture by following the established pattern of defining program constants in consts.rs alongside other important values like RENT_FEES_PERCENTAGE and PROTOCOL_FEES_PERCENTAGE. The use of the pubkey! macro creates a compile-time constant from the base58-encoded address, maintaining type safety and efficiency consistent with Solana program development best practices.

Confidence score: 4/5

  • This PR is safe to merge with low risk as it provides a sensible fallback mechanism
  • Score reflects simple, well-structured changes that follow established patterns in the codebase
  • Pay close attention to verifying the hardcoded validator pubkey is intentional and correct

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@GabrielePicco
GabrielePicco merged commit dc49abd into main Sep 4, 2025
3 checks passed
@GabrielePicco
GabrielePicco deleted the feat/set-default-identity-on-delegation branch September 4, 2025 15:58
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