Skip to content

Commit 4834cab

Browse files
author
Sarvesh Jain
committed
Fixed issues with dev chains and changes related to docker publish
1 parent b86837f commit 4834cab

File tree

6 files changed

+70
-58
lines changed

6 files changed

+70
-58
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,9 @@ typings/
8585

8686
# next.js build output
8787
.next
88+
89+
90+
# Docker data folders
91+
docker/chain_data
92+
docker/configs
93+
docker/root

docker/mosaic.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"valueTokenAddress": "0x9AC77F4c0ca4D0F2142D7a77175cf4F1295fb2d8",
88
"stakePoolAddress": "0x34817af7b685dbd8a360e8bed3121eb03d56c9bd"
99
},
10-
"chain": "dev"
10+
"chain": "dev-origin"
1111
},
1212
"auxiliaryChains": {
1313
"1000": {

docker/startup.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ shift
4444
args=("$@")
4545
cp -r /configs/. /root/
4646
if [ "$chainName" = "origin" ]; then
47-
cp -r /chain_data/origin/. /root/origin/
47+
cp -r /chain_data/origin-geth/. /root/origin-geth/
4848
buildCommand "origin"
4949
remainingCommands="${args[@]}"
50-
/usr/local/bin/geth --datadir=./root/origin --unlock 0x40ebe1ce3428b9cbaddbc20af27f1c4780b7d49f,0x970cadd1c487c66b05ef108e506ae16ae471cf04,0xaf9327b0a8f1af06992ff7f24eca6541c5653b30,0xeca13364a7c4aba548bdfc20d27751869b85854a,0x206a3effd972aa17a609d7708cc2b4ed1f2ff8d5,0x21b5c4ac39a15c4a4a33606a848aa7d8b00298e1,0xbb84f0861325e77397ec42ade981cef2358ebf2c,0x9dc82f76b2985851ea5c73ea8368137cbc143c4a,0x6725a1becba2c74dda4ab86876527d53e36648b4,0x22365c6a6d377effe262896fa7b34d5d12e96f87,0xfe7147289537c23be75da959576d03f31a5e942f,0x6142ae2e46a9675cfb62e290dded0dae870ef538,0xcb91e14adda50c059e1f2bcf973f057984cf8414,0xa2bdfcb744a7032a2a3808f365fe12454a496442,0x26b207c59253fc9e1213e5a237ff189261ee5f26,0x8af0deae57623ee9e8cf25026092b6edba188267,0x39ac06efaef9a4f4b8fd8e2d8dc938166245f4c4,0x0db3406ed416725256ff1f171b86bb41cf67e920,0xef464575795f60a0a0752a7d5317f417a77f0e6b,0x76a313020034b955C4a030761B75E7021d13dF68 --password ./root/origin/dev_pass --minerthreads 1 --mine $gethCommand --rpccorsdomain '*' --rpcvhosts '*' $remainingCommands
50+
/usr/local/bin/geth --datadir=./root/origin-geth --unlock 0x40ebe1ce3428b9cbaddbc20af27f1c4780b7d49f,0x970cadd1c487c66b05ef108e506ae16ae471cf04,0xaf9327b0a8f1af06992ff7f24eca6541c5653b30,0xeca13364a7c4aba548bdfc20d27751869b85854a,0x206a3effd972aa17a609d7708cc2b4ed1f2ff8d5,0x21b5c4ac39a15c4a4a33606a848aa7d8b00298e1,0xbb84f0861325e77397ec42ade981cef2358ebf2c,0x9dc82f76b2985851ea5c73ea8368137cbc143c4a,0x6725a1becba2c74dda4ab86876527d53e36648b4,0x22365c6a6d377effe262896fa7b34d5d12e96f87,0xfe7147289537c23be75da959576d03f31a5e942f,0x6142ae2e46a9675cfb62e290dded0dae870ef538,0xcb91e14adda50c059e1f2bcf973f057984cf8414,0xa2bdfcb744a7032a2a3808f365fe12454a496442,0x26b207c59253fc9e1213e5a237ff189261ee5f26,0x8af0deae57623ee9e8cf25026092b6edba188267,0x39ac06efaef9a4f4b8fd8e2d8dc938166245f4c4,0x0db3406ed416725256ff1f171b86bb41cf67e920,0xef464575795f60a0a0752a7d5317f417a77f0e6b,0x76a313020034b955C4a030761B75E7021d13dF68 --password ./root/origin-geth/dev_pass --minerthreads 1 --mine $gethCommand --rpccorsdomain '*' --rpcvhosts '*' --networkid 1515 $remainingCommands
5151
elif [ "$chainName" = "auxiliary" ]; then
5252
cp -r /chain_data/1000/. /root/1000/
5353
buildCommand "auxiliary"
5454
remainingCommands="${args[@]}"
55-
/usr/local/bin/geth --datadir=./root/1000 --unlock 0xa5bcdd4ad7aaf2959ea164901086b38a01e43af5,0x41ac401c408456f50b5cd30e79acd01e7e3548cb,0x8dfdb7f00e13ab72bb34e440d16a7030be423709,0x9f668fc260c442cb41bf312ba48ae6571e7d08fe,0x0c08bd1f850b23543af9a3f3b1577adacadee86a,0x4e28a6906b454f5aa5faed5c6efeef34a939e1cc,0xa3d8a8511316094de9c0916278b3acc96c095996,0x21bbb3883843611b9b41964c34c5826861f2a7e5,0x707e5cbb8a3663a2d07d9cee558a42b42fb5bd39,0x93a9949dc8ca70c594f90ebaf7ba2a0047806336,0x4a6fd6499d55aa4bd29bdb56c08264632cce0261,0xa381b1bc7886fae876f167b1aa050af5123dc736,0xa530acfd8650021f2540cc594693d7bb48550e98,0x5df7341a956f17e75eb8708cfb46c0122a540353,0x275605cba18458f45c67a1a3b8899f481e79bb18,0x1318a9e299405c899bf6f47ba58c7db4fb558bc7,0x6e26f708182c75ae92e87e3d055d7aa4261b4029,0x94d36b54fc193aadf2ca813b7815f1a29e501994,0x6ea338ef7277d420ed4242c0bc1089a7a6151596,0x57e2ea1e74da1e6292b1367d337a0f83e594b6ac,0x52d242db7c37faba315df2faf928a7f63d1799c6 --password ./root/1000/dev_pass --etherbase 0xa5bcdd4ad7aaf2959ea164901086b38a01e43af5 --minerthreads 1 --mine $gethCommand --rpccorsdomain '*' --rpcvhosts '*' $remainingCommands
55+
/usr/local/bin/geth --datadir=./root/1000 --unlock 0xa5bcdd4ad7aaf2959ea164901086b38a01e43af5,0x41ac401c408456f50b5cd30e79acd01e7e3548cb,0x8dfdb7f00e13ab72bb34e440d16a7030be423709,0x9f668fc260c442cb41bf312ba48ae6571e7d08fe,0x0c08bd1f850b23543af9a3f3b1577adacadee86a,0x4e28a6906b454f5aa5faed5c6efeef34a939e1cc,0xa3d8a8511316094de9c0916278b3acc96c095996,0x21bbb3883843611b9b41964c34c5826861f2a7e5,0x707e5cbb8a3663a2d07d9cee558a42b42fb5bd39,0x93a9949dc8ca70c594f90ebaf7ba2a0047806336,0x4a6fd6499d55aa4bd29bdb56c08264632cce0261,0xa381b1bc7886fae876f167b1aa050af5123dc736,0xa530acfd8650021f2540cc594693d7bb48550e98,0x5df7341a956f17e75eb8708cfb46c0122a540353,0x275605cba18458f45c67a1a3b8899f481e79bb18,0x1318a9e299405c899bf6f47ba58c7db4fb558bc7,0x6e26f708182c75ae92e87e3d055d7aa4261b4029,0x94d36b54fc193aadf2ca813b7815f1a29e501994,0x6ea338ef7277d420ed4242c0bc1089a7a6151596,0x57e2ea1e74da1e6292b1367d337a0f83e594b6ac,0x52d242db7c37faba315df2faf928a7f63d1799c6 --password ./root/1000/dev_pass --etherbase 0xa5bcdd4ad7aaf2959ea164901086b38a01e43af5 --minerthreads 1 --mine $gethCommand --rpccorsdomain '*' --rpcvhosts '*' --networkid 1000 $remainingCommands
5656
else
5757
echo "invalid input"
5858
fi

src/Node/ParityNode.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default class ParityNode extends Node {
2323
args = args.concat('--rm');
2424
}
2525

26+
console.log('this.containerName ',this.containerName);
2627
args = args.concat([
2728
'--network', Node.network,
2829
'--detach',
@@ -72,7 +73,7 @@ export default class ParityNode extends Node {
7273
'--password', '/home/parity/password.txt',
7374
]);
7475
}
75-
76+
console.log('args ',args);
7677
Shell.executeDockerCommand(args);
7778
}
7879

@@ -84,7 +85,7 @@ export default class ParityNode extends Node {
8485

8586
if (!fs.existsSync(this.chainDir)) {
8687
this.logInfo(`${this.chainDir} does not exist; initializing`);
87-
fs.mkdirSync(this.chainDir);
88+
fs.mkdirSync(this.chainDir, { recursive: true });
8889
}
8990
}
9091
}

