-
Notifications
You must be signed in to change notification settings - Fork 11
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: save graced contracts total amount due #631
Conversation
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.
Nice catch.
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.
Great!
Meanwhile I have some comments
if matches!(contract.state, types::ContractState::Deleted(_)) { | ||
Self::remove_contract(contract.contract_id); | ||
return Ok(().into()); | ||
} |
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.
In the bill_contract()
context, the only way to have a contract in Deleted
state is just after the handle_grace()
So i guess this block can be moved above
With this you can get rid of the if
at line 1157
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.
Well, the contract is also moved to state Deleted
if the user cancels it:
Self::_update_contract_state(&mut contract, &types::ContractState::Deleted(cause))?; |
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.
Btw, I don't understand why there is a Deleted
state for contract because I don't see something specific done with this info
Just removing the contract would not be fine?
or I miss something
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.
Well, the contract is also moved to state
Deleted
if the user cancels it:
Self::_update_contract_state(&mut contract, &types::ContractState::Deleted(cause))?;
Ok, I see
So even when Deleted
it is billed and need to reach the end of bill_contract()
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.
Btw, I don't understand why there is a
Deleted
state for contract because I don't see something specific done with this info Just removing the contract would not be fine? or I miss something
It's a leftover state from where we did not remove contracts from chain but marked them as deleted for ever. We can in a next iteration remove this maybe?
No description provided.