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

fix: rework billing extrinsic to take in index #651

Merged
merged 3 commits into from
Apr 4, 2023

Conversation

DylanVerstraete
Copy link
Contributor

No description provided.

@@ -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();
Copy link
Collaborator

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

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@brandonpille brandonpille left a 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.

substrate-node/pallets/pallet-smart-contract/src/lib.rs Outdated Show resolved Hide resolved
@@ -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();
Copy link
Contributor

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?

@DylanVerstraete
Copy link
Contributor Author

@renauter I agree with the confusion this is actually adding. Can we maybe think of another more elegant solution?

@renauter
Copy link
Collaborator

renauter commented Apr 3, 2023

@renauter I agree with the confusion this is actually adding. Can we maybe think of another more elegant solution?

@DylanVerstraete it is better now?

@DylanVerstraete
Copy link
Contributor Author

Good, let's merge and test on devnet

@DylanVerstraete DylanVerstraete merged commit 4bb11aa into development Apr 4, 2023
@DylanVerstraete DylanVerstraete deleted the fix_billing_index branch April 4, 2023 07:40
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

Successfully merging this pull request may close these issues.

3 participants