-
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: rework billing extrinsic to take in index #651
Conversation
3f19cca
to
e3868e9
Compare
@@ -970,7 +971,8 @@ impl<T: Config> Pallet<T> { | |||
} | |||
|
|||
Self::_update_contract_state(&mut contract, &types::ContractState::Deleted(cause))?; | |||
Self::bill_contract(contract.contract_id)?; | |||
let index = Self::get_current_billing_loop_index(); |
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.
this is the only thing that "annoys" me...
because passing no matter what index here will continue to work fine
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.
What do you mean? In case the index doens't exist?
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.
I guess what Erwan is saying is that when you pass a wrong index but a correct contractID, the contract will be billed normally but not cleaned up if the index passed is wrong.
It's a side-effect of having the code structured like this.
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 work, looks good.
@@ -970,7 +971,8 @@ impl<T: Config> Pallet<T> { | |||
} | |||
|
|||
Self::_update_contract_state(&mut contract, &types::ContractState::Deleted(cause))?; | |||
Self::bill_contract(contract.contract_id)?; | |||
let index = Self::get_current_billing_loop_index(); |
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.
What do you mean? In case the index doens't exist?
@renauter I agree with the confusion this is actually adding. Can we maybe think of another more elegant solution? |
@DylanVerstraete it is better now? |
Good, let's merge and test on devnet |
No description provided.