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

Bugfixes found during chatting with Auditors on July 7th #504

Merged
merged 4 commits into from
Jul 11, 2023

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Jul 10, 2023

Unified the check that the ContractId in inputs by TouchedContracts structure.
Check that the contract is in inputs for CROO and CSIZ.
Fixed the bug with total_code_size.
Fixed the bug with incorrect gas charging per unit.

…s` structure.

Check that the contract in inputs for `CROO` and `CSIZ`.
Fixed the bug with `total_code_size`.
Fixed the bug with incorrect gas charging per unit.
@xgreenx xgreenx added bug Something isn't working fuel-vm Related to the `fuel-vm` crate. labels Jul 10, 2023
@xgreenx xgreenx requested a review from a team July 10, 2023 14:41
@xgreenx xgreenx self-assigned this Jul 10, 2023
@@ -461,3 +461,27 @@ impl CheckedMetadata for CreateCheckedMetadata {
self.gas_used_by_predicates = gas_used;
}
}

pub(crate) struct TouchedContracts<'vm, I> {
Copy link
Contributor

@bvrooman bvrooman Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea of centralizing the location where we check the list of input contracts is a good abstraction. However, I think touch is a bit of a misleading name. In the context of software, touch usually means to create a file/modify its timestamp (see https://www.geeksforgeeks.org/touch-command-in-linux-with-examples/). Here, you're using touch to panic if the contract doesn't exist. From a naming perspective, that is almost the opposite of what I would expect it to do.
What about calling the struct something like InputContracts<..> and changing touch to something like check?

@bvrooman bvrooman requested a review from a team July 11, 2023 01:53
Voxelot
Voxelot previously approved these changes Jul 11, 2023
@xgreenx xgreenx added this pull request to the merge queue Jul 11, 2023
Merged via the queue into master with commit bd985e2 Jul 11, 2023
@xgreenx xgreenx deleted the bugfix/audit-findings-7-jul branch July 11, 2023 18:39
@xgreenx xgreenx mentioned this pull request Jul 13, 2023
@xgreenx xgreenx mentioned this pull request Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fuel-vm Related to the `fuel-vm` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants