-
Notifications
You must be signed in to change notification settings - Fork 308
feat(entropy): Add gas tracking for the callback recovery flow #2666
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| EntropyStructs.Request memory reqV1 = EntropyStructConverter | ||
| .toV1Request(req); | ||
| clearRequest(provider, sequenceNumber); | ||
| // WARNING: DO NOT USE req BELOW HERE AS ITS CONTENTS HAS BEEN CLEARED |
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.
referencing req.requester in the prior version of this code wasn't a good idea. (that field doesn't get cleared, but not good to make assumptions about that)
|
|
||
| // callback gas usage is approximate and only triggered when the provider has set a gas limit. | ||
| // Note: this condition is somewhat janky, but we hit the stack limit so can't put in any more local variables :( | ||
| // callback gas usage is approximate |
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.
Note that other tests of the Revealed event don't check the gas field because it's too hard to predict up front. Thus, we're using vm.expectEmit to only check the topics not the data.
Summary
As the title says. Track gas usage and emit it in the event.
Rationale
I previously omitted gas tracking in this recovery flow (which is identical to the old callback flow). However, I realized tracking gas will be useful here -- if a user's callback fails and they recover it, they probably want to know how much gas it used so they can set the gas limit better next time.
How has this been tested?