Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restaking: Change max_slashable_per_epoch from tuple-like structure to named field syntax #173

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

aoikurokawa
Copy link
Contributor

Currently, when we build the InitializeNcnVaultSlasherTicket instruction, we use the args method to add max_slashable_per_epoch data:

        let mut ix_builder = InitializeNcnVaultSlasherTicketBuilder::new();
        ix_builder
            .config(Config::find_program_address(&self.restaking_program_id).0)
            .ncn(ncn)
            .vault(vault)
            .slasher(slasher)
            .ncn_vault_ticket(ncn_vault_ticket)
            .ncn_vault_slasher_ticket(ncn_vault_slasher_ticket)
            .admin(keypair.pubkey())
            .payer(keypair.pubkey())
            .args(100);

While this works, the use of the generic name args lacks clarity.
We can improve clarity by using a method with a more descriptive name:

        let mut ix_builder = InitializeNcnVaultSlasherTicketBuilder::new();
        ix_builder
            ...
            .max_slashable_per_epoch(100);

@aoikurokawa aoikurokawa marked this pull request as ready for review November 17, 2024 07:42
Copy link
Contributor

@coachchucksol coachchucksol left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.40%. Comparing base (00eb1c8) to head (f2dac9e).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #173   +/-   ##
=======================================
  Coverage   79.39%   79.40%           
=======================================
  Files          89       89           
  Lines        9338     9340    +2     
=======================================
+ Hits         7414     7416    +2     
  Misses       1924     1924           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

3 participants