-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore: added method to duplicate predicate #3395
base: master
Are you sure you want to change the base?
chore: added method to duplicate predicate #3395
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@YaTut1901 is attempting to deploy a commit to the Fuel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Hi @YaTut1901, Great work on this! We really appreciate your help. Could you edit the PR description, specifically this part:
and change it to:
Thank you! |
…b.com/YaTut1901/fuels-ts into YaTut1901/chore/predicate-duplication
CodSpeed Performance ReportMerging #3395 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have an e2e test inside fuel-gauge
that uses a predicate via toNewInstance
}); | ||
|
||
expect(predicate.predicateData).toEqual(['DADA']); | ||
expect(predicate.bytes[0]).toEqual(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check seems redundant, can we check the entire bytecode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YaTut1901 Thanks for your help 🙏
However, I am skeptical that the current solution will fully resolve the issue.
When a new predicate is instantiated, its bytes property does not always reflect the original predicate bytes with default configurable values.
Configurable values are embedded directly into the predicate bytes during processing. Consequently, the stored bytes reflect the instance's configurable values rather than the pristine, default state. This can be observed on processPredicateData and setConfigurableConstants.
When using toNewInstance
to create a new predicate, the bytes property inherits the values from the previous instance, which might include non-default configurable values. This makes it impossible to rely on toNewInstance
to produce a new instance with the pristine, default configurable values.
It’s possible that someone might want to use toNewInstance
without setting new configurable values, relying instead on the defaults.
I believe we need to store the predicate's pristine bytes separately, those that remain untouched by configurable values.
Hm, okay, I will check this point more precisely |
Summary
Added method
toNewInstance
which returns new instance of predicate with same abi, loaderBytecode, provider and different configurableConstants and data to be passed:Checklist