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

fix: withdraw slashed staking tx #51

Merged
merged 4 commits into from
Jan 7, 2025
Merged

Conversation

jrwbabylonlab
Copy link
Collaborator

@jrwbabylonlab jrwbabylonlab commented Jan 7, 2025

This PR introduces a new method, createWithdrawSlashedStakingTransaction, which is used to withdraw outputs from the slashing path. The method supports slashing transactions originating from either the timelock or unbonding path.

The functionality is similar to the existing withdrawEarlyUnbondedTransaction method, with one key difference: for withdrawing a slashing transaction, the output index must be specified.

While it’s possible to make the existing withdrawEarlyUnbondedTransaction method more generic to handle slashing transactions, this is a core part of the BBN staking logic. In this case, the code duplication is preferable to the added complexity that would come with mixing usage across different staking flow paths.

NOTE:

  1. Tests added for transaction layer (withdrawSlashingTransaction) but not added for createWithdrawSlashedStakingTransaction. A seperate PR will add the missing coverage later on. This is due to time concern for it to be manual tested on env.

tests/helper/datagen/base.ts Show resolved Hide resolved
src/staking/index.ts Outdated Show resolved Hide resolved
src/staking/transactions.ts Show resolved Hide resolved
src/utils/staking/index.ts Show resolved Hide resolved
@jrwbabylonlab jrwbabylonlab merged commit 4494689 into dev Jan 7, 2025
1 check passed
@jrwbabylonlab jrwbabylonlab deleted the add-withdraw-slashing-tx branch January 7, 2025 08:51
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.

4 participants