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

remove oracle withdraw and allow contract owner to withdraw #11551

Conversation

jinhoonbang
Copy link
Contributor

@jinhoonbang jinhoonbang commented Dec 12, 2023

  • remove oracle withdraw and allow contract owner to withdraw
  • open question. should there be an additional identity who can withdraw?
    • will increase contract size

Testing

On-chain testing

$ forge test -vvv --match-path test/v0.8/foundry/vrf/VRFV2PlusSubscriptionAPI.t.sol
...
Test result: ok. 32 passed; 0 failed; 0 skipped; finished in 7.41ms
Ran 1 test suites: 32 tests passed, 0 failed, 0 skipped (32 total tests)

Off-chain integration testing

$ cd integration-tests
$ make build_docker_image image=chainlink tag=local_dev
$ TEST_LOG_LEVEL=debug \
SELECTED_NETWORKS=SIMULATED \
CHAINLINK_IMAGE=chainlink \
CHAINLINK_VERSION=local_dev \
go test -v -count=1 -timeout 15m -run "^TestVRFv2Plus$" ./smoke

@jinhoonbang jinhoonbang requested a review from a team as a code owner December 12, 2023 22:33
Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

@jinhoonbang jinhoonbang requested a review from a team as a code owner December 13, 2023 21:20
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the naming convention here is defined here . I don't think maintaining a separate foundry profile (e.g. vrfv2plus) is needed

* @param publicProvingKey key that oracle can use to submit vrf fulfillments
*/
function registerProvingKey(address oracle, uint256[2] calldata publicProvingKey) external onlyOwner {
function registerProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jinhoonbang @kidambisrinivas FYI this is a breaking change for Gauntlet commands (both for register and deregister proving key). When I use this branch, unit tests on the Gauntlet repo for proving key registration and deregistration are failing. I will fix those commands in the same PR where I would be introducing new withdrawal functions. Then, we would merge it on the Gauntlet develop branch only when this PR is merged (and after I double-check everything once again).

@@ -36,9 +36,10 @@ type CoordinatorV2_X interface {
GetConfig(opts *bind.CallOpts) (Config, error)
ParseLog(log types.Log) (generated.AbigenLog, error)
OracleWithdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error)
Withdraw(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a second method here for withdrawing native?

Copy link
Contributor Author

@jinhoonbang jinhoonbang Dec 22, 2023

Choose a reason for hiding this comment

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

Yeah we can add it for completeness. It seems that Withdraw() isn't used anywhere currently either

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In terms of test coverage, withdrawNative is tested in integration tests which uses a different interface from this one.

Copy link
Contributor

Choose a reason for hiding this comment

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

So this interface is not tested or is just the Withdraw() method not used/tested? And why do integration tests use a different interface?

Copy link
Contributor Author

@jinhoonbang jinhoonbang Dec 28, 2023

Choose a reason for hiding this comment

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

The interface is used and tested but seems that a few methods (withdraw() and withdrawNative()) are unused.

The integration tests use different interface but I'm not sure if we have a good reason for it. I think we have room for some refactoring in integration tests to either create a new shared interface for v2 and v2plus or use the existing one above.

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate failed

Failed condition 33.3% 33.3% Coverage on New Code (is less than 75%)

See analysis details on SonarQube

@jinhoonbang jinhoonbang requested a review from dkneisly December 22, 2023 17:38
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.

I'm approving the PR to unblock you this week - but please take it with a grain of salt. Also, since this is impacting only v2.5 it should not break anything and would probably be okay to patch things next week (if needed).

@jinhoonbang jinhoonbang added this pull request to the merge queue Jan 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 2, 2024
@jinhoonbang jinhoonbang added this pull request to the merge queue Jan 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 2, 2024
@jinhoonbang jinhoonbang added this pull request to the merge queue Jan 2, 2024
Merged via the queue into develop with commit c8eaac7 Jan 2, 2024
90 of 91 checks passed
@jinhoonbang jinhoonbang deleted the VRF-797-remove-oracle-withdraw-and-allow-contract-owner-to-withdraw branch January 2, 2024 19:52
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.

5 participants