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

Мigrate to truffle #146

Merged
merged 113 commits into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
a72a5fe
Add truffle package
elenadimitrova Jul 5, 2020
b4fda7c
Switch contracts compile to use truffle
elenadimitrova Jul 28, 2020
6441805
Fix path in infrastructure contracts compilation
elenadimitrova Jul 28, 2020
5548d05
Switch to truffle artefact loading in tests
elenadimitrova Jul 28, 2020
e7d92ac
Fix linting issues
elenadimitrova Jul 28, 2020
a7d98fb
Switch to default truffle config file name
elenadimitrova Jul 28, 2020
40a3da9
Move to use mocha test timeout configuration in truffle config
elenadimitrova Jul 28, 2020
222d593
Run ganache directly and not via etherlime
elenadimitrova Jul 28, 2020
18c7acd
Use ganache accounts for testing
elenadimitrova Jul 28, 2020
b207667
Hardcode the first account as deployment account
elenadimitrova Jul 29, 2020
aba6434
Refactor etherlime to using truffle
elenadimitrova Aug 11, 2020
4e0ab47
Fix linting errors [skip ci]
elenadimitrova Aug 11, 2020
61a908e
Migrate away from deployer
elenadimitrova Aug 11, 2020
7dcc003
Fix linting issues including the removal of obsoleted testmanager and…
elenadimitrova Aug 13, 2020
d44f40a
Migrate away from deployer.deploy syntax and to .new()
elenadimitrova Aug 17, 2020
ab806a1
Move getting block timestamp function to utils
elenadimitrova Aug 17, 2020
3cb3a07
Move increasing time function to utils
elenadimitrova Aug 17, 2020
8fa002b
Move getNonceForRelay function to utils
elenadimitrova Aug 17, 2020
8498268
Move network id functionality to utils
elenadimitrova Aug 17, 2020
c29e115
Move getBalance function to utils
elenadimitrova Aug 17, 2020
c19d325
Remove etherlime package used in tests
elenadimitrova Aug 17, 2020
edd8449
Add web3 dependency as used by truffle
elenadimitrova Aug 17, 2020
0725f6e
Refactor .from syntax to truffle variant {from:}
elenadimitrova Aug 17, 2020
4955191
Use custom assertRevert function for verifying revert errors
elenadimitrova Aug 18, 2020
af2ceeb
Set network id to 1597649375983 for development network
elenadimitrova Aug 18, 2020
acb43f0
Set relayer account to accounts[9] by default
elenadimitrova Aug 18, 2020
405f3e4
Migrate to truffle encodeABI call syntax
elenadimitrova Aug 18, 2020
9a0c8c4
Set network id in ganache-cli run
elenadimitrova Aug 18, 2020
a3dfe4a
Fix reading events off transaction receipt to comply with truffle [sk…
elenadimitrova Aug 18, 2020
c029010
Add fs package for reading the file system
elenadimitrova Aug 28, 2020
9df2439
Convert the offchain signing logic in test utils
elenadimitrova Aug 28, 2020
540567c
Fix linting issues
elenadimitrova Aug 28, 2020
58a9128
Add compile-none flag to truffle compile
elenadimitrova Aug 28, 2020
698b60b
Change assert.revert to assertRevert
elenadimitrova Aug 28, 2020
3582630
Fix issues with resolving an event parameter and asserting a revert h…
elenadimitrova Aug 29, 2020
385264f
Switch ethers.BigNumber to pure BigNumber
elenadimitrova Sep 8, 2020
2320508
Test fixing
elenadimitrova Oct 15, 2020
a271613
Upgrade ganache-cli to allow chainId option
elenadimitrova Oct 16, 2020
66b24f7
Fixing tests including:
elenadimitrova Oct 16, 2020
eada847
Fix compoundManager invest test
elenadimitrova Oct 17, 2020
fc60a2a
Use parseLogs util method
elenadimitrova Oct 20, 2020
b551589
Updates to package-lock file
elenadimitrova Oct 21, 2020
9432277
Fixes returning event information from transaction receipt
elenadimitrova Oct 21, 2020
2a94c8e
Fix compound manager loan tests
elenadimitrova Oct 21, 2020
482a294
Fix issues in ens and factory tests
elenadimitrova Oct 22, 2020
0a41399
Fix guardianManager tests
elenadimitrova Oct 22, 2020
985ecfb
Fix kyber and lockManager tests
elenadimitrova Oct 22, 2020
2a9ccf4
Fix linting errors
elenadimitrova Oct 22, 2020
1439cf3
Pull docker images for solc 0.5.4 and 0.6.12
elenadimitrova Oct 22, 2020
0c32b98
Fix a BN issue
elenadimitrova Oct 22, 2020
d5294cc
Test fixing post rebase
elenadimitrova Oct 23, 2020
22c63ba
Fix MultisigExecutor and multisig contract tests
elenadimitrova Oct 23, 2020
f50e6f5
Update parseRelayReceipt to cater for when there is no error
elenadimitrova Oct 23, 2020
605ac48
Fix RecoveryManager tests
elenadimitrova Oct 23, 2020
6b4bf05
Fix relayer tests
elenadimitrova Oct 24, 2020
e952759
Fix remaining tests except for loading legacy contracts
elenadimitrova Oct 29, 2020
282b7a6
Fix defi scripts and maker tests
elenadimitrova Oct 29, 2020
6dc83df
Provision uniswap lib artefacts to build/contracts folder
elenadimitrova Oct 30, 2020
d0141de
Add eth-gas-reporter to truffle
elenadimitrova Oct 30, 2020
dc2f56e
Set gas reporter to only show called methods
elenadimitrova Nov 2, 2020
2195dd2
Consolidate truffle configuration in config base file
elenadimitrova Nov 2, 2020
2c39613
Add codechecks for gas thresholds in CI
elenadimitrova Nov 2, 2020
328c01d
Temporarily skip tests that can't be fixed as artifacts loading outsi…
elenadimitrova Nov 2, 2020
2b9bc18
Update eth-gas-reporter output and artifacts upload in CI
elenadimitrova Nov 2, 2020
f084502
Add solidity coverage truffle plugin
elenadimitrova Nov 2, 2020
45914bb
Remove solc as we compile via docker only
elenadimitrova Nov 2, 2020
17aef9e
Fix artifacts path
elenadimitrova Nov 2, 2020
267ab4d
Add truffle-plugin-verify for etherscan verification
elenadimitrova Nov 4, 2020
c19780b
Remove obsolete solc configuration in base
elenadimitrova Nov 4, 2020
3d1844f
Remove deployment script for 2.2 release
elenadimitrova Nov 4, 2020
f763db2
Fix import path for DexRegistry
elenadimitrova Nov 5, 2020
da47236
Update staticcall tests for truffle syntax
elenadimitrova Nov 5, 2020
4b62b31
Rename ganache network to development
elenadimitrova Nov 6, 2020
b660913
Migrate deployment scripts to truffle
elenadimitrova Nov 6, 2020
8a4a783
Move reading the network parameter to DeployManager class logic
elenadimitrova Nov 6, 2020
2c725f0
Remove benchmark scripts
elenadimitrova Nov 6, 2020
39aa7c1
Package updates
elenadimitrova Nov 7, 2020
33b5461
Reorder circle build steps so everything is compiled before deploymen…
elenadimitrova Nov 7, 2020
50a5f36
Turn off eslint rules for import/no-unresolved and import/no-extraneo…
elenadimitrova Nov 8, 2020
6ea2c04
Abstract signing message hash
elenadimitrova Nov 8, 2020
04d7596
Improve assertRevert function
elenadimitrova Nov 8, 2020
0aff643
Increase timeout for deployment scripts test
elenadimitrova Nov 9, 2020
d87f5cb
Downgrade truffle due to https://github.com/trufflesuite/ganache-cli/…
elenadimitrova Nov 9, 2020
e29469d
Update scripts to truffle syntax
elenadimitrova Nov 9, 2020
d56786b
Increase timout for deployment scripts
elenadimitrova Nov 9, 2020
dada1cb
Add --no-compile flag to deploy script
elenadimitrova Nov 9, 2020
e6402e4
Switch contracts that are compiled alone back to the main contracts/m…
elenadimitrova Nov 9, 2020
4ba30ae
Add truffle-flatten
elenadimitrova Nov 16, 2020
0924d12
Fix a linting issue with old deployer.deploy syntax carried over in r…
elenadimitrova Nov 16, 2020
e83bf3c
Switch etherlime .contractAddress syntax to .address
elenadimitrova Nov 16, 2020
7021aae
Switch to deterministic accounts generation in ganache-cli
elenadimitrova Nov 16, 2020
e38de81
Fix versionManager test
elenadimitrova Nov 16, 2020
fd7205c
Add truffle-assertions package and migrate utils.assertRevert to use …
elenadimitrova Nov 16, 2020
6f181d6
Upgrade solidity-coverage to latest
elenadimitrova Nov 17, 2020
01f23ff
Add coverage script for truffle experiment
cgewecke Nov 19, 2020
700ddf5
Make sure coverage uses same ganache version as regular tests
cgewecke Nov 19, 2020
7c6c883
Update .solcover options for ganache
elenadimitrova Nov 19, 2020
4096d7b
Safeguard against private key not being found in ganache-accounts file
elenadimitrova Nov 19, 2020
7a943ca
Add compile-none option to truffle test
elenadimitrova Nov 19, 2020
0aae542
Fix a test with simpleUpgrader overloaded method
elenadimitrova Nov 20, 2020
49eb6b4
Exclude non Argent contracts from coverage
elenadimitrova Nov 20, 2020
8032b62
Use truffle/contract to instantiate legacy contracts in tests
elenadimitrova Nov 21, 2020
85f3aa6
Use contract error messages inline
elenadimitrova Nov 21, 2020
0a91ffe
Fix tests
elenadimitrova Nov 21, 2020
45e9729
Exclude coverage for non Argent contracts
elenadimitrova Nov 21, 2020
4d0198b
Fix a miltisig test
elenadimitrova Nov 21, 2020
cf7e41f
Drop coverage thresholds
elenadimitrova Nov 22, 2020
dee7bfc
Add etherscan verification script
elenadimitrova Nov 24, 2020
85d662d
Fixing isValidSignature test
olivdb Nov 26, 2020
f2455fa
Fix end to end deployments
elenadimitrova Nov 27, 2020
80dc7bc
Add a small script for testing deployments framework
elenadimitrova Nov 27, 2020
0522fb5
Refactor signOffchain util method to use the new signMessage
elenadimitrova Nov 28, 2020
9fd72d7
Package updates
elenadimitrova Nov 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ step_setup_global_packages: &step_setup_global_packages
name: "Set up global packages"
command: |
npm install
step_pull_solc_docker: &step_pull_solc_docker
run:
name: "Pull solc docker images"
command: |
docker pull ethereum/solc:0.5.4
docker pull ethereum/solc:0.6.12
step_setup_slither: &step_setup_slither
run:
name: "Setup slither analyser https://github.com/crytic/slither"
Expand All @@ -46,13 +52,16 @@ jobs:
steps:
- checkout
- <<: *step_restore_cache
- setup_remote_docker:
version: 19.03.13
- <<: *step_pull_solc_docker
- <<: *step_setup_global_packages
- run:
name: "Lint JavaScript"
command: npm run lint:js
- run:
name: "Lint Solidity contracts"
command: npm run lint:contracts
- run:
name: "Testing deployment scripts and benchmark gas costs"
command: npm run ganache >/dev/null 2>&1 & npm run test:deployment && npm run test:benchmark
- run:
name: "Compiling external library contracts"
command: npm run compile:lib
Expand All @@ -66,11 +75,20 @@ jobs:
name: "Compiling test contracts"
command: npm run compile:test
- run:
name: "Lint JavaScript"
command: npm run lint:js
name: "Provision lib artefacts"
command: npm run provision:lib:artefacts
- run:
name: "Test deployment scripts"
command: npm run ganache >/dev/null 2>&1 & npm run test:deployment
no_output_timeout: 60m
- run:
name: "Running unit tests"
command: npm run ganache >/dev/null 2>&1 & npm run test
# Save coverage artifacts
- store_artifacts:
path: gas-usage-report.log
destination: reports/gas-usage-report.log
- run: npx codechecks
- run:
name: "Running coverage"
command: |
Expand All @@ -81,11 +99,15 @@ jobs:
# Save coverage artifacts
- store_artifacts:
path: coverage
destination: coverage-artifacts
security-test:
<<: *job_python
steps:
- checkout
- <<: *step_restore_cache
- setup_remote_docker:
version: 19.03.13
- <<: *step_pull_solc_docker
- <<: *step_setup_global_packages
- <<: *step_setup_slither
- <<: *step_setup_solc_select
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ build/*
contracts/*
contracts-test/*
coverage/*
lib/*
lib/*
scripts/coverage.js
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
"no-underscore-dangle": "off",
"no-await-in-loop": "off",
"no-restricted-syntax": "off",
"guard-for-in": "off"
"guard-for-in": "off",
"function-paren-newline": "off",
"comma-dangle": "off",
"object-curly-newline": "off",
"no-unused-expressions": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off"

},
"parserOptions": {
"ecmaVersion": 2018
Expand Down
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-legacy
tmp
bin
.outputParameter
flatten

## Core latex/pdflatex auxiliary files:
*.aux
Expand All @@ -28,17 +29,17 @@ bin

.env
utils/config/*.json
!utils/config/ganache.json
!utils/config/development.json
!utils/config/kovan.json
!utils/config/kovan-fork.json
ganache-accounts.json

## Etherlime
**/.etherlime-store
flat
## solidity-coverage
.coverage_artifacts
.coverage_contracts
.coverage_tests
coverage
coverage.json

crytic-export
crytic-export
gas-usage-report.log
15 changes: 15 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
client: require('ganache-cli'),
skipFiles: [
"../contracts-test",
"../contracts-legacy",
"../lib"
],
providerOptions: {
port: 8555,
_chainId: 1895,
network_id: 1597649375983,
account_keys_path: "./ganache-accounts.json",
default_balance_ether: 10000
}
};
2 changes: 2 additions & 0 deletions codechecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
checks:
- name: eth-gas-reporter/codechecks
19 changes: 19 additions & 0 deletions contracts-test/TestOwnedContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.6.12;
import "../contracts/infrastructure/base/Owned.sol";