src/bin/mosaic-start.ts

+56-50
Original file line numberDiff line numberDiff line change
@@ -66,58 +66,64 @@ mosaic
6666
.option('-s,--password <file>', 'the path to the password file on your machine; you must use this together with --unlock')
6767
.option('-g,--withoutGraphNode', 'boolean flag which decides if graph node should be started')
6868
.action((chain: string, options) => {
69-
let chainInput = chain;
70-
let optionInput = Object.assign({}, options);
71-
if (!validateCLIOptions(chain, optionInput)) {
72-
process.exit(1);
73-
}
74-
if (DevChainOptions.isDevChain(chain, options)) {
75-
const devParams = DevChainOptions.getDevChainParams(chain, options);
76-
chainInput = devParams.chain;
77-
optionInput = devParams.options;
78-
}
79-
const {
80-
mosaicDir,
81-
port,
82-
rpcPort,
83-
websocketPort,
84-
keepAfterStop,
85-
unlock,
86-
password,
87-
originChain,
88-
} = NodeOptions.parseOptions(optionInput, chainInput);
89-
const nodeDescription: NodeDescription = {
90-
chain: chainInput,
91-
mosaicDir,
92-
port,
93-
rpcPort,
94-
websocketPort,
95-
keepAfterStop,
96-
unlock,
97-
password,
98-
originChain,
99-
client: optionInput.client,
100-
};
101-
const node: Node = NodeFactory.create(nodeDescription);
102-
node.start();
69+
try {
70+
let chainInput = chain;
71+
let optionInput = Object.assign({}, options);
72+
if (!validateCLIOptions(chain, optionInput)) {
73+
process.exit(1);
74+
}
75+
if (DevChainOptions.isDevChain(chain, options)) {
76+
const devParams = DevChainOptions.getDevChainParams(chain, options);
77+
chainInput = devParams.chain;
78+
optionInput = devParams.options;
79+
// Dev chain should always start with geth.
80+
optionInput.client = GETH_CLIENT;
81+
}
82+
const {
83+
mosaicDir,
84+
port,
85+
rpcPort,
86+
websocketPort,
87+
keepAfterStop,
88+
unlock,
89+
password,
90+
originChain,
91+
} = NodeOptions.parseOptions(optionInput, chainInput);
92+
const nodeDescription: NodeDescription = {
93+
chain: chainInput,
94+
mosaicDir,
95+
port,
96+
rpcPort,
97+
websocketPort,
98+
keepAfterStop,
99+
unlock,
100+
password,
101+
originChain,
102+
client: optionInput.client,
103+
};
104+
const node: Node = NodeFactory.create(nodeDescription);
105+
node.start();
103106

104-
if (!optionInput.withoutGraphNode) {
105-
const graphDescription: GraphDescription = GraphOptions.parseOptions(optionInput, chainInput);
106-
// reuse params from node start command
107-
graphDescription.mosaicDir = mosaicDir;
108-
graphDescription.ethereumRpcPort = rpcPort;
109-
graphDescription.ethereumClient = nodeDescription.client;
107+
if (!optionInput.withoutGraphNode) {
108+
const graphDescription: GraphDescription = GraphOptions.parseOptions(optionInput, chainInput);
109+
// reuse params from node start command
110+
graphDescription.mosaicDir = mosaicDir;
111+
graphDescription.ethereumRpcPort = rpcPort;
112+
graphDescription.ethereumClient = nodeDescription.client;
110113

111-
new Graph(graphDescription).start().then(() => {
112-
let subGraphDeployer;
113-
// options.origin passed only in case of starting an auxiliary chain
114-
if (optionInput.origin) {
115-
subGraphDeployer = new SubGraphDeployer(graphDescription, optionInput.origin, chainInput);
116-
} else {
117-
subGraphDeployer = new SubGraphDeployer(graphDescription, chainInput, null);
118-
}
119-
return subGraphDeployer.deploy();
120-
});
114+
new Graph(graphDescription).start().then(() => {
115+
let subGraphDeployer;
116+
// options.origin passed only in case of starting an auxiliary chain
117+
if (optionInput.origin) {
118+
subGraphDeployer = new SubGraphDeployer(graphDescription, optionInput.origin, chainInput);
119+
} else {
120+
subGraphDeployer = new SubGraphDeployer(graphDescription, chainInput, null);
121+
}
122+
return subGraphDeployer.deploy();
123+
});
124+
}
125+
} catch (e) {
126+
Logger.error(`Error starting node: ${e} `);
121127
}
122128
})
123129
.parse(process.argv);

test_integration/mosaic-create/mosaic-create.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('Mosaic create', () => {
2222
let originDeployerAddress: string;
2323
let auxiliaryWeb3;
2424
let auxiliaryEndpoint = 'http://localhost:40500';
25-
;
2625
let beneficiary;
2726
let stakeAmount;
2827

@@ -74,7 +73,7 @@ describe('Mosaic create', () => {
7473
});
7574

7675
it(`Verify auxiliary chain ${auxChainId}`, () => {
77-
const command = `./mosaic verify-chain ${originWeb3RPCEndPoint} ${auxiliaryEndpoint} ${1} ${500}`;
76+
const command = `./mosaic verify-chain ${originWeb3RPCEndPoint} ${auxiliaryEndpoint} ${originChainId} ${auxChainId}`;
7877
Shell.executeInShell(command, { stdio: 'inherit' });
7978
});
8079

0 commit comments

Comments
 (0)