Skip to content

feat!: add possibility to place a predefined gas amount for predicate #1655

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AurelienFT
Copy link
Contributor

Useful to be forced to estimate_predicates and let the user define it if he wants. Tried to make it non-breaking by using a new constructor (I don't know if the new field in the enum variant is considered breaking)

Release notes

In this release, we:

  • Added a new constructor for Input: resource_predicate_with_gas to let user place a predefined amount

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@AurelienFT AurelienFT requested a review from a team as a code owner April 29, 2025 15:19
@AurelienFT AurelienFT requested a review from hal3e April 29, 2025 15:19
@@ -16,6 +16,7 @@ pub enum Input {
resource: CoinType,
code: Vec<u8>,
data: Vec<u8>,
gas_used: u64,
Copy link
Member

Choose a reason for hiding this comment

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

this is a breaking change unless we annotated this previously with the non_exhaustive attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

Copy link
Member

Choose a reason for hiding this comment

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

adding non_exhaustive also makes this change a breaking change, but prevents breaking changes in the future, was that intended?

Copy link
Member

Choose a reason for hiding this comment

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

in any case, having non_exhaustive only on one enum variant makes it a little annoying for the consumer of this library, so perhaps we can just annotate the whole enum with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I wanted this to be non breaking. Removed for now. Making the PR draft because I might not need it

@hal3e hal3e changed the title Add possibility to place a predefined gas amount for predicate feat!: add possibility to place a predefined gas amount for predicate May 6, 2025
}
}

pub const fn resource_predicate_with_gas(
Copy link
Contributor

@hal3e hal3e May 6, 2025

Choose a reason for hiding this comment

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

As it is already a breaking change I would add the gas_used directly to the resource_predicate fn

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