-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
pending request counter in vrf v2.5 coordinator #12425
Conversation
pending request counter in vrf v2.5 coordinator
I see that you haven't updated any README files. Would it make sense to do so? |
Go solidity wrappers are out-of-date, regenerate them via the |
if (s_consumers[consumers[i]][subId].pendingReqCount > 0) { | ||
return true; |
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.
Since you removed the code above, that removed the only place where we had to recompute the request ID based on the consumer nonce. Now, I'm thinking if we can use s_subscriptions[rc.subId].reqCount
together with pendingReqCount
as a part of the request ID generation (instead of consumer nonce), would that also ensure uniqueness? So, reqCount
is incremented every time a fulfillment is made on a subscription level (at the same time when pendingReqCount
decrements) and pendingReqCount
is incremented every time a new request has been made (but reqCount
stays the same). Somehow, they always complement each other in a way that could ensure a unique combination every time a request has been made. Of course, in case I didn't miss any edge cases or started with wrong assumptions.
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.
I discussed this with @leeyikjiun and seems like this approach won't introduce any additional "wins" compared to the current solution we have. I think we can dismiss it.
if (s_requestCommitments[reqId] != 0) { | ||
return true; | ||
} | ||
if (s_consumers[consumers[i]][subId].pendingReqCount > 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.
Currently both removeConsumer and cancelSubscription call pendingRequestExists, which checks if a subId has pendingRequests or not.
This means we would not be able to delete a consumer of a subId if another consumer of the same subId has pendingRequests. Is this a limiting factor?
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.
The pendingRequestsExists method tracks pending requests on an entire subscriptionID when we check to removeConsumer.
Shall we add a new method that just checks s_consumers[address][subId].pendingReqCounter when removeConsumer is called
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.
Discussed this offline. We will leave as is because customers only removeConsumer when they want to cancel subscriptions anyways.
The base branch was changed.
|
assertTrue(s_testCoordinator.pendingRequestExists(subId)); | ||
} | ||
|
||
function testRequestRandomWords_MultipleConsumers_PendingRequestExists() public { |
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.
Do we have a test to check what happens when you have pending requests and you try to remove the consumer or cancel an entire subscription? Do we need it?
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.
Doesn't look like we have those tests. I can add those in follow up PR
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.
LGTM left one comment but don't consider it blocking
* soft delete nonce in s_consumers so that request IDs do not repeat. WIP * forge unit tests passing except for exact billing amount * add forge tests and optimize gas * regenerate wrappers * remove comment * address comments * fix test * add changeset * implement pending request counter pending request counter in vrf v2.5 coordinator * run prettier and regenerate wrappers * add changeset * bump gas required for remove consumer
* soft delete nonce in s_consumers so that request IDs do not repeat. WIP * forge unit tests passing except for exact billing amount * add forge tests and optimize gas * regenerate wrappers * remove comment * address comments * fix test * add changeset * implement pending request counter pending request counter in vrf v2.5 coordinator * run prettier and regenerate wrappers * add changeset * bump gas required for remove consumer
* soft delete nonce in s_consumers so that request IDs do not repeat. WIP * forge unit tests passing except for exact billing amount * add forge tests and optimize gas * regenerate wrappers * remove comment * address comments * fix test * add changeset * implement pending request counter pending request counter in vrf v2.5 coordinator * run prettier and regenerate wrappers * add changeset * bump gas required for remove consumer
* soft delete nonce in s_consumers so that request IDs do not repeat. WIP * forge unit tests passing except for exact billing amount * add forge tests and optimize gas * regenerate wrappers * remove comment * address comments * fix test * add changeset * implement pending request counter pending request counter in vrf v2.5 coordinator * run prettier and regenerate wrappers * add changeset * bump gas required for remove consumer
* soft delete nonce in s_consumers so that request IDs do not repeat. WIP * forge unit tests passing except for exact billing amount * add forge tests and optimize gas * regenerate wrappers * remove comment * address comments * fix test * add changeset * implement pending request counter pending request counter in vrf v2.5 coordinator * run prettier and regenerate wrappers * add changeset * bump gas required for remove consumer
Implement pending request counter in vrf v2.5 coordinator