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

Fixed all solidity warnings #6

Merged
merged 2 commits into from
Jul 27, 2022

Conversation

alexbakers
Copy link
Contributor

Foundry warning:

warning: Unknown section [default] found in foundry.toml.

Solidity warning:

Compiler run successful (with warnings)
warning[2462]: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
  --> src/APIConsumer.sol:33:5:
   |
33 |     constructor(
   |     ^ (Relevant source part starts here and spans across multiple lines).



warning[2462]: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
   --> src/test/mocks/MockOracle.sol:121:5:
    |
121 |     constructor(address _link) public {
    |     ^ (Relevant source part starts here and spans across multiple lines).



warning[6321]: Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable.
  --> src/KeepersCounter.sol:44:13:
   |
44 |             bytes memory /* performData */
   |             ^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:186:24:
    |
186 |   function addConsumer(uint64 _subId, address _consumer) external pure override {
    |                        ^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:186:39:
    |
186 |   function addConsumer(uint64 _subId, address _consumer) external pure override {
    |                                       ^^^^^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:190:27:
    |
190 |   function removeConsumer(uint64 _subId, address _consumer) external pure override {
    |                           ^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:190:42:
    |
190 |   function removeConsumer(uint64 _subId, address _consumer) external pure override {
    |                                          ^^^^^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:194:45:
    |
194 |   function requestSubscriptionOwnerTransfer(uint64 _subId, address _newOwner) external pure override {
    |                                             ^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:194:60:
    |
194 |   function requestSubscriptionOwnerTransfer(uint64 _subId, address _newOwner) external pure override {
    |                                                            ^^^^^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> lib/chainlink-brownie-contracts/contracts/src/v0.8/mocks/VRFCoordinatorV2Mock.sol:198:44:
    |
198 |   function acceptSubscriptionOwnerTransfer(uint64 _subId) external pure override {
    |                                            ^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> script/APIConsumer.s.sol:36:9:
   |
36 |         APIConsumer apiConsumer = new APIConsumer(
   |         ^^^^^^^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> script/KeepersCounter.s.sol:17:9:
   |
17 |         KeepersCounter keepersCounter = new KeepersCounter(updateInterval);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> src/PriceFeedConsumer.sol:33:13:
   |
33 |             uint80 roundID,
   |             ^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> src/PriceFeedConsumer.sol:35:13:
   |
35 |             uint256 startedAt,
   |             ^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> src/PriceFeedConsumer.sol:36:13:
   |
36 |             uint256 timeStamp,
   |             ^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> src/PriceFeedConsumer.sol:37:13:
   |
37 |             uint80 answeredInRound
   |             ^^^^^^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> script/PriceFeedConsumer.s.sol:25:9:
   |
25 |         PriceFeedConsumer priceFeedConsumer = new PriceFeedConsumer(priceFeed);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



warning[5667]: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
  --> src/VRFConsumerV2.sol:87:33:
   |
87 |     function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords)
   |                                 ^^^^^^^^^^^^^^^^^



warning[2072]: Warning: Unused local variable.
  --> script/VRFConsumerV2.s.sol:36:9:
   |
36 |         VRFConsumerV2 vrfConsumerV2 = new VRFConsumerV2(
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^



warning[2018]: Warning: Function state mutability can be restricted to pure
  --> script/HelperConfig.sol:28:5:
   |
28 |     function getRinkebyEthConfig()
   |     ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to pure
  --> script/HelperConfig.sol:45:5:
   |
45 |     function getAnvilEthConfig()
   |     ^ (Relevant source part starts here and spans across multiple lines).



warning[2018]: Warning: Function state mutability can be restricted to view
  --> src/KeepersCounter.sol:37:5:
   |
37 |     function checkUpkeep(
   |     ^ (Relevant source part starts here and spans across multiple lines).


% forge build
[⠔] Compiling...
[⠒] Compiling 4 files with 0.8.15
[⠢] Solc 0.8.15 finished in 1.56s
Compiler run successful

% forge test 
[⠰] Compiling...
No files changed, compilation skipped

Running 1 test for src/test/PriceFeedConsumer.t.sol:PriceFeedConsumerTest
[PASS] testConsumerReturnsStartingValue() (gas: 17429)
Test result: ok. 1 passed; 0 failed; finished in 2.91ms

Running 2 tests for src/test/APIConsumer.t.sol:APIConsumerTest
[PASS] testCanGetResponse() (gas: 103642)
[PASS] testCanMakeRequest() (gas: 106898)
Test result: ok. 2 passed; 0 failed; finished in 3.61ms

Running 3 tests for src/test/VRFConsumerV2.t.sol:VRFConsumerV2Test
[PASS] testCanGetRandomResponse() (gas: 139958)
[PASS] testCanRequestRandomness() (gas: 72738)
[PASS] testEmitsEventOnFulfillment() (gas: 142582)
Test result: ok. 3 passed; 0 failed; finished in 3.76ms

Running 4 tests for src/test/KeepersCounter.t.sol:KeepersCounterTest
[PASS] testCheckupReturnsFalseBeforeTime() (gas: 8757)
[PASS] testCheckupReturnsTrueAfterTime() (gas: 15981)
[PASS] testFuzzingExample(bytes) (runs: 256, μ: 11914, ~: 11873)
[PASS] testPerformUpkeepUpdatesTime() (gas: 42661)
Test result: ok. 4 passed; 0 failed; finished in 42.23ms

Copy link
Contributor

@PatrickAlphaC PatrickAlphaC left a comment

Choose a reason for hiding this comment

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

Thanks for this PR!

src/VRFConsumerV2.sol Outdated Show resolved Hide resolved
@PatrickAlphaC PatrickAlphaC merged commit bb66f44 into smartcontractkit:main Jul 27, 2022
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.

2 participants