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

feat: add account recovery functionality #424

Merged
merged 21 commits into from
Mar 26, 2024
Merged

Commits on Mar 22, 2024

  1. chore: Add .idea/ to .gitignore

    In this commit, .idea/ was added to the .gitignore file. This is to ensure that IDE settings are not inadvertently committed to the repository.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    fa014a5 View commit details
    Browse the repository at this point in the history
  2. feat: Add RecoverAccount structure to staking context

    The new structure RecoverAccount has been added to the staking context. This structure takes into account a variety of elements such as the native payer, token account, and stake program accounts. The addition of these elements enhances the functional capability of the staking context.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4e2972a View commit details
    Browse the repository at this point in the history
  3. feat: Add RecoverAccount function in staking program

    A new RecoverAccount function has been added to the staking program, allowing an account's ownership to be updated. It modifies the stake account metadata, stake account positions and voter record to reflect the new owner.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    397a329 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    68f47a4 View commit details
    Browse the repository at this point in the history
  5. feat: Export StakeTarget type in staking tests utils

    The StakeTarget type, which is used in the staking tests utilities, was previously unreachable outside its module. By exporting it now, other modules that require it can gain access to it.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    4640c43 View commit details
    Browse the repository at this point in the history
  6. feat: generate staking.ts

    Introduced a new function called "recoverAccount" to the staking.ts file which is responsible for the payer, payerTokenAccount, stakeAccountPositions, stakeAccountMetadata, voterRecord, and config. The new addition will enhance the overall functionality and usage of the staking mechanism.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    aac4e11 View commit details
    Browse the repository at this point in the history
  7. feat: Add buildRecoverAccountInstruction function to StakeConnection

    Implemented a new method named 'buildRecoverAccountInstruction' in the StakeConnection class. This function generates an instruction for account recovery, hence increasing the robustness of the staking mechanism. It dynamically accepts 'stakeAccountAddress' and 'governanceAuthorityAddress' as parameters and defines necessary roles including payer, payerTokenAccount, and stakeAccountPositions.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    1a8a1db View commit details
    Browse the repository at this point in the history
  8. feat: Implement account recovery test in staking application

    A new test case has been added to the staking application which asserts the functionality of recovering staking accounts. This includes the implementation of 'buildRecoverAccountInstruction' in 'StakeConnection' which is integral to this recovery process. This test case bolsters the reliability and resilience of the staking system.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    3c8c92d View commit details
    Browse the repository at this point in the history
  9. feat: add failed account recovery test

    This commit refactors the staking tests and adds a new test case for unsuccessful stake account recovery attempts. It also enhances imports with new functions from the utility modules and changes the name of the type for stake account owner updates. This change will provide more robust testing scenarios for our staking mechanism.
    keyvankhademi committed Mar 22, 2024
    Configuration menu
    Copy the full SHA
    3a0d137 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. Configuration menu
    Copy the full SHA
    87d3872 View commit details
    Browse the repository at this point in the history
  2. fix: corrected typo in file name for 'recover_account.ts'

    Renamed 'recouver_account.ts' to 'recover_account.ts' to correct a typo. This change enhances readability and eliminates the confusion that could have been caused by the incorrect name.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    1cfdd15 View commit details
    Browse the repository at this point in the history
  3. fix: add assertion for stake account metadata owner in recover_accoun…

    …t.ts
    
    This commit implements an additional assertion in the recovery account test. The assertion checks if the stake account metadata owner is correctly set to the expected new owner.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    5bcb2ac View commit details
    Browse the repository at this point in the history
  4. Fix: remove mutability from config account

    The config account was previously mutable, but this has now been changed to be non-mutable. This modification is reflected in `context.rs`, `staking.ts`, and `staking.json`. The change enhances security by preventing unwanted modifications to the configuration.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    438ac47 View commit details
    Browse the repository at this point in the history
  5. Fix: refine documentation and add documentation for account recovery …

    …function
    
    Accept split documentation has been revised by removing a redundant accent mark. In addition, documents for a new function, recover_account, has been written.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    f6b8887 View commit details
    Browse the repository at this point in the history
  6. Update version in staking package.json file

    The package.json file for staking was updated. The version has been changed from 2.1.0 to 2.2.0, reflecting the latest changes in the code. Updated the file to keep the metadata accurate and current.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    cfbda18 View commit details
    Browse the repository at this point in the history
  7. Update version in staking Cargo.toml file

    The Cargo.toml file for the staking program was updated. The version has been changed from 1.0.0 to 1.1.0. This change keeps the package version aligned with recent code modifications.
    keyvankhademi committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    b37c519 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. fix: update version in staking program

    Both the Cargo.toml and Cargo.lock files for the staking program have been updated, changing the version from 1.1.0 and 1.0.0 respectively to 1.2.0. This keeps the package version in sync with the recent code modifications.
    keyvankhademi committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    ce95db1 View commit details
    Browse the repository at this point in the history
  2. fix: update test description in recover_account.ts

    The description block in the recover account test was incorrectly labeled as "config". This commit corrects the test description to accurately reflect its purpose, changing it to "recover account".
    keyvankhademi committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    a0e924f View commit details
    Browse the repository at this point in the history
  3. fix: update staking version and improve documentation

    The version of staking has been updated to 1.2.0 from 1.0.0. Furthermore, corrections were made to the acceptSplit documentation to fix a typographical error. Additional documentation was also added to the recoverAccount function, providing a detailed explanation on how it can be used to recover a user's stake account ownership when mistakenly created using their token account address.
    keyvankhademi committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    85db434 View commit details
    Browse the repository at this point in the history
  4. fix: add tests for stake account ownership

    The updated tests now retrieve and validate the ownership of a problematic stake account before proceeding with recovery operations. Through asserting that the owners of both the stake account positions and metadata match a new owner, this change aims to reinforce account recovery operations by confirming accurate ownership beforehand.
    keyvankhademi committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    be59f75 View commit details
    Browse the repository at this point in the history
  5. fix: add check for staked tokens in recover account function

    A check was added in the recover account function to verify if staked tokens are present. Accounts with staked tokens cannot be transferred due to potential double voting. The necessary error message "RecoverWithStake" has been added to warn users to unstake their tokens before recovering the account.
    keyvankhademi committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    58906a9 View commit details
    Browse the repository at this point in the history