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 argument assertion on staking slashing #157

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified precompile/binaries/stdlib/staking.mv
Binary file not shown.
5 changes: 5 additions & 0 deletions precompile/modules/initia_stdlib/sources/staking.move
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ module initia_std::staking {
/// Chain already has `StakingState` for the given metadata
const ESTAKING_STATE_ALREADY_EXISTS: u64 = 16;

/// Invalid slash fraction
const EINVALID_SLASH_FRACHTION: u64 = 17;
beer-1 marked this conversation as resolved.
Show resolved Hide resolved

// Constants

/// Max number of view function response items.
Expand Down Expand Up @@ -621,6 +624,8 @@ module initia_std::staking {
validator: String,
fraction: BigDecimal
) acquires ModuleStore {
assert!(bigdecimal::le(fraction, bigdecimal::one()), error::invalid_argument(EINVALID_SLASH_FRACHTION));

check_chain_permission(chain);

let module_store = borrow_global_mut<ModuleStore>(@initia_std);
Expand Down
Loading