Skip to content

Docker geth integration and cleanup #108

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

Merged
merged 5 commits into from
Feb 19, 2019
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
15 changes: 1 addition & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,8 @@ notifications:
on_failure: always
node_js:
- "9"
before_install:
- sudo apt-get update
- sudo apt-get install nodejs
- sudo apt-get install npm
- sudo apt-get install software-properties-common
- sudo add-apt-repository -y ppa:ethereum/ethereum
- sudo apt-get update
- sudo bash tools/setup/install_geth_1_8_3.sh
- geth version
install:
- npm install
- npm install -g mocha
before_script:
- node tools/initDevEnv.js ~
script:
- npm run test
after_script:
- kill $(ps aux | grep 'openst-setup/origin-geth' | awk '{print $2}')
- npm run test
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 0.10.0

Docker Geth Integration: Using docker geth([108](https://github.com/OpenSTFoundation/openst.js/pull/108))
MultiSig Operation: Logout all sessions([104](https://github.com/OpenSTFoundation/openst.js/pull/104))
Rule setup: Pricer rule setup and interaction([66](https://github.com/OpenSTFoundation/openst.js/pull/66))
User setup: Company to User Implementation([68](https://github.com/OpenSTFoundation/openst.js/pull/68))
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"webpack-cli": "3.1.0",
"webpack-uglify-js-plugin": "1.1.9",
"package-json-cleanup-loader": "1.0.3",
"abi-decoder": "1.2.0"
"abi-decoder": "1.2.0",
"wait-port": "0.2.2"
},
"pre-commit": {
"run": [
Expand Down
74 changes: 41 additions & 33 deletions test/integration/DirectTransfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,19 @@ const TokenRulesSetup = Package.Setup.TokenRules,
RulesSetup = Package.Setup.Rules,
MockContractsDeployer = require('./../utils/MockContractsDeployer'),
config = require('../utils/configReader'),
Web3WalletHelper = require('../utils/Web3WalletHelper'),
Contracts = Package.Contracts,
User = Package.Helpers.User,
TokenRules = Package.Helpers.TokenRules,
AbiBinProvider = Package.AbiBinProvider,
TokenHolder = Package.Helpers.TokenHolder;
TokenHolder = Package.Helpers.TokenHolder,
{ dockerSetup, dockerTeardown } = require('./../../utils/docker');

const auxiliaryWeb3 = new Web3(config.gethRpcEndPoint),
ContractsInstance = new Contracts(auxiliaryWeb3),
web3WalletHelper = new Web3WalletHelper(auxiliaryWeb3),
assert = chai.assert,
const assert = chai.assert,
OrganizationHelper = Mosaic.ChainSetup.OrganizationHelper,
abiBinProvider = new AbiBinProvider();

let txOptions = {
from: config.deployerAddress,
gasPrice: config.gasPrice,
gas: config.gas
};

let wallets,
let txOptions,
ContractsInstance,
userWalletFactoryAddress,
thMasterCopyAddress,
gnosisSafeMasterCopyAddress,
Expand All @@ -37,8 +29,6 @@ let wallets,
pricerRuleAddress,
worker,
organization,
beneficiary,
facilitator,
mockToken,
owner = config.deployerAddress,
tokenHolderSender,
Expand All @@ -47,21 +37,29 @@ let wallets,
gnosisSafeProxy,
ephemeralKey,
mockTokenDeployerInstance,
tokenRulesObject;
tokenRulesObject,
deployerAddress,
auxiliaryWeb3;

describe('Direct transfers between TH contracts', async function() {
before(async function() {
await web3WalletHelper.init(auxiliaryWeb3);
wallets = web3WalletHelper.web3Object.eth.accounts.wallet;
worker = wallets[1].address;
beneficiary = wallets[2].address;
facilitator = wallets[3].address;
const { rpcEndpointOrigin } = await dockerSetup();
auxiliaryWeb3 = new Web3(rpcEndpointOrigin);
ContractsInstance = new Contracts(auxiliaryWeb3);
const accountsOrigin = await auxiliaryWeb3.eth.getAccounts();
deployerAddress = accountsOrigin[0];
worker = accountsOrigin[1];
owner = accountsOrigin[2];
});

after(() => {
dockerTeardown();
});

it('Deploys Organization contract', async function() {
let orgHelper = new OrganizationHelper(auxiliaryWeb3, null);
const orgConfig = {
deployer: config.deployerAddress,
deployer: deployerAddress,
owner: owner,
workers: worker,
workerExpirationHeight: '20000000'
Expand All @@ -74,7 +72,7 @@ describe('Direct transfers between TH contracts', async function() {
});

it('Deploys EIP20Token contract', async function() {
mockTokenDeployerInstance = new MockContractsDeployer(config.deployerAddress, auxiliaryWeb3);
mockTokenDeployerInstance = new MockContractsDeployer(deployerAddress, auxiliaryWeb3);

await mockTokenDeployerInstance.deployMockToken();

Expand All @@ -83,6 +81,12 @@ describe('Direct transfers between TH contracts', async function() {
});

it('Deploys TokenRules contract', async function() {
txOptions = {
from: deployerAddress,
gasPrice: config.gasPrice,
gas: config.gas
};

const tokenRulesSetupInstance = new TokenRulesSetup(auxiliaryWeb3);

const response = await tokenRulesSetupInstance.deploy(organization, mockToken, txOptions);
Expand Down Expand Up @@ -158,11 +162,7 @@ describe('Direct transfers between TH contracts', async function() {

it('Registers PricerRule rule', async function() {
// Only worker can registerRule.
const txOptions = {
from: worker,
gasPrice: config.gasPrice,
gas: config.gas
};
txOptions.from = worker;

tokenRulesObject = new TokenRules(tokenRulesAddress, auxiliaryWeb3);
const pricerRuleName = 'PricerRule',
Expand All @@ -189,6 +189,7 @@ describe('Direct transfers between TH contracts', async function() {
});

it('Creates first user wallet', async function() {
txOptions.from = deployerAddress;
const userInstance = new User(
gnosisSafeMasterCopyAddress,
thMasterCopyAddress,
Expand All @@ -198,8 +199,10 @@ describe('Direct transfers between TH contracts', async function() {
auxiliaryWeb3
);

ephemeralKey = wallets[5];
const owners = [wallets[3].address],
await auxiliaryWeb3.eth.accounts.wallet.create(1);
ephemeralKey = auxiliaryWeb3.eth.accounts.wallet[0];

const owners = [owner],
threshold = 1,
sessionKeys = [ephemeralKey.address];

Expand Down Expand Up @@ -234,8 +237,10 @@ describe('Direct transfers between TH contracts', async function() {
auxiliaryWeb3
);

ephemeralKey = wallets[5];
const owners = [wallets[3].address],
await auxiliaryWeb3.eth.accounts.wallet.create(1);
ephemeralKey = auxiliaryWeb3.eth.accounts.wallet[0];

const owners = [owner],
threshold = 1,
sessionKeys = [ephemeralKey.address];

Expand Down Expand Up @@ -270,7 +275,10 @@ describe('Direct transfers between TH contracts', async function() {
auxiliaryWeb3
);

const sessionKeys = [wallets[5].address];
await auxiliaryWeb3.eth.accounts.wallet.create(1);
const sessionKey = auxiliaryWeb3.eth.accounts.wallet[0].address;

const sessionKeys = [sessionKey];

const response = await userInstance.createCompanyWallet(
proxyFactoryAddress,
Expand Down
Loading