fix linters

This commit is contained in:
Drygin 2022-01-28 19:46:46 +03:00
parent 85e6a88443
commit 61cc980055
12 changed files with 138 additions and 96 deletions

27
.eslintrc Normal file
View File

@ -0,0 +1,27 @@
{
"env": {
"node": true,
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:prettier/recommended", "prettier"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single", { "avoidEscape": true }],
"semi": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"comma-dangle": ["error", "always-multiline"],
"require-await": "error",
"prettier/prettier": ["error", { "printWidth": 110 }]
}
}

8
.prettierignore Normal file
View File

@ -0,0 +1,8 @@
.vscode
.idea
artifacts
artifacts-ovm
cache
cache-ovm
contracts/Verifier*.sol
src/types

16
.prettierrc Normal file
View File

@ -0,0 +1,16 @@
{
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"semi": false,
"printWidth": 110,
"overrides": [
{
"files": "*.sol",
"options": {
"singleQuote": false,
"printWidth": 130
}
}
]
}

View File

@ -1,6 +1,9 @@
# Nova upgrade proposal # Nova upgrade proposal
There is Tornado governance proposal for upgrade nova contract on Xdai chain. There is Tornado governance proposal for upgrade nova contract on Xdai chain.
## Tests ## Tests
1. Install dependencies: 1. Install dependencies:
``` ```
@ -20,7 +23,9 @@ There is Tornado governance proposal for upgrade nova contract on Xdai chain.
``` ```
yarn lint yarn lint
``` ```
## Deploy ## Deploy
1. Check `config.json` for actual values. 1. Check `config.json` for actual values.
2. Run deploy: 2. Run deploy:

View File

@ -10,11 +10,14 @@ interface IUpgradeableProxy {
} }
interface IAMB { interface IAMB {
function requireToPassMessage(address _contract, bytes calldata _data, uint256 _gas) external returns (bytes32); function requireToPassMessage(
address _contract,
bytes calldata _data,
uint256 _gas
) external returns (bytes32);
} }
contract NovaUpgradeProposal is ImmutableGovernanceInformation { contract NovaUpgradeProposal is ImmutableGovernanceInformation {
event MessagePassed(bytes32 msgId); event MessagePassed(bytes32 msgId);
address public immutable novaProxy; address public immutable novaProxy;
@ -37,11 +40,7 @@ contract NovaUpgradeProposal is ImmutableGovernanceInformation {
function executeProposal() external { function executeProposal() external {
bytes4 methodSelector = IUpgradeableProxy(address(0)).upgradeTo.selector; bytes4 methodSelector = IUpgradeableProxy(address(0)).upgradeTo.selector;
bytes memory data = abi.encodeWithSelector(methodSelector, newNovaImpl); bytes memory data = abi.encodeWithSelector(methodSelector, newNovaImpl);
bytes32 msgId = bridge.requireToPassMessage( bytes32 msgId = bridge.requireToPassMessage(novaProxy, data, gasLimit);
novaProxy,
data,
gasLimit
);
emit MessagePassed(msgId); emit MessagePassed(msgId);
} }
} }

View File

@ -6,10 +6,7 @@ pragma experimental ABIEncoderV2;
import { GovernanceGasUpgrade } from "tornado-governance/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol"; import { GovernanceGasUpgrade } from "tornado-governance/contracts/v2-vault-and-gas/gas/GovernanceGasUpgrade.sol";
contract TestGovernanceUpgrade is GovernanceGasUpgrade { contract TestGovernanceUpgrade is GovernanceGasUpgrade {
constructor( constructor(address gasCompLogic, address userVaultAddress) public GovernanceGasUpgrade(gasCompLogic, userVaultAddress) {}
address gasCompLogic,
address userVaultAddress
) public GovernanceGasUpgrade(gasCompLogic, userVaultAddress) {}
function test() public pure returns (int256) { function test() public pure returns (int256) {
return 231; return 231;

View File

@ -57,18 +57,14 @@ module.exports = {
}, },
accounts: process.env.PRIVATE_KEY accounts: process.env.PRIVATE_KEY
? [process.env.PRIVATE_KEY] ? [process.env.PRIVATE_KEY]
: { : { mnemonic: 'test test test test test junk' },
mnemonic: 'test test test test test test test test test test test junk',
},
}, },
mainnet: { mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`, url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
accounts: process.env.PRIVATE_KEY accounts: process.env.PRIVATE_KEY
? [process.env.PRIVATE_KEY] ? [process.env.PRIVATE_KEY]
: { : { mnemonic: 'test test test test test junk' },
mnemonic: 'test test test test test test test test test test test junk',
},
timeout: 2147483647, timeout: 2147483647,
}, },
} },
} }

View File

@ -7,12 +7,7 @@ async function generate(config) {
const deploymentBytecodeProposal = const deploymentBytecodeProposal =
ProposalFactory.bytecode + ProposalFactory.bytecode +
ProposalFactory.interface ProposalFactory.interface
.encodeDeploy([ .encodeDeploy([config.novaProxy, config.newNovaImpl, config.ethAmbBridge, config.gasLimit])
config.novaProxy,
config.newNovaImpl,
config.ethAmbBridge,
config.gasLimit,
])
.slice(2) .slice(2)
const proposalAddress = ethers.utils.getCreate2Address( const proposalAddress = ethers.utils.getCreate2Address(

View File

@ -1,6 +1,5 @@
const { ethers } = require('hardhat') const { ethers } = require('hardhat')
const { expect } = require('chai') const { expect } = require('chai')
const fs = require('fs')
const config = require('./test.config.json') const config = require('./test.config.json')
const { getSignerFromAddress, takeSnapshot, revertSnapshot } = require('./utils') const { getSignerFromAddress, takeSnapshot, revertSnapshot } = require('./utils')
@ -102,7 +101,7 @@ describe('General functionality tests', () => {
const filter = amb.filters.UserRequestForAffirmation() const filter = amb.filters.UserRequestForAffirmation()
const fromBlock = await ethers.provider.getBlock() const fromBlock = await ethers.provider.getBlock()
events = await amb.queryFilter(filter, fromBlock.number) events = await amb.queryFilter(filter, fromBlock.number)
bridgedData = events[0].args.encodedData.toString() const bridgedData = events[0].args.encodedData.toString()
expect(bridgedData.slice(106, 146)).to.be.equal(config.novaProxy.slice(2)) expect(bridgedData.slice(106, 146)).to.be.equal(config.novaProxy.slice(2))
expect(bridgedData.slice(196)).to.be.equal(config.newNovaImpl.slice(2)) expect(bridgedData.slice(196)).to.be.equal(config.newNovaImpl.slice(2))