Skip to content

Commit 6168139

Browse files
authored
forge lint (#204)
* forge lint * fix forge lint * resolve mixed-case-variable * forge fmt
1 parent 94073a5 commit 6168139

20 files changed

+135
-144
lines changed

.github/workflows/contract-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install Foundry
2020
uses: foundry-rs/foundry-toolchain@v1
2121
with:
22-
version: v1.2.3
22+
version: v1.3.5
2323

2424
- name: Install Dependencies
2525
run: forge install

.github/workflows/link.yml renamed to .github/workflows/lint.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ jobs:
1616
- name: Install Foundry
1717
uses: foundry-rs/foundry-toolchain@v1
1818
with:
19-
version: v1.2.3
19+
version: v1.3.5
2020

21-
- name: Run Lint
21+
- name: fmt
2222
run: |
23-
forge fmt --check
23+
forge fmt --check
24+
25+
- name: build
26+
run: |
27+
forge build
28+
29+
- name: lint
30+
run: |
31+
! (forge lint 2>&1 | grep "")

foundry.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ remappings = [
1818
optimizer_runs = 1
1919
via_ir = true
2020

21+
[lint]
22+
exclude_lints = [
23+
"incorrect-shift",
24+
"mixed-case-function",
25+
]

src/Cids.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
pragma solidity ^0.8.20;
33

4-
import {BitOps} from "./BitOps.sol";
5-
import "@openzeppelin/contracts/utils/Strings.sol";
6-
74
library Cids {
85
uint256 public constant COMMP_LEAF_SIZE = 32;
96
// 0x01 0x55 0x9120

src/Fees.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
pragma solidity ^0.8.20;
33

4-
import {BitOps} from "./BitOps.sol";
5-
64
/// @title PDPFees
75
/// @notice A library for calculating fees for the PDP.
86
library PDPFees {

src/PDPVerifier.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import {BitOps} from "./BitOps.sol";
55
import {Cids} from "./Cids.sol";
66
import {MerkleVerify} from "./Proofs.sol";
77
import {PDPFees} from "./Fees.sol";
8-
import "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
9-
import "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
10-
import "../lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
11-
import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
12-
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
8+
import {ERC1967Utils} from "../lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol";
9+
import {Initializable} from "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
10+
import {UUPSUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
11+
import {OwnableUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
12+
import {IPyth} from "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
13+
import {PythStructs} from "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
1314
import {IPDPTypes} from "./interfaces/IPDPTypes.sol";
14-
import {IPDPEvents} from "./interfaces/IPDPEvents.sol";
1515

1616
/// @title PDPListener
1717
/// @notice Interface for PDP Service applications managing data storage.

src/Proofs.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ library MerkleVerify {
6969
function zeroRoot(uint256 height) internal pure returns (bytes32) {
7070
require(height <= 50, "Height must be <= 50");
7171
// These roots were generated by code in Proots.t.sol.
72-
uint256[51] memory ZERO_ROOTS = [
72+
uint256[51] memory zeroRoots = [
7373
0x0000000000000000000000000000000000000000000000000000000000000000,
7474
0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb0b,
7575
0x3731bb99ac689f66eef5973e4a94da188f4ddcae580724fc6f3fd60dfd488333,
@@ -122,7 +122,7 @@ library MerkleVerify {
122122
0x6f5246ae0f965e5424162403d3ab81ef8d15439c5f3a49038488e3640ef98718,
123123
0x0b5b44ccf91ff135af58d2cf694b2ac99f22f5264863d6b9272b6155956aa10e
124124
];
125-
return bytes32(ZERO_ROOTS[height]);
125+
return bytes32(zeroRoots[height]);
126126
}
127127
}
128128

src/SimplePDPService.sol

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
pragma solidity ^0.8.20;
33

4-
import {PDPVerifier, PDPListener} from "./PDPVerifier.sol";
5-
import "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
6-
import "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
7-
import "../lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
8-
import {IPDPTypes} from "./interfaces/IPDPTypes.sol";
4+
import {PDPListener} from "./PDPVerifier.sol";
5+
import {Initializable} from "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
6+
import {UUPSUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
7+
import {OwnableUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol";
98
import {Cids} from "./Cids.sol";
10-
import {IPDPEvents} from "./interfaces/IPDPEvents.sol";
119
import {IPDPProvingSchedule} from "./IPDPProvingSchedule.sol";
1210

1311
// PDPRecordKeeper tracks PDP operations. It is used as a base contract for PDPListeners

src/interfaces/IPDPEvents.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

4-
import "./IPDPTypes.sol";
4+
import {Cids} from "../Cids.sol";
5+
import {IPDPTypes} from "./IPDPTypes.sol";
56

67
/// @title IPDPEvents
78
/// @notice Shared events for PDP contracts and consumers

src/interfaces/IPDPTypes.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.20;
33

4-
import {Cids} from "../Cids.sol";
5-
64
/// @title IPDPTypes
75
/// @notice Shared types for PDP contracts and consumers
86
interface IPDPTypes {

0 commit comments

Comments
 (0)