/**
* @title TestOwnedContract
* @notice Represents an arbitrary contract implementing Owned.
*/
contract TestOwnedContract is Owned {

uint256 public state;

event StateSet(uint256 indexed _state, uint256 indexed _value);

function setStateRestricted(uint256 _state) public onlyOwner payable {
state = _state;
emit StateSet(_state, msg.value);
}
}
2 changes: 1 addition & 1 deletion contracts/infrastructure/DexRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../infrastructure/base/Owned.sol";
import "./base/Owned.sol";
import "./IDexRegistry.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/LimitUtils.sol";
import "../common/BaseTransfer.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/storage/IGuardianStorage.sol";
import "./common/Utils.sol";
import "./common/LimitUtils.sol";
import "./common/BaseTransfer.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/storage/IGuardianStorage.sol";

/**
* @title ApprovedTransfer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/BaseFeature.sol";
import "../common/GuardianUtils.sol";
import "../common/LimitUtils.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../infrastructure/storage/IGuardianStorage.sol";
import "./common/Utils.sol";
import "./common/BaseFeature.sol";
import "./common/GuardianUtils.sol";
import "./common/LimitUtils.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../infrastructure/storage/IGuardianStorage.sol";

/**
* @title RelayerManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/BaseFeature.sol";
import "../../../lib/other/ERC20.sol";
import "../../../lib/paraswap/IAugustusSwapper.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../infrastructure/IDexRegistry.sol";
import "./common/BaseFeature.sol";
import "../../lib/other/ERC20.sol";
import "../../lib/paraswap/IAugustusSwapper.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../infrastructure/IDexRegistry.sol";

/**
* @title TokenExchanger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/BaseTransfer.sol";
import "../common/LimitUtils.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/storage/ITransferStorage.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../../lib/other/ERC20.sol";
import "./common/Utils.sol";
import "./common/BaseTransfer.sol";
import "./common/LimitUtils.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/storage/ITransferStorage.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../../lib/other/ERC20.sol";

/**
* @title TransferManager
Expand Down
39 changes: 39 additions & 0 deletions deployment/0_limited_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* global artifacts */
global.web3 = web3;
const chai = require("chai");
const BN = require("bn.js");
const bnChai = require("bn-chai");

