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

vrfv2plus: Add batch coordinator tests #13497

Merged
merged 5 commits into from
Jun 26, 2024

Conversation

leeyikjiun
Copy link
Contributor

No description provided.

Copy link
Contributor

I see you updated files related to contracts. Please run pnpm changeset in the contracts directory to add a changeset.

emit RandomWordsFulfilled(output1.requestId, output1.randomness, s_subId, 800000000000304103, false, true, false);

// Fulfill the requests.
s_batchCoordinator.fulfillRandomWords(proofs, rcs);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand what this test is supposed to check in the end. If it's supposed to check that fulfillRandomWords will not revert, then it's fine. But if it's supposed to check the expected state caused by calling the fulfillRandomWords function, then I guess checking the subscription balance might be the best one to check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, the main motivation for the test is to have some code from the test to trigger the fulfillRandomWords so that I can get its gas usage. 😅

So right now, the assertion is quite minimal and it just asserts that the 2 requests are fulfilled.

On hindsight, I don't think we should be doing extensive assertions here as well, as subscription balances check should be done by the coordinator itself. The batch coordinator's job is just to proxy over to the coordinator and fulfill multiple requests. We could do those checks here as well but it will really be a redundant check already covered by the coordinator. If the logic were to change, then we'll need to fix multiple places as well.

Copy link
Contributor

@ibrajer ibrajer left a comment

Choose a reason for hiding this comment

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

LGTM

@leeyikjiun leeyikjiun enabled auto-merge June 13, 2024 08:10
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

* -sender 0x2f1c0761d6e4b1e5f01968d6c746f695e5f3e25d \
* -native-payment false
*/
function _printGenerateProofV2PlusCommand(
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 👍

@leeyikjiun leeyikjiun added this pull request to the merge queue Jun 26, 2024
Merged via the queue into develop with commit f1d4cd3 Jun 26, 2024
116 of 117 checks passed
@leeyikjiun leeyikjiun deleted the vrf-add-batch-coordinator-tests branch June 26, 2024 09:33
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