Skip to content

Commit

Permalink
fix(contracts-rfq): CI workflows [SLT-245] (#3178)
Browse files Browse the repository at this point in the history
* fix: license, files

* fix: package name

* build: update solhint to latest

* build: remove prettier dependencies

* fix: solhint workflows

* build: update solhint in other packages as well

* chore: solhint rules, exceptions

* fix: silence linter warnings in tests

* chore: forge fmt

* add variable to test linter CI

* Revert "add variable to test linter CI"

This reverts commit 0629309.
  • Loading branch information
ChiTimesChi authored Sep 24, 2024
1 parent 0daec70 commit 74b620e
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 248 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@typechain/ethers-v5": "10.0.0",
"hardhat": "2.22.2",
"rimraf": "3.0.2",
"solhint": "3.3.8",
"solhint": "5.0.3",
"typechain": "8.0.0",
"typescript": "4.7.3"
},
Expand Down
13 changes: 12 additions & 1 deletion packages/contracts-rfq/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"extends": "solhint:recommended"
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["error"],
"func-name-mixedcase": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"gas-custom-errors": "off",
"immutable-vars-naming": ["error", { "immutablesAsConstants": false }],
"max-line-length": ["warn", 120],
"modifier-name-mixedcase": "error",
"ordering": "warn",
"var-name-mixedcase": "error"
}
}
5 changes: 5 additions & 0 deletions packages/contracts-rfq/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
contracts/FastBridge.sol
contracts/interfaces/IFastBridge.sol
script/FastBridge.s.sol
test/FastBridge.t.sol
test/FastBridgeMock.sol
2 changes: 0 additions & 2 deletions packages/contracts-rfq/contracts/interfaces/IFastBridgeV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.20;
import {IFastBridge} from "./IFastBridge.sol";

interface IFastBridgeV2 is IFastBridge {

/// @notice Relays destination side of bridge transaction by off-chain relayer
/// @param request The encoded bridge transaction to relay on destination chain
/// @param relayer The address of the relaying entity which should have control of the origin funds when claimed
Expand All @@ -19,5 +18,4 @@ interface IFastBridgeV2 is IFastBridge {
/// @notice Completes bridge transaction on origin chain by claiming originally deposited capital. Can only send funds to the relayer address on the proof.
/// @param request The encoded bridge transaction to claim on origin chain
function claim(bytes memory request) external;

}
24 changes: 9 additions & 15 deletions packages/contracts-rfq/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
{
"name": "FastBridge",
"license": "UNLICENSED",
"name": "@synapsecns/contracts-rfq",
"license": "MIT",
"version": "0.4.1",
"description": "FastBridge contracts.",
"private": true,
"files": [
"src/*.sol"
"contracts/**/*.sol"
],
"dependencies": {
"@openzeppelin/contracts": "5.0.1"
},
"devDependencies": {
"@synapsecns/solidity-devops": "^0.4.5",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.6"
"solhint": "5.0.3"
},
"scripts": {
"build": " ",
"build:contracts": "forge build",
"build:slither": "forge build --out=out --build-info --force",
"test:coverage": "echo 'Please use foundry'",
"test": "forge test",
"lint:contracts:fix": "forge fmt && solhint --fix -c .solhint.json '{contracts,script,test}/**/*.sol'",
"lint": "forge fmt && npm run prettier && npm run solhint",
"ci:lint": "yarn lint",
"lint": "forge fmt && npm run solhint",
"lint:check": "forge fmt --check && npm run solhint:check",
"ci:lint": "npm run lint:check",
"build:go": "./flatten.sh contracts/*.sol test/*.sol",
"prettier": "prettier --write **.sol",
"prettier:list": "prettier --list-different **.sol",
"prettier:check": "prettier --check **.sol",
"solhint": "solhint --config ./.solhint.json 'src/**/*.sol' --fix",
"solhint:check": "solhint --config ./.solhint.json 'src/**/*.sol'",
"lint:check": "npm run prettier:check && npm run solhint:check"
"solhint": "solhint '{contracts,script,test}/**/*.sol' --fix --noPrompt",
"solhint:check": "solhint '{contracts,script,test}/**/*.sol'"
}
}
2 changes: 1 addition & 1 deletion packages/contracts-rfq/test/FastBridgeV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"
import {Test} from "forge-std/Test.sol";
import {stdStorage, StdStorage} from "forge-std/Test.sol";

// solhint-disable no-empty-blocks
// solhint-disable no-empty-blocks, ordering
abstract contract FastBridgeV2Test is Test {
using stdStorage for StdStorage;

Expand Down
8 changes: 4 additions & 4 deletions packages/contracts-rfq/test/MockERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ contract MockERC20 is ERC20 {
_decimals = decimals_;
}

function decimals() public view override returns (uint8) {
return _decimals;
}

function burn(address account, uint256 amount) external {
_burn(account, amount);
}

function mint(address account, uint256 amount) external {
_mint(account, amount);
}

function decimals() public view override returns (uint8) {
return _decimals;
}
}
1 change: 1 addition & 0 deletions packages/contracts-rfq/test/UniversalTokenLib.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {MockRevertingRecipient} from "./MockRevertingRecipient.sol";

import {Test} from "forge-std/Test.sol";

// solhint-disable ordering
contract UniversalTokenLibraryTest is Test {
UniversalTokenLibHarness public libHarness;
MockERC20 public token;
Expand Down
1 change: 1 addition & 0 deletions packages/contracts-rfq/test/UniversalTokenLibHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.17;

import {UniversalTokenLib} from "../contracts/libs/UniversalToken.sol";

// solhint-disable ordering
contract UniversalTokenLibHarness {
function universalTransfer(address token, address to, uint256 value) public {
UniversalTokenLib.universalTransfer(token, to, value);
Expand Down
2 changes: 1 addition & 1 deletion packages/solidity-devops/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"vp": "js/verifyProxy.js"
},
"devDependencies": {
"solhint": "^4.5.4"
"solhint": "5.0.3"
}
}
Loading

0 comments on commit 74b620e

Please sign in to comment.