-
Notifications
You must be signed in to change notification settings - Fork 26
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
[Validator Staking ADO]: Query unbonding period #323
[Validator Staking ADO]: Query unbonding period #323
Conversation
} | ||
|
||
pub fn on_validator_unstake(deps: DepsMut, msg: Reply) -> Result<Response, ContractError> { | ||
let attributes = &msg.result.unwrap().events[0].attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that events
can't be an empty vector? If not we could use events.first()
instead to cover that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events can not be an empty vector as it is called from a reply entry point. Only if undelegate
msg executed successfully, on_validator_unstake
is called with msg
which contains an event for the undelegate
msg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small dependency check
* Feature/staking state management (#298) * created validator staking contract in finance subdirectory * added contract instantiation implementation and created state management * added schema * updated andromeda finance package's toml file to use staking feature of cosmwasm std * removed unncessary macro and renamed improper helper function * fixed issues for pr * Feature/staking execute stake (#300) * added execute and query entrypoint for validator staking * added integration test * added unit test for validator staking * fixed linting error * fixed clippy error * Feature/staking claim rewards (#304) * added execute and query entrypoint for validator staking * added integration test * added unit test for validator staking * fixed linting error * fixed clippy error * undelegate functionality added * test case added for unstaking with invalid validator and owner * claim reward function added * lint error fixed and optimized * updated some validation code with ensure! macro * added AMP handler & updated validator staking unit test mock info to use owner * unauthorized unit test added for claim reward and unstake * Feature/staking withdraw unstaked tokens (#310) * added execute and query entrypoint for validator staking * added integration test * added unit test for validator staking * fixed linting error * fixed clippy error * undelegate functionality added * test case added for unstaking with invalid validator and owner * claim reward function added * lint error fixed and optimized * updated some validation code with ensure! macro * updated integration test to reflect the effect of undelegation * added AMP handler & updated validator staking unit test mock info to use owner * unauthorized unit test added for claim reward and unstake * merged with feature/staking branch & added WithdrawFund message * added withdraw fund handler * query for unstaked tokens added * renamed msgs for clarity * [Validator Staking ADO]: Query unbonding period (#323) * unstaking history saved to storage * removed stargate feature from validator staking * adjusted chrono version to 3 for rust version compatibility * added doc for validator staking
Motivation
Staking ADO is currently using static unbonding period for calculating completion time of the unstaking process. The original issue is created here.
Implementation
Implementing custom message using proto to get staking params was not worthy for this case, as integration test becomes complicated. Thus, the reply is defined for
Undelegate
message to get the event details which contains completion time and fund information.UNSTAKING_QUEUE
inreply
entry point (inon_validator_unstake
function).Testing
tests-integration/tests/validator_staking.rs
is updated from using static unbonding period to use completion time.