Skip to content

Commit

Permalink
ci: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
clauBv23 committed Nov 7, 2024
1 parent 84c5dc5 commit d3757c3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"code-complexity": ["error", 10],
"compiler-version": ["error", ">=0.8.4"],
"func-visibility": ["error", {"ignoreConstructors": true}],
"max-line-length": ["error", 120],
Expand Down
15 changes: 10 additions & 5 deletions packages/contracts/src/TokenVoting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {MajorityVotingBase} from "./MajorityVotingBase.sol";
/// @notice The majority voting implementation using an
/// [OpenZeppelin `Votes`](https://docs.openzeppelin.com/contracts/4.x/api/governance#Votes)
/// compatible governance token.
/// @dev v1.3 (Release 1, Build 3). For each upgrade, if the reinitialization step is required, increment the version numbers in the modifier for both the initialize and initializeFrom functions.
/// @dev v1.3 (Release 1, Build 3). For each upgrade, if the reinitialization step is required,
/// increment the version numbers in the modifier for both the initialize and initializeFrom functions.
/// @custom:security-contact [email protected]
contract TokenVoting is IMembership, MajorityVotingBase {
using SafeCastUpgradeable for uint256;
Expand Down Expand Up @@ -62,10 +63,14 @@ contract TokenVoting is IMembership, MajorityVotingBase {
emit MembershipContractAnnounced({definingContract: address(_token)});
}

/// @notice Reinitializes the TokenVoting after an upgrade from a previous protocol version.For each reinitialization step, use the `_fromBuild` version to decide which internal functions to call for reinitialization.
/// @dev WARNING: The contract should only be upgradeable through PSP to ensure that _fromBuild is not incorrectly passed, and that the appropriate permissions for the upgrade are properly configured.
/// @param _fromBuild The build version number of the previous implementation contract this upgrade is transitioning from.
/// @param _initData The initialization data to be passed to via `upgradeToAndCall` (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)).
/// @notice Reinitializes the TokenVoting after an upgrade from a previous protocol version. For each
/// reinitialization step, use the `_fromBuild` version to decide which internal functions to
/// call for reinitialization.
/// @dev WARNING: The contract should only be upgradeable through PSP to ensure that _fromBuild is not
/// incorrectly passed, and that the appropriate permissions for the upgrade are properly configured.
/// @param _fromBuild Build version number of previous implementation contract this upgrade is transitioning from.
/// @param _initData The initialization data to be passed to via `upgradeToAndCall`
/// (see [ERC-1967](https://docs.openzeppelin.com/contracts/4.x/api/proxy#ERC1967Upgrade)).
function initializeFrom(uint16 _fromBuild, bytes calldata _initData) external reinitializer(2) {
if (_fromBuild < 3) {
(
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/mocks/CustomExecutorMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.8;

import {IExecutor, Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";
import {Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";

/// @dev DO NOT USE IN PRODUCTION!
contract CustomExecutorMock {
Expand Down
10 changes: 2 additions & 8 deletions packages/contracts/test/10_unit-testing/11_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import {
import {
findEvent,
findEventTopicLog,
proposalIdToBytes32,
TIME,
getInterfaceId,
pctToRatio,
Expand All @@ -64,7 +63,6 @@ import {
DAO,
DAOStructs,
DAO__factory,
MajorityVotingBase__factory,
} from '@aragon/osx-ethers';
import {loadFixture, time} from '@nomicfoundation/hardhat-network-helpers';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
Expand Down Expand Up @@ -1878,7 +1876,6 @@ describe('TokenVoting', function () {
judy,
mallory,
initializedPlugin,
uninitializedPlugin,
token,
dao,
dummyActions,
Expand Down Expand Up @@ -2282,7 +2279,6 @@ describe('TokenVoting', function () {
judy,
mallory,
initializedPlugin,
uninitializedPlugin,
token,
dao,
dummyActions,
Expand Down Expand Up @@ -2551,7 +2547,7 @@ describe('TokenVoting', function () {
});

it('executes target with delegate call', async () => {
let {
const {
alice,
bob,
carol,
Expand All @@ -2574,7 +2570,7 @@ describe('TokenVoting', function () {
const abiA = CustomExecutorMock__factory.abi;
const abiB = TokenVoting__factory.abi;

// @ts-ignore
// @ts-expect-error correct abi type
const mergedABI = abiA.concat(abiB);

await dao.grant(
Expand All @@ -2588,7 +2584,6 @@ describe('TokenVoting', function () {
operation: Operation.delegatecall,
});

// @ts-ignore
const pluginMerged = (await ethers.getContractAt(
mergedABI,
plugin.address
Expand Down Expand Up @@ -2760,7 +2755,6 @@ describe('TokenVoting', function () {
dave,
eve,
frank,
grace,
dao,
initializedPlugin: plugin,
dummyMetadata,
Expand Down
3 changes: 1 addition & 2 deletions packages/contracts/test/10_unit-testing/12_plugin-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
IERC20Upgradeable__factory,
IVotesUpgradeable__factory,
} from '../../typechain';
import {plugins} from '../../typechain/@aragon/osx-v1.0.0';
import {IGovernanceWrappedERC20__factory} from '../../typechain/factories/src/ERC20/governance';
import {MajorityVotingBase} from '../../typechain/src/MajorityVotingBase';
import {
Expand Down Expand Up @@ -209,7 +208,7 @@ describe('TokenVotingSetup', function () {

describe('prepareInstallation', async () => {
it('fails if data is empty, or not of minimum length', async () => {
const {pluginSetup, dao, prepareInstallationInputs, defaultMetadata} =
const {pluginSetup, dao, prepareInstallationInputs} =
await loadFixture(fixture);

// Try calling `prepareInstallation` without input data.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createDaoProxy} from '../20_integration-testing/test-helpers';
import {TestGovernanceERC20, TokenVoting} from '../../typechain';
import {TestGovernanceERC20} from '../../typechain';
import {MajorityVotingBase} from '../../typechain/src';
import {
INITIALIZE_SIGNATURE,
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Upgrades', () => {
// Ensure that on the `upgrade`, `initialize` can not be called.
try {
await deployAndUpgradeFromToCheck(
// @ts-ignore
// @ts-expect-error correct data type
...data
);
throw new Error('');
Expand All @@ -100,12 +100,12 @@ describe('Upgrades', () => {
}

data[8] = 'initializeFrom';
// @ts-ignore
// @ts-expect-error types castings will work
data[9] = [latestInitializerVersion, encodedParamsForUpgrade];

const {proxy, fromImplementation, toImplementation} =
await deployAndUpgradeFromToCheck(
// @ts-ignore
// @ts-expect-error correct data type
...data
);

Expand Down Expand Up @@ -186,20 +186,21 @@ describe('Upgrades', () => {
// Ensure that on the `upgrade`, `initialize` can not be called.
try {
await deployAndUpgradeFromToCheck(
// @ts-ignore
// @ts-expect-error correct data type

...data
);
throw new Error('');
} catch (err: any) {
expect(err.data).to.equal(AlreadyInitializedSignature);
}
data[8] = 'initializeFrom';
// @ts-ignore
// @ts-expect-error types castings will work
data[9] = [latestInitializerVersion, encodedParamsForUpgrade];

const {proxy, fromImplementation, toImplementation} =
await deployAndUpgradeFromToCheck(
// @ts-ignore
// @ts-expect-error correct data type
...data
);

Expand Down

0 comments on commit d3757c3

Please sign in to comment.