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

Take into account spent gas during synchronous predicates estimation #771

Merged
merged 6 commits into from
Jun 15, 2024

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Jun 15, 2024

Closes #756

The fuel-core already uses synchronous predicate estimation, so we don't need any other changes.

image

Before requesting review

  • I have reviewed the code myself

@xgreenx xgreenx requested a review from a team June 15, 2024 11:31
@xgreenx xgreenx self-assigned this Jun 15, 2024
let result = transaction.estimate_predicates(&params, MemoryInstance::new());

// Then
assert_eq!(Ok(()), result);
Copy link
Member

Choose a reason for hiding this comment

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

if the estimation runs out of gas due to each predicate running an infinite loop, why is this an Ok(())?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was done a long time ago to allow estimate predicates even if they return false. For cases when signature incorrect and predicate fails

I also don't like it=D I was thinking of modifying the code and returning an error in all cases except false predicate. But it will change how estimation works, so I decided not to include it in this PR.

Copy link
Member

@Voxelot Voxelot Jun 15, 2024

Choose a reason for hiding this comment

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

Ok - this seems odd but makes sense given the context. If predicates are invalid the estimation should return an error imo.

@xgreenx xgreenx added this pull request to the merge queue Jun 15, 2024
Merged via the queue into master with commit 2097ed9 Jun 15, 2024
39 checks passed
@xgreenx xgreenx deleted the bugfix/bound-sync-transaction-estimation branch June 15, 2024 20:02
@xgreenx xgreenx mentioned this pull request Jun 15, 2024
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.

Predicate estimation is, almost, unbounded
2 participants