Skip to content

Commit a2d39b9

Browse files
Merge pull request #108 from gulshanvasnani/docker_geth
Docker geth integration and cleanup
2 parents 57ecd75 + 863b8df commit a2d39b9

18 files changed

+164
-789
lines changed

.travis.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,8 @@ notifications:
1414
on_failure: always
1515
node_js:
1616
- "9"
17-
before_install:
18-
- sudo apt-get update
19-
- sudo apt-get install nodejs
20-
- sudo apt-get install npm
21-
- sudo apt-get install software-properties-common
22-
- sudo add-apt-repository -y ppa:ethereum/ethereum
23-
- sudo apt-get update
24-
- sudo bash tools/setup/install_geth_1_8_3.sh
25-
- geth version
2617
install:
2718
- npm install
2819
- npm install -g mocha
29-
before_script:
30-
- node tools/initDevEnv.js ~
3120
script:
32-
- npm run test
33-
after_script:
34-
- kill $(ps aux | grep 'openst-setup/origin-geth' | awk '{print $2}')
21+
- npm run test

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Version 0.10.0
44

5+
Docker Geth Integration: Using docker geth([108](https://github.com/OpenSTFoundation/openst.js/pull/108))
56
MultiSig Operation: Logout all sessions([104](https://github.com/OpenSTFoundation/openst.js/pull/104))
67
Rule setup: Pricer rule setup and interaction([66](https://github.com/OpenSTFoundation/openst.js/pull/66))
78
User setup: Company to User Implementation([68](https://github.com/OpenSTFoundation/openst.js/pull/68))

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"webpack-cli": "3.1.0",
5050
"webpack-uglify-js-plugin": "1.1.9",
5151
"package-json-cleanup-loader": "1.0.3",
52-
"abi-decoder": "1.2.0"
52+
"abi-decoder": "1.2.0",
53+
"wait-port": "0.2.2"
5354
},
5455
"pre-commit": {
5556
"run": [

test/integration/DirectTransfer.js

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,19 @@ const TokenRulesSetup = Package.Setup.TokenRules,
88
RulesSetup = Package.Setup.Rules,
99
MockContractsDeployer = require('./../utils/MockContractsDeployer'),
1010
config = require('../utils/configReader'),
11-
Web3WalletHelper = require('../utils/Web3WalletHelper'),
1211
Contracts = Package.Contracts,
1312
User = Package.Helpers.User,
1413
TokenRules = Package.Helpers.TokenRules,
1514
AbiBinProvider = Package.AbiBinProvider,
16-
TokenHolder = Package.Helpers.TokenHolder;
15+
TokenHolder = Package.Helpers.TokenHolder,
16+
{ dockerSetup, dockerTeardown } = require('./../../utils/docker');
1717

18-
const auxiliaryWeb3 = new Web3(config.gethRpcEndPoint),
19-
ContractsInstance = new Contracts(auxiliaryWeb3),
20-
web3WalletHelper = new Web3WalletHelper(auxiliaryWeb3),
21-
assert = chai.assert,
18+
const assert = chai.assert,
2219
OrganizationHelper = Mosaic.ChainSetup.OrganizationHelper,
2320
abiBinProvider = new AbiBinProvider();
2421

25-
let txOptions = {
26-
from: config.deployerAddress,
27-
gasPrice: config.gasPrice,
28-
gas: config.gas
29-
};
30-
31-
let wallets,
22+
let txOptions,
23+
ContractsInstance,
3224
userWalletFactoryAddress,
3325
thMasterCopyAddress,
3426
gnosisSafeMasterCopyAddress,
@@ -37,8 +29,6 @@ let wallets,
3729
pricerRuleAddress,
3830
worker,
3931
organization,
40-
beneficiary,
41-
facilitator,
4232
mockToken,
4333
owner = config.deployerAddress,
4434
tokenHolderSender,
@@ -47,21 +37,29 @@ let wallets,
4737
gnosisSafeProxy,
4838
ephemeralKey,
4939
mockTokenDeployerInstance,
50-
tokenRulesObject;
40+
tokenRulesObject,
41+
deployerAddress,
42+
auxiliaryWeb3;
5143

5244
describe('Direct transfers between TH contracts', async function() {
5345
before(async function() {
54-
await web3WalletHelper.init(auxiliaryWeb3);
55-
wallets = web3WalletHelper.web3Object.eth.accounts.wallet;
56-
worker = wallets[1].address;
57-
beneficiary = wallets[2].address;
58-
facilitator = wallets[3].address;
46+
const { rpcEndpointOrigin } = await dockerSetup();
47+
auxiliaryWeb3 = new Web3(rpcEndpointOrigin);
48+
ContractsInstance = new Contracts(auxiliaryWeb3);
49+
const accountsOrigin = await auxiliaryWeb3.eth.getAccounts();
50+
deployerAddress = accountsOrigin[0];
51+
worker = accountsOrigin[1];
52+
owner = accountsOrigin[2];
53+
});
54+
55+
after(() => {
56+
dockerTeardown();
5957
});
6058

6159
it('Deploys Organization contract', async function() {
6260
let orgHelper = new OrganizationHelper(auxiliaryWeb3, null);
6361
const orgConfig = {
64-
deployer: config.deployerAddress,
62+
deployer: deployerAddress,
6563
owner: owner,
6664
workers: worker,
6765
workerExpirationHeight: '20000000'
@@ -74,7 +72,7 @@ describe('Direct transfers between TH contracts', async function() {
7472
});
7573

7674
it('Deploys EIP20Token contract', async function() {
77-
mockTokenDeployerInstance = new MockContractsDeployer(config.deployerAddress, auxiliaryWeb3);
75+
mockTokenDeployerInstance = new MockContractsDeployer(deployerAddress, auxiliaryWeb3);
7876

7977
await mockTokenDeployerInstance.deployMockToken();
8078

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

8583
it('Deploys TokenRules contract', async function() {
84+
txOptions = {
85+
from: deployerAddress,
86+
gasPrice: config.gasPrice,
87+
gas: config.gas
88+
};
89+
8690
const tokenRulesSetupInstance = new TokenRulesSetup(auxiliaryWeb3);
8791

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

159163
it('Registers PricerRule rule', async function() {
160164
// Only worker can registerRule.
161-
const txOptions = {
162-
from: worker,
163-
gasPrice: config.gasPrice,
164-
gas: config.gas
165-
};
165+
txOptions.from = worker;
166166

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

191191
it('Creates first user wallet', async function() {
192+
txOptions.from = deployerAddress;
192193
const userInstance = new User(
193194
gnosisSafeMasterCopyAddress,
194195
thMasterCopyAddress,
@@ -198,8 +199,10 @@ describe('Direct transfers between TH contracts', async function() {
198199
auxiliaryWeb3
199200
);
200201

201-
ephemeralKey = wallets[5];
202-
const owners = [wallets[3].address],
202+
await auxiliaryWeb3.eth.accounts.wallet.create(1);
203+
ephemeralKey = auxiliaryWeb3.eth.accounts.wallet[0];
204+
205+
const owners = [owner],
203206
threshold = 1,
204207
sessionKeys = [ephemeralKey.address];
205208

@@ -234,8 +237,10 @@ describe('Direct transfers between TH contracts', async function() {
234237
auxiliaryWeb3
235238
);
236239

237-
ephemeralKey = wallets[5];
238-
const owners = [wallets[3].address],
240+
await auxiliaryWeb3.eth.accounts.wallet.create(1);
241+
ephemeralKey = auxiliaryWeb3.eth.accounts.wallet[0];
242+
243+
const owners = [owner],
239244
threshold = 1,
240245
sessionKeys = [ephemeralKey.address];
241246

@@ -270,7 +275,10 @@ describe('Direct transfers between TH contracts', async function() {
270275
auxiliaryWeb3
271276
);
272277

273-
const sessionKeys = [wallets[5].address];
278+
await auxiliaryWeb3.eth.accounts.wallet.create(1);
279+
const sessionKey = auxiliaryWeb3.eth.accounts.wallet[0].address;
280+
281+
const sessionKeys = [sessionKey];
274282

275283
const response = await userInstance.createCompanyWallet(
276284
proxyFactoryAddress,

0 commit comments

Comments
 (0)