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

Zero malleable fields before execution #678

Merged
merged 16 commits into from
Feb 26, 2024
Merged

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Feb 19, 2024

Spec PR: FuelLabs/fuel-specs#545
Related to: FuelLabs/fuel-core#1620

Closes: #651

Also:

  • Don't update tx.receiptsRoot after pushing receipts, and do it after execution instead
  • Remove some now-obsolete GTF getters

Before merging make sure that the spec pr above agrees with the changes here.

* Don't update tx.receiptsRoot after pushing receipts
* Remove some now-obsolete GTF getters
@Dentosal Dentosal added breaking A breaking api change fuel-vm Related to the `fuel-vm` crate. fuel-asm Related to the `fuel-asm` crate. labels Feb 19, 2024
@Dentosal Dentosal self-assigned this Feb 19, 2024
@Dentosal Dentosal marked this pull request as ready for review February 19, 2024 17:33
@Dentosal Dentosal requested a review from a team February 19, 2024 17:33
@Dentosal
Copy link
Member Author

Dentosal commented Feb 19, 2024

The current version clears predicate_gas_used too early. Attempting a fix now.
EDIT: fixed

@Dentosal Dentosal marked this pull request as ready for review February 19, 2024 23:20
fuel-tx/src/transaction.rs Outdated Show resolved Hide resolved
@Dentosal Dentosal requested a review from a team February 20, 2024 02:36
Copy link
Collaborator

@xgreenx xgreenx left a comment

Choose a reason for hiding this comment

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

The code looks much cleaner=DDD I like it. Thank you!

Comment on lines 40 to 48
if let Some(s) = tx.as_script_mut() {
*s.receipts_root_mut() = Default::default();
}
tx.inputs_mut()
.iter_mut()
.for_each(fuel_tx::Input::prepare_init_execute);
tx.outputs_mut()
.iter_mut()
.for_each(fuel_tx::Output::prepare_init_execute);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we want to call prepare_init_execute, you can make it part of the ExecutableTransaction=)

Copy link
Member Author

Choose a reason for hiding this comment

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

Adding prepare_init_execute to ExecutableTransaction would mean adding field::ReceiptRoot bound, which is not satisfied by the Create transaction. Although, I'm not sure why Create is an ExecutableTransaction since there's nothing to execute there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to define the implementation inside of the ExecutableTransaction. You can have a separate implementation for Create and Script transactions

Copy link
Member Author

Choose a reason for hiding this comment

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

It feels a bit inelegant, as the method is never called for Create. But it's still probably nicer than the current duplication. Done in 6a39361

fuel-vm/src/interpreter/executors/main.rs Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@xgreenx xgreenx added this pull request to the merge queue Feb 26, 2024
Merged via the queue into master with commit 54110f1 Feb 26, 2024
37 checks passed
@xgreenx xgreenx deleted the dento/checked-tx-update branch February 26, 2024 15:58
@xgreenx xgreenx mentioned this pull request Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change fuel-asm Related to the `fuel-asm` crate. fuel-vm Related to the `fuel-vm` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: Malleable inputs for Checked<Transaction> type
3 participants