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

Inomurko/gnosis multisig #677

Merged
merged 7 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,37 @@ jobs:
name: Start services
command: docker-compose up -d
working_directory: ~/repo/MultiSigWalletOverride
- run: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Install node 9
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install v9
node --version
node -v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra?

nvm alias default v9
echo 'export PATH="$(npm bin):$PATH"' >> $BASH_ENV
- run:
name: Pull Submodules
command: |
git submodule init
git submodule update --remote
working_directory: ~/repo/
- run:
name: Apply Overrides
command: make init_multisig
working_directory: ~/repo/MultiSigWalletOverride
- run:
name: Deploy Gnosis MultiSigWalet
command: |
sudo apt-get update && sudo apt-get install -y libudev-dev libusb-1.0-0 libusb-1.0-0-dev
npm install -g npm@latest
nvm use node
npm install
npx truffle migrate 0xa508dD875f10C33C52a8abb20E16fc68E981F186 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, where does this address comes from? 0xa508dD875f10C33C52a8abb20E16fc68E981F186

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the first address in ganache

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh the deterministic ganache run from docker-compose

working_directory: ~/repo/MultiSigWallet

Truffle tests:
executor: truffle_executor
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ coverage.json

#tenderly config
tenderly.yaml

MultiSigWallet
MultiSigWalletOverride/ganache_data/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "MultiSigWallet"]
path = MultiSigWallet
url = https://github.com/gnosis/MultiSigWallet.git
1 change: 1 addition & 0 deletions MultiSigWallet
Submodule MultiSigWallet added at 4776fd
3 changes: 3 additions & 0 deletions MultiSigWalletOverride/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
init_multisig:
cp ../MultiSigWalletOverride/migrations/* ../MultiSigWallet/migrations
cp ../MultiSigWalletOverride/truffle.js ../MultiSigWallet/
18 changes: 9 additions & 9 deletions MultiSigWalletOverride/docker/immutability/config/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ VAULT_PID=$!

count=1
while [ "$count" -le 60 ]; do
if vault status; then break; fi
count=$((count+1))
sleep 0.5
if vault status; then break; fi
count=$((count+1))
sleep 0.5
done

vault status
Expand All @@ -26,19 +26,19 @@ function configure_plugin {
ls -latr /home/vault/plugins
sha256sum=`cat /home/vault/plugins/SHA256SUMS | awk '{print $1}'`
vault write sys/plugins/catalog/secret/${plugin_file} \
sha_256="$sha256sum" \
command="$plugin_file --ca-cert=/home/vault/ca/certs/ca.crt --client-cert=/home/vault/ca/certs/my-service.crt --client-key=/home/vault/ca/private/my-service.key"
sha_256="$sha256sum" \
command="$plugin_file --ca-cert=/home/vault/ca/certs/ca.crt --client-cert=/home/vault/ca/certs/my-service.crt --client-key=/home/vault/ca/private/my-service.key"

if [[ $? -eq 2 ]] ; then
echo "Vault Catalog update failed!"
exit 2
echo "Vault Catalog update failed!"
exit 2
fi

echo "MOUNTING: ${plugin_file}"
vault secrets enable -path=${plugin_file} -plugin-name=${plugin_file} plugin
if [[ $? -eq 2 ]] ; then
echo "Failed to mount ${plugin_file} plugin for test!"
exit 2
echo "Failed to mount ${plugin_file} plugin for test!"
exit 2
fi
}

Expand Down
28 changes: 28 additions & 0 deletions MultiSigWalletOverride/migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const MultisigWalletWithDailyLimit = artifacts.require('MultiSigWalletWithDailyLimit.sol')
const MultisigWalletWithoutDailyLimit = artifacts.require('MultiSigWallet.sol')
const MultisigWalletFactory = artifacts.require('MultiSigWalletWithDailyLimitFactory.sol')
const fs = require('fs');
const path = require('path');

module.exports = deployer => {
const args = process.argv.slice();
if (process.env.DEPLOY_FACTORY){
deployer.deploy(MultisigWalletFactory);
console.log("Factory with Daily Limit deployed");
} else if (args.length < 5) {
console.error("Multisig with daily limit requires to pass owner " +
"list, required confirmations and daily limit");
} else if (args.length < 6) {
deployer.deploy(MultisigWalletWithoutDailyLimit, args[3].split(","), args[4]).then(function() {
const buildDir = path.resolve(__dirname, '../build');
if (!fs.existsSync(buildDir)) {
fs.mkdirSync(buildDir);
}
fs.writeFileSync(path.resolve(buildDir, 'multisig_instance'), `${MultisigWalletWithoutDailyLimit.address}`.toLowerCase());
});
console.log("Wallet deployed");
} else {
deployer.deploy(MultisigWalletWithDailyLimit, args[3].split(","), args[4], args[5]);
console.log("Wallet with Daily Limit deployed");
}
}
34 changes: 34 additions & 0 deletions MultiSigWalletOverride/truffle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
InoMurko marked this conversation as resolved.
Show resolved Hide resolved
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 4000000,
gasPrice: 10000000000, // 10 gwei
},
loadTest: {
host: '127.0.0.1',
port: 8545,
network_id: '*',
gas: 0xfffffffffff,
},
local: {
host: process.env.ETH_CLIENT_HOST || '127.0.0.1',
port: process.env.ETH_CLIENT_PORT || 8545,
from: process.env.DEPLOYER_ADDRESS,
network_id: '*',
},
remote: {
skipDryRun: true,
gasPrice: process.env.GAS_PRICE || 20000000000, // default 20 gwei
network_id: '*',
}
},
// Configure your compilers
compilers: {
solc: {
version: '0.4.15'
},
}
};
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ docker run --rm omisego/plasma-contracts npx truffle migrate --network remote

For more detail of the deploying scripts and the env vars to set, see [deploying.md](./plasma_framework/docs/deploying/deploying.md)

The `MAINTAINER` account can also be a multisignature contract. The example we've built uses Gnosis MultiSigWallet. The project has been added as a git submodule (https://github.com/gnosis/MultiSigWallet/tree/v1.6.0):
```bash
git submodule init
git submodule update --remote
```

Their deployment scripts were slightly addapted. We can override them by executing:
```bash
cd MultiSigWalletOverride/
make init_multisig
```

While we're in the directory we can deploy the contract by executing:
```bash
truffle migrate <account1,account2,...,accountN> <requiredConfirmations>
```

The address of the multisignature contract is exported into:
```
MultiSigWallet/build/multisig_instance
```

### Building and running the python tests
We suggest running the following commands with an active python virtual environment ex. `venv`.
All the code is in the `plasma_framework/python_tests` directory, so go there first.
Expand Down