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

Only slash undelegations that started after the misbehaviour #177

Open
Tracked by #85
maurolacy opened this issue Nov 29, 2023 · 1 comment
Open
Tracked by #85

Only slash undelegations that started after the misbehaviour #177

maurolacy opened this issue Nov 29, 2023 · 1 comment
Assignees

Comments

@maurolacy
Copy link
Collaborator

maurolacy commented Nov 29, 2023

When slashing associated pending undelegations from a validator

/// Slashes all the entries in `pending_unbonds`, returning total slashed amount.
pub fn slash_pending(&mut self, info: &BlockInfo, slash_ratio: Decimal) -> Uint128 {
self.pending_unbonds
.iter_mut()
.filter(|pending| pending.release_at > info.time)
.map(|pending| {
let slash = pending.amount * slash_ratio;
// Slash it
pending.amount -= slash;
slash
})
.sum()
}
}

we need to filter out not only those that have already expired (done), but also those that started before the misbehaviour we're now processing.

This is not possible right now because we don't have access to the misbehaviour's height and time. These would need to be sent along with the validators to jail and tombstone.

Not doing this would introduce differences, in some cases, between on-chain slashing and the slashing accounting on the contracts.

@maurolacy
Copy link
Collaborator Author

maurolacy commented Dec 8, 2023

This is now addressed as part of #179.

What is still missing is sending the proper misbehaviour time from blockchain code. Zero is currently being sent: osmosis-labs/mesh-security-sdk#125.

Will create a follow-up issue in the SDK repo and reference 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

No branches or pull requests

1 participant