const { expect } = chai;
chai.use(bnChai(BN));

const TestOwnedContract = artifacts.require("TestOwnedContract");
const MultiSig = artifacts.require("MultiSigWallet");

const deployManager = require("../utils/deploy-manager.js");
const MultisigExecutor = require("../utils/multisigexecutor.js");

async function main() {
const { deploymentAccount, configurator } = await deployManager.getProps();
console.log("deploymentAccount", deploymentAccount);
const { config } = configurator;

const testContractWrapper = await TestOwnedContract.new();
console.log("TestOwnedContract created at", testContractWrapper.address);

await testContractWrapper.changeOwner(config.contracts.MultiSigWallet);
console.log("Set the MultiSig as the owner of TestOwnedContract");

const MultiSigWrapper = await MultiSig.at(config.contracts.MultiSigWallet);
const multisigExecutor = new MultisigExecutor(MultiSigWrapper, deploymentAccount, config.multisig.autosign);
await multisigExecutor.executeCall(testContractWrapper, "setStateRestricted", [99]);
const stateValue = await testContractWrapper.state();
expect(stateValue).to.eq.BN(99);

console.log("## completed deployment script 7 ##");
}

// For truffle exec
module.exports = function (callback) {
main().then(() => callback()).catch((err) => callback(err));
};
Loading